Microsoft DirectX 8.1 (C++) |
The SetMediaType method specifies the media type for the connection on the Sample Grabber's input pin.
Syntax
HRESULT SetMediaType(
const AM_MEDIA_TYPE *pType
);
Parameters
pType
Pointer to an AM_MEDIA_TYPE structure specifies the required media type. It is not necessary to set all the structure members; see Remarks for details.
Return Value
Returns S_OK.
Remarks
By default, the Sample Grabber has no preferred media type. To ensure that the Sample Grabber connects to the correct filter, call this method before building the filter graph.
This method restricts the range of connection types that the filter will accept. When the filter connects, it tries to match the connection type against the required type (pType). It checks the major type, subtype, and format type GUIDs, in that order. For each GUID, if the connection type does not match the required type, the filter rejects the connection and returns VFW_E_INVALIDMEDIATYPE. If the GUID in the required type is GUID_NULL, the type is accepted and the search stops.
The Sample Grabber Filter does not support video types with top-down orientation (negative biHeight) or with format type FORMAT_VideoInfo2. The SetMediaType method succeeds, but the filter will not connect.
See Also