- Fix enumerating of KSDATARANGES

- Increment pin instance count when a new pin is created
- Complete IRP on close request for filter 
- Make sure IRP Status block is set when completing played stream IRP 
- Silence debug prints
- Enumerating number of channels and data formats should now work

svn path=/trunk/; revision=39740
This commit is contained in:
Johannes Anderwald 2009-02-24 18:38:39 +00:00
parent 8f47f51547
commit 93ce0dce1f
10 changed files with 112 additions and 43 deletions

View file

@ -112,7 +112,7 @@ KsPinPropertyHandler(
KSP_PIN * Pin;
KSMULTIPLE_ITEM * Item;
PIO_STACK_LOCATION IoStack;
ULONG Size;
ULONG Size, Index;
PVOID Buffer;
IoStack = IoGetCurrentIrpStackLocation(Irp);
@ -161,8 +161,11 @@ KsPinPropertyHandler(
Irp->IoStatus.Information = 0;
break;
}
Size = sizeof(KSMULTIPLE_ITEM) + sizeof(KSDATARANGE) * Descriptor[Pin->PinId].DataRangesCount;
Size = sizeof(KSMULTIPLE_ITEM);
for (Index = 0; Index < Descriptor[Pin->PinId].DataRangesCount; Index++)
{
Size += Descriptor[Pin->PinId].DataRanges[Index]->FormatSize;
}
if (IoStack->Parameters.DeviceIoControl.OutputBufferLength < Size)
{
@ -174,7 +177,13 @@ KsPinPropertyHandler(
Item = (KSMULTIPLE_ITEM*)Buffer;
Item->Size = Size;
Item->Count = Descriptor[Pin->PinId].DataRangesCount;
RtlMoveMemory((PVOID)(Item + 1), Descriptor[Pin->PinId].DataRanges, Descriptor[Pin->PinId].DataRangesCount * sizeof(KSDATARANGE));
Data = (PUCHAR)(Item +1);
for (Index = 0; Index < Descriptor[Pin->PinId].DataRangesCount; Index++)
{
RtlMoveMemory(Data, Descriptor[Pin->PinId].DataRanges[Index], Descriptor[Pin->PinId].DataRanges[Index]->FormatSize);
Data = ((PUCHAR)Data + Descriptor[Pin->PinId].DataRanges[Index]->FormatSize);
}
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = Size;

View file

@ -129,6 +129,10 @@ IPortFilterWaveCyclic_fnNewIrpTarget(
/* store result */
*OutTarget = (IIrpTarget*)Pin;
/* increment current instance count */
Descriptor->Factory.Instances[ConnectDetails->PinId].CurrentPinInstanceCount++;
return Status;
}
@ -144,8 +148,8 @@ IPortFilterWaveCyclic_fnDeviceIoControl(
{
PIO_STACK_LOCATION IoStack;
ISubdevice *SubDevice = NULL;
SUBDEVICE_DESCRIPTOR * Descriptor = NULL;
NTSTATUS Status;
SUBDEVICE_DESCRIPTOR * Descriptor;
NTSTATUS Status;
#if defined(DBG)
IPortFilterWaveCyclicImpl * This = (IPortFilterWaveCyclicImpl *)iface;
#endif
@ -155,8 +159,8 @@ IPortFilterWaveCyclic_fnDeviceIoControl(
ASSERT(This->Port->lpVtbl->QueryInterface(This->Port, &IID_ISubdevice, (PVOID*)&SubDevice) == STATUS_SUCCESS);
ASSERT(SubDevice != NULL);
Status = SubDevice->lpVtbl->GetDescriptor(SubDevice, &Descriptor);
ASSERT(Status == STATUS_SUCCESS);
Status = SubDevice->lpVtbl->GetDescriptor(SubDevice, &Descriptor);
ASSERT(Status == STATUS_SUCCESS);
ASSERT(Descriptor != NULL);
SubDevice->lpVtbl->Release(SubDevice);
@ -213,6 +217,14 @@ IPortFilterWaveCyclic_fnClose(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
DPRINT1("IPortFilterWaveCyclic_fnClose entered\n");
//FIXME
//close all pin instances
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_UNSUCCESSFUL;
}

View file

@ -102,7 +102,7 @@ typedef struct
ULONG MaxGlobalInstanceCount;
ULONG MaxFilterInstanceCount;
ULONG MinFilterInstanceCount;
ULONG CurrentFilterInstanceCount;
ULONG CurrentPinInstanceCount;
}PIN_INSTANCE_INFO, *PPIN_INSTANCE_INFO;

View file

@ -124,6 +124,8 @@ IServiceSink_fnRequestService(
{
if (This->ActiveIrp)
{
This->ActiveIrp->IoStatus.Status = STATUS_SUCCESS;
This->ActiveIrp->IoStatus.Information = This->ActiveIrpBufferSize;
IoCompleteRequest(This->ActiveIrp, IO_SOUND_INCREMENT);
}
@ -167,7 +169,7 @@ IServiceSink_fnRequestService(
Status = This->Stream->lpVtbl->GetPosition(This->Stream, &Position);
DPRINT1("Position %u BufferSize %u ActiveIrpOffset %u\n", Position, This->CommonBufferSize, This->ActiveIrpOffset);
DPRINT("Position %u BufferSize %u ActiveIrpOffset %u\n", Position, This->CommonBufferSize, This->ActiveIrpOffset);
if (Position < This->CommonBufferOffset)
{
@ -176,7 +178,7 @@ IServiceSink_fnRequestService(
BytesToCopy = min(BufferLength, IrpLength);
DPRINT1("Copying %u Remaining %u\n", BytesToCopy, IrpLength);
DPRINT("Copying %u Remaining %u\n", BytesToCopy, IrpLength);
if (BytesToCopy)
{
@ -193,7 +195,7 @@ IServiceSink_fnRequestService(
IrpLength = This->ActiveIrpBufferSize - This->ActiveIrpOffset;
BytesToCopy = min(BufferLength, IrpLength);
DPRINT1("Copying %u Remaining %u\n", BytesToCopy, IrpLength);
DPRINT("Copying %u Remaining %u\n", BytesToCopy, IrpLength);
if (BytesToCopy)
{
@ -209,13 +211,13 @@ IServiceSink_fnRequestService(
IrpLength = This->ActiveIrpBufferSize - This->ActiveIrpOffset;
BytesToCopy = min(BufferLength, IrpLength);
DPRINT1("Copying %u Remaining %u\n", BytesToCopy, IrpLength);
DPRINT("Copying %u Remaining %u\n", BytesToCopy, IrpLength);
if (!BytesToCopy)
{
{
This->Stream->lpVtbl->SetState(This->Stream, KSSTATE_PAUSE);
return;
}
}
This->DmaChannel->lpVtbl->CopyTo(This->DmaChannel,
(PUCHAR)This->CommonBuffer + This->CommonBufferOffset,
@ -567,6 +569,12 @@ IPortPinWaveCyclic_fnDeviceIoControl(
}
UNIMPLEMENTED
DbgBreakPoint();
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = STATUS_UNSUCCESSFUL;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_UNSUCCESSFUL;
}
@ -619,8 +627,15 @@ IPortPinWaveCyclic_fnClose(
IN PDEVICE_OBJECT DeviceObject,
IN PIRP Irp)
{
DPRINT1("IPortPinWaveCyclic_fnClose\n");
return STATUS_UNSUCCESSFUL;
//FIXME
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = STATUS_SUCCESS;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return STATUS_SUCCESS;
}
/*

View file

@ -624,7 +624,7 @@ ISubDevice_fnGetDescriptor(
*Descriptor = This->SubDeviceDescriptor;
DPRINT1("ISubDevice_GetDescriptor this %p desc %p\n", This, This->SubDeviceDescriptor);
DPRINT("ISubDevice_GetDescriptor this %p desc %p\n", This, This->SubDeviceDescriptor);
return STATUS_SUCCESS;
}

View file

@ -9,7 +9,7 @@
#include <ntddk.h>
#include <portcls.h>
#define YDEBUG
#define NDEBUG
#include <debug.h>
#include <dmusicks.h>

View file

@ -25,7 +25,7 @@ HandlePropertyInstances(
else
Instances->PossibleCount = Descriptor->Factory.Instances[Pin->PinId].MaxFilterInstanceCount;
Instances->CurrentCount = Descriptor->Factory.Instances[Pin->PinId].CurrentFilterInstanceCount;
Instances->CurrentCount = Descriptor->Factory.Instances[Pin->PinId].CurrentPinInstanceCount;
Irp->IoStatus.Information = sizeof(KSPIN_CINSTANCES);
Irp->IoStatus.Status = STATUS_SUCCESS;
@ -222,7 +222,6 @@ PcPropertyHandler(
RtlStringFromGUID(&Property->Set, &GuidString);
DPRINT1("Unhandeled property: Set %S Id %u Flags %x\n", GuidString.Buffer, Property->Id, Property->Flags);
DbgBreakPoint();
RtlFreeUnicodeString(&GuidString);
Irp->IoStatus.Information = 0;
Irp->IoStatus.Status = STATUS_NOT_IMPLEMENTED;

View file

@ -33,7 +33,7 @@ IRegistryKey_fnRelease(
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
InterlockedDecrement(&This->ref);
DPRINT1("IRegistryKey_fnRelease ref %u this %p entered\n", This->ref, This);
DPRINT("IRegistryKey_fnRelease ref %u this %p entered\n", This->ref, This);
if (This->ref == 0)
{
if (This->hKey)
@ -55,7 +55,7 @@ IRegistryKey_fnQueryInterface(
OUT PVOID* Output)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
DPRINT1("IRegistryKey_fnQueryInterface entered\n");
DPRINT("IRegistryKey_fnQueryInterface entered\n");
if (IsEqualGUIDAligned(refiid, &IID_IRegistryKey))
{
*Output = (PVOID)&This->lpVtbl;
@ -64,7 +64,7 @@ IRegistryKey_fnQueryInterface(
}
DPRINT("IRegistryKey_QueryInterface: This %p unknown iid\n", This, This->ref);
KeBugCheckEx(0,0,0,0,0);
DbgBreakPoint();
return STATUS_UNSUCCESSFUL;
}
@ -74,7 +74,7 @@ IRegistryKey_fnDeleteKey(
IN IRegistryKey* iface)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
DPRINT1("IRegistryKey_fnDeleteKey entered\n");
DPRINT("IRegistryKey_fnDeleteKey entered\n");
return ZwDeleteKey(This->hKey);
}
@ -89,7 +89,7 @@ IRegistryKey_fnEnumerateKey(
OUT PULONG ResultLength)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
DPRINT1("IRegistryKey_fnEnumerateKey entered\n");
DPRINT("IRegistryKey_fnEnumerateKey entered\n");
return ZwEnumerateKey(This->hKey, Index, KeyInformationClass, KeyInformation, Length, ResultLength);
}
@ -104,7 +104,7 @@ IRegistryKey_fnEnumerateKeyValue(
OUT PULONG ResultLength)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
DPRINT1("IRegistryKey_fnEnumerateKeyValue entered\n");
DPRINT("IRegistryKey_fnEnumerateKeyValue entered\n");
return ZwEnumerateValueKey(This->hKey, Index, KeyValueInformationClass, KeyValueInformation, Length, ResultLength);
}
@ -124,13 +124,16 @@ IRegistryKey_fnNewSubKey(
HANDLE hKey;
IRegistryKeyImpl * NewThis, *This = (IRegistryKeyImpl*)iface;
DPRINT1("IRegistryKey_fnNewSubKey entered\n");
DPRINT("IRegistryKey_fnNewSubKey entered %S\n", SubKeyName);
InitializeObjectAttributes(&Attributes, SubKeyName, 0, This->hKey, NULL);
Status = ZwCreateKey(&hKey, KEY_READ | KEY_WRITE, &Attributes, 0, NULL, 0, Disposition);
if (!NT_SUCCESS(Status))
{
DPRINT1("IRegistryKey_fnNewSubKey failed with %x\n", Status);
DbgBreakPoint();
return Status;
}
NewThis = AllocateItem(NonPagedPool, sizeof(IRegistryKeyImpl), TAG_PORTCLASS);
if (!NewThis)
@ -143,11 +146,11 @@ IRegistryKey_fnNewSubKey(
OuterUnknown->lpVtbl->AddRef(OuterUnknown);
NewThis->hKey = hKey;
NewThis->ref = 2;
NewThis->ref = 1;
NewThis->lpVtbl = &vt_IRegistryKey;
*RegistrySubKey = (PREGISTRYKEY)&NewThis->lpVtbl;
DPRINT1("IRegistryKey_fnNewSubKey RESULT %p\n", *RegistrySubKey );
DPRINT("IRegistryKey_fnNewSubKey RESULT %p\n", *RegistrySubKey );
return STATUS_SUCCESS;
}
@ -162,7 +165,7 @@ IRegistryKey_fnQueryKey(
OUT PULONG ResultLength)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
DPRINT1("IRegistryKey_fnQueryKey entered\n");
DPRINT("IRegistryKey_fnQueryKey entered\n");
return ZwQueryKey(This->hKey, KeyInformationClass, KeyInformation, Length, ResultLength);
}
@ -173,8 +176,9 @@ IRegistryKey_fnQueryRegistryValues(
IN PRTL_QUERY_REGISTRY_TABLE QueryTable,
IN PVOID Context OPTIONAL)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
DPRINT1("IRegistryKey_QueryRegistryValues: This %p\n", This);
//IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
UNIMPLEMENTED
DbgBreakPoint();
return STATUS_UNSUCCESSFUL;
}
@ -204,7 +208,7 @@ IRegistryKey_fnSetValueKey(
)
{
IRegistryKeyImpl * This = (IRegistryKeyImpl*)iface;
DPRINT1("IRegistryKey_fnSetValueKey entered\n");
DPRINT1("IRegistryKey_fnSetValueKey entered %S\n", ValueName->Buffer);
return ZwSetValueKey(This->hKey, ValueName, 0, Type, Data, DataSize);
}
@ -245,7 +249,7 @@ PcNewRegistryKey(
IRegistryKeyImpl * This;
PPCLASS_DEVICE_EXTENSION DeviceExt;
DPRINT1("PcNewRegistryKey entered\n");
DPRINT("PcNewRegistryKey entered\n");
if (!OutRegistryKey)
return STATUS_INVALID_PARAMETER;
@ -290,7 +294,8 @@ PcNewRegistryKey(
else if (RegistryKeyType == DeviceInterfaceRegistryKey)
{
/* FIXME */
DPRINT1("fixme\n");
UNIMPLEMENTED
DbgBreakPoint();
}
if (!NT_SUCCESS(Status))
@ -313,7 +318,7 @@ PcNewRegistryKey(
This->ref = 2;
*OutRegistryKey = (PREGISTRYKEY)&This->lpVtbl;
DPRINT1("PcNewRegistryKey result %p\n", *OutRegistryKey);
DPRINT("PcNewRegistryKey result %p\n", *OutRegistryKey);
return STATUS_SUCCESS;
}

View file

@ -147,7 +147,8 @@ PcCreateSubdeviceDescriptor(
IN PPCFILTER_DESCRIPTOR FilterDescription)
{
SUBDEVICE_DESCRIPTOR * Descriptor;
ULONG Index;
ULONG Index, SubIndex;
PKSDATARANGE DataRange;
NTSTATUS Status = STATUS_INSUFFICIENT_RESOURCES;
Descriptor = AllocateItem(NonPagedPool, sizeof(SUBDEVICE_DESCRIPTOR), TAG_PORTCLASS);
@ -164,7 +165,6 @@ PcCreateSubdeviceDescriptor(
if (FilterPropertiesCount)
{
/// FIXME
/// handle driver properties
Descriptor->FilterPropertySet.Properties = AllocateItem(NonPagedPool, sizeof(KSPROPERTY_SET) * FilterPropertiesCount, TAG_PORTCLASS);
@ -198,7 +198,31 @@ PcCreateSubdeviceDescriptor(
for(Index = 0; Index < FilterDescription->PinCount; Index++)
{
RtlMoveMemory(&Descriptor->Factory.KsPinDescriptor[Index], &FilterDescription->Pins[Index].KsPinDescriptor, FilterDescription->PinSize);
Descriptor->Factory.Instances[Index].CurrentFilterInstanceCount = 0;
if (FilterDescription->Pins[Index].KsPinDescriptor.DataRangesCount)
{
Descriptor->Factory.KsPinDescriptor[Index].DataRanges = AllocateItem(NonPagedPool, FilterDescription->Pins[Index].KsPinDescriptor.DataRangesCount * sizeof(PKSDATARANGE), TAG_PORTCLASS);
if(!Descriptor->Factory.KsPinDescriptor[Index].DataRanges)
goto cleanup;
for (SubIndex = 0; SubIndex < FilterDescription->Pins[Index].KsPinDescriptor.DataRangesCount; SubIndex++)
{
DataRange = AllocateItem(NonPagedPool, FilterDescription->Pins[Index].KsPinDescriptor.DataRanges[SubIndex]->FormatSize, TAG_PORTCLASS);
if (!DataRange)
goto cleanup;
RtlMoveMemory(DataRange,
FilterDescription->Pins[Index].KsPinDescriptor.DataRanges[SubIndex],
FilterDescription->Pins[Index].KsPinDescriptor.DataRanges[SubIndex]->FormatSize);
((PKSDATAFORMAT*)Descriptor->Factory.KsPinDescriptor[Index].DataRanges)[SubIndex] = DataRange;
}
Descriptor->Factory.KsPinDescriptor[Index].DataRangesCount = FilterDescription->Pins[Index].KsPinDescriptor.DataRangesCount;
}
Descriptor->Factory.Instances[Index].CurrentPinInstanceCount = 0;
Descriptor->Factory.Instances[Index].MaxFilterInstanceCount = FilterDescription->Pins[Index].MaxFilterInstanceCount;
Descriptor->Factory.Instances[Index].MaxGlobalInstanceCount = FilterDescription->Pins[Index].MaxGlobalInstanceCount;
Descriptor->Factory.Instances[Index].MinFilterInstanceCount = FilterDescription->Pins[Index].MinFilterInstanceCount;

View file

@ -351,7 +351,7 @@ CheckFormatSupport(
}
}
if (DataRangeAudio->MaximumBitsPerSample <= 16 && DataRangeAudio->MaximumBitsPerSample >= 16)
if (DataRangeAudio->MinimumBitsPerSample <= 16 && DataRangeAudio->MaximumBitsPerSample >= 16)
{
Result |= Mono16Bit;
if (DataRangeAudio->MaximumChannels >= 2)
@ -449,26 +449,31 @@ WdmAudCapabilities(
IsEqualGUIDAligned(&DataRangeAudio->DataRange.SubFormat, &KSDATAFORMAT_SUBTYPE_PCM) &&
IsEqualGUIDAligned(&DataRangeAudio->DataRange.Specifier, &KSDATAFORMAT_SPECIFIER_WAVEFORMATEX))
{
DPRINT("Min Sample %u Max Sample %u Min Bits %u Max Bits %u Max Channel %u\n", DataRangeAudio->MinimumSampleFrequency, DataRangeAudio->MaximumSampleFrequency,
DataRangeAudio->MinimumBitsPerSample, DataRangeAudio->MaximumBitsPerSample, DataRangeAudio->MaximumChannels);
dwFormats |= CheckFormatSupport(DataRangeAudio, 11025, WAVE_FORMAT_1M08, WAVE_FORMAT_1S08, WAVE_FORMAT_1M16, WAVE_FORMAT_1S16);
dwFormats |= CheckFormatSupport(DataRangeAudio, 22050, WAVE_FORMAT_2M08, WAVE_FORMAT_2S08, WAVE_FORMAT_2M16, WAVE_FORMAT_2S16);
dwFormats |= CheckFormatSupport(DataRangeAudio, 44100, WAVE_FORMAT_4M08, WAVE_FORMAT_4S08, WAVE_FORMAT_4M16, WAVE_FORMAT_4S16);
dwFormats |= CheckFormatSupport(DataRangeAudio, 48000, WAVE_FORMAT_48M08, WAVE_FORMAT_48S08, WAVE_FORMAT_48M16, WAVE_FORMAT_48S16);
dwFormats |= CheckFormatSupport(DataRangeAudio, 96000, WAVE_FORMAT_96M08, WAVE_FORMAT_96S08, WAVE_FORMAT_96M16, WAVE_FORMAT_96S16);
wChannels = DataRangeAudio->MaximumChannels;
dwSupport = WAVECAPS_VOLUME; //FIXME get info from nodes
}
}
}
DataRange = (PKSDATARANGE)((PUCHAR)DataRange + DataRange->FormatSize);
}
DeviceInfo->u.WaveOutCaps.dwFormats = dwFormats;
DeviceInfo->u.WaveOutCaps.dwSupport = dwSupport;
DeviceInfo->u.WaveOutCaps.wChannels = wChannels;
DeviceInfo->u.WaveOutCaps.szPname[0] = L'\0';
ExFreePool(MultipleItem);
return SetIrpIoStatus(Irp, Status, sizeof(WDMAUD_DEVICE_INFO));
}