ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

mmdrv.h
Go to the documentation of this file.
00001 /*
00002  *
00003  * COPYRIGHT:            See COPYING in the top level directory
00004  * PROJECT:              ReactOS Multimedia
00005  * FILE:                 dll/win32/mmdrv/mmdrv.h
00006  * PURPOSE:              Multimedia User Mode Driver (header)
00007  * PROGRAMMER:           Andrew Greenwood
00008  *                       Aleksey Bragin
00009  * UPDATE HISTORY:
00010  *                       Jan 30, 2004: Imported into ReactOS tree
00011  *                       Jan 10, 2007: Rewritten and tidied up
00012  */
00013 
00014 #ifndef MMDRV_H
00015 #define MMDRV_H
00016 
00017 #include <mmioctl.h>
00018 #include <mmddk.h>
00019 
00020 #include <stdio.h>
00021 #include <debug.h>
00022 
00023 /* Need to check these */
00024 #define MAX_DEVICES             256
00025 #define MAX_DEVICE_NAME_LENGTH  256
00026 #define MAX_BUFFER_SIZE         1048576
00027 #define MAX_WAVE_BYTES          1048576
00028 
00029 /* Custom flag set when overlapped I/O is done */
00030 #define WHDR_COMPLETE 0x80000000
00031 
00032 
00033 /*
00034     The kinds of devices which MMSYSTEM/WINMM may request from us.
00035 */
00036 
00037 typedef enum
00038 {
00039     WaveOutDevice,
00040     WaveInDevice,
00041     MidiOutDevice,
00042     MidiInDevice,
00043     AuxDevice
00044 } DeviceType;
00045 
00046 #define IsWaveDevice(devicetype) \
00047     ( ( devicetype == WaveOutDevice ) || ( devicetype == WaveInDevice ) )
00048 
00049 #define IsMidiDevice(devicetype) \
00050     ( ( devicetype == MidiOutDevice ) || ( devicetype == MidiInDevice ) )
00051 
00052 #define IsAuxDevice(devicetype) \
00053     ( devicetype == AuxDevice )
00054 
00055 
00056 /*
00057     We use these structures to store information regarding open devices. Since
00058     the main structure gets destroyed when a device is closed, I call this a
00059     "session".
00060 */
00061 
00062 typedef struct
00063 {
00064     OVERLAPPED overlap;
00065     LPWAVEHDR header;
00066 } WaveOverlapInfo;
00067 
00068 /*
00069 typedef enum
00070 {
00071     WaveAddBuffer,
00072     WaveClose,
00073     WaveReset,
00074     WaveRestart,
00075     SessionThreadTerminate,
00076     InvalidFunction
00077 } ThreadFunction;
00078 */
00079 
00080 /* Our own values, used with the session threads */
00081 typedef DWORD ThreadFunction;
00082 #define DRVM_TERMINATE   0xFFFFFFFE
00083 #define DRVM_INVALID     0xFFFFFFFF
00084 
00085 typedef enum
00086 {
00087     WavePlaying,
00088     WaveStopped,
00089     WaveReset,
00090     WaveRestart
00091 } WaveState;
00092 
00093 typedef union
00094 {
00095     PWAVEHDR wave_header;
00096     PMIDIHDR midi_header;
00097 } MediaHeader;
00098 
00099 /*
00100 typedef union
00101 {
00102     MediaHeader header;
00103 } ThreadParameter;
00104 */
00105 
00106 typedef struct _ThreadInfo
00107 {
00108     HANDLE handle;
00109     HANDLE ready_event;
00110     HANDLE go_event;
00111 
00112     /*ThreadFunction function;*/
00113     DWORD function;
00114     PVOID parameter;
00115 
00116     MMRESULT result;
00117 } ThreadInfo;
00118 
00119 typedef struct _LoopInfo
00120 {
00121     PWAVEHDR head;
00122     DWORD iterations;
00123 } LoopInfo;
00124 
00125 typedef struct _SessionInfo
00126 {
00127     struct _SessionInfo* next;
00128 
00129     DeviceType device_type;
00130     UINT device_id;
00131 
00132     HANDLE kernel_device_handle;
00133 
00134     /* These are all the same */
00135     union
00136     {
00137         HDRVR mme_handle;
00138         HWAVE mme_wave_handle;
00139         HMIDI mme_midi_handle;
00140     };
00141 
00142     /* If playback is paused or not */
00143     BOOL is_paused;
00144 
00145     /* Stuff passed to us from winmm */
00146     DWORD_PTR app_user_data;
00147     DWORD_PTR callback;
00148 
00149     DWORD flags;
00150 
00151     /* Can only be one or the other */
00152     union
00153     {
00154         PWAVEHDR wave_queue;
00155         PMIDIHDR midi_queue;
00156     };
00157 
00158     /* Current playback point */
00159     //PWAVEHDR next_buffer;
00160 
00161     /* Where in the current buffer we are */
00162     DWORD buffer_position;
00163 
00164 //    DWORD remaining_bytes;
00165 
00166     LoopInfo loop;
00167 
00168     ThreadInfo thread;
00169 } SessionInfo;
00170 
00171 #undef ASSERT
00172 #define ASSERT(condition) \
00173     if ( ! (condition) ) \
00174         DPRINT("ASSERT FAILED: %s\n", #condition);
00175 
00176 /*
00177     MME interface
00178 */
00179 
00180 BOOL
00181 NotifyClient(
00182     SessionInfo* session_info,
00183     DWORD message,
00184     DWORD_PTR parameter1,
00185     DWORD_PTR parameter2);
00186 
00187 
00188 /*
00189     Helpers
00190 */
00191 
00192 MMRESULT
00193 ErrorToMmResult(UINT error_code);
00194 
00195 
00196 /* Kernel interface */
00197 
00198 MMRESULT
00199 CobbleDeviceName(
00200     DeviceType device_type,
00201     UINT device_id,
00202     PWCHAR out_device_name);
00203 
00204 MMRESULT
00205 OpenKernelDevice(
00206     DeviceType device_type,
00207     UINT device_id,
00208     DWORD access,
00209     HANDLE* handle);
00210 
00211 VOID
00212 CloseKernelDevice(HANDLE device_handle);
00213 
00214 MMRESULT
00215 SetDeviceData(
00216     HANDLE device_handle,
00217     DWORD ioctl,
00218     PBYTE input_buffer,
00219     DWORD buffer_size);
00220 
00221 MMRESULT
00222 GetDeviceData(
00223     HANDLE device_handle,
00224     DWORD ioctl,
00225     PBYTE output_buffer,
00226     DWORD buffer_size);
00227 
00228 
00229 /* Session management */
00230 
00231 MMRESULT
00232 CreateSession(
00233     DeviceType device_type,
00234     UINT device_id,
00235     SessionInfo** session_info);
00236 
00237 VOID
00238 DestroySession(SessionInfo* session);
00239 
00240 SessionInfo*
00241 GetSession(
00242     DeviceType device_type,
00243     UINT device_id);
00244 
00245 MMRESULT
00246 StartSessionThread(SessionInfo* session_info);
00247 
00248 MMRESULT
00249 CallSessionThread(
00250     SessionInfo* session_info,
00251     ThreadFunction function,
00252     PVOID thread_parameter);
00253 
00254 DWORD
00255 HandleBySessionThread(
00256     DWORD_PTR private_handle,
00257     DWORD_PTR message,
00258     DWORD_PTR parameter);
00259 
00260 
00261 /* General */
00262 
00263 DWORD
00264 GetDeviceCount(DeviceType device_type);
00265 
00266 DWORD
00267 GetDeviceCapabilities(
00268     DeviceType device_type,
00269     UINT device_id,
00270     DWORD_PTR capabilities,
00271     DWORD capabilities_size);
00272 
00273 DWORD
00274 OpenDevice(
00275     DeviceType device_type,
00276     UINT device_id,
00277     PVOID open_descriptor,
00278     DWORD flags,
00279     DWORD_PTR private_handle);
00280 
00281 DWORD
00282 CloseDevice(
00283     DWORD_PTR private_handle);
00284 
00285 DWORD
00286 PauseDevice(
00287     DWORD private_handle);
00288 
00289 DWORD
00290 RestartDevice(
00291     DWORD private_handle);
00292 
00293 DWORD
00294 ResetDevice(
00295     DWORD private_handle);
00296 
00297 DWORD
00298 GetPosition(
00299     DWORD private_handle,
00300     PMMTIME time,
00301     DWORD time_size);
00302 
00303 DWORD
00304 BreakLoop(DWORD private_handle);
00305 
00306 DWORD
00307 QueryWaveFormat(
00308     DeviceType device_type,
00309     PVOID lpFormat);
00310 
00311 DWORD
00312 WriteWaveBuffer(
00313     DWORD_PTR private_handle,
00314     PWAVEHDR wave_header,
00315     DWORD wave_header_size);
00316 
00317 
00318 
00319 
00320 
00321 /* wave thread */
00322 
00323 DWORD
00324 WaveThread(LPVOID parameter);
00325 
00326 
00327 /* Wave I/O */
00328 
00329 VOID
00330 PerformWaveIO(SessionInfo* session_info);
00331 
00332 
00333 extern CRITICAL_SECTION critical_section;
00334 
00335 #endif

Generated on Mon May 28 2012 04:24:21 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.