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

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? asyncio.h

?? 陸其名老師directshow開發指南書中的相對應的源代碼
?? H
字號:
//------------------------------------------------------------------------------
// File: AsyncIo.h
//
// Desc: DirectShow sample code - base library for I/O functionality.
//
// Copyright (c) Microsoft Corporation.  All rights reserved.
//------------------------------------------------------------------------------


#ifndef __ASYNCIO_H__
#define __ASYNCIO_H__

//
// definition of CAsyncFile object that performs file access. It provides
// asynchronous, unbuffered, aligned reads from a file, using a worker thread
// on win95 and potentially overlapped i/o if available.

// !!! Need to use real overlapped i/o if available
// currently only uses worker thread, not overlapped i/o


class CAsyncIo;
class CAsyncStream;

//
//  Model the stream we read from based on a file-like interface
//
class CAsyncStream
{
public:
    virtual ~CAsyncStream() {};
    virtual HRESULT SetPointer(LONGLONG llPos) = 0;
    virtual HRESULT Read(PBYTE pbBuffer,
                         DWORD dwBytesToRead,
                         BOOL bAlign,
                         LPDWORD pdwBytesRead) = 0;

    virtual LONGLONG Size(LONGLONG *pSizeAvailable = NULL) = 0;
    virtual DWORD Alignment() = 0;
    virtual void Lock() = 0;
    virtual void Unlock() = 0;
    //virtual void SetStopHandle(HANDLE hevStop) {}
};

// represents a single request and performs the i/o. Can be called on either
// worker thread or app thread, but must hold pcsFile across file accesses.
// (ie across SetFilePointer/ReadFile pairs)
class CAsyncRequest
{
    CAsyncIo     *m_pIo;
    CAsyncStream *m_pStream;
    LONGLONG      m_llPos;
    BOOL          m_bAligned;
    LONG    m_lLength;
    BYTE*   m_pBuffer;
    LPVOID  m_pContext;
    DWORD   m_dwUser;
    HRESULT m_hr;

public:
    // init the params for this request. Issue the i/o
    // if overlapped i/o is possible.
    HRESULT Request(
        CAsyncIo *pIo,
        CAsyncStream *pStream,
        LONGLONG llPos,
        LONG lLength,
        BOOL bAligned,
        BYTE* pBuffer,
        LPVOID pContext,    // filter's context
        DWORD dwUser);      // downstream filter's context

    // issue the i/o if not overlapped, and block until i/o complete.
    // returns error code of file i/o
    HRESULT Complete();

    // cancels the i/o. blocks until i/o is no longer pending
    HRESULT Cancel()
    {
        return S_OK;
    };

    // accessor functions
    LPVOID GetContext()
    {
        return m_pContext;
    };

    DWORD GetUser()
    {
        return m_dwUser;
    };

    HRESULT GetHResult() {
        return m_hr;
    };

    // we set m_lLength to the actual length
    LONG GetActualLength() {
        return m_lLength;
    };

    LONGLONG GetStart() {
        return m_llPos;
    };
};


typedef CGenericList<CAsyncRequest> CRequestList;

// this class needs a worker thread, but the ones defined in classes\base
// are not suitable (they assume you have one message sent or posted per
// request, whereas here for efficiency we want just to set an event when
// there is work on the queue).
//
// we create CAsyncRequest objects and queue them on m_listWork. The worker
// thread pulls them off, completes them and puts them on m_listDone.
// The events m_evWork and m_evDone are set when the corresponding lists are
// not empty.
//
// Synchronous requests are done on the caller thread. These should be
// synchronised by the caller, but to make sure we hold m_csFile across
// the SetFilePointer/ReadFile code.
//
// Flush by calling BeginFlush. This rejects all further requests (by
// setting m_bFlushing within m_csLists), cancels all requests and moves them
// to the done list, and sets m_evDone to ensure that no WaitForNext operations
// will block. Call EndFlush to cancel this state.
//
// we support unaligned calls to SyncRead. This is done by opening the file
// twice if we are using unbuffered i/o (m_dwAlign > 1).
// !!!fix this to buffer on top of existing file handle?
class CAsyncIo
{

    CCritSec m_csReader;
    CAsyncStream *m_pStream;

    CCritSec m_csLists;      // locks access to the list and events
    BOOL m_bFlushing;        // true if between BeginFlush/EndFlush

    CRequestList m_listWork;
    CRequestList m_listDone;

    CAMEvent m_evWork;      // set when list is not empty
    CAMEvent m_evDone;

    // for correct flush behaviour: all protected by m_csLists
    LONG    m_cItemsOut;    // nr of items not on listDone or listWork
    BOOL    m_bWaiting;     // TRUE if someone waiting for m_evAllDone
    CAMEvent m_evAllDone;   // signal when m_cItemsOut goes to 0 if m_cWaiting


    CAMEvent m_evStop;         // set when thread should exit
    HANDLE m_hThread;

    LONGLONG Size() {
        ASSERT(m_pStream != NULL);
        return m_pStream->Size();
    };

    // start the thread
    HRESULT StartThread(void);

    // stop the thread and close the handle
    HRESULT CloseThread(void);

    // manage the list of requests. hold m_csLists and ensure
    // that the (manual reset) event hevList is set when things on
    // the list but reset when the list is empty.
    // returns null if list empty
    CAsyncRequest* GetWorkItem();

    // get an item from the done list
    CAsyncRequest* GetDoneItem();

    // put an item on the work list
    HRESULT PutWorkItem(CAsyncRequest* pRequest);

    // put an item on the done list
    HRESULT PutDoneItem(CAsyncRequest* pRequest);

    // called on thread to process any active requests
    void ProcessRequests(void);

    // initial static thread proc calls ThreadProc with DWORD
    // param as this
    static DWORD WINAPI InitialThreadProc(LPVOID pv) {
        CAsyncIo * pThis = (CAsyncIo*) pv;
        return pThis->ThreadProc();
    };

    DWORD ThreadProc(void);

public:

    CAsyncIo(CAsyncStream *pStream);
    ~CAsyncIo();

    // open the file
    HRESULT Open(LPCTSTR pName);

    // ready for async activity - call this before
    // calling Request
    HRESULT AsyncActive(void);

    // call this when no more async activity will happen before
    // the next AsyncActive call
    HRESULT AsyncInactive(void);

    // queue a requested read. must be aligned.
    HRESULT Request(
            LONGLONG llPos,
            LONG lLength,
            BOOL bAligned,
            BYTE* pBuffer,
            LPVOID pContext,
            DWORD dwUser);

    // wait for the next read to complete
    HRESULT WaitForNext(
            DWORD dwTimeout,
            LPVOID *ppContext,
            DWORD * pdwUser,
            LONG * pcbActual);

    // perform a read of an already aligned buffer
    HRESULT SyncReadAligned(
            LONGLONG llPos,
            LONG lLength,
            BYTE* pBuffer,
            LONG* pcbActual,
            PVOID pvContext);

    // perform a synchronous read. will be buffered
    // if not aligned.
    HRESULT SyncRead(
            LONGLONG llPos,
            LONG lLength,
            BYTE* pBuffer);

    // return length
    HRESULT Length(LONGLONG *pllTotal, LONGLONG* pllAvailable);

    // all Reader positions, read lengths and memory locations must
    // be aligned to this.
    HRESULT Alignment(LONG* pl);

    HRESULT BeginFlush();
    HRESULT EndFlush();

    LONG Alignment()
    {
        return m_pStream->Alignment();
    };

    BOOL IsAligned(LONG l) {
    if ((l & (Alignment() -1)) == 0) {
        return TRUE;
    } else {
        return FALSE;
    }
    };

    BOOL IsAligned(LONGLONG ll) {
        return IsAligned( (LONG) (ll & 0xffffffff));
    };

    //  Accessor
    HANDLE StopEvent() const { return m_evDone; }
};

#endif // __ASYNCIO_H__

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一本到高清视频免费精品| 久久女同精品一区二区| 欧美日韩小视频| 日韩一本二本av| 精品美女一区二区三区| 不卡av在线免费观看| 麻豆精品一区二区av白丝在线| 欧美在线小视频| 日本伦理一区二区| 欧美探花视频资源| 在线综合+亚洲+欧美中文字幕| 91精品国产福利在线观看| 欧美一区二区日韩一区二区| 欧美videos中文字幕| 久久久青草青青国产亚洲免观| 久久综合给合久久狠狠狠97色69| 久久久另类综合| 欧美高清在线一区| 亚洲另类春色校园小说| 亚洲午夜激情网页| 麻豆91免费观看| 成人18精品视频| 欧美日韩精品欧美日韩精品一| 国产精品第13页| 久久综合色之久久综合| 国产精品三级在线观看| 夜色激情一区二区| 久热成人在线视频| caoporen国产精品视频| 欧美日韩日本视频| 久久久噜噜噜久久人人看| 一区二区三区四区国产精品| 日本中文字幕一区| a级精品国产片在线观看| 欧美亚一区二区| 精品国产91洋老外米糕| 亚洲欧美日韩久久| 久久av资源网| 91麻豆精东视频| 日韩一区二区三区电影在线观看| 欧美激情中文不卡| 午夜精品成人在线| 99国产欧美另类久久久精品 | 亚洲欧美激情插 | 久久久www成人免费毛片麻豆| 最新成人av在线| 精品一区二区免费| 欧美性色aⅴ视频一区日韩精品| 精品国产伦一区二区三区观看体验| 亚洲欧洲成人自拍| 久久不见久久见中文字幕免费| 色婷婷av一区二区三区大白胸 | 丁香婷婷综合色啪| 欧美日韩国产另类一区| 国产精品九色蝌蚪自拍| 国模套图日韩精品一区二区 | 蜜臀a∨国产成人精品| 欧美伊人久久久久久久久影院| 国产午夜精品一区二区三区视频| 首页亚洲欧美制服丝腿| 日本高清不卡aⅴ免费网站| 国产免费久久精品| 国产一区二区三区在线观看精品| 777xxx欧美| 亚洲成a人片在线观看中文| 欧美中文字幕久久| 亚洲精品视频免费看| 99久精品国产| 国产精品福利影院| 99re在线视频这里只有精品| 国产欧美中文在线| 国产91清纯白嫩初高中在线观看 | 欧美国产一区视频在线观看| 狠狠色丁香婷婷综合| 日韩欧美www| 精品一区二区三区在线播放视频| 日韩一区二区三区视频在线 | 精品国产伦理网| 麻豆精品一区二区三区| 欧美va亚洲va香蕉在线| 激情图片小说一区| 久久久久久久综合色一本| 国产麻豆精品久久一二三| 久久伊99综合婷婷久久伊| 国产专区欧美精品| 国产日韩av一区二区| 丁香亚洲综合激情啪啪综合| 日本一区二区三区在线观看| eeuss鲁片一区二区三区在线看 | 色美美综合视频| 一区二区三区精品视频| 欧美日韩一区二区在线视频| 日韩不卡一区二区| 久久精品一区二区三区不卡| 波多野结衣视频一区| 亚洲国产精品天堂| 精品免费视频.| 99久久久久免费精品国产| 一区二区在线看| 宅男噜噜噜66一区二区66| 国产一区美女在线| 自拍偷拍国产精品| 日韩一区二区中文字幕| 成人高清免费观看| 亚洲第一主播视频| 国产三级精品视频| 欧美日韩亚洲不卡| 成人免费视频视频| 午夜免费欧美电影| 久久美女艺术照精彩视频福利播放| 国产成人亚洲精品青草天美| 一区2区3区在线看| 久久久亚洲国产美女国产盗摄| 色先锋aa成人| 国产在线视频不卡二| 亚洲三级免费观看| 2020国产成人综合网| 在线视频国产一区| 国产激情视频一区二区在线观看| 亚洲欧美韩国综合色| 久久免费看少妇高潮| 欧美日韩成人综合在线一区二区| 国产jizzjizz一区二区| 日本午夜一本久久久综合| 亚洲人吸女人奶水| 久久蜜桃av一区精品变态类天堂| 精品视频在线视频| 99精品视频在线观看免费| 狠狠色丁香久久婷婷综| 视频一区免费在线观看| 亚洲人妖av一区二区| 久久综合九色综合欧美亚洲| 欧美男男青年gay1069videost| 91亚洲精品一区二区乱码| 国产乱理伦片在线观看夜一区| 午夜免费欧美电影| 亚洲午夜精品17c| 一区二区三区欧美日| 中文字幕人成不卡一区| 欧美激情综合五月色丁香 | caoporen国产精品视频| 国产成人精品亚洲777人妖| 日本vs亚洲vs韩国一区三区二区| 一区二区欧美在线观看| 中文字幕日本乱码精品影院| 国产精品麻豆99久久久久久| 国产欧美日韩视频在线观看| 久久综合久久综合亚洲| 日韩精品最新网址| 日韩一级成人av| 欧美一区二区不卡视频| 欧美一区二区国产| 日韩欧美一区二区不卡| 日韩片之四级片| 日韩一区二区精品葵司在线 | 成av人片一区二区| 成人短视频下载| 成人av午夜电影| 99re66热这里只有精品3直播 | 日韩电影在线免费观看| 男女男精品网站| 久久99国产乱子伦精品免费| 激情图区综合网| 高清shemale亚洲人妖| 99国产欧美另类久久久精品| 色噜噜狠狠色综合中国| 欧美久久久久久久久| 欧美一三区三区四区免费在线看| 欧美日韩久久久一区| 精品99一区二区| 国产精品人人做人人爽人人添| 亚洲少妇30p| 日本不卡视频在线观看| 国产另类ts人妖一区二区| 成人av在线影院| 欧美日韩一区二区三区不卡| 日韩欧美国产精品| 国产精品第四页| 午夜精品一区二区三区免费视频 | 夜夜精品浪潮av一区二区三区| 亚洲mv大片欧洲mv大片精品| 精品一区二区三区不卡| 成人av高清在线| 911精品国产一区二区在线| 日韩欧美国产系列| 亚洲日本在线看| 免费成人美女在线观看.| 成人福利视频网站| 日韩亚洲欧美综合| 自拍偷拍亚洲综合| 精品一区二区三区的国产在线播放| yourporn久久国产精品| 欧美一区二区啪啪| 亚洲欧美日韩国产另类专区 | 欧美激情中文字幕| 青青国产91久久久久久| 99re这里只有精品首页| 精品国产乱码久久久久久免费| 亚洲综合男人的天堂| 国产99久久久国产精品免费看|