亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? outputq.cpp

?? 用DirectX制作高級動畫-[Advanced.Animation.with.DirectX]
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
        if (S_OK == m_hr) {
            if (m_bBatchExact) {
                SendAnyway();
            }
            m_pPin->NewSegment(tStart, tStop, dRate);
        }
    } else {
        if (m_hr == S_OK) {
            //
            // we need to queue the new segment to appear in order in the
            // data, but we need to pass parameters to it. Rather than
            // take the hit of wrapping every single sample so we can tell
            // special ones apart, we queue special pointers to indicate
            // special packets, and we guarantee (by holding the
            // critical section) that the packet immediately following a
            // NEW_SEGMENT value is a NewSegmentPacket containing the
            // parameters.
            NewSegmentPacket * ppack = new NewSegmentPacket;
            if (ppack == NULL) {
                return;
            }
            ppack->tStart = tStart;
            ppack->tStop = tStop;
            ppack->dRate = dRate;

            CAutoLock lck(this);
            QueueSample(NEW_SEGMENT);
            QueueSample( (IMediaSample*) ppack);
            NotifyThread();
        }
    }
}


//
//  End of Stream is queued to output device
//
void COutputQueue::EOS()
{
    CAutoLock lck(this);
    if (!IsQueued()) {
        if (m_bBatchExact) {
            SendAnyway();
        }
        if (m_hr == S_OK) {
            DbgLog((LOG_TRACE, 2, TEXT("COutputQueue sending EndOfStream()")));
            m_bFlushed = FALSE;
            HRESULT hr = m_pPin->EndOfStream();
            if (FAILED(hr)) {
                DbgLog((LOG_ERROR, 2, TEXT("COutputQueue got code 0x%8.8X from EndOfStream()")));
            }
        }
    } else {
        if (m_hr == S_OK) {
            m_bFlushed = FALSE;
            QueueSample(EOS_PACKET);
            NotifyThread();
        }
    }
}

//
//  Flush all the samples in the queue
//
void COutputQueue::BeginFlush()
{
    if (IsQueued()) {
        {
            CAutoLock lck(this);

            // block receives -- we assume this is done by the
            // filter in which we are a component

            // discard all queued data

            m_bFlushing = TRUE;

            //  Make sure we discard all samples from now on

            if (m_hr == S_OK) {
                m_hr = S_FALSE;
            }

            // Optimize so we don't keep calling downstream all the time

            if (m_bFlushed && m_bFlushingOpt) {
                return;
            }

            // Make sure we really wait for the flush to complete
            m_evFlushComplete.Reset();

            NotifyThread();
        }

        // pass this downstream

        m_pPin->BeginFlush();
    } else {
        // pass downstream first to avoid deadlocks
        m_pPin->BeginFlush();
        CAutoLock lck(this);
        // discard all queued data

        m_bFlushing = TRUE;

        //  Make sure we discard all samples from now on

        if (m_hr == S_OK) {
            m_hr = S_FALSE;
        }
    }

}

//
// leave flush mode - pass this downstream
void COutputQueue::EndFlush()
{
    {
        CAutoLock lck(this);
        ASSERT(m_bFlushing);
        if (m_bFlushingOpt && m_bFlushed && IsQueued()) {
            m_bFlushing = FALSE;
            m_hr = S_OK;
            return;
        }
    }

    // sync with pushing thread -- done in BeginFlush
    // ensure no more data to go downstream -- done in BeginFlush
    //
    // Because we are synching here there is no need to hold the critical
    // section (in fact we'd deadlock if we did!)

    if (IsQueued()) {
        m_evFlushComplete.Wait();
    } else {
        FreeSamples();
    }

    //  Be daring - the caller has guaranteed no samples will arrive
    //  before EndFlush() returns

    m_bFlushing = FALSE;
    m_bFlushed  = TRUE;

    // call EndFlush on downstream pins

    m_pPin->EndFlush();

    m_hr = S_OK;
}

//  COutputQueue::QueueSample
//
//  private method to Send a sample to the output queue
//  The critical section MUST be held when this is called

void COutputQueue::QueueSample(IMediaSample *pSample)
{
    if (NULL == m_List->AddTail(pSample)) {
        if (!IsSpecialSample(pSample)) {
            pSample->Release();
        }
    }
}

//
//  COutputQueue::Receive()
//
//  Send a single sample by the multiple sample route
//  (NOTE - this could be optimized if necessary)
//
//  On return the sample will have been Release()'d
//

HRESULT COutputQueue::Receive(IMediaSample *pSample)
{
    LONG nProcessed;
    return ReceiveMultiple(&pSample, 1, &nProcessed);
}

//
//  COutputQueue::ReceiveMultiple()
//
//  Send a set of samples to the downstream pin
//
//      ppSamples           - array of samples
//      nSamples            - how many
//      nSamplesProcessed   - How many were processed
//
//  On return all samples will have been Release()'d
//

HRESULT COutputQueue::ReceiveMultiple (
    IMediaSample **ppSamples,
    long nSamples,
    long *nSamplesProcessed)
{
    CAutoLock lck(this);
    //  Either call directly or queue up the samples

    if (!IsQueued()) {

        //  If we already had a bad return code then just return

        if (S_OK != m_hr) {

            //  If we've never received anything since the last Flush()
            //  and the sticky return code is not S_OK we must be
            //  flushing
            //  ((!A || B) is equivalent to A implies B)
            ASSERT(!m_bFlushed || m_bFlushing);

            //  We're supposed to Release() them anyway!
            *nSamplesProcessed = 0;
            for (int i = 0; i < nSamples; i++) {
                DbgLog((LOG_TRACE, 3, TEXT("COutputQueue (direct) : Discarding %d samples code 0x%8.8X"),
                        nSamples, m_hr));
                ppSamples[i]->Release();
            }

            return m_hr;
        }
        //
        //  If we're flushing the sticky return code should be S_FALSE
        //
        ASSERT(!m_bFlushing);
        m_bFlushed = FALSE;

        ASSERT(m_nBatched < m_lBatchSize);
        ASSERT(m_nBatched == 0 || m_bBatchExact);

        //  Loop processing the samples in batches

        LONG iLost = 0;
        for (long iDone = 0;
             iDone < nSamples || (m_nBatched != 0 && m_bSendAnyway);
            ) {

//pragma message (REMIND("Implement threshold scheme"))
            ASSERT(m_nBatched < m_lBatchSize);
            if (iDone < nSamples) {
                m_ppSamples[m_nBatched++] = ppSamples[iDone++];
            }
            if (m_nBatched == m_lBatchSize ||
                nSamples == 0 && (m_bSendAnyway || !m_bBatchExact)) {
                LONG nDone;
                DbgLog((LOG_TRACE, 4, TEXT("Batching %d samples"),
                       m_nBatched));

                if (m_hr == S_OK) {
                    m_hr = m_pInputPin->ReceiveMultiple(m_ppSamples,
                                                        m_nBatched,
                                                        &nDone);
                } else {
                    nDone = 0;
                }
                iLost += m_nBatched - nDone;
                for (LONG i = 0; i < m_nBatched; i++) {
                    m_ppSamples[i]->Release();
                }
                m_nBatched = 0;
            }
        }
        *nSamplesProcessed = iDone - iLost;
        if (*nSamplesProcessed < 0) {
            *nSamplesProcessed = 0;
        }
        return m_hr;
    } else {
        /*  We're sending to our thread */

        if (m_hr != S_OK) {
            *nSamplesProcessed = 0;
            DbgLog((LOG_TRACE, 3, TEXT("COutputQueue (queued) : Discarding %d samples code 0x%8.8X"),
                    nSamples, m_hr));
            for (int i = 0; i < nSamples; i++) {
                ppSamples[i]->Release();
            }
            return m_hr;
        }
        m_bFlushed = FALSE;
        for (long i = 0; i < nSamples; i++) {
            QueueSample(ppSamples[i]);
        }
        *nSamplesProcessed = nSamples;
        if (!m_bBatchExact ||
            m_nBatched + m_List->GetCount() >= m_lBatchSize) {
            NotifyThread();
        }
        return S_OK;
    }
}

//  Get ready for new data - cancels sticky m_hr
void COutputQueue::Reset()
{
    if (!IsQueued()) {
        m_hr = S_OK;
    } else {
        CAutoLock lck(this);
        QueueSample(RESET_PACKET);
        NotifyThread();
        m_evFlushComplete.Wait();
    }
}

//  Remove and Release() all queued and Batched samples
void COutputQueue::FreeSamples()
{
    CAutoLock lck(this);
    if (IsQueued()) {
        while (TRUE) {
            IMediaSample *pSample = m_List->RemoveHead();
	    // inform derived class we took something off the queue
	    if (m_hEventPop) {
                //DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered  SET EVENT")));
	        SetEvent(m_hEventPop);
	    }

            if (pSample == NULL) {
                break;
            }
            if (!IsSpecialSample(pSample)) {
                pSample->Release();
            } else {
                if (pSample == NEW_SEGMENT) {
                    //  Free NEW_SEGMENT packet
                    NewSegmentPacket *ppacket =
                        (NewSegmentPacket *) m_List->RemoveHead();
		    // inform derived class we took something off the queue
		    if (m_hEventPop) {
                        //DbgLog((LOG_TRACE,3,TEXT("Queue: Delivered  SET EVENT")));
		        SetEvent(m_hEventPop);
		    }

                    ASSERT(ppacket != NULL);
                    delete ppacket;
                }
            }
        }
    }
    for (int i = 0; i < m_nBatched; i++) {
        m_ppSamples[i]->Release();
    }
    m_nBatched = 0;
}

//  Notify the thread if there is something to do
//
//  The critical section MUST be held when this is called
void COutputQueue::NotifyThread()
{
    //  Optimize - no need to signal if it's not waiting
    ASSERT(IsQueued());
    if (m_lWaiting) {
        ReleaseSemaphore(m_hSem, m_lWaiting, NULL);
        m_lWaiting = 0;
    }
}

//  See if there's any work to do
//  Returns
//      TRUE  if there is nothing on the queue and nothing in the batch
//            and all data has been sent
//      FALSE otherwise
//
BOOL COutputQueue::IsIdle()
{
    CAutoLock lck(this);

    //  We're idle if
    //      there is no thread (!IsQueued()) OR
    //      the thread is waiting for more work  (m_lWaiting != 0)
    //  AND
    //      there's nothing in the current batch (m_nBatched == 0)

    if (IsQueued() && m_lWaiting == 0 || m_nBatched != 0) {
        return FALSE;
    } else {

        //  If we're idle it shouldn't be possible for there
        //  to be anything on the work queue

        ASSERT(!IsQueued() || m_List->GetCount() == 0);
        return TRUE;
    }
}


void COutputQueue::SetPopEvent(HANDLE hEvent)
{
    m_hEventPop = hEvent;
}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
美国十次综合导航| 国产精品一级二级三级| 久久夜色精品一区| 91福利国产精品| 国产精一区二区三区| 午夜欧美在线一二页| 国产精品三级在线观看| 日韩视频一区在线观看| 欧美又粗又大又爽| 成人午夜免费视频| 国产一区二区视频在线| 日韩综合小视频| 亚洲黄色尤物视频| 国产精品少妇自拍| 国产婷婷色一区二区三区| 日韩欧美在线一区二区三区| 欧美亚洲免费在线一区| 96av麻豆蜜桃一区二区| 成人网男人的天堂| 国产麻豆一精品一av一免费| 免费成人美女在线观看| 午夜激情一区二区| 亚洲图片自拍偷拍| 亚洲一区二区三区在线播放| 亚洲天堂网中文字| 欧美国产日韩亚洲一区| 久久久青草青青国产亚洲免观| 欧美一三区三区四区免费在线看| 欧美这里有精品| 91久久一区二区| 色婷婷久久99综合精品jk白丝| 高清在线成人网| 国产东北露脸精品视频| 国产成人精品免费看| 国产精品91一区二区| 国产精品18久久久久久久网站| 韩国av一区二区| 国产一区二区三区四区五区入口| 精品一区二区国语对白| 极品销魂美女一区二区三区| 老司机午夜精品| 韩国一区二区三区| 国产一区高清在线| 国产91精品一区二区麻豆亚洲| 国产成人午夜精品影院观看视频 | 亚洲欧洲日韩一区二区三区| 国产亚洲精品福利| 国产精品第一页第二页第三页| 国产精品情趣视频| 亚洲欧美日韩久久精品| 欧美丰满少妇xxxbbb| 日韩片之四级片| 制服丝袜成人动漫| 欧美日韩精品一区二区三区| 欧美猛男超大videosgay| 欧美精品久久一区二区三区| 51精品秘密在线观看| 欧美成人乱码一区二区三区| 久久精品亚洲麻豆av一区二区| 日本一二三四高清不卡| 亚洲另类在线制服丝袜| 亚洲国产一区视频| 日本欧美大码aⅴ在线播放| 激情五月婷婷综合网| 成人污污视频在线观看| 91成人免费电影| 91精品国产品国语在线不卡| 久久久91精品国产一区二区精品| 欧美国产禁国产网站cc| 亚洲夂夂婷婷色拍ww47 | 欧美成人一区二区| 欧美日韩成人综合在线一区二区| 欧美吻胸吃奶大尺度电影 | 精品国产露脸精彩对白| 国产精品狼人久久影院观看方式| 亚洲激情男女视频| 麻豆精品新av中文字幕| 成人涩涩免费视频| 欧美年轻男男videosbes| 欧美zozo另类异族| 亚洲成av人片在www色猫咪| 青青国产91久久久久久| 国产成人av在线影院| 在线观看av不卡| 久久夜色精品一区| 亚洲小说欧美激情另类| 国产一区二区不卡老阿姨| 在线观看视频欧美| 2020国产精品自拍| 亚洲一区二区三区视频在线播放| 国产综合久久久久影院| 欧洲精品视频在线观看| 久久久久久久久久电影| 午夜日韩在线电影| av中文字幕一区| 欧美精品一区二区精品网| 一区二区三区欧美视频| 国产成人精品午夜视频免费| 欧美日韩黄视频| 成人免费一区二区三区视频| 麻豆成人久久精品二区三区小说| 色先锋aa成人| 欧美国产精品劲爆| 久久精品二区亚洲w码| 欧美日韩中文字幕精品| 国产精品国产三级国产| 黑人巨大精品欧美黑白配亚洲| 欧美三级三级三级| 亚洲手机成人高清视频| 国产成人午夜99999| 欧美一区在线视频| 亚洲成人免费av| 91丨porny丨蝌蚪视频| 国产欧美一区二区三区鸳鸯浴| 免费观看久久久4p| 欧美精品国产精品| 亚洲电影你懂得| 欧美中文字幕一二三区视频| 亚洲欧洲另类国产综合| 欧美精品在线一区二区三区| 国产精品久久久久aaaa樱花| 国产精品一区专区| 欧美大片在线观看一区| 日本成人在线一区| 555www色欧美视频| 亚洲成av人影院| 欧美精品精品一区| 日韩专区在线视频| 欧美一区二区三区视频在线| 亚洲成年人影院| 欧美精品丝袜久久久中文字幕| 亚洲电影欧美电影有声小说| 欧美亚洲图片小说| 亚洲成av人片一区二区梦乃| 欧美亚洲日本国产| 视频一区视频二区中文字幕| 欧美男同性恋视频网站| 日本午夜一区二区| 日韩精品一区二区三区swag | 欧美大片一区二区| 六月丁香婷婷久久| 精品久久久久久久久久久院品网| 久久精品免费看| 久久综合九色综合97婷婷| 精品无人区卡一卡二卡三乱码免费卡| 日韩欧美成人一区| 韩国精品主播一区二区在线观看| 337p粉嫩大胆色噜噜噜噜亚洲| 国产在线国偷精品产拍免费yy| 国产亚洲精品bt天堂精选| 波多野结衣亚洲| 亚洲精品乱码久久久久久久久| 在线观看视频一区二区欧美日韩| 亚洲成人一区在线| 欧美成人性战久久| 高清在线不卡av| 一区二区三区中文字幕在线观看| 欧美三级电影网| 麻豆精品在线视频| 免费在线观看不卡| 久久一区二区三区国产精品| gogo大胆日本视频一区| 亚洲精品免费在线| 欧美一区二区久久| 成人动漫视频在线| 亚洲综合男人的天堂| 日韩一区二区在线观看视频| 国产一二三精品| 一区二区三区美女视频| 欧美一区二区三区爱爱| 盗摄精品av一区二区三区| 亚洲一区二区五区| 精品免费99久久| 99久久99久久综合| 日本亚洲视频在线| 国产精品狼人久久影院观看方式| 欧美视频在线播放| 国产成人免费视频一区| 亚洲永久免费视频| 久久久久成人黄色影片| 欧美在线不卡一区| 精品亚洲porn| 一个色在线综合| 久久久久久久久99精品| 91久久免费观看| 国产酒店精品激情| 午夜电影久久久| 国产精品色婷婷| 欧美电影免费观看高清完整版| 9色porny自拍视频一区二区| 奇米色777欧美一区二区| 最好看的中文字幕久久| 欧美精品一区二区精品网| 在线看国产日韩| 岛国精品在线观看| 久久国产夜色精品鲁鲁99| 一区二区三区精品在线观看| 久久九九久精品国产免费直播| 欧美日韩另类一区| 99精品黄色片免费大全|