IEnumMediaTypes::Next

 
Microsoft DirectShow 9.0

IEnumMediaTypes::Next

The Next method 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 AM_MEDIA_TYPE structure pointers, 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 Values

Returns one of the following HRESULT values.

Value Description
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

The caller passes an array of AM_MEDIA_TYPE pointers in ppMediaTypes. The method allocates a number AM_MEDIA_TYPE structures equal to cMediaTypes or to the number of media types that remain in the enumeration, whichever is less. The number of structures allocated is returned in pcFetched. Delete each structure by calling the DeleteMediaType function.

If the set of media types changes, the enumerator becomes inconsistent with the owning pin. In that case, 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 IEnumMediaTypes::Reset method. You can then call the Next method safely.

Requirements

Header: Declared in Strmif.h; include Dshow.h.

Library: Use Strmiids.lib.

See Also