Partager via


Data Flow

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This topic 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.

The following list shows the two ways to stop the flow of input data:

  • Discontinuity. When the application reaches the end of the input data, or there is a break in the data, the application signals a discontinuity. A discontinuity informs the DMO that no further input is expected. At that point, the DMO might still have data to process, so the application should request output until the DMO signals there is none left.
  • Flushing. The application can interrupt the data flow by flushing the DMO. If the DMO was buffering data internally, it releases that 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 nonstreaming state. The DMO retains all of its media type settings, but it releases all IMediaBuffer pointers. At that point, it cannot generate output until the application calls ProcessInput at least once.

To stream data

  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.

    Note

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

See Also

Concepts

Using DirectX Media Objects