IEnumPins Interface

The IBaseFilter::EnumPins method returns this interface. It is based on the IEnumX protocol of the Component Object Model (COM).

Note Actions that cause the number of pins to change might cause the enumerator to fail.

This interface must be implemented and made available by the IBaseFilter::EnumPins method. The CBaseFilter::EnumPins member function automatically does this in the Microsoft® DirectShow® class library and uses the CEnumPins class to create the enumerator object.

This interface is normally used by the filter graph manager when connecting filters. It can, however, be used by an application that must find the pins associated with filters in the filter graph—for example, to add another filter to the graph.

Methods in Vtable Order

IUnknown methodsDescription
QueryInterface Retrieves pointers to supported interfaces.
AddRef Increments the reference count.
Release Decrements the reference count.
IEnumPins methodsDescription
Next Puts pointers to IPin interfaces for the next pins into the specified array.
Skip Skips the specified number of pins.
Reset Resets the position to the beginning so that the next call to the IEnumPins::Next method returns, at a minimum, the first pin of the filter.
Clone Provides another enumerator, which is a duplicate of the current one.

IEnumPins::Clone

IEnumPins Interface

Makes a copy of the enumerator. This enables the calling application to retain two positions in the list of pins.

Syntax

HRESULT Clone(
    IEnumPins **ppEnum
);

Parameters

ppEnum
[out] Address of a pointer to the new copy of this enumerator.

Return Value

Returns one of the following HRESULT values.

E_OUTOFMEMORY Insufficient memory.
E_POINTER Null pointer argument.
S_OK Success.
VFW_E_ENUM_OUT_OF_SYNCThe enumerator has become invalid. For more information, see Remarks.

Remarks

If the number of pins changes, the state of the enumerator will no longer be consistent with the state of the filter. As a result, this method will return the VFW_E_ENUM_OUT_OF_SYNC error code. You should discard any data obtained from previous calls to the enumerator, because it might be invalid, and update the enumerator by calling the Reset method. You can then call the Clone method safely.

IEnumPins::Next

IEnumPins Interface

Places pointers to IPin interfaces into the specified array.

Syntax

HRESULT Next(
    ULONG cPins,
    IPin **ppPins,
    ULONG *pcFetched
);

Parameters

cPins
[in] Number of pins to place.
ppPins
[out] Address of a pointer to the array in which to place the interface pointers.
pcFetched
[out] Pointer to the actual number of pins placed in the array.

Return Value

Returns one of the following HRESULT values.

E_INVALIDARG Invalid argument.
E_POINTER Null pointer argument.
S_FALSEFewer pins were retrieved than requested.
S_OK Success.
VFW_E_ENUM_OUT_OF_SYNCThe enumerator has become invalid. For more information, see Remarks.

Remarks

The interface returned by this method has had its reference count incremented. Be sure to use IUnknown::Release on the interface to decrement the reference count when you have finished using the interface.

If the number of pins changes, the state of the enumerator will no longer be consistent with the state of the filter. As a result, this method will return the VFW_E_ENUM_OUT_OF_SYNC error code. You should discard any data obtained from previous calls to the enumerator, because it might be invalid, and update the enumerator by calling the Reset method. You can then call the Next method safely.

IEnumPins::Reset

IEnumPins Interface

Resets the enumerator to the beginning so that the next call to the IEnumPins::Next method returns, at a minimum, the first pin of the filter.

Syntax

HRESULT Reset(void);

Return Value

Returns S_OK, which indicates success.

IEnumPins::Skip

IEnumPins Interface

Skips the specified number of pins.

Syntax

HRESULT Skip(
    ULONG cPins
);

Parameters

cPins
[in] Number of pins to skip.

Return Value

Returns one of the following HRESULT values.

E_INVALIDARGNo additional pins remain in the enumeration list.
S_FALSEFewer pins were skipped than requested, because not that many remained in the list.
S_OKSuccess.
VFW_E_ENUM_OUT_OF_SYNCThe enumerator has become invalid. For more information, see Remarks.

Remarks

This method affects the next call to the IEnumPins::Next method.

If the number of pins changes, the state of the enumerator will no longer be consistent with the state of the filter. As a result, this method will return the VFW_E_ENUM_OUT_OF_SYNC error code. You should discard any data obtained from previous calls to the enumerator, because it might be invalid, and update the enumerator by calling the Reset method. You can then call the Skip method safely.


Top of Page Top of Page
© 2000 Microsoft and/or its suppliers. All rights reserved. Terms of Use.