ReactOS 0.4.16-dev-311-g9382aa2
mmdrv.h
Go to the documentation of this file.
1/*
2 *
3 * COPYRIGHT: See COPYING in the top level directory
4 * PROJECT: ReactOS Multimedia
5 * FILE: dll/win32/mmdrv/mmdrv.h
6 * PURPOSE: Multimedia User Mode Driver (header)
7 * PROGRAMMER: Andrew Greenwood
8 * Aleksey Bragin
9 * UPDATE HISTORY:
10 * Jan 30, 2004: Imported into ReactOS tree
11 * Jan 10, 2007: Rewritten and tidied up
12 */
13
14#ifndef MMDRV_H
15#define MMDRV_H
16
17#include <stdarg.h>
18
19#define WIN32_NO_STATUS
20#include <windef.h>
21#include <winbase.h>
22#include <winioctl.h>
23
24#include "mmioctl.h"
25#include "mmddk.h"
26
27/* Need to check these */
28#define MAX_DEVICES 256
29#define MAX_DEVICE_NAME_LENGTH 256
30#define MAX_BUFFER_SIZE 1048576
31#define MAX_WAVE_BYTES 1048576
32
33/* Custom flag set when overlapped I/O is done */
34#define WHDR_COMPLETE 0x80000000
35
36
37/*
38 The kinds of devices which MMSYSTEM/WINMM may request from us.
39*/
40
41typedef enum
42{
49
50#define IsWaveDevice(devicetype) \
51 ( ( devicetype == WaveOutDevice ) || ( devicetype == WaveInDevice ) )
52
53#define IsMidiDevice(devicetype) \
54 ( ( devicetype == MidiOutDevice ) || ( devicetype == MidiInDevice ) )
55
56#define IsAuxDevice(devicetype) \
57 ( devicetype == AuxDevice )
58
59
60/*
61 We use these structures to store information regarding open devices. Since
62 the main structure gets destroyed when a device is closed, I call this a
63 "session".
64*/
65
66typedef struct
67{
71
72/*
73typedef enum
74{
75 WaveAddBuffer,
76 WaveClose,
77 WaveReset,
78 WaveRestart,
79 SessionThreadTerminate,
80 InvalidFunction
81} ThreadFunction;
82*/
83
84/* Our own values, used with the session threads */
86#define DRVM_TERMINATE 0xFFFFFFFE
87#define DRVM_INVALID 0xFFFFFFFF
88
89typedef enum
90{
96
97typedef union
98{
102
103/*
104typedef union
105{
106 MediaHeader header;
107} ThreadParameter;
108*/
109
110typedef struct _ThreadInfo
111{
115
116 /*ThreadFunction function;*/
119
122
123typedef struct _LoopInfo
124{
128
129typedef struct _SessionInfo
130{
132
135
137
138 /* These are all the same */
139 union
140 {
144 };
145
146 /* If playback is paused or not */
148
149 /* Stuff passed to us from winmm */
152
154
155 /* Can only be one or the other */
156 union
157 {
160 };
161
162 /* Current playback point */
163 //PWAVEHDR next_buffer;
164
165 /* Where in the current buffer we are */
167
168// DWORD remaining_bytes;
169
171
174
175#undef ASSERT
176#define ASSERT(condition) \
177 if ( ! (condition) ) \
178 DPRINT("ASSERT FAILED: %s\n", #condition);
179
180/*
181 MME interface
182*/
183
184BOOL
186 SessionInfo* session_info,
188 DWORD_PTR parameter1,
189 DWORD_PTR parameter2);
190
191
192/*
193 Helpers
194*/
195
198
199
200/* Kernel interface */
201
206 PWCHAR out_device_name);
207
213 HANDLE* handle);
214
215VOID
216CloseKernelDevice(HANDLE device_handle);
217
220 HANDLE device_handle,
221 DWORD ioctl,
224
227 HANDLE device_handle,
228 DWORD ioctl,
231
232
233/* Session management */
234
239 SessionInfo** session_info);
240
241VOID
243
248
250StartSessionThread(SessionInfo* session_info);
251
254 SessionInfo* session_info,
255 ThreadFunction function,
256 PVOID thread_parameter);
257
258DWORD
260 DWORD_PTR private_handle,
262 DWORD_PTR parameter);
263
264
265/* General */
266
267DWORD
269
270DWORD
274 DWORD_PTR capabilities,
275 DWORD capabilities_size);
276
277DWORD
281 PVOID open_descriptor,
282 DWORD flags,
283 DWORD_PTR private_handle);
284
285DWORD
287 DWORD_PTR private_handle);
288
289DWORD
291 DWORD private_handle);
292
293DWORD
295 DWORD private_handle);
296
297DWORD
299 DWORD private_handle);
300
301DWORD
303 DWORD private_handle,
305 DWORD time_size);
306
307DWORD
308BreakLoop(DWORD private_handle);
309
310DWORD
314
315DWORD
317 DWORD_PTR private_handle,
318 PWAVEHDR wave_header,
319 DWORD wave_header_size);
320
321
322
323
324
325/* wave thread */
326
327DWORD
328WaveThread(LPVOID parameter);
329
330
331/* Wave I/O */
332
333VOID
334PerformWaveIO(SessionInfo* session_info);
335
336
338
339#endif /* MMDRV_H */
device_type
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
__u16 time
Definition: mkdosfs.c:8
MMRESULT SetDeviceData(HANDLE device_handle, DWORD ioctl, PBYTE input_buffer, DWORD buffer_size)
Definition: kernel.c:139
MMRESULT CallSessionThread(SessionInfo *session_info, ThreadFunction function, PVOID thread_parameter)
Definition: session.c:219
MMRESULT GetDeviceData(HANDLE device_handle, DWORD ioctl, PBYTE output_buffer, DWORD buffer_size)
Definition: kernel.c:152
DWORD ResetDevice(DWORD private_handle)
SessionInfo * GetSession(DeviceType device_type, UINT device_id)
Definition: session.c:30
DWORD GetDeviceCapabilities(DeviceType device_type, UINT device_id, DWORD_PTR capabilities, DWORD capabilities_size)
Definition: common.c:84
MMRESULT CreateSession(DeviceType device_type, UINT device_id, SessionInfo **session_info)
Definition: session.c:63
VOID CloseKernelDevice(HANDLE device_handle)
Definition: kernel.c:132
DeviceType
Definition: mmdrv.h:42
@ MidiOutDevice
Definition: mmdrv.h:45
@ MidiInDevice
Definition: mmdrv.h:46
@ WaveInDevice
Definition: mmdrv.h:44
@ AuxDevice
Definition: mmdrv.h:47
@ WaveOutDevice
Definition: mmdrv.h:43
WaveState
Definition: mmdrv.h:90
@ WaveReset
Definition: mmdrv.h:93
@ WavePlaying
Definition: mmdrv.h:91
@ WaveRestart
Definition: mmdrv.h:94
@ WaveStopped
Definition: mmdrv.h:92
VOID PerformWaveIO(SessionInfo *session_info)
Definition: wave_io.c:39
MMRESULT ErrorToMmResult(UINT error_code)
Definition: common.c:22
MMRESULT StartSessionThread(SessionInfo *session_info)
Definition: session.c:154
DWORD ThreadFunction
Definition: mmdrv.h:85
DWORD HandleBySessionThread(DWORD_PTR private_handle, DWORD_PTR message, DWORD_PTR parameter)
Definition: session.c:240
DWORD CloseDevice(DWORD_PTR private_handle)
Definition: common.c:239
CRITICAL_SECTION critical_section
DWORD BreakLoop(DWORD private_handle)
struct _LoopInfo LoopInfo
struct _ThreadInfo ThreadInfo
MMRESULT CobbleDeviceName(DeviceType device_type, UINT device_id, PWCHAR out_device_name)
Definition: kernel.c:28
DWORD QueryWaveFormat(DeviceType device_type, PVOID lpFormat)
Definition: wave.c:335
DWORD GetDeviceCount(DeviceType device_type)
Definition: common.c:58
struct _SessionInfo SessionInfo
DWORD WriteWaveBuffer(DWORD_PTR private_handle, PWAVEHDR wave_header, DWORD wave_header_size)
Definition: wave.c:372
DWORD RestartDevice(DWORD private_handle)
DWORD PauseDevice(DWORD private_handle)
MMRESULT OpenKernelDevice(DeviceType device_type, UINT device_id, DWORD access, HANDLE *handle)
Definition: kernel.c:84
BOOL NotifyClient(SessionInfo *session_info, DWORD message, DWORD_PTR parameter1, DWORD_PTR parameter2)
Definition: mme.c:25
DWORD OpenDevice(DeviceType device_type, UINT device_id, PVOID open_descriptor, DWORD flags, DWORD_PTR private_handle)
Definition: common.c:153
DWORD GetPosition(DWORD private_handle, PMMTIME time, DWORD time_size)
DWORD WaveThread(LPVOID parameter)
Definition: wave.c:266
VOID DestroySession(SessionInfo *session)
Definition: session.c:113
UINT MMRESULT
Definition: mmsystem.h:962
unsigned int UINT
Definition: ndis.h:50
BYTE * PBYTE
Definition: pedump.c:66
LPWAVEHDR header
Definition: mmdrv.h:69
OVERLAPPED overlap
Definition: mmdrv.h:68
PWAVEHDR head
Definition: mmdrv.h:125
DWORD iterations
Definition: mmdrv.h:126
DWORD flags
Definition: mmdrv.h:153
HMIDI mme_midi_handle
Definition: mmdrv.h:143
DWORD_PTR app_user_data
Definition: mmdrv.h:150
HWAVE mme_wave_handle
Definition: mmdrv.h:142
ThreadInfo thread
Definition: mmdrv.h:172
DeviceType device_type
Definition: mmdrv.h:133
PMIDIHDR midi_queue
Definition: mmdrv.h:159
DWORD_PTR callback
Definition: mmdrv.h:151
HANDLE kernel_device_handle
Definition: mmdrv.h:136
DWORD buffer_position
Definition: mmdrv.h:166
PWAVEHDR wave_queue
Definition: mmdrv.h:158
struct _SessionInfo * next
Definition: mmdrv.h:131
HDRVR mme_handle
Definition: mmdrv.h:141
BOOL is_paused
Definition: mmdrv.h:147
UINT device_id
Definition: mmdrv.h:134
LoopInfo loop
Definition: mmdrv.h:170
MMRESULT result
Definition: mmdrv.h:120
HANDLE handle
Definition: mmdrv.h:112
HANDLE ready_event
Definition: mmdrv.h:113
PVOID parameter
Definition: mmdrv.h:118
DWORD function
Definition: mmdrv.h:117
HANDLE go_event
Definition: mmdrv.h:114
Definition: tftpd.h:60
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:888
LPCWSTR lpFormat
Definition: trayclock.cpp:32
uint32_t DWORD_PTR
Definition: typedefs.h:65
uint16_t * PWCHAR
Definition: typedefs.h:56
PWAVEHDR wave_header
Definition: mmdrv.h:99
PMIDIHDR midi_header
Definition: mmdrv.h:100
static int error_code[8]
Definition: odbccp32.c:61
#define ioctl
Definition: wintirpc.h:60