IltmmConvert::SetPreferredFilter Example for C++

// This function does the following: 
// 1) Sets all filters to LEAD Default filters 
// 2) Then resets all preferred filters to NULL, or does not use any preferred filter. 
// 3) Then sets the LEAD H264 Decoder (3.0) as the LEAD H264 Preferred Decompressor using its Friendly Name 
// 4) Gets the preferred H.264 Decompressor display name 
void TestSetPreferredFilter(IltmmConvert *pConvert) 
{ 
   HRESULT hr = S_OK; 
   BSTR bstr = NULL; 
   // Set all filters to LEAD Default filters 
   bstr = SysAllocString(ltmmFilter_LEADDefault); 
   hr = pConvert->SetPreferredFilter(ltmmConvert_PreferredFilter_Generic, bstr); 
   // free the bstr 
   SysFreeString(bstr); 
   // Reset all the preferred filters to NULL, or don't use any preferred filter. 
   bstr = SysAllocString(ltmmFilter_DontCare); 
   hr = pConvert->SetPreferredFilter(ltmmConvert_PreferredFilter_Generic, bstr); 
   // free the bstr 
   SysFreeString(bstr); 
   // Set the H.264 Decompressor to the LEAD H264 Decoder (3.0), using the Friendly Name 
   bstr = SysAllocString(L"LEAD H264 Decoder (3.0)"); 
   hr = pConvert->SetPreferredFilter(ltmmConvert_PreferredFilter_H264Decompressor, bstr); 
   // free the bstr 
   SysFreeString(bstr); 
   // Get the preferred H.264 Decompressor 
   bstr = NULL; 
   hr = pConvert->GetPreferredFilter(ltmmConvert_PreferredFilter_H264Decompressor, &bstr); 
   // check that the preferred filter is the LEAD H264 decoder 
   if(bstr != NULL && !_wcsicmp(bstr, ltmmFilter_LEAD_H264Decompressor)) 
      MessageBox(NULL, TEXT("The preferred filter was set properly!"), TEXT("SUCCESS"), MB_OK); 
   else 
      MessageBox(NULL, TEXT("The preferred filter was not set properly!"), TEXT("FAILURE"), MB_OK); 
   // free the bstr 
   SysFreeString(bstr); 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Multimedia C API Help