Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.11.27
LEADTOOLS Media Foundation Help

IltmfConvert::SetPreferredMediaSourceHandler Example for C++

Show in webframe
// This function does the following:
// 1) Sets all preferred media source handlers to LEAD Default.
// 2) Then resets all preferred media source handlers to NULL, or does not use any preferred media source handlers.
// 3) Then sets the LEAD ISO Media Source Handler as the ISO Preferred media source handlers using its GUID.
// 4) Gets the preferred ISO Media Source Handler GUID.
void TestSetPreferredMediaSourceHandler(IltmfConvert *pConvert)
{
   HRESULT hr = S_OK;
   BSTR bstr = NULL;
   // Set all media source handlers to LEAD Default
   bstr = SysAllocString(ltmfMediaSourceHandler_LEADDefault);
   hr = pConvert->SetPreferredMediaSourceHandler(ltmfConvert_PreferredMediaSourceHandler_Generic, bstr);
   // free the bstr
   SysFreeString(bstr);
   // Reset all the preferred media source handlers to NULL, or don't use any preferred media source handler.
   bstr = SysAllocString(ltmfMediaSourceHandler_DontCare);
   hr = pConvert->SetPreferredMediaSourceHandler(ltmfConvert_PreferredMediaSourceHandler_Generic, bstr);
   // free the bstr
   SysFreeString(bstr);
   // Set the ISO Media Source handler to the LEAD ISO Media Source handler, using it's GUID.
   bstr = SysAllocString(L"EFE620B5-0A2C-49FA-8A01-3768B559B6DA");
   hr = pConvert->SetPreferredMediaSourceHandler(ltmfConvert_PreferredMediaSourceHandler_ISO, bstr);
   // free the bstr
   SysFreeString(bstr);
   
   // Get the preferred ISO Media Source handler
   bstr = NULL;
   hr = pConvert->GetPreferredMediaSourceHandler(ltmfConvert_PreferredMediaSourceHandler_ISO, &bstr);
   // check that the preferred handler for ISO media source is the LEAD ISO Media Source handler
   if(bstr != NULL && !_wcsicmp(bstr, ltmfMediaSourceHandler_LEAD_ISO))
      MessageBox(NULL, TEXT("The preferred media source handler was set properly!"), TEXT("SUCCESS"), MB_OK);
   else
      MessageBox(NULL, TEXT("The preferred media source handler was not set properly!"), TEXT("FAILURE"), MB_OK);
   // free the bstr
   SysFreeString(bstr);
}
Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.