The following code enumerates the valid audio and video compressors for the MKV target format.
// include the LEAD Media Foundation TOOLKIT header
#include "ltmf.h"
void EnumMKVCompressors(IltmfConvert *pConvert, HWND hwndParent)
{
IltmfCompressors *pCompressors;
IltmfCompressor *pCompressor;
IltmfTargetFormats *pTargetformats;
IltmfTargetFormat* pTargetformat;
long lCount, lIndex, lValid;
BSTR Name;
VARIANT_BOOL vbIsLeadTargetFormat;
// set the target format to MKV
pConvert->put_TargetFormat(ltmfConvert_TargetFormat_MKV);
pConvert->get_TargetFormats(&pTargetformats);
pTargetformats->Item(ltmfConvert_TargetFormat_MKV, &pTargetformat);
pTargetformats->Release();
// state whether this is a LEAD target format
pTargetformat->LeadTargetFormat(&vbIsLeadTargetFormat);
// LEAD target format, enum compressors through AudioCompressors and VideoCompressors interfaces.
if ( vbIsLeadTargetFormat )
{
// Audio
// get the compressors collection
pConvert->get_AudioCompressors(&pCompressors);
pCompressors->get_Count(&lCount);
for (lIndex = 0; lIndex < lCount; lIndex++)
{
pCompressors->Item(lIndex, &pCompressor);
pCompressor->get_Name(&Name);
pTargetformat->IsValidCompressor(Name, &lValid);
if (lValid != ltmfTargetFormat_Compressor_Invalid)
{
// do whatever needed with the valid compressor (i.e. add it to some list)
}
::SysFreeString(Name);
pCompressor->Release();
}
pCompressors->Release();
// Video
// get the compressors collection
pConvert->get_VideoCompressors(&pCompressors);
pCompressors->get_Count(&lCount);
for (lIndex = 0; lIndex < lCount; lIndex++)
{
pCompressors->Item(lIndex, &pCompressor);
pCompressor->get_Name(&Name);
pTargetformat->IsValidCompressor(Name, &lValid);
if (lValid != ltmfTargetFormat_Compressor_Invalid)
{
// do whatever needed with the valid compressor (i.e. add it to some list)
}
::SysFreeString(Name);
pCompressor->Release();
}
pCompressors->Release();
}
else
{
// not LEAD target format, use target format profile dialog.
VARIANT_BOOL vbDialog;
pTargetformat->HasDialog(ltmfTargetFormat_Dlg_Profile, &vbDialog);
if (vbDialog)
{
pTargetformat->ShowDialog(ltmfTargetFormat_Dlg_Profile, (long)hwndParent);
}
}
pTargetformat->Release();
}
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
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.