long AddCustomFormatExample (IltmmConvert *pConvert)
{
IltmmTargetFormats* pFormats;
IltmmTargetFormat* pFormat;
BSTR bstr;
long count, lStreams;
IltmmConvert_get_TargetFormats(pConvert, &pFormats);
// add a new format at the end of the Formats list
bstr = SysAllocString(L"My Own Format");
IltmmTargetFormats_Add(pFormats, bstr, -1);
// get the new format
IltmmTargetFormats_get_Count(pFormats, &count);
IltmmTargetFormats_Item(pFormats, count-1, &pFormat);
// set the format's sink filter: this example uses "LEAD Network Sink"
bstr = SysAllocString(L"@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\\{E2B7DE05-38C5-11D5-91F6-00104BDB8FF9}");
IltmmTargetFormat_put_Sink(pFormat, bstr);
SysFreeString(bstr);
// set the format's mux filter: : this example uses "LEAD Network Multiplexer"
bstr = SysAllocString(L"@device:sw:{083863F1-70DE-11D0-BD40-00A0C911CE86}\\{E2B7DE01-38C5-11D5-91F6-00104BDB8FF9}");
IltmmTargetFormat_put_Mux(pFormat, bstr);
SysFreeString(bstr);
// specify which streams your new format can have
IltmmTargetFormat_put_Streams(pFormat, ltmmTargetFormat_Stream_Audio | ltmmTargetFormat_Stream_Video);
// get the streams
IltmmTargetFormat_get_Streams(pFormat, &lStreams);
// verify them if needed ...
// that is it
IUnknown_Release(pFormat);
IUnknown_Release(pFormats);
// later, call put_TargetFormat(count-1) to use your new format.
// return the format index
return (count-1);
}
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