Author: janderwald
Date: Thu Apr 1 19:18:13 2010
New Revision: 46642
URL:
http://svn.reactos.org/svn/reactos?rev=46642&view=rev
Log:
[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
Modified:
trunk/reactos/drivers/multimedia/bdasup/bdasup.c
Modified: trunk/reactos/drivers/multimedia/bdasup/bdasup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/multimedia/bdasup/…
==============================================================================
--- trunk/reactos/drivers/multimedia/bdasup/bdasup.c [iso-8859-1] (original)
+++ trunk/reactos/drivers/multimedia/bdasup/bdasup.c [iso-8859-1] Thu Apr 1 19:18:13
2010
@@ -275,6 +275,14 @@
/* 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 @@
/* 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 @@
{
/* failed to create filter factory */
FreeItem(FilterInstance);
- DPRINT1("KsCreateFilterFactory failed with %lx\n", Status);
+ FreeItem(FilterDescriptor);
}
/* done */