From c44cdc2405e3b2c1a374f51b8842d332f9f9805d Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Thu, 1 Apr 2010 17:18:13 +0000 Subject: [PATCH] [BDASUP] - Register an empty filter descriptor as pins, nodes, connections will be added later dynamically - Fixes the duplicate input / output pins visible with graphedt - Add the filter automation table to the object bag so it gets deleted when filter factory is destroyed svn path=/trunk/; revision=46642 --- reactos/drivers/multimedia/bdasup/bdasup.c | 34 +++++++++++++++------- 1 file changed, 23 insertions(+), 11 deletions(-) diff --git a/reactos/drivers/multimedia/bdasup/bdasup.c b/reactos/drivers/multimedia/bdasup/bdasup.c index 221ae831c98..9e24f929867 100644 --- a/reactos/drivers/multimedia/bdasup/bdasup.c +++ b/reactos/drivers/multimedia/bdasup/bdasup.c @@ -275,6 +275,14 @@ BdaCreateFilterFactoryEx( /* copy filter descriptor template */ RtlMoveMemory(FilterDescriptor, pFilterDescriptor, sizeof(KSFILTER_DESCRIPTOR)); + /* erase pin / nodes / connections from filter descriptor */ + FilterDescriptor->PinDescriptorsCount = 0; + FilterDescriptor->PinDescriptors = NULL; + FilterDescriptor->NodeDescriptorsCount = 0; + FilterDescriptor->NodeDescriptors = NULL; + FilterDescriptor->ConnectionsCount = 0; + FilterDescriptor->Connections = NULL; + /* merge the automation tables */ Status = KsMergeAutomationTables((PKSAUTOMATION_TABLE*)&FilterDescriptor->AutomationTable, (PKSAUTOMATION_TABLE)pFilterDescriptor->AutomationTable, &FilterAutomationTable, NULL); @@ -301,17 +309,21 @@ BdaCreateFilterFactoryEx( /* check for success */ if (NT_SUCCESS(Status)) { - - /* add the item to filter object bag */ - Status = KsAddItemToObjectBag(FilterFactory->Bag, FilterInstance, FreeFilterInstance); - if (!NT_SUCCESS(Status)) + if (FilterDescriptor->AutomationTable != &FilterAutomationTable) { - /* destroy filter instance */ - DPRINT1("KsAddItemToObjectBag failed with %lx\n", Status); - FreeItem(FilterDescriptor); - FreeItem(FilterInstance); - KsDeleteFilterFactory(FilterFactory); - return Status; + /* add the item to filter object bag */ + KsAddItemToObjectBag(FilterFactory->Bag, (PVOID)FilterDescriptor->AutomationTable, FreeFilterInstance); + } + else + { + /* make sure the automation table is not-read only */ + Status = _KsEdit(FilterFactory->Bag, (PVOID*)&FilterDescriptor->AutomationTable, sizeof(KSAUTOMATION_TABLE), sizeof(KSAUTOMATION_TABLE), 0); + + /* sanity check */ + ASSERT(Status == STATUS_SUCCESS); + + /* add to object bag */ + KsAddItemToObjectBag(FilterFactory->Bag, (PVOID)FilterDescriptor->AutomationTable, FreeFilterInstance); } /* initialize filter instance entry */ @@ -338,7 +350,7 @@ BdaCreateFilterFactoryEx( { /* failed to create filter factory */ FreeItem(FilterInstance); - DPRINT1("KsCreateFilterFactory failed with %lx\n", Status); + FreeItem(FilterDescriptor); } /* done */