Directly Accessing the DirectShow Compression Filters

Direct access to the underlying DirectShow audio and video compression filters can be accomplished through the IltmmObjectWrapper interface. Accessing the interface directly makes it possible to programmatically manipulate an individual compressor's properties. Please consult the individual compression filter's documentation to determine the capabilities of that filter.

For example, suppose you wanted to access a particular compressor in the ltmmConvert object. Perform the following steps to access it directly:

  1. Obtain the video compressors collection from the ltmmConvert object:

IltmmCompressors* pCompressors;

convert->get_VideoCompressors(&pCompressors); // get the  video compressor collection

  1. Next, get the selected compressor:

IltmmCompressor* pCompressor;

long index;

pCompressors->get_Selection (&index);  // get the index of the selected compressor

pCompressors->Item(index, &pCompressor); // get the compressor

pCompressors->Release();  // do not need the collection anymore

  1. Now, obtain the IltmmObjectWrapper interface:

IltmmObjectWrapper* pWrapper;
pCompressor->QueryInterface(IID_IltmmObjectWrapper, (void**) &pWrapper); // get the wrapper interface
pCompressor->Release();  // do not need this anymore

  1. Finally, get the underlying DirectShow filter:

IUnknown* pObject;
pWrapper->GetWrappedObject(&pObject); // get the DirectShow filter
pWrapper->Release();  // do not need this anymore

The pObject now contains the IUnknown interface pointer to the filter. Use this interface pointer to access all interfaces that the compressor implements.

Help Version 21.0.2021.4.7
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2021 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Multimedia C API Help