Microsoft DirectX 8.0 |
Enumerates the preferred media types for a pin.
The IPin::EnumMediaTypes method returns this interface. It is based on the standard Component Object Model (COM) enumerators. For more information, see the IEnumXXXX topic in the Platform SDK.
Pins use this interface when they connect to other pins. Applications can also use it to examine a pin's preferred media types. For more information, see Enumerating Objects in a Filter Graph.
If a pin's set of preferred media types changes, some methods on this interface return VFW_E_ENUM_OUT_OF_SYNC. Call the Reset method to resynchronize the enumerator.
Methods in Vtable Order
IUnknown methods Description QueryInterface Retrieves pointers to supported interfaces. AddRef Increments the reference count. Release Decrements the reference count. IEnumMediaTypes methods Description Next Retrieves a specified number of media types. Skip Skips over a specified number of media types. Reset Resets the enumeration sequence to the beginning. Clone Makes a copy of the enumerator with the same enumeration state.
Makes a copy of the enumerator with the same enumeration state.
Syntax
HRESULT Clone( IEnumMediaTypes **ppEnum );
Parameters
- ppEnum
- [out] Address of a variable that receives a pointer to the IEnumMediaTypes interface of the new enumerator.
Return Value
Returns one of the following HRESULT values.
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.
Remarks
If the set of media types changes, the enumerator is no longer consistent with the pin, and the method returns VFW_E_ENUM_OUT_OF_SYNC. Discard any data obtained from previous calls to the enumerator, because it might be invalid. Update the enumerator by calling the Reset method. You can then call the Clone method safely.
Retrieves a specified number of media types.
Syntax
HRESULT Next( ULONG cMediaTypes, AM_MEDIA_TYPE **ppMediaTypes, ULONG *pcFetched );
Parameters
- cMediaTypes
- [in] Number of media types to retrieve.
- ppMediaTypes
- [out] Array of pointers to AM_MEDIA_TYPE structures, of size cPins.
- pcFetched
- [out] 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 following HRESULT values.
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.
If the set of media types changes, the enumerator is no longer consistent with the pin, and the method returns VFW_E_ENUM_OUT_OF_SYNC. Discard any data obtained from previous calls to the enumerator, because it might be invalid. Update the enumerator by calling the Reset method. You can then call the Next method safely.
Resets the enumeration sequence to the beginning.
Syntax
HRESULT Reset(void);
Return Value
Returns S_OK.
Skips over a specified number of media types.
Syntax
HRESULT Skip( ULONG cMediaTypes);
Parameters
- cMediaTypes
- [in] Number of media types to skip.
Return Value
Returns one of the following HRESULT values.
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.
Remarks
If the set of media types changes, the enumerator is no longer consistent with the pin, and the method returns VFW_E_ENUM_OUT_OF_SYNC. Discard any data obtained from previous calls to the enumerator, because it might be invalid. Update the enumerator by calling the Reset method. You can then call the Skip method safely.