ReactOS  0.4.13-dev-92-gf251225
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 
41 typedef enum
42 {
48 } DeviceType;
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 
66 typedef struct
67 {
71 
72 /*
73 typedef 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 
89 typedef enum
90 {
95 } WaveState;
96 
97 typedef union
98 {
101 } MediaHeader;
102 
103 /*
104 typedef union
105 {
106  MediaHeader header;
107 } ThreadParameter;
108 */
109 
110 typedef struct _ThreadInfo
111 {
115 
116  /*ThreadFunction function;*/
117  DWORD function;
119 
121 } ThreadInfo;
122 
123 typedef struct _LoopInfo
124 {
127 } LoopInfo;
128 
129 typedef struct _SessionInfo
130 {
132 
135 
137 
138  /* These are all the same */
139  union
140  {
141  HDRVR mme_handle;
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 
173 } SessionInfo;
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 
184 BOOL
186  SessionInfo* session_info,
187  DWORD message,
188  DWORD_PTR parameter1,
189  DWORD_PTR parameter2);
190 
191 
192 /*
193  Helpers
194 */
195 
196 MMRESULT
198 
199 
200 /* Kernel interface */
201 
202 MMRESULT
205  UINT device_id,
206  PWCHAR out_device_name);
207 
208 MMRESULT
211  UINT device_id,
212  DWORD access,
213  HANDLE* handle);
214 
215 VOID
216 CloseKernelDevice(HANDLE device_handle);
217 
218 MMRESULT
220  HANDLE device_handle,
221  DWORD ioctl,
224 
225 MMRESULT
227  HANDLE device_handle,
228  DWORD ioctl,
231 
232 
233 /* Session management */
234 
235 MMRESULT
238  UINT device_id,
239  SessionInfo** session_info);
240 
241 VOID
242 DestroySession(SessionInfo* session);
243 
245 GetSession(
247  UINT device_id);
248 
249 MMRESULT
250 StartSessionThread(SessionInfo* session_info);
251 
252 MMRESULT
254  SessionInfo* session_info,
255  ThreadFunction function,
256  PVOID thread_parameter);
257 
258 DWORD
260  DWORD_PTR private_handle,
262  DWORD_PTR parameter);
263 
264 
265 /* General */
266 
267 DWORD
269 
270 DWORD
273  UINT device_id,
274  DWORD_PTR capabilities,
275  DWORD capabilities_size);
276 
277 DWORD
278 OpenDevice(
280  UINT device_id,
281  PVOID open_descriptor,
282  DWORD flags,
283  DWORD_PTR private_handle);
284 
285 DWORD
287  DWORD_PTR private_handle);
288 
289 DWORD
291  DWORD private_handle);
292 
293 DWORD
295  DWORD private_handle);
296 
297 DWORD
299  DWORD private_handle);
300 
301 DWORD
303  DWORD private_handle,
304  PMMTIME time,
305  DWORD time_size);
306 
307 DWORD
308 BreakLoop(DWORD private_handle);
309 
310 DWORD
313  PVOID lpFormat);
314 
315 DWORD
317  DWORD_PTR private_handle,
318  PWAVEHDR wave_header,
319  DWORD wave_header_size);
320 
321 
322 
323 
324 
325 /* wave thread */
326 
327 DWORD
328 WaveThread(LPVOID parameter);
329 
330 
331 /* Wave I/O */
332 
333 VOID
334 PerformWaveIO(SessionInfo* session_info);
335 
336 
338 
339 #endif /* MMDRV_H */
PWAVEHDR wave_queue
Definition: mmdrv.h:158
Definition: tftpd.h:59
HMIDI mme_midi_handle
Definition: mmdrv.h:143
DWORD WriteWaveBuffer(DWORD_PTR private_handle, PWAVEHDR wave_header, DWORD wave_header_size)
Definition: wave.c:372
DWORD RestartDevice(DWORD private_handle)
PMIDIHDR midi_queue
Definition: mmdrv.h:159
HANDLE ready_event
Definition: mmdrv.h:113
LPWAVEHDR header
Definition: mmdrv.h:69
DeviceType
Definition: mmdrv.h:41
MMRESULT GetDeviceData(HANDLE device_handle, DWORD ioctl, PBYTE output_buffer, DWORD buffer_size)
Definition: kernel.c:152
DWORD ResetDevice(DWORD private_handle)
PWAVEHDR head
Definition: mmdrv.h:125
device_type
VOID DestroySession(SessionInfo *session)
Definition: session.c:113
DWORD flags
Definition: mmdrv.h:153
UINT MMRESULT
Definition: mmsystem.h:962
struct _ThreadInfo ThreadInfo
MMRESULT OpenKernelDevice(DeviceType device_type, UINT device_id, DWORD access, HANDLE *handle)
Definition: kernel.c:84
uint16_t * PWCHAR
Definition: typedefs.h:54
__u16 time
Definition: mkdosfs.c:366
DWORD_PTR app_user_data
Definition: mmdrv.h:150
WaveState
Definition: mmdrv.h:89
BOOL is_paused
Definition: mmdrv.h:147
DWORD CloseDevice(DWORD_PTR private_handle)
Definition: common.c:239
DWORD ThreadFunction
Definition: mmdrv.h:85
struct _SessionInfo SessionInfo
DWORD BreakLoop(DWORD private_handle)
BOOL NotifyClient(SessionInfo *session_info, DWORD message, DWORD_PTR parameter1, DWORD_PTR parameter2)
Definition: mme.c:25
unsigned int BOOL
Definition: ntddk_ex.h:94
DWORD GetDeviceCount(DeviceType device_type)
Definition: common.c:58
MMRESULT SetDeviceData(HANDLE device_handle, DWORD ioctl, PBYTE input_buffer, DWORD buffer_size)
Definition: kernel.c:139
#define ioctl
Definition: wintirpc.h:60
VOID PerformWaveIO(SessionInfo *session_info)
Definition: wave_io.c:39
MMRESULT result
Definition: mmdrv.h:120
struct _LoopInfo LoopInfo
static int error_code[8]
Definition: odbccp32.c:62
static void buffer_size(GLcontext *ctx, GLuint *width, GLuint *height)
Definition: swimpl.c:927
UINT device_id
Definition: mmdrv.h:134
LoopInfo loop
Definition: mmdrv.h:170
DWORD iterations
Definition: mmdrv.h:126
MMRESULT CobbleDeviceName(DeviceType device_type, UINT device_id, PWCHAR out_device_name)
Definition: kernel.c:28
HANDLE handle
Definition: mmdrv.h:112
MMRESULT CreateSession(DeviceType device_type, UINT device_id, SessionInfo **session_info)
Definition: session.c:63
VOID CloseKernelDevice(HANDLE device_handle)
Definition: kernel.c:132
DWORD GetDeviceCapabilities(DeviceType device_type, UINT device_id, DWORD_PTR capabilities, DWORD capabilities_size)
Definition: common.c:84
struct _SessionInfo * next
Definition: mmdrv.h:131
DeviceType device_type
Definition: mmdrv.h:133
DWORD QueryWaveFormat(DeviceType device_type, PVOID lpFormat)
Definition: wave.c:335
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
SessionInfo * GetSession(DeviceType device_type, UINT device_id)
Definition: session.c:30
DWORD OpenDevice(DeviceType device_type, UINT device_id, PVOID open_descriptor, DWORD flags, DWORD_PTR private_handle)
Definition: common.c:153
HANDLE kernel_device_handle
Definition: mmdrv.h:136
LPCWSTR lpFormat
Definition: trayclock.cpp:32
HDRVR mme_handle
Definition: mmdrv.h:141
DWORD_PTR callback
Definition: mmdrv.h:151
uint32_t DWORD_PTR
Definition: typedefs.h:63
PMIDIHDR midi_header
Definition: mmdrv.h:100
DWORD WaveThread(LPVOID parameter)
Definition: wave.c:266
OVERLAPPED overlap
Definition: mmdrv.h:68
GLuint GLint GLboolean GLint GLenum access
Definition: glext.h:7866
ThreadInfo thread
Definition: mmdrv.h:172
unsigned int UINT
Definition: ndis.h:50
DWORD PauseDevice(DWORD private_handle)
HWAVE mme_wave_handle
Definition: mmdrv.h:142
PWAVEHDR wave_header
Definition: mmdrv.h:99
MMRESULT ErrorToMmResult(UINT error_code)
Definition: common.c:22
MMRESULT CallSessionThread(SessionInfo *session_info, ThreadFunction function, PVOID thread_parameter)
Definition: session.c:219
HANDLE go_event
Definition: mmdrv.h:114
DWORD buffer_position
Definition: mmdrv.h:166
DWORD HandleBySessionThread(DWORD_PTR private_handle, DWORD_PTR message, DWORD_PTR parameter)
Definition: session.c:240
BYTE * PBYTE
Definition: pedump.c:66
DWORD GetPosition(DWORD private_handle, PMMTIME time, DWORD time_size)
MMRESULT StartSessionThread(SessionInfo *session_info)
Definition: session.c:154
CRITICAL_SECTION critical_section
PVOID parameter
Definition: mmdrv.h:118