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