[AUDIO-BRINGUP]
[reactos.git] / lib / drivers / sound / mmixer / priv.h
1 #pragma once
2
3 #include <pseh/pseh2.h>
4 #include <ntddk.h>
5
6 #include <windef.h>
7 #define NOBITMAP
8 #include <mmreg.h>
9 #include <ks.h>
10 #include <ksmedia.h>
11 #include <mmreg.h>
12 #include <mmsystem.h>
13
14 #include "mmixer.h"
15
16 #include <stdio.h>
17 #define YDEBUG
18 #include <debug.h>
19
20 typedef struct __TOPOLOGY_NODE__
21 {
22 GUID NodeType;
23 ULONG NodeIndex;
24
25 ULONG NodeConnectedToCount;
26 struct __TOPOLOGY_NODE__ ** NodeConnectedTo;
27
28 ULONG NodeConnectedFromCount;
29 struct __TOPOLOGY_NODE__ ** NodeConnectedFrom;
30 PULONG LogicalPinNodeConnectedFrom;
31
32 ULONG PinConnectedFromCount;
33 PULONG PinConnectedFrom;
34
35 ULONG PinConnectedToCount;
36 PULONG PinConnectedTo;
37
38 ULONG Visited;
39 ULONG Reserved;
40 }TOPOLOGY_NODE, *PTOPOLOGY_NODE;
41
42 typedef struct
43 {
44 ULONG PinId;
45
46 ULONG NodesConnectedToCount;
47 PTOPOLOGY_NODE * NodesConnectedTo;
48
49 ULONG NodesConnectedFromCount;
50 PTOPOLOGY_NODE * NodesConnectedFrom;
51
52 ULONG PinConnectedFromCount;
53 PULONG PinConnectedFrom;
54
55 ULONG PinConnectedToCount;
56 PULONG PinConnectedTo;
57
58
59 ULONG Visited;
60 }PIN, *PPIN;
61
62
63 typedef struct
64 {
65 ULONG TopologyPinsCount;
66 PPIN TopologyPins;
67
68 ULONG TopologyNodesCount;
69 PTOPOLOGY_NODE TopologyNodes;
70
71 }TOPOLOGY, *PTOPOLOGY;
72
73 typedef struct
74 {
75 LIST_ENTRY Entry;
76 MIXERCAPSW MixCaps;
77 HANDLE hMixer;
78 LIST_ENTRY LineList;
79 ULONG ControlId;
80 LIST_ENTRY EventList;
81 }MIXER_INFO, *LPMIXER_INFO;
82
83 typedef struct
84 {
85 LIST_ENTRY Entry;
86 ULONG PinId;
87 HANDLE hDevice;
88 MIXERLINEW Line;
89 LPMIXERCONTROLW LineControls;
90 PULONG NodeIds;
91 LIST_ENTRY LineControlsExtraData;
92 }MIXERLINE_EXT, *LPMIXERLINE_EXT;
93
94 typedef struct
95 {
96 LIST_ENTRY Entry;
97 ULONG dwControlID;
98 }MIXERCONTROL_DATA, *LPMIXERCONTROL_DATA;
99
100 typedef struct
101 {
102 MIXERCONTROL_DATA Header;
103 LONG SignedMinimum;
104 LONG SignedMaximum;
105 LONG SteppingDelta;
106 ULONG InputSteppingDelta;
107 ULONG ValuesCount;
108 PLONG Values;
109 }MIXERVOLUME_DATA, *LPMIXERVOLUME_DATA;
110
111 typedef struct
112 {
113 LIST_ENTRY Entry;
114 ULONG DeviceId;
115 HANDLE hDevice;
116 HANDLE hDeviceInterfaceKey;
117 LPWSTR DeviceName;
118 PTOPOLOGY Topology;
119 }MIXER_DATA, *LPMIXER_DATA;
120
121 typedef struct
122 {
123 LIST_ENTRY Entry;
124 ULONG DeviceId;
125 ULONG PinId;
126 union
127 {
128 WAVEOUTCAPSW OutCaps;
129 WAVEINCAPSW InCaps;
130 }u;
131 }WAVE_INFO, *LPWAVE_INFO;
132
133 typedef struct
134 {
135 LIST_ENTRY Entry;
136 ULONG DeviceId;
137 ULONG PinId;
138 union
139 {
140 MIDIOUTCAPSW OutCaps;
141 MIDIINCAPSW InCaps;
142 }u;
143
144 }MIDI_INFO, *LPMIDI_INFO;
145
146 typedef struct
147 {
148 ULONG MixerListCount;
149 LIST_ENTRY MixerList;
150
151 ULONG MixerDataCount;
152 LIST_ENTRY MixerData;
153
154 ULONG WaveInListCount;
155 LIST_ENTRY WaveInList;
156
157 ULONG WaveOutListCount;
158 LIST_ENTRY WaveOutList;
159
160 ULONG MidiInListCount;
161 LIST_ENTRY MidiInList;
162
163 ULONG MidiOutListCount;
164 LIST_ENTRY MidiOutList;
165 }MIXER_LIST, *PMIXER_LIST;
166
167 typedef struct
168 {
169 LIST_ENTRY Entry;
170 PVOID MixerEventContext;
171 PMIXER_EVENT MixerEventRoutine;
172
173 }EVENT_NOTIFICATION_ENTRY, *PEVENT_NOTIFICATION_ENTRY;
174
175 #define DESTINATION_LINE (0xFFFF0000)
176 #define SOURCE_LINE (0x10000)
177 ULONG
178 MMixerGetFilterPinCount(
179 IN PMIXER_CONTEXT MixerContext,
180 IN HANDLE hMixer);
181
182 LPGUID
183 MMixerGetNodeType(
184 IN PKSMULTIPLE_ITEM MultipleItem,
185 IN ULONG Index);
186
187 MIXER_STATUS
188 MMixerGetNodeIndexes(
189 IN PMIXER_CONTEXT MixerContext,
190 IN PKSMULTIPLE_ITEM MultipleItem,
191 IN ULONG NodeIndex,
192 IN ULONG bNode,
193 IN ULONG bFrom,
194 OUT PULONG NodeReferenceCount,
195 OUT PULONG *NodeReference);
196
197 PKSTOPOLOGY_CONNECTION
198 MMixerGetConnectionByIndex(
199 IN PKSMULTIPLE_ITEM MultipleItem,
200 IN ULONG Index);
201
202 ULONG
203 MMixerGetControlTypeFromTopologyNode(
204 IN LPGUID NodeType);
205
206 LPMIXERLINE_EXT
207 MMixerGetSourceMixerLineByLineId(
208 LPMIXER_INFO MixerInfo,
209 DWORD dwLineID);
210
211 MIXER_STATUS
212 MMixerGetFilterTopologyProperty(
213 IN PMIXER_CONTEXT MixerContext,
214 IN HANDLE hMixer,
215 IN ULONG PropertyId,
216 OUT PKSMULTIPLE_ITEM * OutMultipleItem);
217
218 VOID
219 MMixerFreeMixerInfo(
220 IN PMIXER_CONTEXT MixerContext,
221 IN LPMIXER_INFO MixerInfo);
222
223 MIXER_STATUS
224 MMixerGetPhysicalConnection(
225 IN PMIXER_CONTEXT MixerContext,
226 IN HANDLE hMixer,
227 IN ULONG PinId,
228 OUT PKSPIN_PHYSICALCONNECTION *OutConnection);
229
230 MIXER_STATUS
231 MMixerSetupFilter(
232 IN PMIXER_CONTEXT MixerContext,
233 IN PMIXER_LIST MixerList,
234 IN LPMIXER_DATA MixerData,
235 IN PULONG DeviceCount);
236
237 PKSPIN_CONNECT
238 MMixerAllocatePinConnect(
239 IN PMIXER_CONTEXT MixerContext,
240 ULONG DataFormatSize);
241
242 MIXER_STATUS
243 MMixerGetAudioPinDataRanges(
244 IN PMIXER_CONTEXT MixerContext,
245 IN HANDLE hDevice,
246 IN ULONG PinId,
247 IN OUT PKSMULTIPLE_ITEM * OutMultipleItem);
248
249 VOID
250 MMixerInitializeMidiForFilter(
251 IN PMIXER_CONTEXT MixerContext,
252 IN PMIXER_LIST MixerList,
253 IN LPMIXER_DATA MixerData,
254 IN PTOPOLOGY Topology);
255
256 MIXER_STATUS
257 MMixerVerifyContext(
258 IN PMIXER_CONTEXT MixerContext);
259
260 LPMIXER_INFO
261 MMixerGetMixerInfoByIndex(
262 IN PMIXER_CONTEXT MixerContext,
263 IN ULONG MixerIndex);
264
265 LPMIXERLINE_EXT
266 MMixerGetSourceMixerLineByComponentType(
267 LPMIXER_INFO MixerInfo,
268 DWORD dwComponentType);
269
270 MIXER_STATUS
271 MMixerGetMixerControlById(
272 LPMIXER_INFO MixerInfo,
273 DWORD dwControlID,
274 LPMIXERLINE_EXT *MixerLine,
275 LPMIXERCONTROLW *MixerControl,
276 PULONG NodeId);
277
278 MIXER_STATUS
279 MMixerSetGetMuteControlDetails(
280 IN PMIXER_CONTEXT MixerContext,
281 IN LPMIXER_INFO MixerInfo,
282 IN ULONG NodeId,
283 IN ULONG dwLineID,
284 IN LPMIXERCONTROLDETAILS MixerControlDetails,
285 IN ULONG bSet);
286
287 MIXER_STATUS
288 MMixerSetGetVolumeControlDetails(
289 IN PMIXER_CONTEXT MixerContext,
290 IN LPMIXER_INFO MixerInfo,
291 IN ULONG NodeId,
292 IN ULONG bSet,
293 LPMIXERCONTROLW MixerControl,
294 IN LPMIXERCONTROLDETAILS MixerControlDetails,
295 LPMIXERLINE_EXT MixerLine);
296
297 MIXER_STATUS
298 MMixerSetGetControlDetails(
299 IN PMIXER_CONTEXT MixerContext,
300 IN HANDLE hMixer,
301 IN ULONG NodeId,
302 IN ULONG bSet,
303 IN ULONG PropertyId,
304 IN ULONG Channel,
305 IN PLONG InputValue);
306
307 LPMIXER_DATA
308 MMixerGetDataByDeviceId(
309 IN PMIXER_LIST MixerList,
310 IN ULONG DeviceId);
311
312 LPMIXER_DATA
313 MMixerGetDataByDeviceName(
314 IN PMIXER_LIST MixerList,
315 IN LPWSTR DeviceName);
316
317 MIXER_STATUS
318 MMixerCreateMixerData(
319 IN PMIXER_CONTEXT MixerContext,
320 IN PMIXER_LIST MixerList,
321 IN ULONG DeviceId,
322 IN LPWSTR DeviceName,
323 IN HANDLE hDevice,
324 IN HANDLE hKey);
325
326 MIXER_STATUS
327 MMixerInitializeWaveInfo(
328 IN PMIXER_CONTEXT MixerContext,
329 IN PMIXER_LIST MixerList,
330 IN LPMIXER_DATA MixerData,
331 IN LPWSTR DeviceName,
332 IN ULONG bWaveIn,
333 IN ULONG PinCount,
334 IN PULONG Pins);
335
336 MIXER_STATUS
337 MMixerAddEvent(
338 IN PMIXER_CONTEXT MixerContext,
339 IN OUT LPMIXER_INFO MixerInfo,
340 IN PVOID MixerEvent,
341 IN PMIXER_EVENT MixerEventRoutine);
342
343 MIXER_STATUS
344 MMixerGetDeviceName(
345 IN PMIXER_CONTEXT MixerContext,
346 OUT LPWSTR DeviceName,
347 IN HANDLE hKey);
348
349 VOID
350 MMixerInitializePinConnect(
351 IN OUT PKSPIN_CONNECT PinConnect,
352 IN ULONG PinId);
353
354 MIXER_STATUS
355 MMixerGetPinDataFlowAndCommunication(
356 IN PMIXER_CONTEXT MixerContext,
357 IN HANDLE hDevice,
358 IN ULONG PinId,
359 OUT PKSPIN_DATAFLOW DataFlow,
360 OUT PKSPIN_COMMUNICATION Communication);
361
362
363 /* topology.c */
364
365 MIXER_STATUS
366 MMixerCreateTopology(
367 IN PMIXER_CONTEXT MixerContext,
368 IN ULONG PinCount,
369 IN PKSMULTIPLE_ITEM NodeConnections,
370 IN PKSMULTIPLE_ITEM NodeTypes,
371 OUT PTOPOLOGY *OutTopology);
372
373 VOID
374 MMixerGetAllUpOrDownstreamPinsFromNodeIndex(
375 IN PMIXER_CONTEXT MixerContext,
376 IN PTOPOLOGY Topology,
377 IN ULONG NodeIndex,
378 IN ULONG bUpStream,
379 OUT PULONG OutPinsCount,
380 OUT PULONG OutPins);
381
382 MIXER_STATUS
383 MMixerGetAllUpOrDownstreamPinsFromPinIndex(
384 IN PMIXER_CONTEXT MixerContext,
385 IN PTOPOLOGY Topology,
386 IN ULONG PinIndex,
387 IN ULONG bUpStream,
388 OUT PULONG OutPinsCount,
389 OUT PULONG OutPins);
390
391 VOID
392 MMixerGetNextNodesFromPinIndex(
393 IN PMIXER_CONTEXT MixerContext,
394 IN PTOPOLOGY Topology,
395 IN ULONG PinIndex,
396 IN ULONG bUpStream,
397 OUT PULONG OutNodesCount,
398 OUT PULONG OutNodes);
399
400 MIXER_STATUS
401 MMixerAllocateTopologyPinArray(
402 IN PMIXER_CONTEXT MixerContext,
403 IN PTOPOLOGY Topology,
404 OUT PULONG * OutPins);
405
406 MIXER_STATUS
407 MMixerAllocateTopologyNodeArray(
408 IN PMIXER_CONTEXT MixerContext,
409 IN PTOPOLOGY Topology,
410 OUT PULONG * OutPins);
411
412 VOID
413 MMixerGetAllUpOrDownstreamNodesFromPinIndex(
414 IN PMIXER_CONTEXT MixerContext,
415 IN PTOPOLOGY Topology,
416 IN ULONG PinIndex,
417 IN ULONG bUpStream,
418 OUT PULONG OutNodesCount,
419 OUT PULONG OutNodes);
420
421 VOID
422 MMixerIsNodeTerminator(
423 IN PTOPOLOGY Topology,
424 IN ULONG NodeIndex,
425 OUT ULONG * bTerminator);
426
427 VOID
428 MMixerGetNextNodesFromNodeIndex(
429 IN PMIXER_CONTEXT MixerContext,
430 IN PTOPOLOGY Topology,
431 IN ULONG NodeIndex,
432 IN ULONG bUpStream,
433 OUT PULONG OutNodesCount,
434 OUT PULONG OutNodes);
435
436 LPGUID
437 MMixerGetNodeTypeFromTopology(
438 IN PTOPOLOGY Topology,
439 IN ULONG NodeIndex);
440
441 MIXER_STATUS
442 MMixerGetAllUpOrDownstreamNodesFromNodeIndex(
443 IN PMIXER_CONTEXT MixerContext,
444 IN PTOPOLOGY Topology,
445 IN ULONG NodeIndex,
446 IN ULONG bUpStream,
447 OUT PULONG OutNodesCount,
448 OUT PULONG OutNodes);
449
450 MIXER_STATUS
451 MMixerIsNodeConnectedToPin(
452 IN PMIXER_CONTEXT MixerContext,
453 IN PTOPOLOGY Topology,
454 IN ULONG NodeIndex,
455 IN ULONG PinId,
456 IN ULONG bUpStream,
457 OUT PULONG bConnected);
458
459 ULONG
460 MMixerGetNodeIndexFromGuid(
461 IN PTOPOLOGY Topology,
462 IN const GUID *NodeType);
463
464 VOID
465 MMixerSetTopologyNodeReserved(
466 IN PTOPOLOGY Topology,
467 IN ULONG NodeIndex);
468
469 VOID
470 MMixerIsTopologyNodeReserved(
471 IN PTOPOLOGY Topology,
472 IN ULONG NodeIndex,
473 OUT PULONG bReserved);
474
475 VOID
476 MMixerGetTopologyPinCount(
477 IN PTOPOLOGY Topology,
478 OUT PULONG PinCount);
479