Streams and Buffers

Conceptually a DMO is an object that takes m inputs and produces n outputs. The inputs and outputs are called streams. Every DMO has at least one stream. It is possible for a DMO to have no input streams or no output streams, but a typical DMO has both inputs and outputs.

Note   Unlike pins in DirectShow, streams are not distinct COM objects. They are referenced on the DMO object itself, using a zero-based index.

A DMO receives data through its input streams. It processes the data and produces output through its output streams. All data is typed using a media type, which defines how to interpret the contents of the data. For example, 320 x 240 24-bit RGB video is one type and 44.1-kilohertz (kHz) 16-bit stereo PCM audio is another type. Media types are described using the DMO_MEDIA_TYPE structure.

Each stream on a DMO can accept a certain range of media types. Depending on the DMO, it might accept a wide range of types (video at any bit depth) or a narrow range (only 16-bit video). Also, a DMO might be limited to certain combinations of inputs and outputs. For example, if an input stream is set to 16-bit video, an output stream might require the same bit depth. The application can enumerate each stream's preferred types and then test specific combinations.

The following list shows two situations in which the DMO is limitied to certain combinations of inputs and outputs:

  • A DMO that creates AVI data might have two input streams, one for video and one for audio. It would produce one output stream for the interleaved audio-video data.
  • A DMO that posterizes RGB images might have 24-bit RGB video input and 8-bit RGB video output.

The application delivers input data grouped in blocks of memory. Each block of memory is encapsulated by a COM object called a buffer that supports the IMediaBuffer interface. This interface contains methods for setting the length of the data in the buffer, retrieving a pointer to the data, and retrieving the allocated size of the buffer. The application is responsible for allocating all buffers used by the DMO, both input and output.

See Also

Using DirectX Media Objects

Last updated on Wednesday, April 13, 2005

© 2005 Microsoft Corporation. All rights reserved.