815e6515f072a90764ce584d329ffc58580ac251
[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 ULONG Visited;
59 ULONG Reserved;
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 LIST_ENTRY LineList;
78 ULONG ControlId;
79 LIST_ENTRY EventList;
80 }MIXER_INFO, *LPMIXER_INFO;
81
82 typedef struct
83 {
84 LIST_ENTRY Entry;
85 MIXERCONTROLW Control;
86 ULONG NodeID;
87 HANDLE hDevice;
88 PVOID ExtraData;
89 }MIXERCONTROL_EXT, *LPMIXERCONTROL_EXT;
90
91 typedef struct
92 {
93 LIST_ENTRY Entry;
94 ULONG PinId;
95 MIXERLINEW Line;
96 LIST_ENTRY ControlsList;
97
98 }MIXERLINE_EXT, *LPMIXERLINE_EXT;
99
100 typedef struct
101 {
102 LIST_ENTRY Entry;
103 ULONG dwControlID;
104 }MIXERCONTROL_DATA, *LPMIXERCONTROL_DATA;
105
106 typedef struct
107 {
108 MIXERCONTROL_DATA Header;
109 LONG SignedMinimum;
110 LONG SignedMaximum;
111 LONG SteppingDelta;
112 ULONG InputSteppingDelta;
113 ULONG ValuesCount;
114 PLONG Values;
115 }MIXERVOLUME_DATA, *LPMIXERVOLUME_DATA;
116
117 typedef struct
118 {
119 LIST_ENTRY Entry;
120 ULONG DeviceId;
121 HANDLE hDevice;
122 HANDLE hDeviceInterfaceKey;
123 LPWSTR DeviceName;
124 PTOPOLOGY Topology;
125 }MIXER_DATA, *LPMIXER_DATA;
126
127 typedef struct
128 {
129 LIST_ENTRY Entry;
130 ULONG DeviceId;
131 ULONG PinId;
132 union
133 {
134 WAVEOUTCAPSW OutCaps;
135 WAVEINCAPSW InCaps;
136 }u;
137 }WAVE_INFO, *LPWAVE_INFO;
138
139 typedef struct
140 {
141 LIST_ENTRY Entry;
142 ULONG DeviceId;
143 ULONG PinId;
144 union
145 {
146 MIDIOUTCAPSW OutCaps;
147 MIDIINCAPSW InCaps;
148 }u;
149
150 }MIDI_INFO, *LPMIDI_INFO;
151
152 typedef struct
153 {
154 ULONG MixerListCount;
155 LIST_ENTRY MixerList;
156
157 ULONG MixerDataCount;
158 LIST_ENTRY MixerData;
159
160 ULONG WaveInListCount;
161 LIST_ENTRY WaveInList;
162
163 ULONG WaveOutListCount;
164 LIST_ENTRY WaveOutList;
165
166 ULONG MidiInListCount;
167 LIST_ENTRY MidiInList;
168
169 ULONG MidiOutListCount;
170 LIST_ENTRY MidiOutList;
171 }MIXER_LIST, *PMIXER_LIST;
172
173 typedef struct
174 {
175 LIST_ENTRY Entry;
176 PVOID MixerEventContext;
177 PMIXER_EVENT MixerEventRoutine;
178
179 }EVENT_NOTIFICATION_ENTRY, *PEVENT_NOTIFICATION_ENTRY;
180
181 #define DESTINATION_LINE (0xFFFF0000)
182 #define SOURCE_LINE (0x10000)
183 ULONG
184 MMixerGetFilterPinCount(
185 IN PMIXER_CONTEXT MixerContext,
186 IN HANDLE hMixer);
187
188 LPGUID
189 MMixerGetNodeType(
190 IN PKSMULTIPLE_ITEM MultipleItem,
191 IN ULONG Index);
192
193 MIXER_STATUS
194 MMixerGetNodeIndexes(
195 IN PMIXER_CONTEXT MixerContext,
196 IN PKSMULTIPLE_ITEM MultipleItem,
197 IN ULONG NodeIndex,
198 IN ULONG bNode,
199 IN ULONG bFrom,
200 OUT PULONG NodeReferenceCount,
201 OUT PULONG *NodeReference);
202
203 PKSTOPOLOGY_CONNECTION
204 MMixerGetConnectionByIndex(
205 IN PKSMULTIPLE_ITEM MultipleItem,
206 IN ULONG Index);
207
208 ULONG
209 MMixerGetControlTypeFromTopologyNode(
210 IN LPGUID NodeType);
211
212 LPMIXERLINE_EXT
213 MMixerGetSourceMixerLineByLineId(
214 LPMIXER_INFO MixerInfo,
215 DWORD dwLineID);
216
217 MIXER_STATUS
218 MMixerGetFilterTopologyProperty(
219 IN PMIXER_CONTEXT MixerContext,
220 IN HANDLE hMixer,
221 IN ULONG PropertyId,
222 OUT PKSMULTIPLE_ITEM * OutMultipleItem);
223
224 VOID
225 MMixerFreeMixerInfo(
226 IN PMIXER_CONTEXT MixerContext,
227 IN LPMIXER_INFO MixerInfo);
228
229 MIXER_STATUS
230 MMixerGetPhysicalConnection(
231 IN PMIXER_CONTEXT MixerContext,
232 IN HANDLE hMixer,
233 IN ULONG PinId,
234 OUT PKSPIN_PHYSICALCONNECTION *OutConnection);
235
236 MIXER_STATUS
237 MMixerSetupFilter(
238 IN PMIXER_CONTEXT MixerContext,
239 IN PMIXER_LIST MixerList,
240 IN LPMIXER_DATA MixerData,
241 IN PULONG DeviceCount);
242
243 PKSPIN_CONNECT
244 MMixerAllocatePinConnect(
245 IN PMIXER_CONTEXT MixerContext,
246 ULONG DataFormatSize);
247
248 MIXER_STATUS
249 MMixerGetAudioPinDataRanges(
250 IN PMIXER_CONTEXT MixerContext,
251 IN HANDLE hDevice,
252 IN ULONG PinId,
253 IN OUT PKSMULTIPLE_ITEM * OutMultipleItem);
254
255 VOID
256 MMixerInitializeMidiForFilter(
257 IN PMIXER_CONTEXT MixerContext,
258 IN PMIXER_LIST MixerList,
259 IN LPMIXER_DATA MixerData,
260 IN PTOPOLOGY Topology);
261
262 MIXER_STATUS
263 MMixerVerifyContext(
264 IN PMIXER_CONTEXT MixerContext);
265
266 LPMIXER_INFO
267 MMixerGetMixerInfoByIndex(
268 IN PMIXER_CONTEXT MixerContext,
269 IN ULONG MixerIndex);
270
271 LPMIXERLINE_EXT
272 MMixerGetSourceMixerLineByComponentType(
273 LPMIXER_INFO MixerInfo,
274 DWORD dwComponentType);
275
276 MIXER_STATUS
277 MMixerGetMixerControlById(
278 LPMIXER_INFO MixerInfo,
279 DWORD dwControlID,
280 LPMIXERLINE_EXT *MixerLine,
281 LPMIXERCONTROL_EXT *MixerControl,
282 PULONG NodeId);
283
284 MIXER_STATUS
285 MMixerSetGetMuteControlDetails(
286 IN PMIXER_CONTEXT MixerContext,
287 IN LPMIXER_INFO MixerInfo,
288 IN LPMIXERCONTROL_EXT MixerControl,
289 IN ULONG dwLineID,
290 IN LPMIXERCONTROLDETAILS MixerControlDetails,
291 IN ULONG bSet);
292
293 MIXER_STATUS
294 MMixerSetGetVolumeControlDetails(
295 IN PMIXER_CONTEXT MixerContext,
296 IN LPMIXER_INFO MixerInfo,
297 IN ULONG NodeId,
298 IN ULONG bSet,
299 LPMIXERCONTROL_EXT MixerControl,
300 IN LPMIXERCONTROLDETAILS MixerControlDetails,
301 LPMIXERLINE_EXT MixerLine);
302
303 MIXER_STATUS
304 MMixerSetGetControlDetails(
305 IN PMIXER_CONTEXT MixerContext,
306 IN HANDLE hMixer,
307 IN ULONG NodeId,
308 IN ULONG bSet,
309 IN ULONG PropertyId,
310 IN ULONG Channel,
311 IN PLONG InputValue);
312
313 LPMIXER_DATA
314 MMixerGetDataByDeviceId(
315 IN PMIXER_LIST MixerList,
316 IN ULONG DeviceId);
317
318 LPMIXER_DATA
319 MMixerGetDataByDeviceName(
320 IN PMIXER_LIST MixerList,
321 IN LPWSTR DeviceName);
322
323 MIXER_STATUS
324 MMixerCreateMixerData(
325 IN PMIXER_CONTEXT MixerContext,
326 IN PMIXER_LIST MixerList,
327 IN ULONG DeviceId,
328 IN LPWSTR DeviceName,
329 IN HANDLE hDevice,
330 IN HANDLE hKey);
331
332 MIXER_STATUS
333 MMixerInitializeWaveInfo(
334 IN PMIXER_CONTEXT MixerContext,
335 IN PMIXER_LIST MixerList,
336 IN LPMIXER_DATA MixerData,
337 IN LPWSTR DeviceName,
338 IN ULONG bWaveIn,
339 IN ULONG PinCount,
340 IN PULONG Pins);
341
342 MIXER_STATUS
343 MMixerAddEvent(
344 IN PMIXER_CONTEXT MixerContext,
345 IN OUT LPMIXER_INFO MixerInfo,
346 IN PVOID MixerEvent,
347 IN PMIXER_EVENT MixerEventRoutine);
348
349 MIXER_STATUS
350 MMixerGetDeviceName(
351 IN PMIXER_CONTEXT MixerContext,
352 OUT LPWSTR DeviceName,
353 IN HANDLE hKey);
354
355 VOID
356 MMixerInitializePinConnect(
357 IN OUT PKSPIN_CONNECT PinConnect,
358 IN ULONG PinId);
359
360 MIXER_STATUS
361 MMixerGetPinDataFlowAndCommunication(
362 IN PMIXER_CONTEXT MixerContext,
363 IN HANDLE hDevice,
364 IN ULONG PinId,
365 OUT PKSPIN_DATAFLOW DataFlow,
366 OUT PKSPIN_COMMUNICATION Communication);
367
368 VOID
369 MMixerHandleAlternativeMixers(
370 IN PMIXER_CONTEXT MixerContext,
371 IN PMIXER_LIST MixerList,
372 IN LPMIXER_DATA MixerData,
373 IN PTOPOLOGY Topology);
374
375
376 /* topology.c */
377
378 MIXER_STATUS
379 MMixerCreateTopology(
380 IN PMIXER_CONTEXT MixerContext,
381 IN ULONG PinCount,
382 IN PKSMULTIPLE_ITEM NodeConnections,
383 IN PKSMULTIPLE_ITEM NodeTypes,
384 OUT PTOPOLOGY *OutTopology);
385
386 VOID
387 MMixerGetAllUpOrDownstreamPinsFromNodeIndex(
388 IN PMIXER_CONTEXT MixerContext,
389 IN PTOPOLOGY Topology,
390 IN ULONG NodeIndex,
391 IN ULONG bUpStream,
392 OUT PULONG OutPinsCount,
393 OUT PULONG OutPins);
394
395 MIXER_STATUS
396 MMixerGetAllUpOrDownstreamPinsFromPinIndex(
397 IN PMIXER_CONTEXT MixerContext,
398 IN PTOPOLOGY Topology,
399 IN ULONG PinIndex,
400 IN ULONG bUpStream,
401 OUT PULONG OutPinsCount,
402 OUT PULONG OutPins);
403
404 VOID
405 MMixerGetNextNodesFromPinIndex(
406 IN PMIXER_CONTEXT MixerContext,
407 IN PTOPOLOGY Topology,
408 IN ULONG PinIndex,
409 IN ULONG bUpStream,
410 OUT PULONG OutNodesCount,
411 OUT PULONG OutNodes);
412
413 MIXER_STATUS
414 MMixerAllocateTopologyPinArray(
415 IN PMIXER_CONTEXT MixerContext,
416 IN PTOPOLOGY Topology,
417 OUT PULONG * OutPins);
418
419 MIXER_STATUS
420 MMixerAllocateTopologyNodeArray(
421 IN PMIXER_CONTEXT MixerContext,
422 IN PTOPOLOGY Topology,
423 OUT PULONG * OutPins);
424
425 VOID
426 MMixerGetAllUpOrDownstreamNodesFromPinIndex(
427 IN PMIXER_CONTEXT MixerContext,
428 IN PTOPOLOGY Topology,
429 IN ULONG PinIndex,
430 IN ULONG bUpStream,
431 OUT PULONG OutNodesCount,
432 OUT PULONG OutNodes);
433
434 VOID
435 MMixerIsNodeTerminator(
436 IN PTOPOLOGY Topology,
437 IN ULONG NodeIndex,
438 OUT ULONG * bTerminator);
439
440 VOID
441 MMixerGetNextNodesFromNodeIndex(
442 IN PMIXER_CONTEXT MixerContext,
443 IN PTOPOLOGY Topology,
444 IN ULONG NodeIndex,
445 IN ULONG bUpStream,
446 OUT PULONG OutNodesCount,
447 OUT PULONG OutNodes);
448
449 LPGUID
450 MMixerGetNodeTypeFromTopology(
451 IN PTOPOLOGY Topology,
452 IN ULONG NodeIndex);
453
454 MIXER_STATUS
455 MMixerGetAllUpOrDownstreamNodesFromNodeIndex(
456 IN PMIXER_CONTEXT MixerContext,
457 IN PTOPOLOGY Topology,
458 IN ULONG NodeIndex,
459 IN ULONG bUpStream,
460 OUT PULONG OutNodesCount,
461 OUT PULONG OutNodes);
462
463 MIXER_STATUS
464 MMixerIsNodeConnectedToPin(
465 IN PMIXER_CONTEXT MixerContext,
466 IN PTOPOLOGY Topology,
467 IN ULONG NodeIndex,
468 IN ULONG PinId,
469 IN ULONG bUpStream,
470 OUT PULONG bConnected);
471
472 ULONG
473 MMixerGetNodeIndexFromGuid(
474 IN PTOPOLOGY Topology,
475 IN const GUID *NodeType);
476
477 VOID
478 MMixerSetTopologyNodeReserved(
479 IN PTOPOLOGY Topology,
480 IN ULONG NodeIndex);
481
482 VOID
483 MMixerIsTopologyNodeReserved(
484 IN PTOPOLOGY Topology,
485 IN ULONG NodeIndex,
486 OUT PULONG bReserved);
487
488 VOID
489 MMixerSetTopologyPinReserved(
490 IN PTOPOLOGY Topology,
491 IN ULONG PinId);
492
493 VOID
494 MMixerIsTopologyPinReserved(
495 IN PTOPOLOGY Topology,
496 IN ULONG PinId,
497 OUT PULONG bReserved);
498
499 VOID
500 MMixerGetTopologyPinCount(
501 IN PTOPOLOGY Topology,
502 OUT PULONG PinCount);
503