Operates frames in MFormats way
Methods
MFAddToStream
Add a frame to a stream
Syntax
void MFAddToStream( IStream _pStream, eMFrameClone _eSaveType )
Parameters
_pStream - target stream object
_eSaveType - type of clone to save the frame
MFAllGet
Gets all frame properties
Syntax
void MFAllGet( out MF_FRAME_INFO _pFrameInfo )
Parameters
_pFrameInfo - frame information
MFAudioAlloc
Allocates frame's audio data
Syntax
void MFAudioAlloc( ref M_AUD_PROPS _pAudProps, int _lSamples )
Parameters
_pAudProps - audio properties
_lSamples - audio samples
MFAudioChannelGetBytes
Gets audio channel's data pointer. Warning: For 20, 24, 32 integer this method returns 32 bit float data. The changes are applied only after a call of MFAudioChannelsUpdate() method
Syntax
void MFAudioChannelGetBytes( int _nChannel, int _bCreateNewChannels, out int _pcbSize, out long _ppbAudio )
Parameters
_nChannel - channel index
_bCreateNewChannels - creates new channel (1) or not (0)
_pcbSize - audio data size
_ppbAudio - poiter to audio data
MFAudioChannelsUpdate
Update frame's audio channel's data or number of channels. Call this method after modification of memory that is returned by MFAudioChannelGetBytes() method.
Syntax
void MFAudioChannelsUpdate()
MFAudioCopyTo
Copies audio channels, the bits conversion can be also performed
Syntax
void MFAudioCopyTo( string _bsChannelsList, IMFFrame _pFrameTo )
Parameters
_bsChannelsList - list of audio channels
_pFrameTo - a target frame to copy data to
MFAudioGain
Sets audio gain in dB.
Syntax
void MFAudioGain( string _bsChannelsList, double _dblGainStartDb, double _dblGainEndDb )
Parameters
_bsChannelsList - audio channels list
_dblGainStartDb - start audio gain
_dblGainEndDb - end audio gain
MFAudioGetBytes
Gets audio data pointer and data size
Syntax
void MFAudioGetBytes( out int _pcbSize, out long _ppbAudio )
Parameters
_pcbSize - audio data size
_ppbAudio - pointer to audio data
MFAudioLoadFromFile
Loads audio data from a WAV file
Syntax
void MFAudioLoadFromFile( string _bsFileName, long _llSamplesOffset, int _lSamplesLoad )
Parameters
_bsFileName - path to file
_llSamplesOffset - offset position in audio samples
_lSamplesLoad - number of samples to loadamount of audio samples to be loaded
MFAudioMix
Mixes audio data
Syntax
void MFAudioMix( IMFFrame _pFrameMixFrom, double _dblGainStartDb, double _dblGainEndDb, int _bSymmetricGain, string _bsAudioBufferID )
Parameters
_pFrameMixFrom - a source frame
_dblGainStartDb - start audio gain
_dblGainEndDb - end audio gain
_bSymmetricGain - uses symmetric gain (1) or not (0)
_bsAudioBufferID - audio buffer ID
MFAudioMixDirect
Directly mixes audio data (audio data of source frame and of the mixed frame should have equal frequency)
Syntax
void MFAudioMixDirect( out int _plAudioOffsetSrc, IMFFrame _pFrameMixFrom, out int _plAudioOffsetMix, int _lSamplesMixMax, double _dblGainStartDb, double _dblGainEndDb, int _bSymmetricGain )
Parameters
_plAudioOffsetSrc - audio samples offset in source frame
_pFrameMixFrom - source frame
_plAudioOffsetMix - audio samples offset in mixed frame
_lSamplesMixMax - maximal amount of mixed samples
_dblGainStartDb - start audio gain
_dblGainEndDb - end audio gain
_bSymmetricGain - use symmetric gain (1) or not (0)
MFAudioSaveToFile
Save audio to file (WAV format is used). If the file is exist and have WAV format then audio will be added to the end of the file. Note: format is not checked.
Syntax
void MFAudioSaveToFile( string _bsFileName, int _bAppend )
Parameters
_bsFileName - path to file
_bAppend - append new audio data to existed file (1) or overwrite it (0)
MFAudioSet
Sets frame's audio data
Syntax
void MFAudioSet( ref M_AUD_PROPS _pAudProps, int _cbSize, long _pbAudio )
Parameters
_pAudProps - audio properties
_cbSize - audio data size
_pbAudio - pointer to audio data
MFAVPropsGet
Gets media properties of the frame
Syntax
void MFAVPropsGet( out M_AV_PROPS _pProps, out int _plAudioSamples )
Parameters
_pProps - media properties of a frame
_plAudioSamples - number of audio samples
MFAVPropsSet
Sets media properties for the frame. Note that width, height, row-bytes can't be changed with this method. To change them you should convert a frame.
Syntax
void MFAVPropsSet( ref M_AV_PROPS _pProps, string _bsChannelsRemap )
Parameters
_pProps - media properties of a frame
_bsChannelsRemap - re-mapping channels string
MFClone
Gets a clone of the frame. See eMFrameClone for more information about clone types.
Syntax
void MFClone( out IMFFrame _ppCloneFrame, eMFrameClone _eCloneType, eMFCC _fccPixelFormat )
Parameters
_ppCloneFrame - result (cloned) frame
_eCloneType - clone type
_fccPixelFormat - output frame pixel format
MFConvert
Converts the frame's format (include frame rate conversion) or just scale the video frame.
Syntax
void MFConvert( ref M_AV_PROPS _pPropsDest, out IMFFrame _ppFrameRes, out int _pnFrameRest, string _bsPropsList, string _bsConverterID )
Parameters
_pPropsDest - target media properties
_ppFrameRes - result frame
_pnFrameRest - number of frames rest in a converter
_bsPropsList - additional properties
_bsConverterID - converter ID
MFCut
Cuts out part of video frame without memory copy. nFeild <= 0->both, nField=1 -> first field, nField=2 -> second field
Syntax
void MFCut( int _nField, ref tagRECT _pRect, out IMFFrame _ppFrameRes )
Parameters
_nField - number of field
_pRect - rectangle to cut
_ppFrameRes - result frame
MFDataGet
Gets ancillary data by four char code e.g. 'C608'.
Syntax
void MFDataGet( string _bsDataID, out int _pcbANCData, out long _ppbANCData )
Parameters
_bsDataID - data ID
_pcbANCData - data size of ancillary data
_ppbANCData - pointer to ancillary data
MFDataGetByIndex
Gets ancillary data by its index
Syntax
void MFDataGetByIndex( int _nIndex, out string _pbsDataID, out int _pcbANCData, out long _ppbANCData )
Parameters
_nIndex - ancillary data index
_pbsDataID - data ID
_pcbANCData - ancillary data size
_ppbANCData - pointer to the data
MFDataSet
Sets ancillary data by four char code e.g. 'C608'.
Syntax
void MFDataSet( string _bsDataID, int _cbANCData, long _pbANCData )
Parameters
_bsDataID - data ID
_cbANCData - data size
_pbANCData - pointer to the data
MFFlagCheck
Checks a frame's flag
Syntax
void MFFlagCheck( eMFrameFlags _eFlagCheck, out int _pnRes )
Parameters
_eFlagCheck - flag to check with
_pnRes - result: 1 if a frame has this flag, 0 - if not.
MFGetProcessID
Gets frame's process ID
Syntax
void MFGetProcessID( out uint _pdwProcessID )
Parameters
_pdwProcessID - process ID where the frame is processed
MFLoad
Loads a full copy of all data (used internally for transfer data between process)
Syntax
void MFLoad( uint _cbData, ref byte _pbData, eMFrameClone _eLoadType )
Parameters
_cbData - memory data size
_pbData - pointer to memory data
_eLoadType - load type
MFLoadFromStream
Loads a frame from a stream
Syntax
void MFLoadFromStream( IStream _pStream, eMFrameClone _eLoadType )
Parameters
_pStream - a stream to load a frame from
_eLoadType - clone type
MFObjGet
Gets an attached object by its ID
Syntax
void MFObjGet( string _bsObjID, out object _ppObj, int _bMakeLocal )
Parameters
_bsObjID - object ID
_ppObj - object
_bMakeLocal - indicates whether to make a frame local
MFObjGetByIndex
Gets an attached object by its index.
Syntax
void MFObjGetByIndex( int _nIndex, out string _pbsObjID, out object _ppObj, int _bMakeLocal )
Parameters
_nIndex - object index
_pbsObjID - object ID
_ppObj - object
_bMakeLocal - indicates whether to make a frame local
MFObjSet
Sets an attached object by its ID
Syntax
void MFObjSet( string _bsObjID, object _pObj )
Parameters
_bsObjID - object ID
_pObj - object
MFOverlay
Mixes frames: overlays _pFrameOverlay frame over this frame. By default audio gain is calculated based on overlay size and transparency or can be specified via 'audio_gain' property.
Syntax
void MFOverlay( object _pFrameOverlay, object _pFrameMask, int _nPosX, int _nPosY, double _dblAlpha, string _bsPropsList, string _bsAudioBufferID )
Parameters
_pFrameOverlay - frame to use as overlay
_pFrameMask - frame to use as maska mask frame
_nPosX - horizontal position
_nPosY - vertical position
_dblAlpha - transparency
_bsPropsList - additional properties
_bsAudioBufferID - audio buffer ID
MFOverlayRect
Mixes frames - overlays _pFrameOverlay frame over this frame, the position is from top-left corner, for 4:2:2 images (e.g. UYVY) horizontal position is aligned by two (e.g. 21->20). By default audio gain is calculated based on overlay size and transparency or can be specified via 'audio_gain' props.
Syntax
void MFOverlayRect( IMFFrame _pFrameOverlay, IMFFrame _pFrameMask, ref MF_RECT _pRect, eMFOverlayFlags _eMFOverlayFlags, double _dblAlpha, string _bsPropsList, string _bsAudioBufferID )
Parameters
_pFrameOverlay - frame to use as overlay
_pFrameMask - frame to use as mask
_pRect - target rectangle
_eMFOverlayFlags - overlay flags
_dblAlpha - transparency
_bsPropsList - additional properties
_bsAudioBufferID - audio buffer ID
MFPrint
Prints text over the frame
Syntax
void MFPrint( string _bsText, double _dblTextSize, ref MF_RECT _pRect, eMFTextFlags _eMFTextFlags, string _bsExtraParam )
Parameters
_bsText - text to be printed
_dblTextSize - text size
_pRect - target rectangle
_eMFTextFlags - text flags
_bsExtraParam - additional parameters
MFResize
Resizes the frame (just scale video frame).
Syntax
void MFResize( eMFCC _fccOutput, int _nWidth, int _nHeight, int _nResizeField, out IMFFrame _ppFrameRes, string _bsPropsList, string _bsConverterID )
Parameters
_fccOutput - output pixel format
_nWidth - target width
_nHeight - target height
_nResizeField - target field
_ppFrameRes - result frame
_bsPropsList - additional properties
_bsConverterID - converter ID
MFSave
Saves a full copy of all data (used internally for transfer data between process)
Syntax
void MFSave( out uint _pcbData, out IntPtr _ppData, eMFrameClone _eSaveType )
Parameters
_pcbData - data size
_ppData - pointer to data
_eSaveType - save type
MFSaveToStream
Saves a frame to a stream
Syntax
void MFSaveToStream( out IStream _ppStream, eMFrameClone _eSaveType )
Parameters
_ppStream - a stream
_eSaveType - clone type to save a frame
MFStrGet
Gets a string by its ID
Syntax
void MFStrGet( string _bsStrID, out string _pbsString )
Parameters
_bsStrID - string ID
_pbsString - string results
MFStrGetByIndex
Gets a string by its index.
Syntax
void MFStrGetByIndex( int _nIndex, out string _pbsStrID, out string _pbsString )
Parameters
_nIndex - string index
_pbsStrID - string ID
_pbsString - string result
MFStrSet
Sets a string by its ID.
Syntax
void MFStrSet( string _bsStrID, string _bsString )
Parameters
_bsStrID - string ID
_bsString - string to be set
MFTimeGet
Gets a frame's time
Syntax
void MFTimeGet( out M_TIME _pTime )
Parameters
_pTime - frame time
MFTimeSet
Sets a frame's time
Syntax
void MFTimeSet( ref M_TIME _pTime )
Parameters
_pTime - frame time
MFTransition
Makes a transition between frames
Syntax
void MFTransition( object _pFrameFrom, out IMFFrame _ppFrameRes, double _dblPos, string _bsTransition, string _bsPropsList, string _bsConverterID )
Parameters
_pFrameFrom - frame from which transition is made
_ppFrameRes - result frame
_dblPos - position of transition (0 - beginning, 1 - end)
_bsTransition - transition type
_bsPropsList - additional properties
_bsConverterID - converter ID
MFVideoGetBytes
Gets frame's video data pointer
Syntax
void MFVideoGetBytes( out int _pcbSize, out long _ppbVideo )
Parameters
_pcbSize - video data size
_ppbVideo - video data pointer
MFVideoGetBytesEx
Extended method to get video bytes of a frame
Syntax
void MFVideoGetBytesEx( out MF_VID_PTR _pVideoPtr )
Parameters
_pVideoPtr - video pointer structure
MFVideoGetHbitmap
Gets a HBitmap for a frame
Note: the returned bitmap should be free via WinAPI ::DeleteObject() call
Syntax
void MFVideoGetHbitmap( out long _pllHBitmap )
Parameters
_pllHBitmap - video HBitmapHBITMAP of video data of the frame
MFVideoSaveToFile
Saves frame's video to a file. Supported formats are: PNG, JPG, BMP, TGA, TIFF
Syntax
void MFVideoSaveToFile( string _bsFileName )
Parameters
_bsFileName - path to target file
MFWaitAsync
Waits until asynchronous procedure is finished
Syntax
void MFWaitAsync()