Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
DeleteMediaType
Collapse the table of content
Expand the table of content

DeleteMediaType function

The DeleteMediaType function deletes an allocated AM_MEDIA_TYPE structure, including the format block.

Syntax


void WINAPI DeleteMediaType(
   AM_MEDIA_TYPE *pmt
);

Parameters

pmt

A pointer to an AM_MEDIA_TYPE structure.

Return value

This function does not return a value.

Remarks

Use this function to release any media type structure that was allocated using either CoTaskMemAlloc or CreateMediaType.

This function is defined in the DirectShow Base Classes library. If you prefer not to link to the base class library, you can use the following code:


// Release the format block for a media type.

void _FreeMediaType(AM_MEDIA_TYPE& mt)
{
    if (mt.cbFormat != 0)
    {
        CoTaskMemFree((PVOID)mt.pbFormat);
        mt.cbFormat = 0;
        mt.pbFormat = NULL;
    }
    if (mt.pUnk != NULL)
    {
        // pUnk should not be used.
        mt.pUnk->Release();
        mt.pUnk = NULL;
    }
}



// Delete a media type structure that was allocated on the heap.
void _DeleteMediaType(AM_MEDIA_TYPE *pmt)
{
    if (pmt != NULL)
    {
        _FreeMediaType(*pmt); 
        CoTaskMemFree(pmt);
    }
}


Requirements

Header

Mtype.h (include Streams.h)

Library

Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

FreeMediaType
Media Type Functions

 

 

Community Additions

ADD
Show:
© 2015 Microsoft