The IEnumMediaTypes interface enumerates the preferred formats for a pin.
When to Implement
This interface must be implemented and made available by the IPin::EnumMediaTypes method. The CBasePin::EnumMediaTypes member function automatically does this in the DirectShow™ class library and uses the CEnumMediaTypes class to create the enumerator object.
When to Use
This interface is normally used by a connecting pin to determine the media type when negotiating a connection. It can also be passed through to other pins, either upstream or downstream of the filter, when intervening filters do not have a list of preferred media types. For example, a transform-inplace filter might pass the IEnumMediaTypes interface of a downstream input pin to the connecting output pin of the upstream filter, instead of providing its own IEnumMediaTypes interface.
Methods in Vtable Order
IUnknown methods | Description |
QueryInterface | Returns pointers to supported interfaces. |
AddRef | Increments the reference count. |
Release | Decrements the reference count. |
IEnumMediaTypes methods | Description |
Next | Retrieves the specified number of items in the enumeration sequence. |
Skip | Skips a specified number of elements in the enumeration sequence. |
Reset | Resets the enumeration sequence to the beginning. |
Clone | Returns another enumerator containing the same enumeration state as the current one. |
Returns another enumerator containing the same enumeration state as the current one.
HRESULT Clone(
IEnumMediaTypes ** ppEnum
);
Returns an HRESULT value.
Retrieves the specified number of items in the enumeration sequence.
HRESULT Next(
ULONG cMediaTypes,
AM_MEDIA_TYPE ** ppMediaTypes,
ULONG * pcFetched
);
Returns an HRESULT value.
To use this method, pass an array of pointers to media types. (If you want only a single media type, you can pass a pointer to a media type pointer in place of an array of media type pointers.) The interface allocates the necessary AM_MEDIA_TYPE structures and initializes them with the variable format block. Free each media type by calling DeleteMediaType, which will free the format block and the media type itself.
Resets the enumerator to the beginning so that the next call to the IEnumMediaTypes::Next method returns, at a minimum, the first media type (if any) in the enumeration.
HRESULT Reset(void);
Returns S_OK if successful; otherwise, returns S_FALSE.
Skips a specified number of elements in the enumeration sequence.
HRESULT Skip(
ULONG cMediaTypes
);
Returns an HRESULT value.
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.