• 第二十一篇:基​于​W​D​M​模​型​的​A​V​S​t​r​e​a​m​驱​动​架​构​研​究


    基​于​W​D​M​模​型​的​A​V​S​t​r​e​a​m​驱​动​架​构​研​

    这篇论文2006年早就发表, 与当时开发这个驱动正好几乎相同的时间.


    近期实际项目须要, 又回过头来将AVStream中的主要框架列举一下.


    整个框架由:

    KSDevice

    KSFilter

    KSPin所构成


    KSDevice负责了PNP相关的DISPATCH, 如START, STOP, ADD, REMOVE

    KSFilter构成软件AVSTREAM设备的DISPATCH, 这就是所谓的FILTER CENTRIC

    而KSPin构成实际硬件AVSTREAM设备的DISPATCH, 这就是所谓的PIN CENTRIC

    不管哪一种, 都是在这些FILTER/PIN DISPATCH中处理对应的数据流


    而每一个FILTER都有相应的属性,事件与方法

    这就由AUTOMATION TABLE来构建

    AUTOMATION TABLE一级级往下各自是: Property Sets/Set/Item, Method Set/Set/Item, Event Set/Set/Item.


    举个曾经讲过的样例,USB VIDEO CLASS驱动, 它就是一个典型的AVSTREAM架构的AVSTREAM miniport驱动.

    相对一个PCTV ATV AVSTREAM miniport驱动须要实现, TUNER, CROSS BAR, CAPTURE, AUDIO这四个FILTER(对应的AUTOMATION TABLE)及其对应的PIN(CAPTURE PIN, PREVIEW PIN, AUDIO OUT PIN), 

    USB Video相对来讲, 则更加简单一些, 由于, 往往,它仅仅有一个FILTER(以及FILTER上的PROPERTY), 须要实际实现的则是一个CAPTURE PIN(依据 USB DEVICE DESCRIPTOR中的 IT/OUT TERMINALS的描写叙述符来建立对应的PIN 实例)

    比如:

    这个WDM STREAMING CAPTURE DEVICE FILTER, 在它的PIN上实现了视频数据流的管理, 

    以及FILTER PROPERTY中对于

    VIDEO的属性如, BRIGHTNESS, CONTRAST, HUE, SATURATION, SHARPNESS, GAMMA, WHITE BALANCE BACKLIGHT COMP

    CAMERA的属性控制,如ZOOM, FOCUS, EXPOSURE, PAN, APERURE, PAN, TILT, ROLL, LOW LIGHT COMPENSATION.


    而这个USB VIDEO CLASS 驱动的难度, 不只在于KSDEVICE, KSFILTER, KSPIN以及DISPATCH, AUTOMATION TABLE的建立

    而是依据USB VIDEO DEVICE的DESCRIPTOR中描写叙述的TOPOLOGY动态地建立一张由KSFILTER/KSPIN构成的KS GRAPH, 同一时候, 在这些KSFILTER/KSPIN中实现对应的属性,事件,方法及它们的DISPATCH.

    同一时候, 须要完毕PIN与PIN之间, DATA RANGE, DATA INTERSECTION的处理.

    动态地转化过程, 是USB VIDEO CLASS DRIVER的一个主要与重要的部分, 相对较一电视卡的固定GRAPH结构.


    也有人对AVSTREAM架构的复杂产生怀疑, 感觉没有必要採用这样的框架去实际设备驱动, 但它的优点就在于, 你所实现的设备驱动, 是全然符合DSHOW COM接口的, 能够与市面上全部符合DSHOW的应用程序去配合工作.

    这就是微软为什么要设计这样一个复杂的AVSTREAM架构的根本原因.



    USB Video Class Implementation

    The Microsoft-provided USB Video Class driver (usbvideo.sys) is a pin-centric AVStream minidriver. It creates a filter factory for each USB Video Class–compliant device instance enumerated by the operating system. The driver also creates a pin factory for each input or output terminal on the device, with the DataFlow member of the KSPIN_DESCRIPTOR structure set to the relevant value.

    The USB Video Class driver uses the internal device topology reported by the device descriptors to construct a kernel streaming (KS) topology graph comprised of filters, nodes, and connections.

    Based on the number and types of controls supported by the device, USB Video Class dynamically reports filter, pin, and node property sets through the KS automation tables in the AVStream filter and pin descriptors.

    Based on the data formats supported by each video or still image data endpoint on the device, USB Video Class reports the corresponding list of KS data ranges supported and a data intersection handler in the respective AVStream pin descriptor. The USB Video Class driver exports the information through the Kernel Streaming Proxy module.

    The USB Video Class driver also supports audio/video stream synchronization; usbvideo.sys can serve as a KS master clock and add time stamps to video samples. The USB Video Class specification includes details about how the hardware should provide timing information to the class driver.

    To communicate with USB Video Class, user-mode clients call DirectShow or Media Foundation interfaces. These interfaces are COM interface wrappers defined by the kernel streaming proxy as plug-ins. See the Microsoft Windows SDK documentation for more information about Media Foundation.








  • 相关阅读:
    学到的一种编程风格
    防止忘记初始化NSMutableArray的方法
    == 和 isEqualToString的区别之备忘
    IOS开发中--点击imageView上的Button没有任何反应
    [__NSCFString absoluteURL]错误的解决方案
    二叉树镜像
    判断树的子结构
    算法练习-贪心问题
    重建二叉树:
    IDEA搭建web项目出现中文乱码问题
  • 原文地址:https://www.cnblogs.com/zhchoutai/p/7289270.html
Copyright © 2020-2023  润新知