COutputQueue Constructor : Determines if a thread is to be created and creates resources pInputPin - the downstream input pin we're queueing samples to phr - changed to a failure code if this function fails (otherwise unchanges) bAuto - Ask pInputPin if it can block in Receive by calling its ReceiveCanBlock method and create a thread if it can block, otherwise not. bQueue - i
| 39 | // dwPriority - If we create a thread set its priority to this |
| 40 | // |
| 41 | COutputQueue::COutputQueue(IPin *pInputPin, // Pin to send stuff to |
| 42 | __inout HRESULT *phr, // 'Return code' |
| 43 | BOOL bAuto, // Ask pin if queue or not |
| 44 | BOOL bQueue, // Send through queue |
| 45 | LONG lBatchSize, // Batch |
| 46 | BOOL bBatchExact, // Batch exactly to BatchSize |
| 47 | LONG lListSize, DWORD dwPriority, |
| 48 | bool bFlushingOpt // flushing optimization |
| 49 | ) |
| 50 | : m_lBatchSize(lBatchSize) |
| 51 | , m_bBatchExact(bBatchExact && (lBatchSize > 1)) |
| 52 | , m_hThread(NULL) |
| 53 | , m_hSem(NULL) |
| 54 | , m_List(NULL) |
| 55 | , m_pPin(pInputPin) |
| 56 | , m_ppSamples(NULL) |
| 57 | , m_lWaiting(0) |
| 58 | , m_evFlushComplete(FALSE, phr) |
| 59 | , m_pInputPin(NULL) |
| 60 | , m_bSendAnyway(FALSE) |
| 61 | , m_nBatched(0) |
| 62 | , m_bFlushing(FALSE) |
| 63 | , m_bFlushed(TRUE) |
| 64 | , m_bFlushingOpt(bFlushingOpt) |
| 65 | , m_bTerminate(FALSE) |
| 66 | , m_hEventPop(NULL) |
| 67 | , m_hr(S_OK) |
| 68 | { |
| 69 | ASSERT(m_lBatchSize > 0); |
| 70 | |
| 71 | if (FAILED(*phr)) |
| 72 | { |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | // Check the input pin is OK and cache its IMemInputPin interface |
| 77 | |
| 78 | *phr = pInputPin->QueryInterface(IID_IMemInputPin, (void **)&m_pInputPin); |
| 79 | if (FAILED(*phr)) |
| 80 | { |
| 81 | return; |
| 82 | } |
| 83 | |
| 84 | // See if we should ask the downstream pin |
| 85 | |
| 86 | if (bAuto) |
| 87 | { |
| 88 | HRESULT hr = m_pInputPin->ReceiveCanBlock(); |
| 89 | if (SUCCEEDED(hr)) |
| 90 | { |
| 91 | bQueue = hr == S_OK; |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | // Create our sample batch |
| 96 | |
| 97 | m_ppSamples = new PMEDIASAMPLE[m_lBatchSize]; |
| 98 | if (m_ppSamples == NULL) |
nothing calls this directly
no test coverage detected