Microsoft DirectX 8.1 (C++)

Data Flow in a DMO

This section describes how data moves between the application and the DMO.

An application alternates between delivering input buffers and requesting output. It delivers input buffers by calling the IMediaObject::ProcessInput method on the DMO. It requests output by calling the IMediaObject::ProcessOutput method.

There are two ways to stop the flow of input data:

Streaming begins when the application first calls IMediaObject::ProcessInput on the DMO. A DMO will not begin streaming until the application sets media types for all the streams. (Optional streams are an exception; see Discardable and Optional Streams.) Streaming stops when the application flushes the DMO, or signals a discontinuity on every input stream and then processes all of the output. These actions return the DMO to a non-streaming state. The DMO retains all of its media type settings, but it releases all IMediaBuffer pointers. At that point, it cannot generate any more output until the application calls ProcessInput at least once.

The following list is a general outline of the steps needed to process data in a DMO:

  1. Query the DMO for the number of streams it supports and the preferred media types for each stream.
  2. Set media types for all the streams.
  3. Allocate input buffers and output buffers.
  4. Fill the input buffers with data and call ProcessInput.
  5. Call ProcessOutput and retrieve the output data. Repeat steps 4 and 5 until all of the input data is processed.
  6. Signal a discontinuity and process any remaining output.

You can interrupt steps 4 through 6 by flushing the data.

For details, see How to Process Data with a DMO.