Bewerken

Delen via


KS Filters

A filter is a group of nodes that encapsulates a processing task to be performed on the data stream. Pins serve as input and output conduits on a filter.

A simple filter could contain one data sink pin and one data source pin. The filter receives incoming data on the data sink pin, processes it internally, and writes to the data source pin. In the following figure, the pins are shown as heavy line segments. Internally, the filter connects the data sink pin to an internal processing unit, a node, which in turn is connected to the data source pin.

diagram illustrating a simple ks filter.

Another device might combine or split data flows between pins. For example, an audio mixer supports several data sink pins. The mixer combines them into a single stream, and writes that stream to a data source pin. The following illustration shows the data flow.

diagram illustrating a mixer.

The graph describes the internal relationship between the filter's pins. A more complicated filter might encapsulate several nodes that transform data flowing through the filter.

Filters specify internal connections between pins and internal nodes by using the KSPROPSETID_Topology property set.

The KSPROPERTY_TOPOLOGY_CONNECTIONS property queries all connections between nodes of a KS filter. This property returns an array of KSTOPOLOGY_CONNECTION. Each KSTOPOLOGY_CONNECTION structure represents a single data-path connection inside a filter. In the mixer diagram above, the sequence of KSTOPOLOGY_CONNECTION structures could be as follows:

//    FromNode,       FromNodePin,     ToNode,        ToNodePin,
{
 {  KSFILTER_NODE,        0,            0,               0     },
 {       0,               1,       KSFILTER_NODE,        1     }
}