Microsoft DirectX 9.0

COutputQueue Class

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.

Requirements

Header: Declared in Outputq.h; include Streams.h.

Library: Use Strmbase.lib (retail builds) or Strmbasd.lib (debug builds).

Protected Member Variables  
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 signalled whenever the object removes a sample from the queue.
Protected Methods  
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  
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 signalled whenever the object removes a sample from the queue.