다음을 통해 공유


BDA 미니드라이버 시작

BDA 디바이스가 작동을 시작하면 PnP(플러그 앤 플레이) 관리자가 IRP_MN_START_DEVICE 디스패치합니다. AVStream 클래스는 BDA 디바이스와 연결된 BDA 미니드라이버의 시작 루틴을 호출합니다. 이 시작 루틴은 레지스트리에서 디바이스에 대한 정보를 검색하고 디바이스에 대한 정보를 설정한 다음 BdaCreateFilterFactory 지원 함수를 호출하여 다음을 수행합니다.

  • 디바이스의 초기 필터 설명자(KSFILTER_DESCRIPTOR)에서 디바이스에 대한 필터 팩터리를 만듭니다. 초기 필터 설명자는 필터 및 입력 핀에 대한 디스패치 및 자동화 테이블을 참조합니다. 자세한 내용은 디스패치 테이블 만들기Automation 테이블 정의를 참조하세요.

  • 필터 팩터리를 BDA_FILTER_TEMPLATE 구조와 연결합니다. 이 구조체는 디바이스에 대한 템플릿 필터 설명자와 가능한 입력 및 출력 핀 쌍 목록을 참조합니다. 이 설명자 및 목록은 다음을 차례로 참조합니다.

    • 네트워크 공급자가 BDA 필터의 토폴로지를 결정하는 데 사용할 수 있는 정적 템플릿 구조입니다.
    • 필터를 연결하는 가능한 방법과 함께 BDA 필터에 대한 노드 및 핀입니다.
    • 네트워크 공급자가 필터 instance 만들고 닫는 데 사용할 수 있는 루틴입니다.
    • 네트워크 공급자가 BDA 필터를 조작하는 데 사용할 수 있는 정적 템플릿 구조입니다.
  • 라이브러리가 BDA 미니드라이버의 속성 및 메서드에 대한 기본 처리를 제공할 수 있도록 BDA_FILTER_TEMPLATE 지정된 정적 템플릿 구조를 BDA 지원 라이브러리에 등록합니다.

다음 코드 조각은 BdaCreateFilterFactory 가 필터 팩터리로 설정하는 디바이스에 대한 초기 필터 설명자의 예를 보여 줍니다.

const KSFILTER_DESCRIPTOR    InitialTunerFilterDescriptor;
//
//  Filter Factory Descriptor for the tuner filter
//
//  This structure brings together all of the structures that define
//  the tuner filter instance as it appears when it is first created.
//  Note that not all template pin and node types are exposed as
//  pin and node factories when the filter instance is created.
//
DEFINE_KSFILTER_DESCRIPTOR(InitialTunerFilterDescriptor)
{
    &FilterDispatch,             // Table of dispatch routines
    &FilterAutomation,           // Table of properties and methods
    KSFILTER_DESCRIPTOR_VERSION, // Version
    0,                           // Flags
    &KSNAME_Filter,              // Reference Guid
    DEFINE_KSFILTER_PIN_DESCRIPTORS(InitialPinDescriptors),
                                   // PinDescriptorsCount
                                   // PinDescriptorSize
                                   // PinDescriptors
    DEFINE_KSFILTER_CATEGORY(KSCATEGORY_BDA_RECEIVER_COMPONENT),
                            // CategoriesCount
                            // Categories
    DEFINE_KSFILTER_NODE_DESCRIPTORS_NULL(NodeDescriptors),
                                    // NodeDescriptorsCount
                                    // NodeDescriptorSize
                                    // NodeDescriptors
    DEFINE_KSFILTER_DEFAULT_CONNECTIONS, // ConnectionsCount
                                         // Connections
    NULL                // ComponentId
};

다음 코드 조각은 초기화된 필터에 의해 노출되는 초기 핀 설명자 배열의 예제를 보여줍니다. 네트워크 공급자는 네트워크 공급자가 해당 필터를 구성하기 전에 이러한 배열을 사용하여 필터를 초기화합니다. 그러나 초기화된 필터를 구성할 때 네트워크 공급자는 BDA_FILTER_TEMPLATE 구조체의 필터 설명자 멤버에 대한 포인터에서 참조되는 핀을 선택합니다. 자세한 내용은 BDA 필터 구성 을 참조하세요.

//
//  Initial Pin Descriptors
//
//  This data structure defines the pins that will appear on the 
//  filter when it is first created.
//
const
KSPIN_DESCRIPTOR_EX
InitialPinDescriptors[] =
{
    //  Antenna Pin
    //
    {
        &AntennaPinDispatch,
        &AntennaAutomation,   // AntennaPinAutomation
        {
            0,  // Interfaces
            NULL,
            0,  // Mediums
            NULL,
            SIZEOF_ARRAY(AntennaPinRanges),
            AntennaPinRanges,
            KSPIN_DATAFLOW_IN,
            KSPIN_COMMUNICATION_BOTH,
            NULL,   // Name
            NULL,   // Category
            0
        },
        KSPIN_FLAG_DO_NOT_USE_STANDARD_TRANSPORT | 
        KSPIN_FLAG_FRAMES_NOT_REQUIRED_FOR_PROCESSING | 
        KSPIN_FLAG_FIXED_FORMAT,
        1,      // InstancesPossible
        0,      // InstancesNecessary
        NULL,   // Allocator Framing
        NULL    // PinIntersectHandler
    }
};

초기화된 필터에는 Microsoft DirectShow IFilterMapper2 또는 IFilterMapper 인터페이스가 해당 필터를 찾을 수 있도록 하나 이상의 입력 핀이 노출되어 있어야 합니다. 이러한 DirectShow 인터페이스에 대한 자세한 내용은 Microsoft Windows SDK 설명서를 참조하세요.

다음 코드 조각은 BDA_FILTER_TEMPLATE 구조체 및 관련 구조체 및 배열의 예를 보여 줍니다.

const KSFILTER_DESCRIPTOR  TemplateTunerFilterDescriptor;
const BDA_PIN_PAIRING  *TemplateTunerPinPairings;
//
//  BDA Template Topology Descriptor for the filter factory.
//
//  This structure defines the pin and node types that the network 
//  provider can create on the filter and how they are arranged. 
//
const
BDA_FILTER_TEMPLATE
TunerBdaFilterTemplate =
{
    &TemplateTunerFilterDescriptor,
    SIZEOF_ARRAY(TemplateTunerPinPairings),
    TemplateTunerPinPairings
};
//
//  Filter Factory Descriptor for the tuner filter template topology
//
//  This structure brings together all of the structures that define
//  the topologies that the tuner filter can assume as a result of
//  pin factory and topology creation methods.
//
DEFINE_KSFILTER_DESCRIPTOR(TemplateTunerFilterDescriptor)
{
    &FilterDispatch,             // Table of dispatch routines
    &FilterAutomation,           // Table of properties and methods
    KSFILTER_DESCRIPTOR_VERSION, // Version
    0,                           // Flags
    &KSNAME_Filter,              // Reference Guid
    DEFINE_KSFILTER_PIN_DESCRIPTORS(TemplatePinDescriptors),
                                   // PinDescriptorsCount
                                   // PinDescriptorSize
                                   // PinDescriptors
    DEFINE_KSFILTER_CATEGORY(KSCATEGORY_BDA_RECEIVER_COMPONENT),
                            // CategoriesCount
                            // Categories
    DEFINE_KSFILTER_NODE_DESCRIPTORS(NodeDescriptors),  
                                    // NodeDescriptorsCount
                                    // NodeDescriptorSize
                                    // NodeDescriptors
    DEFINE_KSFILTER_CONNECTIONS(TemplateTunerConnections),
                               // ConnectionsCount
                               // Connections
    NULL                // ComponentId
};
//
//  Lists how pairs of input and output pins are configured. 
//
//  Values given to the BDA_PIN_PAIRING structures in the list inform 
//  the network provider which nodes get duplicated when more than one 
//  output pin type is connected to a single input pin type or when
//  more that one input pin type is connected to a single output pin 
//  type. Also, informs of the joints array.
//
const
BDA_PIN_PAIRING TemplateTunerPinPairings[] =
{
    //  Antenna to Transport Topology Joints
    //
    {
        0,  // ulInputPin
        1,  // ulOutputPin
        1,  // ulcMaxInputsPerOutput
        1,  // ulcMinInputsPerOutput
        1,  // ulcMaxOutputsPerInput
        1,  // ulcMinOutputsPerInput
        SIZEOF_ARRAY(AntennaTransportJoints),   // ulcTopologyJoints
        AntennaTransportJoints                  // pTopologyJoints
    }
};