The IMFConverter interface provides methods for converting video frames according to specified output parameters and optional transformation settings.
It is implemented by both MFFactoryClass and MFConverterClass objects and is primarily used internally within the Medialooks SDK for frame conversion tasks such as scaling, rotation, cropping, or format changes.
Creating an Instance
// Create an instance of the MFFactoryClass:
MFFactoryClass m_objFactory = new MFFactoryClass();
// Or create an instance of the MFConverterClass:
MFConverterClass m_objMFConverter = new MFConverterClass();
// Release when no longer needed:
Marshal.ReleaseComObject(m_objFactory);
Marshal.ReleaseComObject(m_objMFConverter);ConverterFrameConvert
Converts a video frame according to the specified output configuration and optional conversion properties.
Syntax
void ConverterFrameConvert(
string _bsLine,
MFFrame _pFrameIn,
ref M_AV_PROPS _pAVPropsOut,
out MFFrame _ppFrameOut,
out int _pnFramesRest,
string _bsPropsList
)| Parameter | Description |
|---|---|
| _bsLine | The converter line identifier. It defines a subconverter name used for concurrent operations. Different values allow independent conversion pipelines under the same |
| _pFrameIn | The input frame to be converted. |
| _pAVPropsOut | Output structure ( |
| _ppFrameOut | Returns the converted frame. |
| _pnFramesRest | Indicates how many frames remain in the converter buffer. This helps preserve consistent duration and playback speed when frame rates differ between input and output sources. |
| _bsPropsList | A string with optional parameters for image transformation (rotation, mirroring, cropping, etc.). Example: |
Example:
int rest = 0;
do
{
MFFrame convertedFrame = null;
m_objMFConverter.ConverterFrameConvert(
"thread_1",
pFrame,
ref m_avProps,
out convertedFrame,
out rest,
"rotate='left' mirror='horz' crop='0,10,20,30'"
);
if (convertedFrame != null)
{
m_objPreview.ReceiverFramePut(convertedFrame, 0, "");
Marshal.ReleaseComObject(convertedFrame);
}
} while (rest > 0);The loop ensures all buffered frames are retrieved when frame rate conversion is active (for example, converting 25 fps → 50 fps).
ConverterReset
Clears the converter’s internal state, including cached or pending frames. Use this method when switching to a new stream, changing conversion parameters, or restarting the processing session.
Syntax
void ConverterReset(
string _bsLine
)| Parameter | Description |
|---|---|
| _bsLine | The converter line identifier. It defines a subconverter name used for concurrent operations. Different values allow independent conversion pipelines under the same MFFactoryClass instance — useful for multi-threaded processing of separate video sources. |
Example:
m_objMFConverter.ConverterReset("thread_1");Call this method before starting a new conversion session or when switching input formats.