Microsoft DirectX 8.1 (C++) |
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's 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. The media type defines how to interpret the contents of the data. For example, 320 x 240 24-bit RGB video is one type; 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.
Examples:
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.