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

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

?? device.cpp

?? winddk src目錄下的WDM源碼壓縮!
?? CPP
?? 第 1 頁 / 共 2 頁
字號:
/**************************************************************************

    AVStream Simulated Hardware Sample

    Copyright (c) 2001, Microsoft Corporation.

    File:

        device.cpp

    Abstract:

        This file contains the device level implementation of the AVStream
        hardware sample.  Note that this is not the "fake" hardware.  The
        "fake" hardware is in hwsim.cpp.

    History:

        created 3/9/2001

**************************************************************************/

#include "BDACap.h"

/**************************************************************************

    PAGEABLE CODE

**************************************************************************/

#ifdef ALLOC_PRAGMA
#pragma code_seg("PAGE")
#endif // ALLOC_PRAGMA


NTSTATUS
CCaptureDevice::
DispatchCreate (
    IN PKSDEVICE Device
    )

/*++

Routine Description:

    Create the capture device.  This is the creation dispatch for the
    capture device.

Arguments:

    Device -
        The AVStream device being created.

Return Value:

    Success / Failure

--*/

{

    PAGED_CODE();

    NTSTATUS Status;

    CCaptureDevice *CapDevice = new (NonPagedPool, MS_SAMPLE_CAPTURE_POOL_TAG) CCaptureDevice (Device);

    if (!CapDevice) {
        //
        // Return failure if we couldn't create the pin.
        //
        Status = STATUS_INSUFFICIENT_RESOURCES;

    } else {

        //
        // Add the item to the object bag if we were successful.
        // Whenever the device goes away, the bag is cleaned up and
        // we will be freed.
        //
        // For backwards compatibility with DirectX 8.0, we must grab
        // the device mutex before doing this.  For Windows XP, this is
        // not required, but it is still safe.
        //
        KsAcquireDevice (Device);
        Status = KsAddItemToObjectBag (
            Device -> Bag,
            reinterpret_cast <PVOID> (CapDevice),
            reinterpret_cast <PFNKSFREE> (CCaptureDevice::Cleanup)
            );
        KsReleaseDevice (Device);

        if (!NT_SUCCESS (Status)) {
            delete CapDevice;
        } else {
            Device -> Context = reinterpret_cast <PVOID> (CapDevice);
        }

    }

    return Status;

}

/*************************************************/


NTSTATUS
CCaptureDevice::
PnpStart (
    IN PCM_RESOURCE_LIST TranslatedResourceList,
    IN PCM_RESOURCE_LIST UntranslatedResourceList
    )

/*++

Routine Description:

    Called at Pnp start.  We start up our virtual hardware simulation.

Arguments:

    TranslatedResourceList -
        The translated resource list from Pnp

    UntranslatedResourceList -
        The untranslated resource list from Pnp

Return Value:

    Success / Failure

--*/

{

    PAGED_CODE();

    //
    // Normally, we'd do things here like parsing the resource lists and
    // connecting our interrupt.  Since this is a simulation, there isn't
    // much to parse.  The parsing and connection should be the same as
    // any WDM driver.  The sections that will differ are illustrated below
    // in setting up a simulated DMA.
    //

    NTSTATUS Status = STATUS_SUCCESS;

    //
    // By PnP, it's possible to receive multiple starts without an intervening
    // stop (to reevaluate resources, for example).  Thus, we only perform
    // creations of the simulation on the initial start and ignore any 
    // subsequent start.  Hardware drivers with resources should evaluate
    // resources and make changes on 2nd start.
    //
    if (!m_Device -> Started) {

	m_HardwareSimulation = new (NonPagedPool, MS_SAMPLE_CAPTURE_POOL_TAG) CHardwareSimulation (this);
	if (!m_HardwareSimulation) {
	    //
            // If we couldn't create the hardware simulation, fail.
            //
            Status = STATUS_INSUFFICIENT_RESOURCES;
	    return Status;
	    
	} else {
	    //
	    // Add the item to the object bag if we were successful. 
	    //
	    
	    Status = KsAddItemToObjectBag (
		       m_Device -> Bag,
		       reinterpret_cast <PVOID> (m_HardwareSimulation),
		       reinterpret_cast <PFNKSFREE> (CCaptureDevice::CleanupHW)
		       );
	    if (!NT_SUCCESS(Status)) {
		delete m_HardwareSimulation;
		return Status;
	    }
	    
	}	
    
	INTERFACE_TYPE InterfaceBuffer;
	ULONG InterfaceLength;
	DEVICE_DESCRIPTION DeviceDescription;
	NTSTATUS IfStatus;
	
	if (NT_SUCCESS (Status)) {
	    //
	    // Set up DMA...
	    //
	    IfStatus = IoGetDeviceProperty (
                    m_Device -> PhysicalDeviceObject,
		    DevicePropertyLegacyBusType,
		    sizeof (INTERFACE_TYPE),
		    &InterfaceBuffer,
		    &InterfaceLength
		    );

            //
            // Initialize our fake device description.  We claim to be a 
            // bus-mastering 32-bit scatter/gather capable piece of hardware.
            //
            // Ordinarilly, we'd be using InterfaceBuffer or 
            // InterfaceTypeUndefined if !NT_SUCCESS (IfStatus) as the 
            // InterfaceType below; however, for the purposes of this sample, 
            // we lie and say we're on the PCI Bus.  Otherwise, we're using map
            // registers on x86 32 bit physical to 32 bit logical and this isn't
            // what I want to show in this sample.
            //
            DeviceDescription.Version = DEVICE_DESCRIPTION_VERSION;
            DeviceDescription.DmaChannel = ((ULONG) ~0);
            DeviceDescription.InterfaceType = PCIBus;
            DeviceDescription.DmaWidth = Width32Bits;
            DeviceDescription.DmaSpeed = Compatible;
            DeviceDescription.ScatterGather = TRUE;
            DeviceDescription.Master = TRUE;
            DeviceDescription.Dma32BitAddresses = TRUE;
            DeviceDescription.AutoInitialize = FALSE;
            DeviceDescription.MaximumLength = (ULONG) -1;
    
            //
            // Get a DMA adapter object from the system.
            //
            m_DmaAdapterObject = IoGetDmaAdapter (
                m_Device -> PhysicalDeviceObject,
                &DeviceDescription,
                &m_NumberOfMapRegisters
                );
    
            if (!m_DmaAdapterObject) {
                Status = STATUS_UNSUCCESSFUL;
            }
    
	}
	
	if (NT_SUCCESS (Status)) {
            //
            // Initialize our DMA adapter object with AVStream.  This is 
            // **ONLY** necessary **IF** you are doing DMA directly into
            // capture buffers as this sample does.  For this,
            // KSPIN_FLAG_GENERATE_MAPPINGS must be specified on a queue.
            //
    
            //
            // The (1 << 20) below is the maximum size of a single s/g mapping
            // that this hardware can handle.  Note that I have pulled this
            // number out of thin air for the "fake" hardware.
            //
            KsDeviceRegisterAdapterObject (
		m_Device,
                m_DmaAdapterObject,
                (1 << 20),
                sizeof (KSMAPPING)
                );
	    
        }
	
    }
    
    
    return Status;

}

/*************************************************/


void
CCaptureDevice::
PnpStop (
    )

/*++

Routine Description:

    This is the pnp stop dispatch for the capture device.  It releases any
    adapter object previously allocated by IoGetDmaAdapter during Pnp Start.

Arguments:

    None

Return Value:

    None

--*/

{

    if (m_DmaAdapterObject) {
        //
        // Return the DMA adapter back to the system.
        //
        m_DmaAdapterObject -> DmaOperations -> 
            PutDmaAdapter (m_DmaAdapterObject);

        m_DmaAdapterObject = NULL;
    }

}

/*************************************************/


NTSTATUS
CCaptureDevice::
AcquireHardwareResources (
    IN ICaptureSink *CaptureSink,
    IN PBDA_TRANSPORT_INFO TransportInfo
    )

/*++

Routine Description:

    Acquire hardware resources for the capture hardware.  If the 
    resources are already acquired, this will return an error.
    The hardware configuration must be passed as a VideoInfoHeader.

Arguments:

    CaptureSink -
        The capture sink attempting to acquire resources.  When scatter /
        gather mappings are completed, the capture sink specified here is
        what is notified of the completions.

    VideoInfoHeader -
        Information about the capture stream.  This **MUST** remain
        stable until the caller releases hardware resources.  Note
        that this could also be guaranteed by bagging it in the device
        object bag as well.

Return Value:

    Success / Failure

--*/

{

    PAGED_CODE();

    NTSTATUS Status = STATUS_SUCCESS;

    //
    // If we're the first pin to go into acquire (remember we can have
    // a filter in another graph going simultaneously), grab the resources.
    //
    if (InterlockedCompareExchange (
        &m_PinsWithResources,
        1,
        0) == 0) {

        m_TransportInfo = TransportInfo;

        //
        // If there's an old hardware simulation sitting around for some
        // reason, blow it away.
        //
        if (m_TsSynth) {

	    delete m_TsSynth;
	    m_TsSynth = NULL;

        }

        //
        // Create the necessary type of transport stream synthesizer.
        //
        if (m_TransportInfo)
        {
            m_TsSynth = new (NonPagedPool, MS_SAMPLE_CAPTURE_POOL_TAG) 
                CTsSynthesizer (
                    m_TransportInfo -> ulcbPhyiscalPacket,
                    m_TransportInfo -> ulcbPhyiscalFrame / m_TransportInfo -> ulcbPhyiscalPacket
                    );
        }
        else
            //
            // We don't synthesize anything but RGB 24 and UYVY.
            //
            Status = STATUS_INVALID_PARAMETER;
    
        if (NT_SUCCESS (Status) && !m_TsSynth) {
    
            Status = STATUS_INSUFFICIENT_RESOURCES;
    
        } 

	//
	// If everything has succeeded thus far, set the capture sink.
	//
	if (NT_SUCCESS(Status))
	    m_CaptureSink = CaptureSink;
	else {
	    ReleaseHardwareResources();
	}

    } else {
	
        //
        // TODO: Better status code?
        //
        Status = STATUS_SHARING_VIOLATION;
	
    }
    
    return Status;

}

/*************************************************/


void
CCaptureDevice::
ReleaseHardwareResources (
    )

/*++

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
91精品蜜臀在线一区尤物| 香港成人在线视频| 99re热视频精品| 亚洲乱码国产乱码精品精小说 | 午夜国产精品影院在线观看| 色香蕉久久蜜桃| 亚洲国产cao| 欧美日韩不卡视频| 美女视频免费一区| 精品国产一区二区在线观看| 精品一区二区三区香蕉蜜桃| 欧美电影精品一区二区 | 亚洲高清在线精品| 91精品蜜臀在线一区尤物| 国内外成人在线视频| 国产精品色一区二区三区| 成人中文字幕在线| 亚洲欧美色综合| 91精品麻豆日日躁夜夜躁| 国产美女视频91| 一区二区三区视频在线观看| 欧美久久久久久久久| 国产精品影视网| 亚洲免费在线看| 日韩午夜精品视频| 大尺度一区二区| 午夜欧美电影在线观看| 精品盗摄一区二区三区| eeuss鲁片一区二区三区在线看| 一片黄亚洲嫩模| 欧美大胆人体bbbb| 91国偷自产一区二区三区成为亚洲经典 | 成人综合在线观看| 午夜精品成人在线| 日本一区二区三区在线不卡| 欧美在线制服丝袜| 国产经典欧美精品| 蜜臀精品一区二区三区在线观看| 国产精品情趣视频| 欧美一区二区三区公司| 99国产欧美久久久精品| 久久99国产精品麻豆| 一区二区三区小说| 国产调教视频一区| 欧美一区二区黄| 92国产精品观看| 极品瑜伽女神91| 香蕉久久夜色精品国产使用方法| 欧美极品少妇xxxxⅹ高跟鞋| 这里是久久伊人| 91欧美激情一区二区三区成人| 久久99精品久久久久久动态图 | 国产精品综合一区二区| 偷偷要91色婷婷| 伊人一区二区三区| 自拍偷自拍亚洲精品播放| 精品国产乱码久久久久久牛牛 | 欧洲一区二区三区在线| 国产精品自在在线| 喷水一区二区三区| 亚洲一区二区三区四区五区黄| 欧美国产97人人爽人人喊| 日韩精品一区二区三区四区视频| 在线观看av一区二区| 99视频精品在线| 成人免费看黄yyy456| 国产二区国产一区在线观看| 三级影片在线观看欧美日韩一区二区| 中文字幕亚洲一区二区av在线| 久久品道一品道久久精品| 91精品国产免费| 欧美一区二区三区在线看| 欧美日韩一区高清| 欧美伦理影视网| 欧美日韩国产大片| 欧美日韩欧美一区二区| 日韩一级黄色片| 日韩免费视频一区二区| 6080yy午夜一二三区久久| 欧美日韩综合一区| 欧美另类变人与禽xxxxx| 欧美日本不卡视频| 4438x成人网最大色成网站| 日韩写真欧美这视频| 精品国产伦一区二区三区观看体验| 日韩限制级电影在线观看| 欧美成人三级在线| 26uuu亚洲综合色欧美| 久久影院视频免费| 国产精品久久午夜| 亚洲色图自拍偷拍美腿丝袜制服诱惑麻豆| 中文字幕乱码久久午夜不卡| 欧美国产精品中文字幕| 国产精品久久久久影视| 亚洲精品菠萝久久久久久久| 亚洲成人动漫在线观看| 久久精品噜噜噜成人88aⅴ | 成人国产在线观看| 色8久久精品久久久久久蜜| 欧美色大人视频| 日韩你懂的在线观看| 国产丝袜在线精品| 一区二区三区在线影院| 日本成人在线网站| 国产精品自产自拍| 日本乱码高清不卡字幕| 在线成人高清不卡| 欧美激情一区二区在线| 亚洲综合色噜噜狠狠| 六月丁香综合在线视频| 99国内精品久久| 日韩欧美一级片| 国产精品久久久久7777按摩| 亚洲一区二区三区自拍| 久久99精品久久久久婷婷| 91色综合久久久久婷婷| 91麻豆精品国产自产在线| 久久精品欧美日韩精品| 亚洲在线中文字幕| 国产精品一区二区在线播放| 91国偷自产一区二区开放时间| 日韩一级大片在线观看| 亚洲美女少妇撒尿| 国产伦精品一区二区三区免费 | 男女男精品视频网| 91网页版在线| 欧美一区二区三区不卡| 亚洲色图制服诱惑| 国产一区久久久| 欧美挠脚心视频网站| 国产精品免费视频一区| 奇米777欧美一区二区| 色噜噜狠狠成人中文综合 | 国产成人无遮挡在线视频| 欧美亚洲综合另类| 国产精品久久一级| 韩国一区二区三区| 欧美精品色一区二区三区| 亚洲欧洲日韩女同| 国产精品996| 日韩三级伦理片妻子的秘密按摩| 亚洲免费观看在线视频| 国产精品自拍三区| 精品国偷自产国产一区| 亚洲成人一区在线| 色综合激情五月| 国产精品乱码人人做人人爱| 久久国产精品无码网站| 欧美久久久一区| 亚洲电影第三页| 在线精品视频免费观看| 1000精品久久久久久久久| 国产激情视频一区二区三区欧美| 欧美一级日韩不卡播放免费| 亚洲图片自拍偷拍| 欧美亚洲免费在线一区| 一区二区三区中文字幕精品精品 | 中文字幕一区av| 国产成人av电影免费在线观看| 欧美v亚洲v综合ⅴ国产v| 日韩电影在线免费观看| 欧美色综合影院| 亚洲午夜日本在线观看| 日本乱人伦一区| 亚洲综合免费观看高清在线观看| 一本到不卡精品视频在线观看| 国产精品国产a| 91视频精品在这里| 亚洲婷婷在线视频| 色视频一区二区| 亚洲黄色av一区| 欧美日韩在线播放三区| 亚洲国产aⅴ成人精品无吗| 欧美日韩精品一区二区三区蜜桃| 亚洲成av人在线观看| 欧美日本精品一区二区三区| 日韩在线一区二区三区| 制服丝袜中文字幕亚洲| 久久精品二区亚洲w码| 精品久久久网站| 国产91对白在线观看九色| 国产精品日产欧美久久久久| 99九九99九九九视频精品| 亚洲日本在线视频观看| 91网站在线观看视频| 亚洲成人av一区| 精品人在线二区三区| 成人激情免费网站| 一区二区三区中文字幕在线观看| 欧美乱妇15p| 国产一区中文字幕| 亚洲美女屁股眼交| 911精品产国品一二三产区| 国内精品视频666| 中文字幕中文字幕一区二区| 色偷偷久久一区二区三区| 日韩中文字幕亚洲一区二区va在线 | 成人夜色视频网站在线观看| 亚洲视频在线一区| 色吧成人激情小说|