Share via


Discardable and Optional Streams (Windows Embedded CE 6.0)

1/6/2010

A DMO can designate some of its output streams as discardable or optional:

  • A discardable stream contains data that the application can discard, either completely or on occasional samples.
  • An optional stream is a secondary stream that not all applications will need or that contains additional information about a primary stream.

To query whether a stream is discardable or optional, call the IMediaObject::GetOutputStreamInfo method and check the pdwFlags parameter.

The DMO_OUTPUT_STREAMF_DISCARDABLE flag indicates the stream is discardable.

The DMO_OUTPUT_STREAMF_OPTIONAL flag indicates that the stream is optional.

In general, at least one stream should be nonoptional.

When you call the IMediaObject::ProcessOutput method, you can discard data from one or more streams by setting the DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER flag in the dwFlags parameter. For each stream that you want to discard, set the pBuffer member of the DMO_OUTPUT_DATA_BUFFER structure to NULL.

The following list shows the two ways the DMO attempts to discard the data from those streams:

  • If the stream is discardable or optional, the DMO is guaranteed to discard the data.
  • Otherwise, the DMO discards the data if possible. However, there is no guarantee that it can do so.

If a pBuffer member is NULL but you do not set the DMO_PROCESS_OUTPUT_DISCARD_WHEN_NO_BUFFER flag, the DMO does not discard the data, even if the stream is discardable or optional.

If pBuffer is NULL but no data was discarded, the DMO signals the DMO_OUTPUT_DATA_BUFFERF_INCOMPLETE flag to indicate that the stream still has data.

If you do not process an output stream, but do not discard it, the DMO might be unable to generate data for other output streams.

If you never use an optional stream, you do not have to set its media type. The same is not true for discardable streams; you must always set the media type on a discardable stream. This is the only functional difference between optional and discardable streams.

See Also

Concepts

Using DirectX Media Objects