BDA minidriver 的初始化方式類似於其他 AVStream 迷你驅動程式。 BDA minidriver 的 DriverEntry 函式會呼叫 AVStream KsInitializeDriver 函式,以初始化 BDA minidriver 的驅動程序物件。 在此呼叫中,BDA 迷你驅動程式會將指標傳遞至 KSDEVICE_DESCRIPTOR 結構,該結構指定裝置的特性,其中包括:
指向包含 BDA 裝置分派表的 KSDEVICE_DISPATCH 結構的指標。 BDA 迷你驅動程式至少應該提供建立和啟動裝置的例程,並在 KSDEVICE_DISPATCH 結構的 Add 和 Start 成員中指定這些例程。 BDA 迷你驅動程式的建立例程應該配置裝置類別的記憶體,並將 BDA 裝置 KSDEVICE 結構的指標參考至此裝置類別。 BDA 迷你驅動程式的開始例程應該從登錄取得裝置的相關信息、設定裝置的相關信息,然後向 BDA 支援連結庫註冊一組靜態範本結構。 如需詳細資訊 ,請參閱啟動 BDA Minidriver 。
此裝置支援的個別篩選類型的 KSFILTER_DESCRIPTOR 結構陣列。 此結構類型描述指定篩選處理站所建立之篩選的特性。 如果您創建的 BDA 迷你驅動程式不使用 BDA 支援庫(Bdasup.lib)來處理 BDA 迷你驅動程式的屬性和方法集,那麼您應該在此陣列中指定此類型結構的成員。 如果您建立 BDA 迷你驅動程式,以使其使用 BDA 支援庫,那麼您的 BDA 迷你驅動程式應改為呼叫 BdaCreateFilterFactory 支援函式,來添加裝置的篩選器工廠描述符(KSFILTER_DESCRIPTOR 結構)。 如需詳細資訊 ,請參閱啟動 BDA Minidriver 。
下列程式碼片段顯示範例,包括篩選描述元陣列、BDA 裝置的分派表,以及 BDA 裝置的描述元:
//
// Array containing descriptors for all filter factories
// available on the device.
//
// Note! Only used when dynamic topology is not used (that is,
// only when filters and pins are fixed). Typically, this
// is when the network provider is not present.
//
DEFINE_KSFILTER_DESCRIPTOR_TABLE(FilterDescriptors)
{
&TemplateTunerFilterDescriptor
};
//
// Device Dispatch Table
//
// Lists the dispatch routines for the major events related to
// the underlying device.
//
extern
const
KSDEVICE_DISPATCH
DeviceDispatch =
{
CDevice::Create, // Add
CDevice::Start, // Start
NULL, // PostStart
NULL, // QueryStop
NULL, // CancelStop
NULL, // Stop
NULL, // QueryRemove
NULL, // CancelRemove
NULL, // Remove
NULL, // QueryCapabilities
NULL, // SurpriseRemoval
NULL, // QueryPower
NULL // SetPower
};
//
// Device Descriptor
//
// Brings together the data structures that define the device and
// the initial filter factories that can be created on it.
// Note that because template topology structures are specific
// to BDA, the device descriptor does not include them.
// Note also that if BDA dynamic topology is used, the device
// descriptor does not specify a list of filter factory descriptors.
// If BDA dynamic topology is used, the BDA minidriver calls
// BdaCreateFilterFactory to add filter factory descriptors.
extern
const
KSDEVICE_DESCRIPTOR
DeviceDescriptor =
{
&DeviceDispatch, // Dispatch
#ifdef DYNAMIC_TOPOLOGY // network provider is present
0, // FilterDescriptorsCount
NULL, // FilterDescriptors
#else // network provider is not present
SIZEOF_ARRAY( FilterDescriptors), // FilterDescriptorsCount
FilterDescriptors // FilterDescriptors
#endif // DYNAMIC_TOPOLOGY