Rediger

Del via


COutputQueue class

[The feature associated with this page, DirectShow, is a legacy feature. It has been superseded by MediaPlayer, IMFMediaEngine, and Audio/Video Capture in Media Foundation. Those features have been optimized for Windows 10 and Windows 11. Microsoft strongly recommends that new code use MediaPlayer, IMFMediaEngine and Audio/Video Capture in Media Foundation instead of DirectShow, when possible. Microsoft suggests that existing code that uses the legacy APIs be rewritten to use the new APIs if possible.]

coutputqueue

The COutputQueue class implements a queue to deliver media samples.

This class enables an output pin to deliver samples asynchronously. Samples are placed on a queue, and a worker thread delivers them to the input pin. The queue can also hold control messages that indicate a new segment, an end-of-stream notification, or a flush operation.

To use this class, create a COutputQueue object for every output pin on the filter. In the constructor method, specify the input pin connected to that output pin. Using this class, the output pin does not call methods directly on the input pin. Instead, it calls corresponding methods in COutputQueue, as shown in the following table.

Pin Method COutputQueue Method
IPin::BeginFlush BeginFlush
IPin::EndFlush EndFlush
IPin::EndOfStream EOS
IPin::NewSegment NewSegment
IMemInputPin::Receive Receive
IMemInputPin::ReceiveMultiple ReceiveMultiple

Optionally, you can configure the COutputQueue object to deliver samples synchronously, without a worker thread. The object can also decide at run time whether to use a worker thread, based on the characteristics of the input pin. For more information, see COutputQueue::COutputQueue.

Protected Member Variables Description
m_pPin Pointer to the input pin's IPin interface.
m_pInputPin Pointer to the input pin's IMemInputPin interface.
m_bBatchExact Flag that specifies whether the object delivers samples in exact batches.
m_lBatchSize Batch size.
m_List Media sample queue.
m_hSem Handle to a semaphore, used by the thread to wait for samples.
m_evFlushComplete Event that signals when a flush operation has finished.
m_hThread Handle to the worker thread.
m_ppSamples Array of samples of size COutputQueue::m_lBatchSize.
m_nBatched Number of samples currently batched and awaiting processing.
m_lWaiting Flag that has a nonzero value when the thread is waiting for a sample.
m_bFlushing Flag that specifies whether the object is performing a flush operation.
m_bTerminate Flag that specifies whether the thread should terminate.
m_bSendAnyway Flag to override batch processing.
m_hr HRESULT value that indicates whether the object will accept samples.
m_hEventPop Event that is signaled whenever the object removes a sample from the queue.
Protected Methods Description
InitialThreadProc Calls the COutputQueue::ThreadProc method when the thread is created.
ThreadProc Retrieves samples from the queue and delivers them to the input pin.
IsQueued Determines whether the object is using a worker thread to deliver samples.
QueueSample Queues a media sample or control message.
IsSpecialSample Determines whether queued data is a control message.
FreeSamples Frees all pending samples.
NotifyThread Notifies the thread that the queue contains data.
Public Methods Description
COutputQueue Constructor method.
~COutputQueue Destructor method.
BeginFlush Begins a flush operation.
EndFlush Ends a flush operation.
EOS Delivers an end-of-stream call to the input pin.
SendAnyway Delivers any pending samples.
NewSegment Delivers a new segment to the input pin.
Receive Delivers a media sample to the input pin.
ReceiveMultiple Delivers a batch of media samples to the input pin.
Reset Resets the object so that it can receive more data.
IsIdle Determines whether the object is waiting for data.
SetPopEvent Specifies an event that is signaled whenever the object removes a sample from the queue.

Requirements

Requirement Value
Header
Outputq.h (include Streams.h)
Library
Strmbase.lib (retail builds);
Strmbasd.lib (debug builds)