IltmmPlay::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 LEAD H264 Decoder (3.0) as LEAD H264 Preferred Decompressor using its Friendly Name 
// 4) Gets the preferred H.264 Decompressor display name 
 
void TestSetPreferredFilter(IltmmPlay *pPlay) 
{ 
   HRESULT hr = S_OK; 
   BSTR bstr = NULL; 
   // Setting all filters to LEAD Default filters 
   bstr = SysAllocString(ltmmFilter_LEADDefault); 
   hr = pPlay->SetPreferredFilter(ltmmPlay_PreferredFilter_Generic, bstr); 
   SysFreeString(bstr); 
 
   // Resets all the preferred filters to NULL, or don't use any preferred filter. 
   bstr = SysAllocString(ltmmFilter_DontCare); 
   hr = pPlay->SetPreferredFilter(ltmmPlay_PreferredFilter_Generic, bstr); 
   SysFreeString(bstr); 
 
   // Setting H.264 Decompressor to LEAD H264 Decoder (3.0), using the Friendly Name 
   bstr = SysAllocString(L"LEAD H264 Decoder (3.0)"); 
   hr = pPlay->SetPreferredFilter(ltmmPlay_PreferredFilter_H264Decompressor, bstr); 
   SysFreeString(bstr); 
    
   // Gets the preferred H.264 Decompressor 
   bstr = NULL; 
   hr = pPlay->GetPreferredFilter(ltmmPlay_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 21.0.2021.7.19
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Multimedia C API Help
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.