mirror of
https://github.com/reactos/reactos.git
synced 2025-01-01 03:54:02 +00:00
[BDASUP]
- Allocate KSFILTER_DESCRIPTOR before passing to KsCreateFilterFactory - Allocate KSPIN_DESCRIPTOR_EX before passing to KsFilterCreatePinFactory - Use stored BDA_FILTER_TEMPLATE when caller doesnt pass any svn path=/trunk/; revision=46632
This commit is contained in:
parent
f8ed547043
commit
40c15eccb7
2 changed files with 40 additions and 13 deletions
|
@ -261,19 +261,28 @@ BdaCreateFilterFactoryEx(
|
|||
PBDA_FILTER_INSTANCE_ENTRY FilterInstance;
|
||||
KIRQL OldLevel;
|
||||
NTSTATUS Status;
|
||||
KSFILTER_DESCRIPTOR FilterDescriptor;
|
||||
PKSFILTER_DESCRIPTOR FilterDescriptor;
|
||||
|
||||
DPRINT("BdaCreateFilterFactoryEx\n");
|
||||
/* backup filter descriptor */
|
||||
RtlMoveMemory(&FilterDescriptor, pFilterDescriptor, sizeof(KSFILTER_DESCRIPTOR));
|
||||
|
||||
FilterDescriptor = AllocateItem(NonPagedPool, sizeof(KSFILTER_DESCRIPTOR));
|
||||
if (!FilterDescriptor)
|
||||
{
|
||||
/* no memory */
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* copy filter descriptor template */
|
||||
RtlMoveMemory(FilterDescriptor, pFilterDescriptor, sizeof(KSFILTER_DESCRIPTOR));
|
||||
|
||||
/* merge the automation tables */
|
||||
Status = KsMergeAutomationTables((PKSAUTOMATION_TABLE*)&FilterDescriptor.AutomationTable, (PKSAUTOMATION_TABLE)pFilterDescriptor->AutomationTable, &FilterAutomationTable, NULL);
|
||||
Status = KsMergeAutomationTables((PKSAUTOMATION_TABLE*)&FilterDescriptor->AutomationTable, (PKSAUTOMATION_TABLE)pFilterDescriptor->AutomationTable, &FilterAutomationTable, NULL);
|
||||
|
||||
/* check for success */
|
||||
if (!NT_SUCCESS(Status))
|
||||
{
|
||||
DPRINT1("KsMergeAutomationTables failed with %lx\n", Status);
|
||||
FreeItem(FilterDescriptor);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -282,11 +291,12 @@ BdaCreateFilterFactoryEx(
|
|||
if (!FilterInstance)
|
||||
{
|
||||
/* not enough memory */
|
||||
FreeItem(FilterDescriptor);
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* create the filter factory */
|
||||
Status = KsCreateFilterFactory(pKSDevice->FunctionalDeviceObject, &FilterDescriptor, NULL, NULL, 0, NULL, NULL, &FilterFactory);
|
||||
Status = KsCreateFilterFactory(pKSDevice->FunctionalDeviceObject, FilterDescriptor, NULL, NULL, 0, NULL, NULL, &FilterFactory);
|
||||
|
||||
/* check for success */
|
||||
if (NT_SUCCESS(Status))
|
||||
|
@ -298,6 +308,7 @@ BdaCreateFilterFactoryEx(
|
|||
{
|
||||
/* destroy filter instance */
|
||||
DPRINT1("KsAddItemToObjectBag failed with %lx\n", Status);
|
||||
FreeItem(FilterDescriptor);
|
||||
FreeItem(FilterInstance);
|
||||
KsDeleteFilterFactory(FilterFactory);
|
||||
return Status;
|
||||
|
@ -350,7 +361,7 @@ BdaCreatePin(
|
|||
PBDA_FILTER_INSTANCE_ENTRY InstanceEntry;
|
||||
NTSTATUS Status;
|
||||
ULONG PinId;
|
||||
KSPIN_DESCRIPTOR_EX NewPinDescriptor;
|
||||
PKSPIN_DESCRIPTOR_EX NewPinDescriptor;
|
||||
|
||||
DPRINT("BdaCreatePin\n");
|
||||
|
||||
|
@ -380,6 +391,7 @@ BdaCreatePin(
|
|||
if (!InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount)
|
||||
{
|
||||
/* no pins supported */
|
||||
DPRINT("BdaCreatePin NoPins supported\n");
|
||||
return STATUS_UNSUCCESSFUL;
|
||||
}
|
||||
|
||||
|
@ -387,6 +399,7 @@ BdaCreatePin(
|
|||
if (InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount <= ulPinType)
|
||||
{
|
||||
/* pin request is out of bounds */
|
||||
DPRINT("BdaCreatePin ulPinType %lu >= PinDescriptorCount %lu\n", ulPinType, InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount);
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
}
|
||||
|
||||
|
@ -396,17 +409,26 @@ BdaCreatePin(
|
|||
/* get pin descriptor */
|
||||
PinDescriptor = (PKSPIN_DESCRIPTOR_EX)&InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptors[ulPinType];
|
||||
|
||||
/* allocate pin descriptor */
|
||||
NewPinDescriptor = AllocateItem(NonPagedPool, sizeof(KSPIN_DESCRIPTOR_EX));
|
||||
if (!NewPinDescriptor)
|
||||
{
|
||||
/* no memory */
|
||||
DPRINT("BdaCreatePin OutOfMemory\n");
|
||||
return STATUS_INSUFFICIENT_RESOURCES;
|
||||
}
|
||||
|
||||
/* make a copy of the pin descriptor */
|
||||
RtlMoveMemory(&NewPinDescriptor, PinDescriptor, sizeof(KSPIN_DESCRIPTOR_EX));
|
||||
RtlMoveMemory(NewPinDescriptor, PinDescriptor, sizeof(KSPIN_DESCRIPTOR_EX));
|
||||
|
||||
/* merge the automation tables */
|
||||
Status = KsMergeAutomationTables((PKSAUTOMATION_TABLE*)&NewPinDescriptor.AutomationTable, (PKSAUTOMATION_TABLE)PinDescriptor->AutomationTable, &PinAutomationTable, pKSFilter->Bag);
|
||||
Status = KsMergeAutomationTables((PKSAUTOMATION_TABLE*)&NewPinDescriptor->AutomationTable, (PKSAUTOMATION_TABLE)PinDescriptor->AutomationTable, &PinAutomationTable, pKSFilter->Bag);
|
||||
|
||||
/* check for success */
|
||||
if (NT_SUCCESS(Status))
|
||||
{
|
||||
/* create the pin factory */
|
||||
Status = KsFilterCreatePinFactory(pKSFilter, &NewPinDescriptor, &PinId);
|
||||
Status = KsFilterCreatePinFactory(pKSFilter, NewPinDescriptor, &PinId);
|
||||
|
||||
/* check for success */
|
||||
if (NT_SUCCESS(Status))
|
||||
|
@ -417,7 +439,7 @@ BdaCreatePin(
|
|||
}
|
||||
|
||||
|
||||
DPRINT("BdaCreatePin Result %x\n", Status);
|
||||
DPRINT("BdaCreatePin Result %x PinId %u\n", Status, PinId);
|
||||
return Status;
|
||||
}
|
||||
|
||||
|
@ -470,7 +492,7 @@ BdaInitFilter(
|
|||
ULONG Index, PinId;
|
||||
NTSTATUS Status = STATUS_SUCCESS;
|
||||
|
||||
DPRINT("BdaInitFilter\n");
|
||||
DPRINT("BdaInitFilter %p\n", pBdaFilterTemplate);
|
||||
|
||||
/* check input parameters */
|
||||
if (!pKSFilter)
|
||||
|
@ -487,7 +509,12 @@ BdaInitFilter(
|
|||
|
||||
/* sanity check */
|
||||
ASSERT(InstanceEntry);
|
||||
ASSERT(InstanceEntry->FilterTemplate == pBdaFilterTemplate);
|
||||
|
||||
if (!pBdaFilterTemplate)
|
||||
{
|
||||
/* use template from BdaCreateFilterFactoryEx */
|
||||
pBdaFilterTemplate = InstanceEntry->FilterTemplate;
|
||||
}
|
||||
|
||||
/* now create the pins */
|
||||
for(Index = 0; Index < pBdaFilterTemplate->pFilterDescriptor->PinDescriptorsCount; Index++)
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
#include <bdamedia.h>
|
||||
#include <bdasup.h>
|
||||
|
||||
#define NDEBUG
|
||||
#define YDEBUG
|
||||
#include <debug.h>
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue