MoCreateMediaType function (dmort.h)

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The MoCreateMediaType function allocates a new media type structure.

Syntax

HRESULT MoCreateMediaType(
  DMO_MEDIA_TYPE **ppmt,
  DWORD          cbFormat
);

Parameters

ppmt

Receives a pointer to an allocated DMO_MEDIA_TYPE structure.

cbFormat

Number of bytes to allocate for the format block. Can be zero.

Return value

Returns an HRESULT value. Possible values include the following.

Return code Description
E_OUTOFMEMORY
Insufficient memory
E_POINTER
NULL pointer argument
S_OK
Success

Remarks

This function allocates a new DMO_MEDIA_TYPE structure on the heap. It also allocates memory for the format block. The caller must delete the structure by calling the MoDeleteMediaType function.

Internally, this function calls MoInitMediaType to allocate the format block.

Requirements

   
Target Platform Windows
Header dmort.h (include Dmo.h)
Library Msdmo.lib
DLL Msdmo.dll