Assume you want to insert the mosaic as the first filter to the play object.
1. Create an instance of the ltmmPlay class. This is accomplished using the Win32 CoCreateInstance function as follows:
C Source
IltmmPlay* pPlay;CoCreateInstance(&CLSID_ltmmPlay, NULL, CLSCTX_INPROC_SERVER, &IID_IltmmPlay, (void**) &pPlay);
C++ Source
IltmmPlay* pPlay;CoCreateInstance(CLSID_ltmmPlay, NULL, CLSCTX_INPROC_SERVER, IID_IltmmPlay, (void**) &pPlay);
2. Get the registered processors collection as follows:
C Source
IltmmProcessors* pProcessors;IltmmPlay_get_VideoProcessors (pPlay, &pProcessors);
C++ Source
IltmmProcessors* pProcessors;pPlay->get_VideoProcessors(&pProcessors);
3. Find the processor index by name as follows:
C Source
long index;BSTR bstr;// The string below is retrieved from the Filters List utilitybstr = SysAllocString(L"@device:sw:{E526D606-22E7-494C-B81E-AC0A94BFE603}\\{E2B7DB28-38C5-11D5-91F6-00104BDB8FF9}");IltmmProcessors_Find (pProcessors, bstr, &index);SysFreeString(bstr);
C++ Source
long index;BSTR bstr;// The string below is retrieved from the Filters List utilitybstr = SysAllocString(L"@device:sw:{E526D606-22E7-494C-B81E-AC0A94BFE603}\\{E2B7DB28-38C5-11D5-91F6-00104BDB8FF9}");pProcessors->Find (bstr, &index);SysFreeString(bstr);
4. Get the processor interface and the selected processors collection as follows:
C Source
IltmmProcessors* pSelProcessors;IltmmProcessor* pProcessor;// get the processor interfaceIltmmProcessors_Item(pProcessors, index, &pProcessor);// get the selected processors collectionIltmmPlay_get_SelectedVideoProcessors (pPlay, &pSelProcessors);
C++ Source
IltmmProcessors* pSelProcessors;IltmmProcessor* pProcessor;// get the processor interfacepProcessors->Item (index, &pProcessor);// get the selected processors collectionpPlay->get_SelectedVideoProcessors (&pSelProcessors);
5. Finally, add the processor to the selected processors collection as the first filter as follows:
C Source
IltmmProcessors_Add (pSelProcessors, pProcessor, 0);// release interfacesIUnknown_Release(pProcessor);IUnknown_Release(pProcessors);IUnknown_Release(pSelProcessors);
C++ Source
pSelProcessors->Add (pProcessor, 0);// release interfacespProcessor->Release();pProcessors->Release();pSelProcessors->Release();
Note: If you want to know how to use the interface of the filter, refer to Access the Interface of Filters.
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
