CSourceStream::GetMediaType
Microsoft DirectShow 9.0 |
CSourceStream::GetMediaType
The GetMediaType method retrieves a preferred media type.
Syntax
virtual HRESULT GetMediaType( int iPosition, CMediaType *pMediaType ); virtual HRESULT GetMediaType( CMediaType *pMediaType );
Parameters
iPosition
Zero-based index value.
pMediaType
Pointer to a CMediaType object that receives the media type.
Return Value
Returns one of the HRESULT values shown in the following table.
Value | Description |
S_OK | Success. |
VFW_S_NO_MORE_ITEMS | Index out of range. |
E_INVALIDARG | Index less than zero. |
E_UNEXPECTED | Unexpected error. |
Remarks
There are two versions of this method. One version overrides the CBasePin::GetMediaType method and takes an index value as a parameter. The other version is designed to retrieve a single media type, so it lacks the index parameter.
The single-parameter method returns E_UNEXPECTED. The two-parameter method verifies that the iPosition parameter is zero and then calls the single-parameter version. Depending on the number of media types the pin supports, you must override one of these methods:
- If the pin supports exactly one media type, override the single-parameter version. Fill in the media type that the pin supports.
- If the pin supports more than one media type, override the two-parameter version. Also override the CSourceStream::CheckMediaType method.
Requirements
** Header:** Declared in Source.h; include Streams.h.
** Library:** Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).
See Also