This example 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(IltmfPlay *pPlay)
{
HRESULT hr = S_OK;
BSTR bstr = NULL;
// Setting all media source handlers to LEAD Default
bstr = SysAllocString(ltmfMediaSourceHandler_LEADDefault);
hr = pPlay->SetPreferredMediaSourceHandler(ltmfPlay_PreferredMediaSourceHandler_Generic, bstr);
SysFreeString(bstr);
// Resets all the preferred media source handlers to NULL, or don't use any preferred media source handler.
bstr = SysAllocString(ltmfMediaSourceHandler_DontCare);
hr = pPlay->SetPreferredMediaSourceHandler(ltmfPlay_PreferredMediaSourceHandler_Generic, bstr);
SysFreeString(bstr);
// Setting 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 = pPlay->SetPreferredMediaSourceHandler(ltmfPlay_PreferredMediaSourceHandler_ISO, bstr);
SysFreeString(bstr);
// Gets the preferred ISO Media Source handler
bstr = NULL;
hr = pPlay->GetPreferredMediaSourceHandler(ltmfPlay_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);
}
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document