這篇論文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架構的根本原因.
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
.