Microsoft DirectX 8.0

CEnumMediaTypes Class

CEnumMediaTypes class hierarchy

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
CEnumMediaTypesConstructor method.
~CEnumMediaTypesDestructor method. Virtual.
IEnumMediaTypes Methods
CloneMakes a copy of the enumerator with the same enumeration state.
NextRetrieves a specified number of media types.
ResetResets the enumeration sequence to the beginning.
SkipSkips over a specified number of media types.

CEnumMediaTypes::CEnumMediaTypes

CEnumMediaTypes Class

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.

CEnumMediaTypes::~CEnumMediaTypes

CEnumMediaTypes Class

Destructor method.

Syntax

virtual ~CEnumMediaTypes(void);

CEnumMediaTypes::Clone

CEnumMediaTypes Class

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_OKSuccess.
E_OUTOFMEMORYInsufficient memory.
E_POINTERNULL pointer argument.
VFW_E_ENUM_OUT_OF_SYNCThe pin's state has changed and is now inconsistent with the enumerator.

CEnumMediaTypes::Next

CEnumMediaTypes Class

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_FALSEDid not retrieve as many media types as requested.
S_OKSuccess.
E_INVALIDARGInvalid argument.
E_POINTERNULL pointer argument.
VFW_E_ENUM_OUT_OF_SYNCThe 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.

CEnumMediaTypes::Reset

CEnumMediaTypes Class

Resets the enumeration sequence to the beginning. Implements the IEnumMediaTypes::Reset method.

Syntax

HRESULT Reset(void);

Return Value

Returns S_OK.

CEnumMediaTypes::Skip

CEnumMediaTypes Class

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_FALSESkipped past the end of the sequence.
S_OKSuccess.
VFW_E_ENUM_OUT_OF_SYNCThe pin's state has changed and is now inconsistent with the enumerator.