ReactOS 0.4.16-dev-297-gc569aee
usbaudio.h File Reference
#include <ntddk.h>
#include <portcls.h>
#include <ksmedia.h>
#include <hubbusif.h>
#include <usbbusif.h>
#include <usbioctl.h>
#include <usb.h>
#include <usbdlib.h>
#include <debug.h>
#include <pshpack1.h>
#include <poppack.h>
Include dependency graph for usbaudio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  USB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR
 
struct  USB_AUDIO_CONTROL_OUTPUT_TERMINAL_DESCRIPTOR
 
struct  USB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR
 
struct  USB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR
 
struct  USB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR
 
struct  USB_AUDIO_CONTROL_SELECTOR_UNIT_DESCRIPTOR
 
struct  USB_AUDIO_STREAMING_INTERFACE_DESCRIPTOR
 
struct  USB_AUDIO_STREAMING_FORMAT_TYPE_DESCRIPTOR
 
struct  NODE_CONTEXT
 
struct  __DEVICE_EXTENSION__
 
struct  FILTER_CONTEXT
 
struct  PIN_CONTEXT
 

Macros

#define USBAUDIO_TAG   'AbsU'
 
#define USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE   (0x24)
 
#define USB_AUDIO_STREAMING_TERMINAL_TYPE   (0x0101)
 
#define USB_AUDIO_MICROPHONE_TERMINAL_TYPE   (0x0201)
 
#define USB_AUDIO_DESKTOP_MICROPHONE_TERMINAL_TYPE   (0x0202)
 
#define USB_AUDIO_PERSONAL_MICROPHONE_TERMINAL_TYPE   (0x0203)
 
#define USB_AUDIO_OMMNI_MICROPHONE_TERMINAL_TYPE   (0x0204)
 
#define USB_AUDIO_ARRAY_MICROPHONE_TERMINAL_TYPE   (0x0205)
 
#define USB_AUDIO_ARRAY_PROCESSING_MICROPHONE_TERMINAL_TYPE   (0x0206)
 
#define USB_AUDIO_SPEAKER_TERMINAL_TYPE   (0x0301)
 
#define USB_HEADPHONES_SPEAKER_TERMINAL_TYPE   (0x0302)
 
#define USB_AUDIO_HMDA_TERMINAL_TYPE   (0x0303)
 
#define USB_AUDIO_DESKTOP_SPEAKER_TERMINAL_TYPE   (0x0304)
 
#define USB_AUDIO_ROOM_SPEAKER_TERMINAL_TYPE   (0x0305)
 
#define USB_AUDIO_COMMUNICATION_SPEAKER_TERMINAL_TYPE   (0x0306)
 
#define USB_AUDIO_SUBWOOFER_TERMINAL_TYPE   (0x0307)
 
#define USB_AUDIO_UNDEFINED_TERMINAL_TYPE   (0xFFFF)
 
#define USB_AUDIO_INPUT_TERMINAL   (0x02)
 
#define USB_AUDIO_OUTPUT_TERMINAL   (0x03)
 
#define DEFINE_KSPROPERTY_ITEM_AUDIO_VOLUME(Handler)
 
#define DEFINE_KSPROPERTY_TABLE_AUDIO_VOLUME(TopologySet, Handler)
 
#define DEFINE_KSPROPERTY_ITEM_AUDIO_MUTE(Handler)
 
#define DEFINE_KSPROPERTY_TABLE_AUDIO_MUTE(TopologySet, Handler)
 

Typedefs

typedef struct USB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTORPUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR
 
typedef struct USB_AUDIO_CONTROL_OUTPUT_TERMINAL_DESCRIPTORPUSB_AUDIO_CONTROL_OUTPUT_TERMINAL_DESCRIPTOR
 
typedef struct USB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTORPUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR
 
typedef struct USB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTORPUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR
 
typedef struct USB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTORPUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR
 
typedef struct USB_AUDIO_CONTROL_SELECTOR_UNIT_DESCRIPTORPUSB_AUDIO_CONTROL_SELECTOR_UNIT_DESCRIPTOR
 
typedef struct USB_AUDIO_STREAMING_INTERFACE_DESCRIPTORPUSB_AUDIO_STREAMING_INTERFACE_DESCRIPTOR
 
typedef struct USB_AUDIO_STREAMING_FORMAT_TYPE_DESCRIPTORPUSB_AUDIO_STREAMING_FORMAT_TYPE_DESCRIPTOR
 
typedef struct NODE_CONTEXTPNODE_CONTEXT
 
typedef struct __DEVICE_EXTENSION__ DEVICE_EXTENSION
 
typedef struct __DEVICE_EXTENSION__PDEVICE_EXTENSION
 
typedef struct FILTER_CONTEXTPFILTER_CONTEXT
 
typedef struct PIN_CONTEXTPPIN_CONTEXT
 

Functions

NTSTATUS NTAPI USBAudioCreateFilterContext (PKSDEVICE Device)
 
PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR UsbAudioGetStreamingTerminalDescriptorByIndex (IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, IN ULONG Index)
 
PVOID NTAPI AllocFunction (IN ULONG ItemSize)
 
VOID NTAPI FreeFunction (IN PVOID Item)
 
VOID NTAPI CountTerminalUnits (IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, OUT PULONG NonStreamingTerminalDescriptorCount, OUT PULONG TotalTerminalDescriptorCount)
 
NTSTATUS SubmitUrbSync (IN PDEVICE_OBJECT Device, IN PURB Urb)
 
NTSTATUS NTAPI USBAudioAddDevice (_In_ PKSDEVICE Device)
 
NTSTATUS NTAPI USBAudioPnPStart (_In_ PKSDEVICE Device, _In_ PIRP Irp, _In_opt_ PCM_RESOURCE_LIST TranslatedResourceList, _In_opt_ PCM_RESOURCE_LIST UntranslatedResourceList)
 
NTSTATUS NTAPI USBAudioPnPQueryStop (_In_ PKSDEVICE Device, _In_ PIRP Irp)
 
VOID NTAPI USBAudioPnPCancelStop (_In_ PKSDEVICE Device, _In_ PIRP Irp)
 
VOID NTAPI USBAudioPnPStop (_In_ PKSDEVICE Device, _In_ PIRP Irp)
 
NTSTATUS NTAPI USBAudioPnPQueryRemove (_In_ PKSDEVICE Device, _In_ PIRP Irp)
 
VOID NTAPI USBAudioPnPCancelRemove (_In_ PKSDEVICE Device, _In_ PIRP Irp)
 
VOID NTAPI USBAudioPnPRemove (_In_ PKSDEVICE Device, _In_ PIRP Irp)
 
NTSTATUS NTAPI USBAudioPnPQueryCapabilities (_In_ PKSDEVICE Device, _In_ PIRP Irp, _Inout_ PDEVICE_CAPABILITIES Capabilities)
 
VOID NTAPI USBAudioPnPSurpriseRemoval (_In_ PKSDEVICE Device, _In_ PIRP Irp)
 
NTSTATUS NTAPI USBAudioPnPQueryPower (_In_ PKSDEVICE Device, _In_ PIRP Irp, _In_ DEVICE_POWER_STATE DeviceTo, _In_ DEVICE_POWER_STATE DeviceFrom, _In_ SYSTEM_POWER_STATE SystemTo, _In_ SYSTEM_POWER_STATE SystemFrom, _In_ POWER_ACTION Action)
 
VOID NTAPI USBAudioPnPSetPower (_In_ PKSDEVICE Device, _In_ PIRP Irp, _In_ DEVICE_POWER_STATE To, _In_ DEVICE_POWER_STATE From)
 
NTSTATUS NTAPI UsbAudioPinDataIntersect (_In_ PVOID Context, _In_ PIRP Irp, _In_ PKSP_PIN Pin, _In_ PKSDATARANGE DataRange, _In_ PKSDATARANGE MatchingDataRange, _In_ ULONG DataBufferSize, _Out_ PVOID Data, _Out_ PULONG DataSize)
 
NTSTATUS NTAPI UsbAudioCaptureComplete (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
 
NTSTATUS NTAPI UsbAudioRenderComplete (IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context)
 
NTSTATUS NTAPI USBAudioPinCreate (_In_ PKSPIN Pin, _In_ PIRP Irp)
 
NTSTATUS NTAPI USBAudioPinClose (_In_ PKSPIN Pin, _In_ PIRP Irp)
 
NTSTATUS NTAPI USBAudioPinProcess (_In_ PKSPIN Pin)
 
VOID NTAPI USBAudioPinReset (_In_ PKSPIN Pin)
 
NTSTATUS NTAPI USBAudioPinSetDataFormat (_In_ PKSPIN Pin, _In_opt_ PKSDATAFORMAT OldFormat, _In_opt_ PKSMULTIPLE_ITEM OldAttributeList, _In_ const KSDATARANGE *DataRange, _In_opt_ const KSATTRIBUTE_LIST *AttributeRange)
 
NTSTATUS NTAPI USBAudioPinSetDeviceState (_In_ PKSPIN Pin, _In_ KSSTATE ToState, _In_ KSSTATE FromState)
 

Macro Definition Documentation

◆ DEFINE_KSPROPERTY_ITEM_AUDIO_MUTE

#define DEFINE_KSPROPERTY_ITEM_AUDIO_MUTE (   Handler)
Value:
(Handler),\
sizeof(BOOL),\
(Handler), NULL, 0, NULL, NULL, 0)
ACPI_PHYSICAL_ADDRESS ACPI_SIZE BOOLEAN Warn UINT32 *TableIdx UINT32 ACPI_TABLE_HEADER *OutTableHeader ACPI_TABLE_HEADER **OutTable ACPI_HANDLE UINT32 ACPI_WALK_CALLBACK ACPI_WALK_CALLBACK void void **ReturnValue UINT32 ACPI_BUFFER *RetPathPtr ACPI_OBJECT_HANDLER Handler
Definition: acpixf.h:672
#define NULL
Definition: types.h:112
unsigned int BOOL
Definition: ntddk_ex.h:94
#define DEFINE_KSPROPERTY_ITEM(PropertyId, GetHandler, MinProperty, MinData, SetHandler, Values, RelationsCount, Relations, SupportHandler, SerializedSize)
Definition: ks.h:1177
@ KSPROPERTY_AUDIO_MUTE
Definition: ksmedia.h:1066

Definition at line 52 of file usbaudio.h.

◆ DEFINE_KSPROPERTY_ITEM_AUDIO_VOLUME

#define DEFINE_KSPROPERTY_ITEM_AUDIO_VOLUME (   Handler)
Value:
(Handler),\
sizeof(LONG),\
(Handler), NULL, 0, NULL, NULL, 0)
@ KSPROPERTY_AUDIO_VOLUMELEVEL
Definition: ksmedia.h:1057
long LONG
Definition: pedump.c:60

Definition at line 38 of file usbaudio.h.

◆ DEFINE_KSPROPERTY_TABLE_AUDIO_MUTE

#define DEFINE_KSPROPERTY_TABLE_AUDIO_MUTE (   TopologySet,
  Handler 
)
Value:
DEFINE_KSPROPERTY_TABLE(TopologySet) {\
DEFINE_KSPROPERTY_ITEM_AUDIO_MUTE(Handler)\
}

Definition at line 60 of file usbaudio.h.

◆ DEFINE_KSPROPERTY_TABLE_AUDIO_VOLUME

#define DEFINE_KSPROPERTY_TABLE_AUDIO_VOLUME (   TopologySet,
  Handler 
)
Value:
DEFINE_KSPROPERTY_TABLE(TopologySet) {\
DEFINE_KSPROPERTY_ITEM_AUDIO_VOLUME(Handler)\
}

Definition at line 47 of file usbaudio.h.

◆ USB_AUDIO_ARRAY_MICROPHONE_TERMINAL_TYPE

#define USB_AUDIO_ARRAY_MICROPHONE_TERMINAL_TYPE   (0x0205)

Definition at line 23 of file usbaudio.h.

◆ USB_AUDIO_ARRAY_PROCESSING_MICROPHONE_TERMINAL_TYPE

#define USB_AUDIO_ARRAY_PROCESSING_MICROPHONE_TERMINAL_TYPE   (0x0206)

Definition at line 24 of file usbaudio.h.

◆ USB_AUDIO_COMMUNICATION_SPEAKER_TERMINAL_TYPE

#define USB_AUDIO_COMMUNICATION_SPEAKER_TERMINAL_TYPE   (0x0306)

Definition at line 31 of file usbaudio.h.

◆ USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE

#define USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE   (0x24)

Definition at line 14 of file usbaudio.h.

◆ USB_AUDIO_DESKTOP_MICROPHONE_TERMINAL_TYPE

#define USB_AUDIO_DESKTOP_MICROPHONE_TERMINAL_TYPE   (0x0202)

Definition at line 20 of file usbaudio.h.

◆ USB_AUDIO_DESKTOP_SPEAKER_TERMINAL_TYPE

#define USB_AUDIO_DESKTOP_SPEAKER_TERMINAL_TYPE   (0x0304)

Definition at line 29 of file usbaudio.h.

◆ USB_AUDIO_HMDA_TERMINAL_TYPE

#define USB_AUDIO_HMDA_TERMINAL_TYPE   (0x0303)

Definition at line 28 of file usbaudio.h.

◆ USB_AUDIO_INPUT_TERMINAL

#define USB_AUDIO_INPUT_TERMINAL   (0x02)

Definition at line 35 of file usbaudio.h.

◆ USB_AUDIO_MICROPHONE_TERMINAL_TYPE

#define USB_AUDIO_MICROPHONE_TERMINAL_TYPE   (0x0201)

Definition at line 19 of file usbaudio.h.

◆ USB_AUDIO_OMMNI_MICROPHONE_TERMINAL_TYPE

#define USB_AUDIO_OMMNI_MICROPHONE_TERMINAL_TYPE   (0x0204)

Definition at line 22 of file usbaudio.h.

◆ USB_AUDIO_OUTPUT_TERMINAL

#define USB_AUDIO_OUTPUT_TERMINAL   (0x03)

Definition at line 36 of file usbaudio.h.

◆ USB_AUDIO_PERSONAL_MICROPHONE_TERMINAL_TYPE

#define USB_AUDIO_PERSONAL_MICROPHONE_TERMINAL_TYPE   (0x0203)

Definition at line 21 of file usbaudio.h.

◆ USB_AUDIO_ROOM_SPEAKER_TERMINAL_TYPE

#define USB_AUDIO_ROOM_SPEAKER_TERMINAL_TYPE   (0x0305)

Definition at line 30 of file usbaudio.h.

◆ USB_AUDIO_SPEAKER_TERMINAL_TYPE

#define USB_AUDIO_SPEAKER_TERMINAL_TYPE   (0x0301)

Definition at line 26 of file usbaudio.h.

◆ USB_AUDIO_STREAMING_TERMINAL_TYPE

#define USB_AUDIO_STREAMING_TERMINAL_TYPE   (0x0101)

Definition at line 17 of file usbaudio.h.

◆ USB_AUDIO_SUBWOOFER_TERMINAL_TYPE

#define USB_AUDIO_SUBWOOFER_TERMINAL_TYPE   (0x0307)

Definition at line 32 of file usbaudio.h.

◆ USB_AUDIO_UNDEFINED_TERMINAL_TYPE

#define USB_AUDIO_UNDEFINED_TERMINAL_TYPE   (0xFFFF)

Definition at line 33 of file usbaudio.h.

◆ USB_HEADPHONES_SPEAKER_TERMINAL_TYPE

#define USB_HEADPHONES_SPEAKER_TERMINAL_TYPE   (0x0302)

Definition at line 27 of file usbaudio.h.

◆ USBAUDIO_TAG

#define USBAUDIO_TAG   'AbsU'

Definition at line 13 of file usbaudio.h.

Typedef Documentation

◆ DEVICE_EXTENSION

◆ PDEVICE_EXTENSION

◆ PFILTER_CONTEXT

◆ PNODE_CONTEXT

◆ PPIN_CONTEXT

◆ PUSB_AUDIO_CONTROL_FEATURE_UNIT_DESCRIPTOR

◆ PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR

◆ PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR

◆ PUSB_AUDIO_CONTROL_MIXER_UNIT_DESCRIPTOR

◆ PUSB_AUDIO_CONTROL_OUTPUT_TERMINAL_DESCRIPTOR

◆ PUSB_AUDIO_CONTROL_SELECTOR_UNIT_DESCRIPTOR

◆ PUSB_AUDIO_STREAMING_FORMAT_TYPE_DESCRIPTOR

◆ PUSB_AUDIO_STREAMING_INTERFACE_DESCRIPTOR

Function Documentation

◆ AllocFunction()

◆ CountTerminalUnits()

VOID NTAPI CountTerminalUnits ( IN PUSB_CONFIGURATION_DESCRIPTOR  ConfigurationDescriptor,
OUT PULONG  NonStreamingTerminalDescriptorCount,
OUT PULONG  TotalTerminalDescriptorCount 
)

Definition at line 970 of file filter.c.

974{
976 PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR InterfaceHeaderDescriptor;
977 PUSB_COMMON_DESCRIPTOR CommonDescriptor;
978 PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR InputTerminalDescriptor;
979 ULONG NonStreamingTerminalCount = 0;
980 ULONG TotalTerminalCount = 0;
981
982 for(Descriptor = USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor, ConfigurationDescriptor, -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1);
983 Descriptor != NULL;
984 Descriptor = USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor, (PVOID)((ULONG_PTR)Descriptor + Descriptor->bLength), -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1))
985 {
986 if (Descriptor->bInterfaceSubClass == 0x01) /* AUDIO_CONTROL */
987 {
988 InterfaceHeaderDescriptor = (PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR)USBD_ParseDescriptors(ConfigurationDescriptor, ConfigurationDescriptor->wTotalLength, Descriptor, USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE);
989 if (InterfaceHeaderDescriptor != NULL)
990 {
991 CommonDescriptor = USBD_ParseDescriptors(InterfaceHeaderDescriptor, InterfaceHeaderDescriptor->wTotalLength, (PVOID)((ULONG_PTR)InterfaceHeaderDescriptor + InterfaceHeaderDescriptor->bLength), USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE);
992 while (CommonDescriptor)
993 {
994 InputTerminalDescriptor = (PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR)CommonDescriptor;
995 if (InputTerminalDescriptor->bDescriptorSubtype == 0x02 /* INPUT TERMINAL*/ || InputTerminalDescriptor->bDescriptorSubtype == 0x03 /* OUTPUT_TERMINAL*/)
996 {
997 if (InputTerminalDescriptor->wTerminalType != USB_AUDIO_STREAMING_TERMINAL_TYPE)
998 {
999 NonStreamingTerminalCount++;
1000 }
1001 TotalTerminalCount++;
1002 }
1003 CommonDescriptor = (PUSB_COMMON_DESCRIPTOR)((ULONG_PTR)CommonDescriptor + CommonDescriptor->bLength);
1004 if ((ULONG_PTR)CommonDescriptor >= ((ULONG_PTR)InterfaceHeaderDescriptor + InterfaceHeaderDescriptor->wTotalLength))
1005 break;
1006 }
1007 }
1008 }
1009 else if (Descriptor->bInterfaceSubClass == 0x03) /* MIDI_STREAMING */
1010 {
1012 }
1013 }
1014 *NonStreamingTerminalDescriptorCount = NonStreamingTerminalCount;
1015 *TotalTerminalDescriptorCount = TotalTerminalCount;
1016}
#define UNIMPLEMENTED
Definition: ntoskrnl.c:15
#define ULONG_PTR
Definition: config.h:101
uint32_t ULONG_PTR
Definition: typedefs.h:65
uint32_t ULONG
Definition: typedefs.h:59
struct _USB_COMMON_DESCRIPTOR * PUSB_COMMON_DESCRIPTOR
#define USB_DEVICE_CLASS_AUDIO
Definition: usb100.h:91
struct USB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR * PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR
struct USB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR * PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR
#define USB_AUDIO_STREAMING_TERMINAL_TYPE
Definition: usbaudio.h:17
#define USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE
Definition: usbaudio.h:14
PUSB_COMMON_DESCRIPTOR NTAPI USBD_ParseDescriptors(PVOID DescriptorBuffer, ULONG TotalLength, PVOID StartPosition, LONG DescriptorType)
Definition: usbd.c:445
PUSB_INTERFACE_DESCRIPTOR NTAPI USBD_ParseConfigurationDescriptorEx(PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, PVOID StartPosition, LONG InterfaceNumber, LONG AlternateSetting, LONG InterfaceClass, LONG InterfaceSubClass, LONG InterfaceProtocol)
Definition: usbd.c:496
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:342

Referenced by BuildUSBAudioFilterTopology(), and USBAudioPinBuildDescriptors().

◆ FreeFunction()

◆ SubmitUrbSync()

NTSTATUS SubmitUrbSync ( IN PDEVICE_OBJECT  Device,
IN PURB  Urb 
)

Definition at line 37 of file usbaudio.c.

40{
41 PIRP Irp;
44 PIO_STACK_LOCATION IoStack;
46
47 // init event
49
50 // build irp
53 NULL,
54 0,
55 NULL,
56 0,
57 TRUE,
58 &Event,
59 &IoStatus);
60
61 if (!Irp)
62 {
63 //
64 // no memory
65 //
67 }
68
69 // get next stack location
71
72 // store urb
73 IoStack->Parameters.Others.Argument1 = Urb;
74
75 // call driver
77
78 // wait for the request to finish
80 {
82 Status = IoStatus.Status;
83 }
84
85 // done
86 return Status;
87}
LONG NTSTATUS
Definition: precomp.h:26
_In_ PIRP Irp
Definition: csq.h:116
#define STATUS_PENDING
Definition: d3dkmdt.h:43
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
#define KeWaitForSingleObject(pEvt, foo, a, b, c)
Definition: env_spec_w32.h:478
#define KeInitializeEvent(pEvt, foo, foo2)
Definition: env_spec_w32.h:477
Status
Definition: gdiplustypes.h:25
__in UCHAR __in POWER_STATE __in_opt PVOID __in PIO_STATUS_BLOCK IoStatus
Definition: mxum.h:159
#define KernelMode
Definition: asm.h:34
@ NotificationEvent
PIRP NTAPI IoBuildDeviceIoControlRequest(IN ULONG IoControlCode, IN PDEVICE_OBJECT DeviceObject, IN PVOID InputBuffer, IN ULONG InputBufferLength, IN PVOID OutputBuffer, IN ULONG OutputBufferLength, IN BOOLEAN InternalDeviceIoControl, IN PKEVENT Event, IN PIO_STATUS_BLOCK IoStatusBlock)
Definition: irp.c:881
#define IoCallDriver
Definition: irp.c:1225
struct _IO_STACK_LOCATION::@3978::@4017 Others
union _IO_STACK_LOCATION::@1579 Parameters
#define STATUS_INSUFFICIENT_RESOURCES
Definition: udferr_usr.h:158
#define IOCTL_INTERNAL_USB_SUBMIT_URB
Definition: usbioctl.h:32
_In_ PDEVICE_OBJECT DeviceObject
Definition: wdfdevice.h:2055
__drv_aliasesMem FORCEINLINE PIO_STACK_LOCATION IoGetNextIrpStackLocation(_In_ PIRP Irp)
Definition: iofuncs.h:2695
@ Executive
Definition: ketypes.h:415

Referenced by USBAudioGetDescriptor(), UsbAudioGetSetProperty(), USBAudioSelectAudioStreamingInterface(), USBAudioSelectConfiguration(), UsbAudioSetFormat(), and USBAudioStartDevice().

◆ USBAudioAddDevice()

NTSTATUS NTAPI USBAudioAddDevice ( _In_ PKSDEVICE  Device)

Definition at line 287 of file usbaudio.c.

289{
290 /* no op */
291 DPRINT1("USBAudioAddDevice\n");
292 return STATUS_SUCCESS;
293}
#define DPRINT1
Definition: precomp.h:8
#define STATUS_SUCCESS
Definition: shellext.h:65

◆ UsbAudioCaptureComplete()

NTSTATUS NTAPI UsbAudioCaptureComplete ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PVOID  Context 
)

Definition at line 909 of file pin.c.

913{
914 PKSPIN Pin;
915 PPIN_CONTEXT PinContext;
916 KIRQL OldLevel;
917 PURB Urb;
918
919 /* get pin context */
920 Pin = Context;
921 PinContext = Pin->Context;
922
923 /* get urb */
924 Urb = Irp->Tail.Overlay.DriverContext[0];
925
926 /* acquire lock */
927 KeAcquireSpinLock(&PinContext->IrpListLock, &OldLevel);
928
929 if (!NT_SUCCESS(Urb->UrbIsochronousTransfer.Hdr.Status))
930 {
931 //DPRINT("UsbAudioCaptureComplete Irp %p Urb %p Status %x Packet Status %x\n", Irp, Urb, Urb->UrbIsochronousTransfer.Hdr.Status, Urb->UrbIsochronousTransfer.IsoPacket[0].Status);
932
933 /* insert entry into ready list */
934 InsertTailList(&PinContext->IrpListHead, &Irp->Tail.Overlay.ListEntry);
935
936 /* release lock */
937 KeReleaseSpinLock(&PinContext->IrpListLock, OldLevel);
938
940 }
941 else
942 {
943 /* insert entry into done list */
944 InsertTailList(&PinContext->DoneIrpListHead, &Irp->Tail.Overlay.ListEntry);
945
946 /* release lock */
947 KeReleaseSpinLock(&PinContext->IrpListLock, OldLevel);
948
950 }
951
952 /* done */
954}
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:33
#define InsertTailList(ListHead, Entry)
UCHAR KIRQL
Definition: env_spec_w32.h:591
#define KeReleaseSpinLock(sl, irql)
Definition: env_spec_w32.h:627
#define KeAcquireSpinLock(sl, irql)
Definition: env_spec_w32.h:609
IN PDCB IN VBO IN ULONG IN BOOLEAN Pin
Definition: fatprocs.h:428
#define STATUS_MORE_PROCESSING_REQUIRED
Definition: shellext.h:68
LIST_ENTRY IrpListHead
Definition: usbaudio.h:198
PKSWORKER StarvationWorker
Definition: usbaudio.h:209
PKSWORKER CaptureWorker
Definition: usbaudio.h:207
KSPIN_LOCK IrpListLock
Definition: usbaudio.h:200
LIST_ENTRY DoneIrpListHead
Definition: usbaudio.h:199
Definition: usb.h:529
struct _URB_ISOCH_TRANSFER UrbIsochronousTransfer
Definition: usb.h:544
KSDDKAPI ULONG NTAPI KsIncrementCountedWorker(IN PKSWORKER Worker)
Definition: worker.c:222

Referenced by CaptureInitializeUrbAndIrp(), and InitCapturePin().

◆ USBAudioCreateFilterContext()

NTSTATUS NTAPI USBAudioCreateFilterContext ( PKSDEVICE  Device)

Definition at line 1525 of file filter.c.

1527{
1528 PKSFILTER_DESCRIPTOR FilterDescriptor;
1531
1532 /* allocate descriptor */
1533 FilterDescriptor = AllocFunction(sizeof(KSFILTER_DESCRIPTOR));
1534 if (!FilterDescriptor)
1535 {
1536 /* no memory */
1538 }
1539
1540 /* init filter descriptor*/
1541 FilterDescriptor->Version = KSFILTER_DESCRIPTOR_VERSION;
1542 FilterDescriptor->Flags = 0;
1543 FilterDescriptor->ReferenceGuid = &KSNAME_Filter;
1545 FilterDescriptor->CategoriesCount = 1;
1547
1548 /* init component id*/
1550 if (!ComponentId)
1551 {
1552 /* no memory */
1554 }
1556 if (!NT_SUCCESS(Status))
1557 {
1558 /* failed*/
1560 return Status;
1561 }
1562 FilterDescriptor->ComponentId = ComponentId;
1563
1564 /* build pin descriptors */
1565 Status = USBAudioPinBuildDescriptors(Device, (PKSPIN_DESCRIPTOR_EX *)&FilterDescriptor->PinDescriptors, &FilterDescriptor->PinDescriptorsCount, &FilterDescriptor->PinDescriptorSize);
1566 if (!NT_SUCCESS(Status))
1567 {
1568 /* failed*/
1570 return Status;
1571 }
1572
1573 /* build topology */
1575 if (!NT_SUCCESS(Status))
1576 {
1577 /* failed*/
1579 return Status;
1580 }
1581
1582 /* lets create the filter */
1583 Status = KsCreateFilterFactory(Device->FunctionalDeviceObject, FilterDescriptor, ReferenceString, NULL, KSCREATE_ITEM_FREEONSTOP, NULL, NULL, NULL);
1584 DPRINT("KsCreateFilterFactory: %x\n", Status);
1585
1586 return Status;
1587}
ACPI_BUFFER *RetBuffer ACPI_BUFFER *RetBuffer char ACPI_WALK_RESOURCE_CALLBACK void *Context ACPI_BUFFER *RetBuffer UINT16 ACPI_RESOURCE **ResourcePtr ACPI_GENERIC_ADDRESS *Reg UINT32 *ReturnValue UINT8 UINT8 *Slp_TypB ACPI_PHYSICAL_ADDRESS PhysicalAddress64 UINT32 UINT32 *TimeElapsed UINT32 ACPI_STATUS const char UINT32 ACPI_STATUS const char UINT32 const char const char UINT32 ComponentId
Definition: acpixf.h:1281
static KSFILTER_DISPATCH USBAudioFilterDispatch
Definition: filter.c:71
NTSTATUS BuildUSBAudioFilterTopology(PKSDEVICE Device, PKSFILTER_DESCRIPTOR FilterDescriptor)
Definition: filter.c:426
GUID GUID_KSCATEGORY_AUDIO
Definition: filter.c:27
NTSTATUS USBAudioPinBuildDescriptors(PKSDEVICE Device, PKSPIN_DESCRIPTOR_EX *PinDescriptors, PULONG PinDescriptorsCount, PULONG PinDescriptorSize)
Definition: filter.c:1252
NTSTATUS USBAudioInitComponentId(PKSDEVICE Device, IN PKSCOMPONENTID ComponentId)
Definition: filter.c:1473
KSDDKAPI NTSTATUS NTAPI KsCreateFilterFactory(IN PDEVICE_OBJECT DeviceObject, IN const KSFILTER_DESCRIPTOR *Descriptor, IN PWSTR RefString OPTIONAL, IN PSECURITY_DESCRIPTOR SecurityDescriptor OPTIONAL, IN ULONG CreateItemFlags, IN PFNKSFILTERFACTORYPOWER SleepCallback OPTIONAL, IN PFNKSFILTERFACTORYPOWER WakeCallback OPTIONAL, OUT PKSFILTERFACTORY *FilterFactory OPTIONAL)
PVOID NTAPI AllocFunction(IN ULONG ItemSize)
Definition: hid.c:45
VOID NTAPI FreeFunction(IN PVOID Item)
Definition: hid.c:53
#define KSNAME_Filter
Definition: ks.h:111
#define DPRINT
Definition: sndvol32.h:73
const KSFILTER_DESCRIPTOR FilterDescriptor
Definition: splitter.c:229
#define USBD_STATUS_INSUFFICIENT_RESOURCES
Definition: usb.h:204
_Must_inspect_result_ _In_ WDFDEVICE Device
Definition: wdfchildlist.h:474
_Must_inspect_result_ _In_ WDFDEVICE _In_ CONST GUID _In_opt_ PCUNICODE_STRING ReferenceString
Definition: wdfdevice.h:3630

Referenced by USBAudioPnPStart().

◆ UsbAudioGetStreamingTerminalDescriptorByIndex()

PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR UsbAudioGetStreamingTerminalDescriptorByIndex ( IN PUSB_CONFIGURATION_DESCRIPTOR  ConfigurationDescriptor,
IN ULONG  Index 
)

Definition at line 1063 of file filter.c.

1066{
1068 PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR InterfaceHeaderDescriptor;
1069 PUSB_COMMON_DESCRIPTOR CommonDescriptor;
1070 PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR InputTerminalDescriptor;
1071 ULONG TerminalCount = 0;
1072
1073 for (Descriptor = USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor, ConfigurationDescriptor, -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1);
1074 Descriptor != NULL;
1075 Descriptor = USBD_ParseConfigurationDescriptorEx(ConfigurationDescriptor, (PVOID)((ULONG_PTR)Descriptor + Descriptor->bLength), -1, -1, USB_DEVICE_CLASS_AUDIO, -1, -1))
1076 {
1077 if (Descriptor->bInterfaceSubClass == 0x01) /* AUDIO_CONTROL */
1078 {
1079 InterfaceHeaderDescriptor = (PUSB_AUDIO_CONTROL_INTERFACE_HEADER_DESCRIPTOR)USBD_ParseDescriptors(ConfigurationDescriptor, ConfigurationDescriptor->wTotalLength, Descriptor, USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE);
1080 if (InterfaceHeaderDescriptor != NULL)
1081 {
1082 CommonDescriptor = USBD_ParseDescriptors(InterfaceHeaderDescriptor, InterfaceHeaderDescriptor->wTotalLength, (PVOID)((ULONG_PTR)InterfaceHeaderDescriptor + InterfaceHeaderDescriptor->bLength), USB_AUDIO_CONTROL_TERMINAL_DESCRIPTOR_TYPE);
1083 while (CommonDescriptor)
1084 {
1085 InputTerminalDescriptor = (PUSB_AUDIO_CONTROL_INPUT_TERMINAL_DESCRIPTOR)CommonDescriptor;
1086 if (InputTerminalDescriptor->bDescriptorSubtype == 0x02 /* INPUT TERMINAL*/ || InputTerminalDescriptor->bDescriptorSubtype == 0x03 /* OUTPUT_TERMINAL*/)
1087 {
1088 if (InputTerminalDescriptor->wTerminalType == USB_AUDIO_STREAMING_TERMINAL_TYPE)
1089 {
1090 if (TerminalCount == Index)
1091 {
1092 return InputTerminalDescriptor;
1093 }
1094 TerminalCount++;
1095 }
1096 }
1097 CommonDescriptor = (PUSB_COMMON_DESCRIPTOR)((ULONG_PTR)CommonDescriptor + CommonDescriptor->bLength);
1098 if ((ULONG_PTR)CommonDescriptor >= ((ULONG_PTR)InterfaceHeaderDescriptor + InterfaceHeaderDescriptor->wTotalLength))
1099 break;
1100 }
1101 }
1102 }
1103 }
1104 return NULL;
1105}
_In_ WDFCOLLECTION _In_ ULONG Index

Referenced by USBAudioPinBuildDescriptors(), and USBAudioSelectAudioStreamingInterface().

◆ USBAudioPinClose()

NTSTATUS NTAPI USBAudioPinClose ( _In_ PKSPIN  Pin,
_In_ PIRP  Irp 
)

Definition at line 843 of file pin.c.

846{
849}
#define STATUS_NOT_IMPLEMENTED
Definition: d3dkmdt.h:42

◆ USBAudioPinCreate()

NTSTATUS NTAPI USBAudioPinCreate ( _In_ PKSPIN  Pin,
_In_ PIRP  Irp 
)

Definition at line 764 of file pin.c.

767{
768 PKSFILTER Filter;
770 PPIN_CONTEXT PinContext;
772 ULONG FormatIndex;
773
775 if (Filter == NULL)
776 {
777 /* invalid parameter */
779 }
780
781 /* get filter context */
782 FilterContext = Filter->Context;
783
784 /* allocate pin context */
785 PinContext = AllocFunction(sizeof(PIN_CONTEXT));
786 if (!PinContext)
787 {
788 /* no memory*/
790 }
791
792 /* init pin context */
793 PinContext->DeviceExtension = FilterContext->DeviceExtension;
794 PinContext->LowerDevice = FilterContext->LowerDevice;
795 InitializeListHead(&PinContext->IrpListHead);
797 KeInitializeSpinLock(&PinContext->IrpListLock);
798
799 /* store pin context*/
800 Pin->Context = PinContext;
801
802 /* lets edit allocator framing struct */
803 Status = _KsEdit(Pin->Bag, (PVOID*)&Pin->Descriptor, sizeof(KSPIN_DESCRIPTOR_EX), sizeof(KSPIN_DESCRIPTOR_EX), USBAUDIO_TAG);
804 if (NT_SUCCESS(Status))
805 {
806 Status = _KsEdit(Pin->Bag, (PVOID*)&Pin->Descriptor->AllocatorFraming, sizeof(KSALLOCATOR_FRAMING_EX), sizeof(KSALLOCATOR_FRAMING_EX), USBAUDIO_TAG);
808 }
809
810 /* choose correct dataformat */
811 FormatIndex = GetDataRangeIndexForFormat(Pin->ConnectionFormat, Pin->Descriptor->PinDescriptor.DataRanges, Pin->Descriptor->PinDescriptor.DataRangesCount);
812 if (FormatIndex == MAXULONG)
813 {
814 /* no format match */
815 return STATUS_NO_MATCH;
816 }
817
818 /* select streaming interface */
819 Status = USBAudioSelectAudioStreamingInterface(Pin, PinContext, PinContext->DeviceExtension, PinContext->DeviceExtension->ConfigurationDescriptor, FormatIndex);
820 if (!NT_SUCCESS(Status))
821 {
822 /* failed */
823 DPRINT1("USBAudioSelectAudioStreamingInterface failed with %x\n", Status);
824 return Status;
825 }
826
827 if (Pin->DataFlow == KSPIN_DATAFLOW_OUT)
828 {
829 /* init capture pin */
831 }
832 else
833 {
834 /* audio streaming pin*/
836 }
837
838 return Status;
839}
KSDDKAPI NTSTATUS NTAPI _KsEdit(IN KSOBJECT_BAG ObjectBag, IN OUT PVOID *PointerToPointerToItem, IN ULONG NewSize, IN ULONG OldSize, IN ULONG Tag)
Definition: bag.c:358
PKSFILTER NTAPI KsPinGetParentFilter(IN PKSPIN Pin)
Definition: pin.c:1097
NTSTATUS InitCapturePin(IN PKSPIN Pin)
Definition: pin.c:490
NTSTATUS InitStreamPin(IN PKSPIN Pin)
Definition: pin.c:630
ULONG GetDataRangeIndexForFormat(IN PKSDATARANGE ConnectionFormat, IN const PKSDATARANGE *DataRanges, IN ULONG DataRangesCount)
Definition: pin.c:698
NTSTATUS USBAudioSelectAudioStreamingInterface(IN PKSPIN Pin, IN PPIN_CONTEXT PinContext, IN PDEVICE_EXTENSION DeviceExtension, IN PUSB_CONFIGURATION_DESCRIPTOR ConfigurationDescriptor, IN ULONG FormatDescriptorIndex)
Definition: pin.c:168
#define InitializeListHead(ListHead)
Definition: env_spec_w32.h:944
#define KeInitializeSpinLock(sl)
Definition: env_spec_w32.h:604
_Must_inspect_result_ _In_opt_ PFLT_FILTER Filter
Definition: fltkernel.h:1801
_In_ PLIST_ENTRY _In_ PSTRING _In_ USHORT _In_opt_ PSTRING _In_opt_ PSTRING _In_ ULONG _In_ ULONG _In_opt_ PVOID _In_opt_ PVOID FilterContext
Definition: fsrtlfuncs.h:746
@ KSPIN_DATAFLOW_OUT
Definition: ks.h:1250
#define ASSERT(a)
Definition: mode.c:44
#define STATUS_NO_MATCH
Definition: ntstatus.h:751
PDEVICE_EXTENSION DeviceExtension
Definition: usbaudio.h:196
PDEVICE_OBJECT LowerDevice
Definition: usbaudio.h:197
#define MAXULONG
Definition: typedefs.h:251
#define STATUS_INVALID_PARAMETER
Definition: udferr_usr.h:135
#define USBAUDIO_TAG
Definition: usbaudio.h:13

◆ UsbAudioPinDataIntersect()

NTSTATUS NTAPI UsbAudioPinDataIntersect ( _In_ PVOID  Context,
_In_ PIRP  Irp,
_In_ PKSP_PIN  Pin,
_In_ PKSDATARANGE  DataRange,
_In_ PKSDATARANGE  MatchingDataRange,
_In_ ULONG  DataBufferSize,
_Out_ PVOID  Data,
_Out_ PULONG  DataSize 
)

Definition at line 1416 of file pin.c.

1425{
1426 PKSFILTER Filter;
1427 PKSPIN_DESCRIPTOR_EX PinDescriptor;
1429 PKSDATARANGE_AUDIO DataRangeAudio;
1430
1431 /* get filter from irp*/
1433 if (!Filter)
1434 {
1435 /* no match*/
1436 return STATUS_NO_MATCH;
1437 }
1438
1439 /* get pin descriptor */
1440 PinDescriptor = (PKSPIN_DESCRIPTOR_EX)&Filter->Descriptor->PinDescriptors[Pin->PinId];
1441
1443 if (DataBufferSize == 0)
1444 {
1445 /* buffer too small */
1447 }
1448
1449 /* sanity checks*/
1450 ASSERT(PinDescriptor->PinDescriptor.DataRangesCount >= 0);
1451 ASSERT(PinDescriptor->PinDescriptor.DataRanges[0]->FormatSize == sizeof(KSDATARANGE_AUDIO));
1452
1453 DataRangeAudio = (PKSDATARANGE_AUDIO)PinDescriptor->PinDescriptor.DataRanges[0];
1454
1455 DataFormat = Data;
1456 DataFormat->WaveFormatEx.wFormatTag = WAVE_FORMAT_PCM;
1457 DataFormat->WaveFormatEx.nChannels = DataRangeAudio->MaximumChannels;
1458 DataFormat->WaveFormatEx.nSamplesPerSec = DataRangeAudio->MaximumSampleFrequency;
1459 DataFormat->WaveFormatEx.nAvgBytesPerSec = DataRangeAudio->MaximumSampleFrequency * (DataRangeAudio->MaximumBitsPerSample / 8) * DataRangeAudio->MaximumChannels;
1460 DataFormat->WaveFormatEx.nBlockAlign = (DataRangeAudio->MaximumBitsPerSample / 8) * DataRangeAudio->MaximumChannels;
1461 DataFormat->WaveFormatEx.wBitsPerSample = DataRangeAudio->MaximumBitsPerSample;
1462 DataFormat->WaveFormatEx.cbSize = 0;
1463
1464 DataFormat->DataFormat.FormatSize = sizeof(KSDATAFORMAT) + sizeof(WAVEFORMATEX);
1465 DataFormat->DataFormat.Flags = 0;
1466 DataFormat->DataFormat.Reserved = 0;
1467 DataFormat->DataFormat.MajorFormat = KSDATAFORMAT_TYPE_AUDIO;
1468 DataFormat->DataFormat.SubFormat = KSDATAFORMAT_SUBTYPE_PCM;
1469 DataFormat->DataFormat.Specifier = KSDATAFORMAT_SPECIFIER_WAVEFORMATEX;
1470 DataFormat->DataFormat.SampleSize = (DataRangeAudio->MaximumBitsPerSample / 8) * DataRangeAudio->MaximumChannels;
1471
1472 return STATUS_SUCCESS;
1473}
#define WAVE_FORMAT_PCM
Definition: constants.h:425
KSDDKAPI PKSFILTER NTAPI KsGetFilterFromIrp(IN PIRP Irp)
Definition: filter.c:2106
#define KSDATAFORMAT_SUBTYPE_PCM
Definition: ksmedia.h:1021
struct KSDATARANGE_AUDIO * PKSDATARANGE_AUDIO
#define KSDATAFORMAT_TYPE_AUDIO
Definition: ksmedia.h:983
#define KSDATAFORMAT_SPECIFIER_WAVEFORMATEX
Definition: ksmedia.h:1031
_In_ NDIS_STATUS _In_ ULONG _In_ USHORT _In_opt_ PVOID _In_ ULONG DataSize
Definition: ndis.h:4755
#define STATUS_BUFFER_OVERFLOW
Definition: shellext.h:66
ULONG MaximumChannels
Definition: ksmedia.h:680
ULONG MaximumBitsPerSample
Definition: ksmedia.h:682
ULONG MaximumSampleFrequency
Definition: ksmedia.h:684

Referenced by USBAudioPinBuildDescriptors().

◆ USBAudioPinProcess()

NTSTATUS NTAPI USBAudioPinProcess ( _In_ PKSPIN  Pin)

Definition at line 1270 of file pin.c.

1272{
1274
1275 if (Pin->DataFlow == KSPIN_DATAFLOW_OUT)
1276 {
1278 }
1279 else
1280 {
1282 }
1283
1284 return Status;
1285}
NTSTATUS PinRenderProcess(IN PKSPIN Pin)
Definition: pin.c:987
NTSTATUS PinCaptureProcess(IN PKSPIN Pin)
Definition: pin.c:1121

◆ USBAudioPinReset()

VOID NTAPI USBAudioPinReset ( _In_ PKSPIN  Pin)

Definition at line 1290 of file pin.c.

1292{
1294}

◆ USBAudioPinSetDataFormat()

NTSTATUS NTAPI USBAudioPinSetDataFormat ( _In_ PKSPIN  Pin,
_In_opt_ PKSDATAFORMAT  OldFormat,
_In_opt_ PKSMULTIPLE_ITEM  OldAttributeList,
_In_ const KSDATARANGE DataRange,
_In_opt_ const KSATTRIBUTE_LIST *  AttributeRange 
)

Definition at line 1298 of file pin.c.

1304{
1305 if (OldFormat == NULL)
1306 {
1307 /* TODO: verify connection format */
1309 return STATUS_SUCCESS;
1310 }
1311
1312 return UsbAudioSetFormat(Pin);
1313}
NTSTATUS UsbAudioSetFormat(IN PKSPIN Pin)
Definition: pin.c:94

◆ USBAudioPinSetDeviceState()

NTSTATUS NTAPI USBAudioPinSetDeviceState ( _In_ PKSPIN  Pin,
_In_ KSSTATE  ToState,
_In_ KSSTATE  FromState 
)

Definition at line 1392 of file pin.c.

1396{
1398
1399 if (Pin->DataFlow == KSPIN_DATAFLOW_OUT)
1400 {
1401 /* handle capture state changes */
1402 Status = CapturePinStateChange(Pin, ToState, FromState);
1403 }
1404 else
1405 {
1408 }
1409
1410 return Status;
1411}
NTSTATUS CapturePinStateChange(_In_ PKSPIN Pin, _In_ KSSTATE ToState, _In_ KSSTATE FromState)
Definition: pin.c:1359

◆ USBAudioPnPCancelRemove()

VOID NTAPI USBAudioPnPCancelRemove ( _In_ PKSDEVICE  Device,
_In_ PIRP  Irp 
)

Definition at line 377 of file usbaudio.c.

380{
381 /* no op */
382}

◆ USBAudioPnPCancelStop()

VOID NTAPI USBAudioPnPCancelStop ( _In_ PKSDEVICE  Device,
_In_ PIRP  Irp 
)

Definition at line 347 of file usbaudio.c.

350{
351 /* no op */
352}

◆ USBAudioPnPQueryCapabilities()

NTSTATUS NTAPI USBAudioPnPQueryCapabilities ( _In_ PKSDEVICE  Device,
_In_ PIRP  Irp,
_Inout_ PDEVICE_CAPABILITIES  Capabilities 
)

Definition at line 396 of file usbaudio.c.

400{
401 /* TODO: set caps */
403 return STATUS_SUCCESS;
404}

◆ USBAudioPnPQueryPower()

NTSTATUS NTAPI USBAudioPnPQueryPower ( _In_ PKSDEVICE  Device,
_In_ PIRP  Irp,
_In_ DEVICE_POWER_STATE  DeviceTo,
_In_ DEVICE_POWER_STATE  DeviceFrom,
_In_ SYSTEM_POWER_STATE  SystemTo,
_In_ SYSTEM_POWER_STATE  SystemFrom,
_In_ POWER_ACTION  Action 
)

Definition at line 418 of file usbaudio.c.

426{
427 /* no op */
428 return STATUS_SUCCESS;
429}

◆ USBAudioPnPQueryRemove()

NTSTATUS NTAPI USBAudioPnPQueryRemove ( _In_ PKSDEVICE  Device,
_In_ PIRP  Irp 
)

Definition at line 366 of file usbaudio.c.

369{
370 /* no op */
371 return STATUS_SUCCESS;
372}

◆ USBAudioPnPQueryStop()

NTSTATUS NTAPI USBAudioPnPQueryStop ( _In_ PKSDEVICE  Device,
_In_ PIRP  Irp 
)

Definition at line 337 of file usbaudio.c.

340{
341 /* no op */
342 return STATUS_SUCCESS;
343}

◆ USBAudioPnPRemove()

VOID NTAPI USBAudioPnPRemove ( _In_ PKSDEVICE  Device,
_In_ PIRP  Irp 
)

Definition at line 386 of file usbaudio.c.

389{
390 /* TODO: stop device */
392}

◆ USBAudioPnPSetPower()

VOID NTAPI USBAudioPnPSetPower ( _In_ PKSDEVICE  Device,
_In_ PIRP  Irp,
_In_ DEVICE_POWER_STATE  To,
_In_ DEVICE_POWER_STATE  From 
)

Definition at line 433 of file usbaudio.c.

438{
439 /* TODO: stop streams */
441}

◆ USBAudioPnPStart()

NTSTATUS NTAPI USBAudioPnPStart ( _In_ PKSDEVICE  Device,
_In_ PIRP  Irp,
_In_opt_ PCM_RESOURCE_LIST  TranslatedResourceList,
_In_opt_ PCM_RESOURCE_LIST  UntranslatedResourceList 
)

Definition at line 297 of file usbaudio.c.

302{
304 PDEVICE_EXTENSION DeviceExtension;
305
306 if (!Device->Started)
307 {
308 /* alloc context */
309 DeviceExtension = AllocFunction(sizeof(DEVICE_EXTENSION));
310 if (DeviceExtension == NULL)
311 {
312 /* insufficient resources */
314 }
315
316 /* init context */
317 Device->Context = DeviceExtension;
318 DeviceExtension->LowerDevice = Device->NextDeviceObject;
319
320 /* add to object bag*/
322
323 /* init device*/
325 if (NT_SUCCESS(Status))
326 {
327 /* TODO retrieve interface */
329 }
330 }
331
332 return Status;
333}
NTSTATUS NTAPI KsAddItemToObjectBag(IN KSOBJECT_BAG ObjectBag, IN PVOID Item, IN PFNKSFREE Free OPTIONAL)
Definition: bag.c:86
NTSTATUS NTAPI USBAudioCreateFilterContext(PKSDEVICE Device)
Definition: filter.c:1525
#define ExFreePool(addr)
Definition: env_spec_w32.h:352
NTSTATUS NTAPI USBAudioStartDevice(IN PKSDEVICE Device)
Definition: usbaudio.c:171

◆ USBAudioPnPStop()

VOID NTAPI USBAudioPnPStop ( _In_ PKSDEVICE  Device,
_In_ PIRP  Irp 
)

Definition at line 356 of file usbaudio.c.

359{
360 /* TODO: stop device */
362}

◆ USBAudioPnPSurpriseRemoval()

VOID NTAPI USBAudioPnPSurpriseRemoval ( _In_ PKSDEVICE  Device,
_In_ PIRP  Irp 
)

Definition at line 408 of file usbaudio.c.

411{
412 /* TODO: stop streams */
414}

◆ UsbAudioRenderComplete()

NTSTATUS NTAPI UsbAudioRenderComplete ( IN PDEVICE_OBJECT  DeviceObject,
IN PIRP  Irp,
IN PVOID  Context 
)

Definition at line 853 of file pin.c.

857{
858 PKSPIN Pin;
859 PPIN_CONTEXT PinContext;
860 KIRQL OldLevel;
861 PKSSTREAM_POINTER StreamPointerClone;
863 PURB Urb;
864
865 /* get pin context */
866 Pin = Context;
867 PinContext = Pin->Context;
868
869 /* get status */
870 Status = Irp->IoStatus.Status;
871
872 /* get streampointer */
873 StreamPointerClone = Irp->Tail.Overlay.DriverContext[1];
874
875 /* get urb */
876 Urb = Irp->Tail.Overlay.DriverContext[0];
877
878 /* and free it */
879 FreeFunction(Urb);
880
881 /* acquire lock */
882 KeAcquireSpinLock(&PinContext->IrpListLock, &OldLevel);
883
884 /* insert entry into ready list */
885 InsertTailList(&PinContext->IrpListHead, &Irp->Tail.Overlay.ListEntry);
886
887 /* release lock */
888 KeReleaseSpinLock(&PinContext->IrpListLock, OldLevel);
889
890 if (!NT_SUCCESS(Status) && StreamPointerClone)
891 {
892 /* set status code because it failed */
894 DPRINT1("UsbAudioRenderComplete failed with %x\n", Status);
895 }
896
897 if (StreamPointerClone)
898 {
899 /* lets delete the stream pointer clone */
900 KsStreamPointerDelete(StreamPointerClone);
901 }
902
903 /* done */
905}
KSDDKAPI NTSTATUS NTAPI KsStreamPointerSetStatusCode(IN PKSSTREAM_POINTER StreamPointer, IN NTSTATUS Status)
Definition: pin.c:1436
KSDDKAPI VOID NTAPI KsStreamPointerDelete(IN PKSSTREAM_POINTER StreamPointer)
Definition: pin.c:1497
#define STATUS_DEVICE_DATA_ERROR
Definition: udferr_usr.h:159

Referenced by InitStreamPin(), and RenderInitializeUrbAndIrp().