Configuration d’un filtre BDA

Un minidriver BDA traite les demandes de méthode de l’ensemble de méthodes KSMETHODSETID_BdaDeviceConfiguration pour configurer un filtre instance pour le minidriver dans le graphique de filtre actuel.

Dans l’extrait de code suivant, deux des méthodes de l’ensemble de méthodes KSMETHODSETID_BdaDeviceConfiguration sont distribuées directement à la bibliothèque de prise en charge BDA et la méthode restante est d’abord interceptée par le minidriver BDA avant de la distribuer à la bibliothèque de prise en charge BDA.

//
//  BDA Device Configuration Method Set
//
//  Defines the dispatch routines for the filter level
//  topology configuration methods
//
DEFINE_KSMETHOD_TABLE(BdaDeviceConfigurationMethods)
{
    DEFINE_KSMETHOD_ITEM_BDA_CREATE_PIN_FACTORY(
        BdaMethodCreatePin,
        NULL
        ),
    DEFINE_KSMETHOD_ITEM_BDA_DELETE_PIN_FACTORY(
        BdaMethodDeletePin,
        NULL
        ),
    DEFINE_KSMETHOD_ITEM_BDA_CREATE_TOPOLOGY(
        CFilter::CreateTopology,
        NULL
        )
};
/*
** CreateTopology()
**
** Keeps track of topology association between input and output pins
**
*/
NTSTATUS
CFilter::
CreateTopology(
    IN PIRP         pIrp,
    IN PKSMETHOD    pKSMethod,
    PVOID           pvIgnored
    )
{
    NTSTATUS            Status = STATUS_SUCCESS;
    CFilter *           pFilter;
    ULONG               ulPinType;
    PKSFILTER           pKSFilter;

    ASSERT( pIrp);
    ASSERT( pKSMethod);

    //  Obtain a "this" pointer for the method.
    //
    //  Because this function is called directly from the property 
    //  dispatch table, get pointer to the underlying object.
    //
    pFilter = FilterFromIRP( pIrp);
    ASSERT( pFilter);
    if (!pFilter)
    {
        Status = STATUS_INVALID_PARAMETER;
        goto errExit;
    }

    //  Let the BDA support library create the standard topology.
    //  It will also validate the method, instance count, etc.
    //
    Status = BdaMethodCreateTopology( pIrp, pKSMethod, pvIgnored);
    if (Status != STATUS_SUCCESS)
    {
        goto errExit;
    }

    //  This is where the filter can keep track of associated pins.
    //
errExit:
    return Status;
}

La demande de méthode KSMETHOD_BDA_CREATE_TOPOLOGY appelle la méthode CFilter::CreateTopology du minidriver. Cette méthode appelle la fonction de bibliothèque de prise en charge BDA BdaMethodCreateTopology pour créer une topologie entre les broches de filtre. Cette fonction crée en fait une structure de topologie dans l’anneau 3, qui reflète, pour d’autres jeux de propriétés, les connexions connues du filtre. Un minidriver BDA doit intercepter la demande de méthode KSMETHOD_BDA_CREATE_TOPOLOGY comme indiqué dans l’extrait de code précédent si ce minidriver doit envoyer des instructions spéciales au matériel lors de la connexion de types de broches particuliers, par exemple, si le périphérique BDA effectue un démultiplexage matériel et crée un nombre arbitraire de broches de sortie supprimées d’une seule broche d’entrée.