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