mirror of
https://github.com/reactos/reactos.git
synced 2024-07-06 20:55:16 +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
|
@ -261,19 +261,28 @@ BdaCreateFilterFactoryEx(
|
||||||
PBDA_FILTER_INSTANCE_ENTRY FilterInstance;
|
PBDA_FILTER_INSTANCE_ENTRY FilterInstance;
|
||||||
KIRQL OldLevel;
|
KIRQL OldLevel;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
KSFILTER_DESCRIPTOR FilterDescriptor;
|
PKSFILTER_DESCRIPTOR FilterDescriptor;
|
||||||
|
|
||||||
DPRINT("BdaCreateFilterFactoryEx\n");
|
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 */
|
/* 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 */
|
/* check for success */
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
DPRINT1("KsMergeAutomationTables failed with %lx\n", Status);
|
DPRINT1("KsMergeAutomationTables failed with %lx\n", Status);
|
||||||
|
FreeItem(FilterDescriptor);
|
||||||
return Status;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -282,11 +291,12 @@ BdaCreateFilterFactoryEx(
|
||||||
if (!FilterInstance)
|
if (!FilterInstance)
|
||||||
{
|
{
|
||||||
/* not enough memory */
|
/* not enough memory */
|
||||||
|
FreeItem(FilterDescriptor);
|
||||||
return STATUS_INSUFFICIENT_RESOURCES;
|
return STATUS_INSUFFICIENT_RESOURCES;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create the filter factory */
|
/* 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 */
|
/* check for success */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
|
@ -298,6 +308,7 @@ BdaCreateFilterFactoryEx(
|
||||||
{
|
{
|
||||||
/* destroy filter instance */
|
/* destroy filter instance */
|
||||||
DPRINT1("KsAddItemToObjectBag failed with %lx\n", Status);
|
DPRINT1("KsAddItemToObjectBag failed with %lx\n", Status);
|
||||||
|
FreeItem(FilterDescriptor);
|
||||||
FreeItem(FilterInstance);
|
FreeItem(FilterInstance);
|
||||||
KsDeleteFilterFactory(FilterFactory);
|
KsDeleteFilterFactory(FilterFactory);
|
||||||
return Status;
|
return Status;
|
||||||
|
@ -350,7 +361,7 @@ BdaCreatePin(
|
||||||
PBDA_FILTER_INSTANCE_ENTRY InstanceEntry;
|
PBDA_FILTER_INSTANCE_ENTRY InstanceEntry;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
ULONG PinId;
|
ULONG PinId;
|
||||||
KSPIN_DESCRIPTOR_EX NewPinDescriptor;
|
PKSPIN_DESCRIPTOR_EX NewPinDescriptor;
|
||||||
|
|
||||||
DPRINT("BdaCreatePin\n");
|
DPRINT("BdaCreatePin\n");
|
||||||
|
|
||||||
|
@ -380,6 +391,7 @@ BdaCreatePin(
|
||||||
if (!InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount)
|
if (!InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount)
|
||||||
{
|
{
|
||||||
/* no pins supported */
|
/* no pins supported */
|
||||||
|
DPRINT("BdaCreatePin NoPins supported\n");
|
||||||
return STATUS_UNSUCCESSFUL;
|
return STATUS_UNSUCCESSFUL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,6 +399,7 @@ BdaCreatePin(
|
||||||
if (InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount <= ulPinType)
|
if (InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount <= ulPinType)
|
||||||
{
|
{
|
||||||
/* pin request is out of bounds */
|
/* pin request is out of bounds */
|
||||||
|
DPRINT("BdaCreatePin ulPinType %lu >= PinDescriptorCount %lu\n", ulPinType, InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptorsCount);
|
||||||
return STATUS_INVALID_PARAMETER;
|
return STATUS_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -396,17 +409,26 @@ BdaCreatePin(
|
||||||
/* get pin descriptor */
|
/* get pin descriptor */
|
||||||
PinDescriptor = (PKSPIN_DESCRIPTOR_EX)&InstanceEntry->FilterTemplate->pFilterDescriptor->PinDescriptors[ulPinType];
|
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 */
|
/* 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 */
|
/* 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 */
|
/* check for success */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* create the pin factory */
|
/* create the pin factory */
|
||||||
Status = KsFilterCreatePinFactory(pKSFilter, &NewPinDescriptor, &PinId);
|
Status = KsFilterCreatePinFactory(pKSFilter, NewPinDescriptor, &PinId);
|
||||||
|
|
||||||
/* check for success */
|
/* check for success */
|
||||||
if (NT_SUCCESS(Status))
|
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;
|
return Status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +492,7 @@ BdaInitFilter(
|
||||||
ULONG Index, PinId;
|
ULONG Index, PinId;
|
||||||
NTSTATUS Status = STATUS_SUCCESS;
|
NTSTATUS Status = STATUS_SUCCESS;
|
||||||
|
|
||||||
DPRINT("BdaInitFilter\n");
|
DPRINT("BdaInitFilter %p\n", pBdaFilterTemplate);
|
||||||
|
|
||||||
/* check input parameters */
|
/* check input parameters */
|
||||||
if (!pKSFilter)
|
if (!pKSFilter)
|
||||||
|
@ -487,7 +509,12 @@ BdaInitFilter(
|
||||||
|
|
||||||
/* sanity check */
|
/* sanity check */
|
||||||
ASSERT(InstanceEntry);
|
ASSERT(InstanceEntry);
|
||||||
ASSERT(InstanceEntry->FilterTemplate == pBdaFilterTemplate);
|
|
||||||
|
if (!pBdaFilterTemplate)
|
||||||
|
{
|
||||||
|
/* use template from BdaCreateFilterFactoryEx */
|
||||||
|
pBdaFilterTemplate = InstanceEntry->FilterTemplate;
|
||||||
|
}
|
||||||
|
|
||||||
/* now create the pins */
|
/* now create the pins */
|
||||||
for(Index = 0; Index < pBdaFilterTemplate->pFilterDescriptor->PinDescriptorsCount; Index++)
|
for(Index = 0; Index < pBdaFilterTemplate->pFilterDescriptor->PinDescriptorsCount; Index++)
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
#include <bdamedia.h>
|
#include <bdamedia.h>
|
||||||
#include <bdasup.h>
|
#include <bdasup.h>
|
||||||
|
|
||||||
#define NDEBUG
|
#define YDEBUG
|
||||||
#include <debug.h>
|
#include <debug.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue