The following code demonstrates enumerates the valid audio and video compressors for the MPEG2 target format. A recommended compressor is also retrieved.
void EnumMPEG2CompressorsExample (IltmmConvert *pConvert)
{
IltmmCompressors *pCompressors;
IltmmCompressor *pCompressor;
IltmmTargetFormats *pTargetformats;
IltmmTargetFormat* pTargetformat;
long lCount, lIndex;
BSTR Name;
/* set the target format to MPEG2 */
IltmmConvert_put_TargetFormat(pConvert, ltmmCapture_TargetFormat_MPEG2_PROGRAM);
IltmmConvert_get_TargetFormats(pConvert, &pTargetformats);
IltmmTargetFormats_Item(pTargetformats, ltmmCapture_TargetFormat_MPEG2_PROGRAM, &pTargetformat);
IUnknown_Release(pTargetformats);
/* Audio */
/* get the compressors collection */
IltmmConvert_get_AudioCompressors(pConvert, &pCompressors);
IltmmCompressors_get_Count(pCompressors, &lCount);
for(lIndex = 0; lIndex < lCount; lIndex++)
{
long lValid;
IltmmCompressors_Item(pCompressors, lIndex, &pCompressor);
IltmmCompressor_get_Name(pCompressor, &Name);
IltmmTargetFormat_IsValidCompressor(pTargetformat, Name, &lValid);
if( lValid != ltmmTargetFormat_Compressor_Invalid )
{
// do whatever needed with the valid compressor (i.e. add it to some list)
}
SysFreeString(Name);
IUnknown_Release(pCompressor);
}
// get the recommended compressor for the current format
IltmmTargetFormat_get_RecommendedAudioCompressor(pTargetformat, &Name);
if( Name )
{
// do whatever needed with the recommended compressor (i.e. select it)
}
IUnknown_Release(pCompressors);
/*Video*/
/* get the compressors collection */
IltmmConvert_get_VideoCompressors(pConvert, &pCompressors);
IltmmCompressors_get_Count(pCompressors, &lCount);
for(lIndex = 0; lIndex < lCount; lIndex++)
{
long lValid;
IltmmCompressors_Item(pCompressors, lIndex, &pCompressor);
IltmmCompressor_get_Name(pCompressor, &Name);
IltmmTargetFormat_IsValidCompressor(pTargetformat, Name, &lValid);
if( lValid != ltmmTargetFormat_Compressor_Invalid )
{
// do whatever needed with the valid compressor (i.e. add it to some list)
}
SysFreeString(Name);
IUnknown_Release(pCompressor);
}
// get the recommended compressor for the current format
IltmmTargetFormat_get_RecommendedVideoCompressor(pTargetformat, &Name);
if( Name )
{
// do whatever needed with the recommended compressor (i.e. select it)
}
IUnknown_Release(pCompressors);
IUnknown_Release(pTargetformat);
}
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
Your email has been sent to support! Someone should be in touch! If your matter is urgent please come back into chat.
Chat Hours:
Monday - Friday, 8:30am to 6pm ET
Thank you for your feedback!
Please fill out the form again to start a new chat.
All agents are currently offline.
Chat Hours:
Monday - Friday
8:30AM - 6PM EST
To contact us please fill out this form and we will contact you via email.