CImageAllocator.NotifyMediaType method

[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 NotifyMediaType method informs the object of the current media type.

Syntax

void NotifyMediaType(
   CMediaType *pMediaType
);

Parameters

pMediaType

Pointer to a CMediaType object, or NULL to clear the media type.

Return value

This method does not return a value.

Remarks

The owning filter should call this method whenever the media type changes. Typically this occurs when the pin first connects, and after a dynamic format change. The allocator uses the media type to validate proposed allocator properties, and also when it creates media samples.

The CImageAllocator object stores the pMediaType pointer in the m_pMediaType member variable. Therefore, if the caller needs to release the CMediaType object, it should update the allocator by calling this method again, either with a new pointer or with a NULL value. Otherwise, an error can occur when the allocator attempts to reference the old pointer.

Requirements

Requirement Value
Header
Winutil.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)

See also

CImageAllocator Class