Microsoft DirectX 8.0 |
Enumerator for preferred media types.
Declaration: Amfilter.h
This class implements the IEnumMediaTypes interface. It calls the following CBasePin methods:
Whenever a pin alters its list of preferred media types, the pin increments the media-type version number. When this happens, the enumerator object is no longer synchronized with the pin, and the class methods return VFW_E_ENUM_OUT_OF_SYNC. Call the Reset method to resynchronize the enumerator.
Public Methods | |
---|---|
CEnumMediaTypes | Constructor method. |
~CEnumMediaTypes | Destructor method. Virtual. |
IEnumMediaTypes Methods | |
Clone | Makes a copy of the enumerator with the same enumeration state. |
Next | Retrieves a specified number of media types. |
Reset | Resets the enumeration sequence to the beginning. |
Skip | Skips over a specified number of media types. |
Constructor method.
Syntax
CEnumMediaTypes( CBasePin *pPin, CEnumMediaTypes *pEnumMediaTypes );
Parameters
- pPin
- Pointer to the pin on which the enumeration is to be performed.
- pEnumMediaTypes
- Pointer to the IEnumMediaTypes interface of an enumerator to clone, or NULL.
Remarks
If pEnumMediaTypes is NULL, this method initializes the enumerator to the beginning of the enumeration sequence. Otherwise, it duplicates the internal state of the enumerator specified by pEnumMediaTypes.
Destructor method.
Syntax
virtual ~CEnumMediaTypes(void);
Makes a copy of the enumerator with the same enumeration state. Implements the IEnumMediaTypes::Clone method.
Syntax
HRESULT Clone( IEnumMediaTypes **ppEnum );
Parameters
- ppEnum
- Address of a variable that receives a pointer to the IEnumMediaTypes interface of the new enumerator.
Return Value
Returns one of the HRESULT values shown in the following table.
S_OK Success. E_OUTOFMEMORY Insufficient memory. E_POINTER NULL pointer argument. VFW_E_ENUM_OUT_OF_SYNC The pin's state has changed and is now inconsistent with the enumerator.
Retrieves a specified number of media types. Implements the IEnumMediaTypes::Next method.
Syntax
HRESULT Next( ULONG cMediaTypes, AM_MEDIA_TYPE **ppMediaTypes, ULONG *pcFetched );
Parameters
- cMediaTypes
- Number of media types to retrieve.
- ppMediaTypes
- Array of pointers to AM_MEDIA_TYPE structures, of size cPins.
- pcFetched
- Pointer to a variable that receives the number of media types the method returned. Can be NULL if cMediaTypes is 1.
Return Value
Returns one of the HRESULT values shown in the following table.
S_FALSE Did not retrieve as many media types as requested. S_OK Success. E_INVALIDARG Invalid argument. E_POINTER NULL pointer argument. VFW_E_ENUM_OUT_OF_SYNC The pin's state has changed and is now inconsistent with the enumerator.
Remarks
If the method succeeds, the array specified by ppMediaTypes contains pointers to AM_MEDIA_TYPE structures. The number of structures is equal to *pcFetched. Free each media type by calling the DeleteMediaType function.
This method calls the pin's CBasePin::GetMediaType method to retrieve the media types.
Resets the enumeration sequence to the beginning. Implements the IEnumMediaTypes::Reset method.
Syntax
HRESULT Reset(void);
Return Value
Returns S_OK.
Skips over a specified number of media types. Implements the IEnumMediaTypes::Skip method.
Syntax
HRESULT Skip( ULONG cMediaTypes );
Parameters
- cMediaTypes
- Number of media types to skip.
Return Value
Returns one of the HRESULT values shown in the following table.
S_FALSE Skipped past the end of the sequence. S_OK Success. VFW_E_ENUM_OUT_OF_SYNC The pin's state has changed and is now inconsistent with the enumerator.