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