bb598c379545e61a87438bd9766b4e7631d93be0
[reactos.git] / reactos / drivers / wdm / audio / sysaudio / sysaudio.h
1 #include <ntifs.h>
2 #include <ntddk.h>
3 #include <portcls.h>
4 #include <ks.h>
5 #include <ksmedia.h>
6 #include <math.h>
7 #include <stdio.h>
8
9 typedef struct
10 {
11 HANDLE PinHandle; // handle to audio irp pin
12 ULONG References; // number of clients having a reference to this audio irp pin
13 }PIN_INFO;
14
15 typedef struct
16 {
17 LIST_ENTRY Entry; // device entry for KsAudioDeviceList
18 UNICODE_STRING DeviceName; // symbolic link of audio device
19
20 HANDLE Handle; // handle to audio device
21 PFILE_OBJECT FileObject; // file objecto to audio device
22
23 //PIN_INFO * Pins; // array of PIN_INFO
24 }KSAUDIO_DEVICE_ENTRY, *PKSAUDIO_DEVICE_ENTRY;
25
26 typedef struct
27 {
28 KSDEVICE_HEADER KsDeviceHeader; // ks streaming header - must always be first item in device extension
29 PDEVICE_OBJECT PhysicalDeviceObject; // pdo
30 PDEVICE_OBJECT NextDeviceObject; // lower device object
31 ULONG NumberOfKsAudioDevices; // number of audio devices
32
33 LIST_ENTRY KsAudioDeviceList; // audio device list
34 PVOID KsAudioNotificationEntry; // ks audio notification hook
35 PVOID EchoCancelNotificationEntry; // ks echo cancel notification hook
36 KSPIN_LOCK Lock; // audio device list mutex
37
38 PFILE_OBJECT KMixerFileObject; // mixer file object
39 HANDLE KMixerHandle; // mixer file handle
40
41 }SYSAUDIODEVEXT, *PSYSAUDIODEVEXT;
42
43 // struct DISPATCH_CONTEXT
44 //
45 // This structure is used to dispatch read / write / device io requests
46 // It is stored in the file object FsContext2 member
47 // Note: FsContext member is reserved for ks object header
48
49 typedef struct
50 {
51 KSOBJECT_HEADER ObjectHeader; // pin object header
52 HANDLE Handle; // audio irp pin handle
53 ULONG PinId; // pin id of device
54 PKSAUDIO_DEVICE_ENTRY AudioEntry; // pointer to audio device entry
55
56 HANDLE hMixerPin; // handle to mixer pin
57 }DISPATCH_CONTEXT, *PDISPATCH_CONTEXT;
58
59 NTSTATUS
60 SysAudioAllocateDeviceHeader(
61 IN SYSAUDIODEVEXT *DeviceExtension);
62
63 NTSTATUS
64 SysAudioRegisterDeviceInterfaces(
65 IN PDEVICE_OBJECT DeviceObject);
66
67 NTSTATUS
68 SysAudioRegisterNotifications(
69 IN PDRIVER_OBJECT DriverObject,
70 IN PDEVICE_OBJECT DeviceObject);
71
72 NTSTATUS
73 SysAudioHandleProperty(
74 PDEVICE_OBJECT DeviceObject,
75 PIRP Irp);
76
77 NTSTATUS
78 SysAudioOpenKMixer(
79 IN SYSAUDIODEVEXT *DeviceExtension);
80
81 NTSTATUS
82 OpenDevice(
83 IN PUNICODE_STRING DeviceName,
84 IN PHANDLE HandleOut,
85 IN PFILE_OBJECT * FileObjectOut);
86
87 PKSAUDIO_DEVICE_ENTRY
88 GetListEntry(
89 IN PLIST_ENTRY Head,
90 IN ULONG Index);
91
92 NTSTATUS
93 NTAPI
94 DispatchCreateSysAudioPin(
95 IN PDEVICE_OBJECT DeviceObject,
96 IN PIRP Irp);
97
98 ULONG
99 GetDeviceCount(
100 PSYSAUDIODEVEXT DeviceExtension,
101 BOOL WaveIn);
102
103 NTSTATUS
104 GetPinInstanceCount(
105 PKSAUDIO_DEVICE_ENTRY Entry,
106 PKSPIN_CINSTANCES PinInstances,
107 PKSPIN_CONNECT PinConnect);
108
109 NTSTATUS
110 ComputeCompatibleFormat(
111 IN PKSAUDIO_DEVICE_ENTRY Entry,
112 IN ULONG PinId,
113 IN PKSDATAFORMAT_WAVEFORMATEX ClientFormat,
114 OUT PKSDATAFORMAT_WAVEFORMATEX MixerFormat);
115
116 PVOID
117 AllocateItem(
118 IN POOL_TYPE PoolType,
119 IN SIZE_T NumberOfBytes);
120
121 VOID
122 FreeItem(
123 IN PVOID Item);
124