Microsoft Windows CE 3.0  

Enumerator Base Classes

Important:
This is retired content. This content is outdated and is no longer being maintained. It is provided as a courtesy for individuals who are still using these technologies. This content may contain URLs that were valid when originally published, but now link to sites or pages that no longer exist.

An enumeratoris an interface that provides methods for traversing a list of elements. Enumerators are used in COM programming, and the DirectShow model follows the COM model in enumerating objects. Two enumerator classes are provided in the class library: CEnumPins, which implements the IEnumPinsinterfaces, and CEnumMediaTypes, which implements the IEnumMediaTypesinterface. Two other DirectShow enumerator interfaces, IEnumFiltersand IEnumRegFilters, are not represented by base classes because they are implemented only by the filter graph manager.

The CEnumPinsclass creates an enumerator when the IBaseFilter::EnumPinsmethod is called. The enumerator returned by this method is a pointer to the IEnumPinsinterface, which is implemented by the CEnumPinsclass. The CEnumPinsmember functions can then be called to retrieve pointers to each of the pins on the filter, which this enumerator accomplishes by calling the CBaseFilter::GetPinmember function on the filter. The filter must override the base class CBaseFilter::GetPinmember function to supply the enumerator with the next pin in the list each time it is called.

The CEnumMediaTypesclass creates an enumerator when the IPin::EnumMediaTypesmethod is called. Pins store a list of the media types that they support. During negotiation of the media type, one pin typically calls the EnumMediaTypesmethod on its connected pin, retrieves the enumerator, and uses it to select a media type. Both of these enumerator classes support the Next, Skip, Reset, and Clonemethods familiar to COM programmers. The media type enumerators call the CBasePin::GetMediaTypemember function, which must be overridden by the derived pin class, to return the next media type in a list of media types accepted by the pin.

Enumerators operate as threads, and must have synchronized access to the pin media type list. For this reason, the classes that implement enumerators inherit (through multiple inheritance) from the CCritSecclass, which provides critical section management. For more information about the CCritSecclass, see Win32 Classes.



 Last updated on Tuesday, May 18, 2004

© 2004 Microsoft Corporation. All rights reserved.