Share via


DirectShow Overview (Compact 7)

3/12/2014

This topic defines key DirectShow terms and introduces the following components:

  • Playback Filter Graph
  • Registry Entries
  • DirectShow Codecs Supported by Windows Embedded Compact 7

DirectShow Terms

The following list defines common terms for understanding how to work in DirectShow.

  • Filter. A DirectShow component that performs a fundamental operation such as playback, capture, or a type of transform, such as decompressing a compressed media stream.
  • Filter graph. A set of connected DirectShow filters that, together, perform a more complex multimedia task.
  • Filter Graph Manager. The DirectShow engine that sets up, tears down, and manages the filter graphs. The Filter Graph Manager makes calls to the filters to indicate whether they should pause, run, stop, and so on.
  • Playback pipeline. A playback filter graph that is currently running.
  • Media. Compressed or uncompressed audio, video, or both audio and video data that is appropriate for the context.
  • Samples. Generic term for audio samples and video frames. The term "frame" is also used in the context of video decoding.
  • Container format. Defines how the media is stored in a file, stream, or some other type of container, and is typically identified by the file extension, such as .asf.
  • Elementary streams. The media content within a container. A container may contain multiple elementary streams. An elementary stream is also referred to as the payload.
  • Encoding format. The compression format of an elementary stream within the container. Occasionally, the codec type is used to refer to the encoding format.
  • Demultiplexer. The software component that separates the audio and video data from the interleaved streams of data found in the containers, timestamps them, and pushes them out through different output connections.
  • Decoder. A filter that decompresses the compressed format of the media. A video decoder receives compressed video samples and produces uncompressed video frames. Similarly, an audio decoder receives compressed audio and produces uncompressed audio.
  • Renderer. A filter that plays the media data through an appropriate device. A video renderer displays the uncompressed video frames it receives from the video decoder. An audio renderer plays the audio samples through the audio device.
  • Pin. A unidirectional connection point that connects one filter to another filter.
  • Upstream filter. A filter that produces data.
  • Downstream filter. A filter that consumes data.

Playback Filter Graph

A playback filter graph has a source filter, a demultiplexer filter, one or more decoder filters, and one or more renderer filters. For certain formats, Windows Embedded Compact 7 has a new buffering filter, the Buffering Stream Filter, which is located between the source filter and the demultiplexer and manages pools of IMediaSample buffers so that other filters downstream can work with minimal buffer management. When the Buffering Stream Filter is in use, a typical filter graph looks like the following:

DirectShow Filter Graph

For a given platform, you typically implement the audio and video decoder filters to take advantage of any available decoding hardware on the platform. You might also implement the renderer filters if the platform has specific requirements; for example, it requires writing to predetermined video memory for faster processing. Alternatively, you can use the software renderers that are supplied by the OS.

Note that you do not need to implement the audio and video decoders and renderers in separate software components. A software module can consist of one or more binaries containing all of these parts. For example, assume that you are implementing both the decoders and the renderers. In this situation, you can create a component that combines the audio decoder and renderer and another component that combines the video decoder and renderer. Alternatively, you can create one single binary that contains all of these parts. Depending on your implementation, the filter graph could appear as one of the configurations shown in the following figure:

DirectShow A/V Combined and Separate

Note also that some media formats do not require a buffering stream filter, so there may not be one present in your filter graph. If the buffering stream filter is not used, the source filter connects directly to the demultiplexer filter.

Registry Entries

Every filter in DirectShow must have a GUID. A filter must also have registry entries that describe its input and output types so that DirectShow can discover the filter and use it. The following example code shows a set of registry entries for a typical decoder. In your own code, you would replace the placeholder text in the angle brackets with appropriate values for the decoder. All input and output types and subtypes are GUIDs, and all GUIDs must be specified in a <xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx> form, where each x represents a hexadecimal digit. For audio and video, the major types are MEDIATYPE_Audio and MEDIATYPE_Video, respectively. The input subtypes depend on the encoding format accepted by the decoder and the output subtype depends on the format of the decoded, or uncompressed, data. In Windows Embedded Compact 7, the GUIDs for the major types and common subtypes can be found in %_WINCEROOT%\Public\Directx\SDK\Inc\uuids.h.

[HKEY_CLASSES_ROOT\Filter\<DecoderGUID>]
@="<DecoderName>"

[HKEY_CLASSES_ROOT\CLSID\<DecoderGUID>]
@="<DecoderName>"
"Merit"=dword:00600000

[HKEY_CLASSES_ROOT\CLSID\<Decoder GUID>\InprocServer32]
@="<DecoderBinary.dll>"
"ThreadingModel"="Both"

[HKEY_CLASSES_ROOT\CLSID\<Decoder GUID>\Pins\Input]
"Direction"=dword:00000000
"IsRendered"=dword:00000000
"AllowedZero"=dword:00000000
"AllowedMany"=dword:00000000
"ConnectsToPin"="Output"

[HKEY_CLASSES_ROOT\CLSID\<DecoderGUID>\Pins\Input\Types\<MajorType>\<Subtype1>]
[HKEY_CLASSES_ROOT\CLSID\<DecoderGUID>\Pins\Input\Types\<MajorType>\<Subtype2>]
…

[HKEY_CLASSES_ROOT\CLSID\<DecoderGUID>\Pins\Output]
"Direction"=dword:00000001
"IsRendered"=dword:00000000
"AllowedZero"=dword:00000000
"AllowedMany"=dword:00000000
"ConnectsToPin"="Input"

[HKEY_CLASSES_ROOT\CLSID\<DecoderGUID>\Pins\Output\Types\<MajorType>\<Subtype1>]
[HKEY_CLASSES_ROOT\CLSID\<DecoderGUID>\Pins\Output\Types\<MajorType>\<Subtype2>]
…

DirectShow Codecs Supported by Windows Embedded Compact 7

The following table of DirectShow codecs summarizes the encoding formats supported by Windows Embedded Compact 7 for each container format.

Container format File extension Supported video coding Supported audio coding Buffering Stream Filter support

MPEG-1

.mpg, .mpa, .mp2, .mp3

MPEG-1

MPEG-1 Layers 1, 2, and 3 (MP3)

Yes

MPEG-2 Program Stream

.mpg, .mpeg, .m2p

MPEG-2

AC-3, LPCM, MPEG-2 Layers 1 and 2

Yes

MPEG-2 Transport Stream

.mpg, .mpeg, .m2t, .ts, .tts

MPEG-2, MPEG-4

AAC, AC-3, MPEG-2 Layers 1 and 2

Yes

MPEG-4

.mp4, .m4a, .m4v, .mp4v

MPEG-4 Part 2, H.264

AAC, AC-3

Yes

ASF

.asf, .wma, .wmv

Any video coding found within the container

Any audio coding found within the container

No

See Also

Concepts

DirectShow Decoder Filter for Windows Embedded Compact