Microsoft DirectX 8.0

Media Type Helper Functions

These functions manipulate the DMO_MEDIA_TYPE structure. They are declared in the file Dmort.h.

MoInitMediaTypeInitializes a media type structure.
MoFreeMediaTypeFrees the allocated members of a media type structure.
MoCopyMediaTypeCopies the members of one media type structure into another media type structure.
MoCreateMediaTypeAllocates a new media type structure.
MoDeleteMediaTypeDeletes a media type structure that was previously allocated.
MoDuplicateMediaTypeDuplicates a media type structure.

MoInitMediaType

DMO Registration Functions

Initializes a media type structure.

Syntax

HRESULT MoInitMediaType(
    DMO_MEDIA_TYPE *pmt, 
    DWORD cbFormat
);

Parameters

pmt
Pointer to an uninitialized DMO_MEDIA_TYPE structure allocated by the caller.
cbFormat
Number of bytes to allocate for the format block. Can be zero.

Return Value

Returns an HRESULT value. Possible values include the following:

S_OKSuccess
E_OUTOFMEMORYInsufficient memory
E_POINTERNULL pointer argument

Remarks

This function allocates the format block and sets the cbFormat and pbFormat members of the DMO_MEDIA_TYPE structure.

The caller must free the media type by calling the MoFreeMediaType function.

MoFreeMediaType

DMO Registration Functions

Frees the allocated members of a media type structure.

Syntax

HRESULT MoFreeMediaType(
    DMO_MEDIA_TYPE *pmt
);

Parameters

pmt
Pointer to an initialized DMO_MEDIA_TYPE structure.

Return Value

Returns an HRESULT value. Possible values include the following:

S_OKSuccess
E_POINTERNULL pointer argument

Remarks

This function frees the format block pointed to by the pbFormat member of the DMO_MEDIA_TYPE structure.

MoCopyMediaType

DMO Registration Functions

Copies the members of one media type structure into another media type structure.

Syntax

HRESULT MoCopyMediaType(
    DMO_MEDIA_TYPE *pmtDest, 
    const DMO_MEDIA_TYPE *pmtSrc
);

Parameters

pmtDest
Pointer to the target DMO_MEDIA_TYPE structure. The caller must allocate, but not initialize, this structure.
pmtSrc
Pointer to the source DMO_MEDIA_TYPE structure.

Return Value

Returns an HRESULT value. Possible values include the following:

S_OKSuccess
E_OUTOFMEMORYInsufficient memory
E_POINTERNULL pointer argument

Remarks

This function copies all the members of pmtSrc to pmtDest and copies the format block.

The caller must free the target media type by calling the MoFreeMediaType function.

MoCreateMediaType

DMO Registration Functions

Allocates a new media type structure.

Syntax

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

Parameters

ppmt
Address of a pointer to a DMO_MEDIA_TYPE structure that receives the allocated 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:

S_OKSuccess
E_OUTOFMEMORYInsufficient memory
E_POINTERNULL pointer argument

Remarks

This function allocates a new DMO_MEDIA_TYPE structure and then initializes it by calling the MoInitMediaType function.

The caller must delete the media type structure by calling the MoDeleteMediaType function.

MoDeleteMediaType

DMO Registration Functions

Deletes a media type structure that was previously allocated.

Syntax

HRESULT MoDeleteMediaType(
    DMO_MEDIA_TYPE *pmt
);

Parameters

pmt
Pointer to an initialized DMO_MEDIA_TYPE structure.

Return Value

Returns an HRESULT value. Possible values include the following:

S_OKSuccess
E_POINTERNULL pointer argument

Remarks

This function frees the allocated members of the media type structure by calling MoFreeMediaType. Then it frees the media type structure itself.

MoDuplicateMediaType

DMO Registration Functions

Duplicates a media type structure.

Syntax

HRESULT MoDuplicateMediaType(
    DMO_MEDIA_TYPE **ppmtDest, 
    const DMO_MEDIA_TYPE *pmtSrc
);

Parameters

ppmtDest
Address of a pointer to a DMO_MEDIA_TYPE structure that receives the duplicated structure.
pmtSrc
Pointer to the media type structure to duplicate.

Return Value

Returns an HRESULT value. Possible values include the following:

S_OKSuccess
E_OUTOFMEMORYInsufficient memory
E_POINTERNULL pointer argument

Remarks

This method is equivalent to calling MoCreateMediaType and MoCopyMediaType.

The caller must delete the returned media type structure by calling the MoDeleteMediaType function.