共用方式為


ISelector interface (vidcap.h)

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

The ISelector interface is used to select source nodes in a stream class driver. Applications can use this interface to select which input is active on the device. For example, if a USB video capture device has a camera and a tape transport, these inputs could be represented as source nodes.

Inheritance

The ISelector interface inherits from the IUnknown interface. ISelector also has these types of members:

Methods

The ISelector interface has these methods.

 
ISelector::get_NumSources

The get_NumSources method returns the number of source nodes connected to the selector node.
ISelector::get_SourceNodeId

The get_SourceNodeId method returns the index of the active source node.
ISelector::put_SourceNodeId

The put_SourceNodeId method activates a source node.

Remarks

A kernel-streaming (KS) filter contains one or more nodes. Each node encapsulates a processing task that is applied to the stream. In the following diagram, nodes 1 and 2 are source nodes and node 3 is a selector node.

KsProxy nodes

The source nodes represent input streams—for example, a camera or a tape transport. The selector node controls which stream is sent to the filter's output pin. To switch between inputs, an application would do the following:

  1. Use the IKsTopologyInfo interface to enumerate the nodes and discover the node types, identifiers, and names.
  2. Call IKsTopologyInfo::CreateNodeInstance to create the selector node, passing in the node identifier and the interface identifier IID_ISelector. The method returns an ISelector interface pointer.
  3. Use the ISelector interface to select the source node.
The ISelector interface is available if the selector node supports the PROPSETID_VIDCAP_SELECTOR property set. For more information, see the Windows DDK documentation.

Requirements

Requirement Value
Minimum supported client Windows XP with SP2 [desktop apps only]
Minimum supported server Windows Server 2003 R2 [desktop apps only]
Target Platform Windows
Header vidcap.h