Author: janderwald Date: Sun Jul 12 03:23:40 2009 New Revision: 41901
URL: http://svn.reactos.org/svn/reactos?rev=41901&view=rev Log: - Use free index directly - Update interface
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c trunk/reactos/drivers/wdm/audio/legacy/wdmaud/interface.h
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/wd... ============================================================================== --- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/control.c [iso-8859-1] Sun Jul 12 03:23:40 2009 @@ -146,6 +146,7 @@ KSDATAFORMAT_WAVEFORMATEX * DataFormat; ULONG FilterId; ULONG PinId; + ULONG FreeIndex;
if (DeviceInfo->DeviceType == MIXER_DEVICE_TYPE) { @@ -166,12 +167,14 @@ }
/* close pin handle which uses same virtual audio device id and pin id */ + FreeIndex = (ULONG)-1; for(Index = 0; Index < ClientInfo->NumPins; Index++) { - if (ClientInfo->hPins[Index].FilterId == FilterId && ClientInfo->hPins[Index].PinId == PinId && ClientInfo->hPins[Index].Handle) + if (ClientInfo->hPins[Index].FilterId == FilterId && ClientInfo->hPins[Index].PinId == PinId && ClientInfo->hPins[Index].Handle && ClientInfo->hPins[Index].Type == DeviceInfo->DeviceType) { ZwClose(ClientInfo->hPins[Index].Handle); ClientInfo->hPins[Index].Handle = NULL; + FreeIndex = Index; } }
@@ -248,19 +251,16 @@ { PWDMAUD_HANDLE Handels;
- for(Index = 0; Index < ClientInfo->NumPins; Index++) - { - if (ClientInfo->hPins[Index].Handle == NULL) - { - /* re-use a free index */ - ClientInfo->hPins[Index].Handle = PinHandle; - ClientInfo->hPins[Index].FilterId = FilterId; - ClientInfo->hPins[Index].PinId = PinId; - ClientInfo->hPins[Index].Type = DeviceInfo->DeviceType; - - DeviceInfo->hDevice = PinHandle; - return SetIrpIoStatus(Irp, Status, sizeof(WDMAUD_DEVICE_INFO)); - } + if (FreeIndex != (ULONG)-1) + { + /* re-use a free index */ + ClientInfo->hPins[Index].Handle = PinHandle; + ClientInfo->hPins[Index].FilterId = FilterId; + ClientInfo->hPins[Index].PinId = PinId; + ClientInfo->hPins[Index].Type = DeviceInfo->DeviceType; + + DeviceInfo->hDevice = PinHandle; + return SetIrpIoStatus(Irp, Status, sizeof(WDMAUD_DEVICE_INFO)); }
Handels = ExAllocatePool(NonPagedPool, sizeof(WDMAUD_HANDLE) * (ClientInfo->NumPins+1)); @@ -411,7 +411,7 @@ Property.Id = KSPROPERTY_CONNECTION_STATE; Property.Flags = KSPROPERTY_TYPE_SET;
- State = DeviceInfo->State; + State = DeviceInfo->u.State;
Status = KsSynchronousIoControlDevice(FileObject, KernelMode, IOCTL_KS_PROPERTY, (PVOID)&Property, sizeof(KSPROPERTY), (PVOID)&State, sizeof(KSSTATE), &BytesReturned);
@@ -647,6 +647,8 @@ return WdmAudCapabilities(DeviceObject, Irp, DeviceInfo, ClientInfo); case IOCTL_CLOSE_WDMAUD: return WdmAudIoctlClose(DeviceObject, Irp, DeviceInfo, ClientInfo); + case IOCTL_GETPOS: + DPRINT1("IOCTL_GETPOS\n"); case IOCTL_GETDEVID: case IOCTL_GETVOLUME: case IOCTL_SETVOLUME:
Modified: trunk/reactos/drivers/wdm/audio/legacy/wdmaud/interface.h URL: http://svn.reactos.org/svn/reactos/trunk/reactos/drivers/wdm/audio/legacy/wd... ============================================================================== --- trunk/reactos/drivers/wdm/audio/legacy/wdmaud/interface.h [iso-8859-1] (original) +++ trunk/reactos/drivers/wdm/audio/legacy/wdmaud/interface.h [iso-8859-1] Sun Jul 12 03:23:40 2009 @@ -30,8 +30,6 @@
HANDLE hDevice; ULONG DeviceCount; - KSSTATE State; - ULONG Volume;
ULONG BufferSize; PUCHAR Buffer; @@ -41,7 +39,10 @@ WAVEFORMATEX WaveFormatEx; WAVEOUTCAPSW WaveOutCaps; AUXCAPSW AuxCaps; - WAVEINCAPSW WaveInCaps; + WAVEINCAPSW WaveInCaps; + ULONGLONG Position; + KSSTATE State; + ULONG Volume; }u;
}WDMAUD_DEVICE_INFO, *PWDMAUD_DEVICE_INFO; @@ -204,5 +205,22 @@ METHOD_BUFFERED, \ FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS)
+/// IOCTL_GETPOS +/// +/// Description: This IOCTL retrieves the current playback / write position +/// +/// Arguments: InputBuffer is a pointer to a WDMAUD_DEVICE_INFO structure, +/// InputBufferSize is size of WDMAUD_DEVICE_INFO structure +/// Note: The DeviceType and hDevice must be set +/// Result: The result is returned in Volume +/// ReturnCode: STATUS_SUCCESS indicates success +/// Prequsites: opened device + +#define IOCTL_GETPOS \ + CTL_CODE(FILE_DEVICE_SOUND, \ + 9, \ + METHOD_BUFFERED, \ + FILE_CREATE_TREE_CONNECTION | FILE_ANY_ACCESS) +
#endif