Define new propsheet messages.
[wine/multimedia.git] / dlls / winmm / mciavi / mciavi.c
blob382b483b6ae98207bda40bff187ebe89d599d765
1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
3 /*
4 * Digital video MCI Wine Driver
6 * Copyright 1999, 2000 Eric POUECH
7 * Copyright 2003 Dmitry Timoshkov
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 /* TODO list :
25 * - handling of palettes
26 * - recording (which input devices ?), a cam recorder ?
27 * - lots of messages still need to be handled (cf FIXME)
28 * - synchronization between audio and video (especially for interleaved
29 * files)
30 * - robustness when reading file can be enhanced
31 * - better move the AVI handling part to avifile DLL and make use of it
32 * - some files appear to have more than one audio stream (we only play the
33 * first one)
34 * - some files contain an index of audio/video frame. Better use it,
35 * instead of rebuilding it
36 * - stopping while playing a file with sound blocks until all buffered
37 * audio is played... still should be stopped ASAP
40 #include <string.h>
41 #include "private_mciavi.h"
42 #include "wine/debug.h"
44 WINE_DEFAULT_DEBUG_CHANNEL(mciavi);
46 static DWORD MCIAVI_mciStop(UINT, DWORD, LPMCI_GENERIC_PARMS);
48 /* ===================================================================
49 * ===================================================================
50 * FIXME: should be using the new mmThreadXXXX functions from WINMM
51 * instead of those
52 * it would require to add a wine internal flag to mmThreadCreate
53 * in order to pass a 32 bit function instead of a 16 bit one
54 * ===================================================================
55 * =================================================================== */
57 struct SCA {
58 MCIDEVICEID wDevID;
59 UINT wMsg;
60 DWORD_PTR dwParam1;
61 DWORD_PTR dwParam2;
64 /**************************************************************************
65 * MCI_SCAStarter [internal]
67 static DWORD CALLBACK MCI_SCAStarter(LPVOID arg)
69 struct SCA* sca = (struct SCA*)arg;
70 DWORD ret;
72 TRACE("In thread before async command (%08x,%04x,%08lx,%08lx)\n",
73 sca->wDevID, sca->wMsg, sca->dwParam1, sca->dwParam2);
74 ret = mciSendCommandA(sca->wDevID, sca->wMsg, sca->dwParam1 | MCI_WAIT, sca->dwParam2);
75 TRACE("In thread after async command (%08x,%04x,%08lx,%08lx)\n",
76 sca->wDevID, sca->wMsg, sca->dwParam1, sca->dwParam2);
77 HeapFree(GetProcessHeap(), 0, sca);
78 return ret;
81 /**************************************************************************
82 * MCI_SendCommandAsync [internal]
84 static DWORD MCI_SendCommandAsync(UINT wDevID, UINT wMsg, DWORD dwParam1,
85 DWORD_PTR dwParam2, UINT size)
87 HANDLE handle;
88 struct SCA* sca = HeapAlloc(GetProcessHeap(), 0, sizeof(struct SCA) + size);
90 if (sca == 0)
91 return MCIERR_OUT_OF_MEMORY;
93 sca->wDevID = wDevID;
94 sca->wMsg = wMsg;
95 sca->dwParam1 = dwParam1;
97 if (size && dwParam2) {
98 sca->dwParam2 = (DWORD_PTR)sca + sizeof(struct SCA);
99 /* copy structure passed by program in dwParam2 to be sure
100 * we can still use it whatever the program does
102 memcpy((LPVOID)sca->dwParam2, (LPVOID)dwParam2, size);
103 } else {
104 sca->dwParam2 = dwParam2;
107 if ((handle = CreateThread(NULL, 0, MCI_SCAStarter, sca, 0, NULL)) == 0) {
108 WARN("Couldn't allocate thread for async command handling, sending synchronously\n");
109 return MCI_SCAStarter(&sca);
111 CloseHandle(handle);
112 return 0;
115 /*======================================================================*
116 * MCI AVI implemantation *
117 *======================================================================*/
119 HINSTANCE MCIAVI_hInstance = 0;
121 /***********************************************************************
122 * DllMain (MCIAVI.0)
124 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
126 switch (fdwReason) {
127 case DLL_PROCESS_ATTACH:
128 DisableThreadLibraryCalls(hInstDLL);
129 MCIAVI_hInstance = hInstDLL;
130 break;
132 return TRUE;
135 /**************************************************************************
136 * MCIAVI_drvOpen [internal]
138 static DWORD MCIAVI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
140 WINE_MCIAVI* wma;
141 static const WCHAR mciAviWStr[] = {'M','C','I','A','V','I',0};
143 TRACE("%s, %p\n", debugstr_a(str), modp);
145 /* session instance */
146 if (!modp) return 0xFFFFFFFF;
148 if (!MCIAVI_RegisterClass()) return 0;
150 wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIAVI));
151 if (!wma)
152 return 0;
154 InitializeCriticalSection(&wma->cs);
155 wma->hStopEvent = CreateEventA(NULL, FALSE, FALSE, NULL);
156 wma->wDevID = modp->wDeviceID;
157 wma->wCommandTable = mciLoadCommandResource(MCIAVI_hInstance, mciAviWStr, 0);
158 modp->wCustomCommandTable = wma->wCommandTable;
159 modp->wType = MCI_DEVTYPE_DIGITAL_VIDEO;
160 mciSetDriverData(wma->wDevID, (DWORD)wma);
162 return modp->wDeviceID;
165 /**************************************************************************
166 * MCIAVI_drvClose [internal]
168 static DWORD MCIAVI_drvClose(DWORD dwDevID)
170 WINE_MCIAVI *wma;
172 TRACE("%04lx\n", dwDevID);
174 /* finish all outstanding things */
175 MCIAVI_mciClose(dwDevID, MCI_WAIT, NULL);
177 wma = (WINE_MCIAVI*)mciGetDriverData(dwDevID);
179 if (wma) {
180 MCIAVI_UnregisterClass();
182 EnterCriticalSection(&wma->cs);
184 mciSetDriverData(dwDevID, 0);
185 mciFreeCommandResource(wma->wCommandTable);
187 CloseHandle(wma->hStopEvent);
189 LeaveCriticalSection(&wma->cs);
190 DeleteCriticalSection(&wma->cs);
192 HeapFree(GetProcessHeap(), 0, wma);
193 return 1;
195 return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
198 /**************************************************************************
199 * MCIAVI_drvConfigure [internal]
201 static DWORD MCIAVI_drvConfigure(DWORD dwDevID)
203 WINE_MCIAVI *wma;
205 TRACE("%04lx\n", dwDevID);
207 MCIAVI_mciStop(dwDevID, MCI_WAIT, NULL);
209 wma = (WINE_MCIAVI*)mciGetDriverData(dwDevID);
211 if (wma) {
212 MessageBoxA(0, "Sample AVI Wine Driver !", "MM-Wine Driver", MB_OK);
213 return 1;
215 return 0;
218 /**************************************************************************
219 * MCIAVI_mciGetOpenDev [internal]
221 WINE_MCIAVI* MCIAVI_mciGetOpenDev(UINT wDevID)
223 WINE_MCIAVI* wma = (WINE_MCIAVI*)mciGetDriverData(wDevID);
225 if (wma == NULL || wma->nUseCount == 0) {
226 WARN("Invalid wDevID=%u\n", wDevID);
227 return 0;
229 return wma;
232 static void MCIAVI_CleanUp(WINE_MCIAVI* wma)
234 /* to prevent handling in WindowProc */
235 wma->dwStatus = MCI_MODE_NOT_READY;
236 if (wma->hFile) {
237 mmioClose(wma->hFile, 0);
238 wma->hFile = 0;
240 if (wma->lpFileName) HeapFree(GetProcessHeap(), 0, wma->lpFileName);
241 wma->lpFileName = NULL;
243 if (wma->lpVideoIndex) HeapFree(GetProcessHeap(), 0, wma->lpVideoIndex);
244 wma->lpVideoIndex = NULL;
245 if (wma->lpAudioIndex) HeapFree(GetProcessHeap(), 0, wma->lpAudioIndex);
246 wma->lpAudioIndex = NULL;
247 if (wma->hic) ICClose(wma->hic);
248 wma->hic = 0;
249 if (wma->inbih) HeapFree(GetProcessHeap(), 0, wma->inbih);
250 wma->inbih = NULL;
251 if (wma->outbih) HeapFree(GetProcessHeap(), 0, wma->outbih);
252 wma->outbih = NULL;
253 if (wma->indata) HeapFree(GetProcessHeap(), 0, wma->indata);
254 wma->indata = NULL;
255 if (wma->outdata) HeapFree(GetProcessHeap(), 0, wma->outdata);
256 wma->outdata = NULL;
257 if (wma->hbmFrame) DeleteObject(wma->hbmFrame);
258 wma->hbmFrame = 0;
259 if (wma->hWnd) DestroyWindow(wma->hWnd);
260 wma->hWnd = 0;
262 if (wma->lpWaveFormat) HeapFree(GetProcessHeap(), 0, wma->lpWaveFormat);
263 wma->lpWaveFormat = 0;
265 memset(&wma->mah, 0, sizeof(wma->mah));
266 memset(&wma->ash_video, 0, sizeof(wma->ash_video));
267 memset(&wma->ash_audio, 0, sizeof(wma->ash_audio));
268 wma->dwCurrVideoFrame = wma->dwCurrAudioBlock = 0;
269 wma->dwCachedFrame = -1;
273 /***************************************************************************
274 * MCIAVI_mciOpen [internal]
276 static DWORD MCIAVI_mciOpen(UINT wDevID, DWORD dwFlags,
277 LPMCI_DGV_OPEN_PARMSA lpOpenParms)
279 WINE_MCIAVI *wma;
280 LRESULT dwRet = 0;
282 TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpOpenParms);
284 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
286 if (lpOpenParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
288 wma = (WINE_MCIAVI *)mciGetDriverData(wDevID);
289 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
291 EnterCriticalSection(&wma->cs);
293 if (wma->nUseCount > 0) {
294 /* The driver is already open on this channel */
295 /* If the driver was opened shareable before and this open specifies */
296 /* shareable then increment the use count */
297 if (wma->fShareable && (dwFlags & MCI_OPEN_SHAREABLE))
298 ++wma->nUseCount;
299 else
301 LeaveCriticalSection(&wma->cs);
302 return MCIERR_MUST_USE_SHAREABLE;
304 } else {
305 wma->nUseCount = 1;
306 wma->fShareable = dwFlags & MCI_OPEN_SHAREABLE;
309 wma->dwStatus = MCI_MODE_NOT_READY;
311 if (dwFlags & MCI_OPEN_ELEMENT) {
312 if (dwFlags & MCI_OPEN_ELEMENT_ID) {
313 /* could it be that (DWORD)lpOpenParms->lpstrElementName
314 * contains the hFile value ?
316 dwRet = MCIERR_UNRECOGNIZED_COMMAND;
317 } else if (strlen(lpOpenParms->lpstrElementName) > 0) {
318 /* FIXME : what should be done id wma->hFile is already != 0, or the driver is playin' */
319 TRACE("MCI_OPEN_ELEMENT '%s' !\n", lpOpenParms->lpstrElementName);
321 if (lpOpenParms->lpstrElementName && (strlen(lpOpenParms->lpstrElementName) > 0))
323 wma->lpFileName = HeapAlloc(GetProcessHeap(), 0, strlen(lpOpenParms->lpstrElementName) + 1);
324 strcpy(wma->lpFileName, lpOpenParms->lpstrElementName);
326 wma->hFile = mmioOpenA(lpOpenParms->lpstrElementName, NULL,
327 MMIO_ALLOCBUF | MMIO_DENYWRITE | MMIO_READ);
329 if (wma->hFile == 0) {
330 WARN("can't find file='%s' !\n", lpOpenParms->lpstrElementName);
331 dwRet = MCIERR_FILE_NOT_FOUND;
332 } else {
333 if (!MCIAVI_GetInfo(wma))
334 dwRet = MCIERR_INVALID_FILE;
335 else if (!MCIAVI_OpenVideo(wma))
336 dwRet = MCIERR_CANNOT_LOAD_DRIVER;
337 else if (!MCIAVI_CreateWindow(wma, dwFlags, lpOpenParms))
338 dwRet = MCIERR_CREATEWINDOW;
341 } else {
342 FIXME("Don't record yet\n");
343 dwRet = MCIERR_UNSUPPORTED_FUNCTION;
347 if (dwRet == 0) {
348 TRACE("lpOpenParms->wDeviceID = %04x\n", lpOpenParms->wDeviceID);
350 wma->dwStatus = MCI_MODE_STOP;
351 wma->dwMciTimeFormat = MCI_FORMAT_FRAMES;
352 } else {
353 MCIAVI_CleanUp(wma);
356 LeaveCriticalSection(&wma->cs);
357 return dwRet;
360 /***************************************************************************
361 * MCIAVI_mciClose [internal]
363 DWORD MCIAVI_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
365 WINE_MCIAVI *wma;
366 DWORD dwRet = 0;
368 TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
370 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
372 wma = (WINE_MCIAVI *)MCIAVI_mciGetOpenDev(wDevID);
373 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
375 EnterCriticalSection(&wma->cs);
377 if (wma->nUseCount == 1) {
378 if (wma->dwStatus != MCI_MODE_STOP)
379 dwRet = MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
380 MCIAVI_CleanUp(wma);
382 if ((dwFlags & MCI_NOTIFY) && lpParms) {
383 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
384 wDevID,
385 MCI_NOTIFY_SUCCESSFUL);
387 LeaveCriticalSection(&wma->cs);
388 return dwRet;
390 wma->nUseCount--;
392 LeaveCriticalSection(&wma->cs);
393 return dwRet;
396 /***************************************************************************
397 * MCIAVI_mciPlay [internal]
399 static DWORD MCIAVI_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
401 WINE_MCIAVI *wma;
402 DWORD tc;
403 DWORD frameTime;
404 DWORD delta;
405 DWORD dwRet;
406 LPWAVEHDR waveHdr = NULL;
407 unsigned i, nHdr = 0;
408 DWORD dwFromFrame, dwToFrame;
410 TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
412 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
414 wma = (WINE_MCIAVI *)MCIAVI_mciGetOpenDev(wDevID);
415 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
417 EnterCriticalSection(&wma->cs);
419 if (!wma->hFile)
421 LeaveCriticalSection(&wma->cs);
422 return MCIERR_FILE_NOT_FOUND;
424 if (!wma->hWndPaint)
426 LeaveCriticalSection(&wma->cs);
427 return MCIERR_NO_WINDOW;
430 LeaveCriticalSection(&wma->cs);
432 if (!(dwFlags & MCI_WAIT)) {
433 return MCI_SendCommandAsync(wDevID, MCI_PLAY, dwFlags,
434 (DWORD_PTR)lpParms, sizeof(MCI_PLAY_PARMS));
437 if (!(GetWindowLongW(wma->hWndPaint, GWL_STYLE) & WS_VISIBLE))
438 ShowWindow(wma->hWndPaint, SW_SHOWNA);
440 EnterCriticalSection(&wma->cs);
442 dwFromFrame = wma->dwCurrVideoFrame;
443 dwToFrame = wma->dwPlayableVideoFrames - 1;
445 if (lpParms && (dwFlags & MCI_FROM)) {
446 dwFromFrame = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwFrom);
448 if (lpParms && (dwFlags & MCI_TO)) {
449 dwToFrame = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwTo);
451 if (dwToFrame >= wma->dwPlayableVideoFrames)
452 dwToFrame = wma->dwPlayableVideoFrames - 1;
454 TRACE("Playing from frame=%lu to frame=%lu\n", dwFromFrame, dwToFrame);
456 wma->dwCurrVideoFrame = dwFromFrame;
457 wma->dwToVideoFrame = dwToFrame;
459 /* if already playing exit */
460 if (wma->dwStatus == MCI_MODE_PLAY)
462 LeaveCriticalSection(&wma->cs);
463 return 0;
466 if (wma->dwToVideoFrame <= wma->dwCurrVideoFrame)
468 dwRet = 0;
469 goto mci_play_done;
472 wma->dwStatus = MCI_MODE_PLAY;
474 if (dwFlags & (MCI_DGV_PLAY_REPEAT|MCI_DGV_PLAY_REVERSE|MCI_MCIAVI_PLAY_WINDOW|MCI_MCIAVI_PLAY_FULLSCREEN))
475 FIXME("Unsupported flag %08lx\n", dwFlags);
477 /* time is in microseconds, we should convert it to milliseconds */
478 frameTime = (wma->mah.dwMicroSecPerFrame + 500) / 1000;
480 if (wma->lpWaveFormat) {
481 if (MCIAVI_OpenAudio(wma, &nHdr, &waveHdr) != 0)
483 /* can't play audio */
484 HeapFree(GetProcessHeap(), 0, wma->lpWaveFormat);
485 wma->lpWaveFormat = NULL;
487 else
488 /* fill the queue with as many wave headers as possible */
489 MCIAVI_PlayAudioBlocks(wma, nHdr, waveHdr);
492 while (wma->dwStatus == MCI_MODE_PLAY)
494 HDC hDC;
496 tc = GetTickCount();
498 hDC = wma->hWndPaint ? GetDC(wma->hWndPaint) : 0;
499 if (hDC)
501 MCIAVI_PaintFrame(wma, hDC);
502 ReleaseDC(wma->hWndPaint, hDC);
505 if (wma->lpWaveFormat) {
506 HANDLE events[2];
507 DWORD ret;
509 events[0] = wma->hStopEvent;
510 events[1] = wma->hEvent;
512 MCIAVI_PlayAudioBlocks(wma, nHdr, waveHdr);
513 delta = GetTickCount() - tc;
515 LeaveCriticalSection(&wma->cs);
516 ret = MsgWaitForMultipleObjects(2, events, FALSE,
517 (delta >= frameTime) ? 0 : frameTime - delta, MWMO_INPUTAVAILABLE);
518 EnterCriticalSection(&wma->cs);
520 if (ret == WAIT_OBJECT_0 || wma->dwStatus != MCI_MODE_PLAY) break;
523 delta = GetTickCount() - tc;
524 if (delta < frameTime)
526 DWORD ret;
528 LeaveCriticalSection(&wma->cs);
529 ret = MsgWaitForMultipleObjects(1, &wma->hStopEvent, FALSE, frameTime - delta, MWMO_INPUTAVAILABLE);
530 EnterCriticalSection(&wma->cs);
531 if (ret == WAIT_OBJECT_0) break;
534 if (wma->dwCurrVideoFrame < dwToFrame)
535 wma->dwCurrVideoFrame++;
536 else
537 break;
540 if (wma->lpWaveFormat) {
541 while (wma->dwEventCount != nHdr - 1)
543 LeaveCriticalSection(&wma->cs);
544 Sleep(100);
545 EnterCriticalSection(&wma->cs);
548 /* just to get rid of some race conditions between play, stop and pause */
549 LeaveCriticalSection(&wma->cs);
550 waveOutReset(wma->hWave);
551 EnterCriticalSection(&wma->cs);
553 for (i = 0; i < nHdr; i++)
554 waveOutUnprepareHeader(wma->hWave, &waveHdr[i], sizeof(WAVEHDR));
557 dwRet = 0;
559 if (wma->lpWaveFormat) {
560 HeapFree(GetProcessHeap(), 0, waveHdr);
562 if (wma->hWave) {
563 LeaveCriticalSection(&wma->cs);
564 waveOutClose(wma->hWave);
565 EnterCriticalSection(&wma->cs);
566 wma->hWave = 0;
568 CloseHandle(wma->hEvent);
571 mci_play_done:
572 wma->dwStatus = MCI_MODE_STOP;
574 if (lpParms && (dwFlags & MCI_NOTIFY)) {
575 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
576 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
577 wDevID, MCI_NOTIFY_SUCCESSFUL);
579 LeaveCriticalSection(&wma->cs);
580 return dwRet;
583 /***************************************************************************
584 * MCIAVI_mciRecord [internal]
586 static DWORD MCIAVI_mciRecord(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECORD_PARMS lpParms)
588 WINE_MCIAVI *wma;
590 FIXME("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
592 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
594 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
596 wma = MCIAVI_mciGetOpenDev(wDevID);
597 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
599 EnterCriticalSection(&wma->cs);
600 wma->dwStatus = MCI_MODE_RECORD;
601 LeaveCriticalSection(&wma->cs);
602 return 0;
605 /***************************************************************************
606 * MCIAVI_mciStop [internal]
608 static DWORD MCIAVI_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
610 WINE_MCIAVI *wma;
611 DWORD dwRet = 0;
613 TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
615 wma = MCIAVI_mciGetOpenDev(wDevID);
616 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
618 EnterCriticalSection(&wma->cs);
620 switch (wma->dwStatus) {
621 case MCI_MODE_PLAY:
622 case MCI_MODE_RECORD:
623 LeaveCriticalSection(&wma->cs);
624 SetEvent(wma->hStopEvent);
625 EnterCriticalSection(&wma->cs);
626 /* fall through */
627 case MCI_MODE_PAUSE:
628 /* Since our wave notification callback takes the lock,
629 * we must release it before resetting the device */
630 LeaveCriticalSection(&wma->cs);
631 dwRet = waveOutReset(wma->hWave);
632 EnterCriticalSection(&wma->cs);
633 /* fall through */
634 default:
635 do /* one more chance for an async thread to finish */
637 LeaveCriticalSection(&wma->cs);
638 Sleep(10);
639 EnterCriticalSection(&wma->cs);
640 } while (wma->dwStatus != MCI_MODE_STOP);
642 break;
644 case MCI_MODE_NOT_READY:
645 break;
648 if ((dwFlags & MCI_NOTIFY) && lpParms) {
649 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
650 wDevID, MCI_NOTIFY_SUCCESSFUL);
652 LeaveCriticalSection(&wma->cs);
653 return dwRet;
656 /***************************************************************************
657 * MCIAVI_mciPause [internal]
659 static DWORD MCIAVI_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
661 WINE_MCIAVI *wma;
663 TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
665 wma = MCIAVI_mciGetOpenDev(wDevID);
666 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
668 EnterCriticalSection(&wma->cs);
670 if (wma->dwStatus == MCI_MODE_PLAY)
671 wma->dwStatus = MCI_MODE_PAUSE;
673 if (wma->lpWaveFormat) {
674 LeaveCriticalSection(&wma->cs);
675 return waveOutPause(wma->hWave);
678 LeaveCriticalSection(&wma->cs);
679 return 0;
682 /***************************************************************************
683 * MCIAVI_mciResume [internal]
685 static DWORD MCIAVI_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
687 WINE_MCIAVI *wma;
689 TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
691 wma = MCIAVI_mciGetOpenDev(wDevID);
692 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
694 EnterCriticalSection(&wma->cs);
696 if (wma->dwStatus == MCI_MODE_PAUSE)
697 wma->dwStatus = MCI_MODE_PLAY;
699 if (wma->lpWaveFormat) {
700 LeaveCriticalSection(&wma->cs);
701 return waveOutRestart(wma->hWave);
704 LeaveCriticalSection(&wma->cs);
705 return 0;
708 /***************************************************************************
709 * MCIAVI_mciSeek [internal]
711 static DWORD MCIAVI_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
713 WINE_MCIAVI *wma;
715 TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
717 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
719 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
721 wma = MCIAVI_mciGetOpenDev(wDevID);
722 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
724 EnterCriticalSection(&wma->cs);
726 if (dwFlags & MCI_SEEK_TO_START) {
727 wma->dwCurrVideoFrame = 0;
728 } else if (dwFlags & MCI_SEEK_TO_END) {
729 wma->dwCurrVideoFrame = wma->dwPlayableVideoFrames - 1;
730 } else if (dwFlags & MCI_TO) {
731 if (lpParms->dwTo > wma->dwPlayableVideoFrames - 1)
732 lpParms->dwTo = wma->dwPlayableVideoFrames - 1;
733 wma->dwCurrVideoFrame = MCIAVI_ConvertTimeFormatToFrame(wma, lpParms->dwTo);
734 } else {
735 WARN("dwFlag doesn't tell where to seek to...\n");
736 LeaveCriticalSection(&wma->cs);
737 return MCIERR_MISSING_PARAMETER;
740 TRACE("Seeking to frame=%lu bytes\n", wma->dwCurrVideoFrame);
742 if (dwFlags & MCI_NOTIFY) {
743 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
744 wDevID, MCI_NOTIFY_SUCCESSFUL);
746 LeaveCriticalSection(&wma->cs);
747 return 0;
750 /*****************************************************************************
751 * MCIAVI_mciLoad [internal]
753 static DWORD MCIAVI_mciLoad(UINT wDevID, DWORD dwFlags, LPMCI_DGV_LOAD_PARMSA lpParms)
755 WINE_MCIAVI *wma;
757 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
759 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
761 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
763 wma = MCIAVI_mciGetOpenDev(wDevID);
764 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
766 return 0;
769 /******************************************************************************
770 * MCIAVI_mciSave [internal]
772 static DWORD MCIAVI_mciSave(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SAVE_PARMSA lpParms)
774 WINE_MCIAVI *wma;
776 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
778 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
780 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
782 wma = MCIAVI_mciGetOpenDev(wDevID);
783 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
785 return 0;
788 /******************************************************************************
789 * MCIAVI_mciFreeze [internal]
791 static DWORD MCIAVI_mciFreeze(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
793 WINE_MCIAVI *wma;
795 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
797 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
799 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
801 wma = MCIAVI_mciGetOpenDev(wDevID);
802 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
804 return 0;
807 /******************************************************************************
808 * MCIAVI_mciRealize [internal]
810 static DWORD MCIAVI_mciRealize(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
812 WINE_MCIAVI *wma;
814 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
816 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
818 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
820 wma = MCIAVI_mciGetOpenDev(wDevID);
821 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
823 return 0;
826 /******************************************************************************
827 * MCIAVI_mciUnFreeze [internal]
829 static DWORD MCIAVI_mciUnFreeze(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
831 WINE_MCIAVI *wma;
833 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
835 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
837 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
839 wma = MCIAVI_mciGetOpenDev(wDevID);
840 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
842 return 0;
845 /******************************************************************************
846 * MCIAVI_mciUpdate [internal]
848 static DWORD MCIAVI_mciUpdate(UINT wDevID, DWORD dwFlags, LPMCI_DGV_UPDATE_PARMS lpParms)
850 WINE_MCIAVI *wma;
852 TRACE("%04x, %08lx, %p\n", wDevID, dwFlags, lpParms);
854 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
856 wma = MCIAVI_mciGetOpenDev(wDevID);
857 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
859 EnterCriticalSection(&wma->cs);
861 if (dwFlags & MCI_DGV_UPDATE_HDC)
862 MCIAVI_PaintFrame(wma, lpParms->hDC);
864 LeaveCriticalSection(&wma->cs);
866 return 0;
869 /******************************************************************************
870 * MCIAVI_mciStep [internal]
872 static DWORD MCIAVI_mciStep(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STEP_PARMS lpParms)
874 WINE_MCIAVI *wma;
876 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
878 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
880 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
882 wma = MCIAVI_mciGetOpenDev(wDevID);
883 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
885 return 0;
888 /******************************************************************************
889 * MCIAVI_mciCopy [internal]
891 static DWORD MCIAVI_mciCopy(UINT wDevID, DWORD dwFlags, LPMCI_DGV_COPY_PARMS lpParms)
893 WINE_MCIAVI *wma;
895 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
897 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
899 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
901 wma = MCIAVI_mciGetOpenDev(wDevID);
902 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
904 return 0;
907 /******************************************************************************
908 * MCIAVI_mciCut [internal]
910 static DWORD MCIAVI_mciCut(UINT wDevID, DWORD dwFlags, LPMCI_DGV_CUT_PARMS lpParms)
912 WINE_MCIAVI *wma;
914 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
916 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
918 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
920 wma = MCIAVI_mciGetOpenDev(wDevID);
921 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
923 return 0;
926 /******************************************************************************
927 * MCIAVI_mciDelete [internal]
929 static DWORD MCIAVI_mciDelete(UINT wDevID, DWORD dwFlags, LPMCI_DGV_DELETE_PARMS lpParms)
931 WINE_MCIAVI *wma;
933 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
935 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
937 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
939 wma = MCIAVI_mciGetOpenDev(wDevID);
940 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
942 return 0;
945 /******************************************************************************
946 * MCIAVI_mciPaste [internal]
948 static DWORD MCIAVI_mciPaste(UINT wDevID, DWORD dwFlags, LPMCI_DGV_PASTE_PARMS lpParms)
950 WINE_MCIAVI *wma;
952 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
954 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
956 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
958 wma = MCIAVI_mciGetOpenDev(wDevID);
959 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
961 return 0;
964 /******************************************************************************
965 * MCIAVI_mciCue [internal]
967 static DWORD MCIAVI_mciCue(UINT wDevID, DWORD dwFlags, LPMCI_DGV_CUE_PARMS lpParms)
969 WINE_MCIAVI *wma;
971 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
973 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
975 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
977 wma = MCIAVI_mciGetOpenDev(wDevID);
978 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
980 return 0;
983 /******************************************************************************
984 * MCIAVI_mciCapture [internal]
986 static DWORD MCIAVI_mciCapture(UINT wDevID, DWORD dwFlags, LPMCI_DGV_CAPTURE_PARMSA lpParms)
988 WINE_MCIAVI *wma;
990 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
992 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
994 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
996 wma = MCIAVI_mciGetOpenDev(wDevID);
997 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
999 return 0;
1002 /******************************************************************************
1003 * MCIAVI_mciMonitor [internal]
1005 static DWORD MCIAVI_mciMonitor(UINT wDevID, DWORD dwFlags, LPMCI_DGV_MONITOR_PARMS lpParms)
1007 WINE_MCIAVI *wma;
1009 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
1011 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
1013 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
1015 wma = MCIAVI_mciGetOpenDev(wDevID);
1016 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
1018 return 0;
1021 /******************************************************************************
1022 * MCIAVI_mciReserve [internal]
1024 static DWORD MCIAVI_mciReserve(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RESERVE_PARMSA lpParms)
1026 WINE_MCIAVI *wma;
1028 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
1030 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
1032 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
1034 wma = MCIAVI_mciGetOpenDev(wDevID);
1035 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
1037 return 0;
1040 /******************************************************************************
1041 * MCIAVI_mciSetAudio [internal]
1043 static DWORD MCIAVI_mciSetAudio(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETAUDIO_PARMSA lpParms)
1045 WINE_MCIAVI *wma;
1047 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
1049 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
1051 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
1053 wma = MCIAVI_mciGetOpenDev(wDevID);
1054 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
1056 return 0;
1059 /******************************************************************************
1060 * MCIAVI_mciSignal [internal]
1062 static DWORD MCIAVI_mciSignal(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SIGNAL_PARMS lpParms)
1064 WINE_MCIAVI *wma;
1066 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
1068 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
1070 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
1072 wma = MCIAVI_mciGetOpenDev(wDevID);
1073 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
1075 return 0;
1078 /******************************************************************************
1079 * MCIAVI_mciSetVideo [internal]
1081 static DWORD MCIAVI_mciSetVideo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETVIDEO_PARMSA lpParms)
1083 WINE_MCIAVI *wma;
1085 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
1087 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
1089 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
1091 wma = MCIAVI_mciGetOpenDev(wDevID);
1092 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
1094 return 0;
1097 /******************************************************************************
1098 * MCIAVI_mciQuality [internal]
1100 static DWORD MCIAVI_mciQuality(UINT wDevID, DWORD dwFlags, LPMCI_DGV_QUALITY_PARMSA lpParms)
1102 WINE_MCIAVI *wma;
1104 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
1106 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
1108 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
1110 wma = MCIAVI_mciGetOpenDev(wDevID);
1111 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
1113 return 0;
1116 /******************************************************************************
1117 * MCIAVI_mciList [internal]
1119 static DWORD MCIAVI_mciList(UINT wDevID, DWORD dwFlags, LPMCI_DGV_LIST_PARMSA lpParms)
1121 WINE_MCIAVI *wma;
1123 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
1125 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
1127 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
1129 wma = MCIAVI_mciGetOpenDev(wDevID);
1130 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
1132 return 0;
1135 /******************************************************************************
1136 * MCIAVI_mciUndo [internal]
1138 static DWORD MCIAVI_mciUndo(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
1140 WINE_MCIAVI *wma;
1142 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
1144 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
1146 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
1148 wma = MCIAVI_mciGetOpenDev(wDevID);
1149 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
1151 return 0;
1154 /******************************************************************************
1155 * MCIAVI_mciConfigure [internal]
1157 static DWORD MCIAVI_mciConfigure(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
1159 WINE_MCIAVI *wma;
1161 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
1163 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
1165 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
1167 wma = MCIAVI_mciGetOpenDev(wDevID);
1168 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
1170 return 0;
1173 /******************************************************************************
1174 * MCIAVI_mciRestore [internal]
1176 static DWORD MCIAVI_mciRestore(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RESTORE_PARMSA lpParms)
1178 WINE_MCIAVI *wma;
1180 FIXME("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
1182 MCIAVI_mciStop(wDevID, MCI_WAIT, NULL);
1184 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
1186 wma = MCIAVI_mciGetOpenDev(wDevID);
1187 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
1189 return 0;
1192 /*======================================================================*
1193 * MCI AVI entry points *
1194 *======================================================================*/
1196 /**************************************************************************
1197 * DriverProc (MCIAVI.@)
1199 LONG CALLBACK MCIAVI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
1200 DWORD dwParam1, DWORD dwParam2)
1202 TRACE("(%08lX, %p, %08lX, %08lX, %08lX)\n",
1203 dwDevID, hDriv, wMsg, dwParam1, dwParam2);
1205 switch (wMsg) {
1206 case DRV_LOAD: return 1;
1207 case DRV_FREE: return 1;
1208 case DRV_OPEN: return MCIAVI_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
1209 case DRV_CLOSE: return MCIAVI_drvClose(dwDevID);
1210 case DRV_ENABLE: return 1;
1211 case DRV_DISABLE: return 1;
1212 case DRV_QUERYCONFIGURE: return 1;
1213 case DRV_CONFIGURE: return MCIAVI_drvConfigure(dwDevID);
1214 case DRV_INSTALL: return DRVCNF_RESTART;
1215 case DRV_REMOVE: return DRVCNF_RESTART;
1218 /* session instance */
1219 if (dwDevID == 0xFFFFFFFF) return 1;
1221 switch (wMsg) {
1222 case MCI_OPEN_DRIVER: return MCIAVI_mciOpen (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSA) dwParam2);
1223 case MCI_CLOSE_DRIVER: return MCIAVI_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1224 case MCI_PLAY: return MCIAVI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
1225 case MCI_RECORD: return MCIAVI_mciRecord (dwDevID, dwParam1, (LPMCI_DGV_RECORD_PARMS) dwParam2);
1226 case MCI_STOP: return MCIAVI_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1227 case MCI_SET: return MCIAVI_mciSet (dwDevID, dwParam1, (LPMCI_DGV_SET_PARMS) dwParam2);
1228 case MCI_PAUSE: return MCIAVI_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1229 case MCI_RESUME: return MCIAVI_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1230 case MCI_STATUS: return MCIAVI_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSA) dwParam2);
1231 case MCI_GETDEVCAPS: return MCIAVI_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
1232 case MCI_INFO: return MCIAVI_mciInfo (dwDevID, dwParam1, (LPMCI_DGV_INFO_PARMSA) dwParam2);
1233 case MCI_SEEK: return MCIAVI_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
1234 case MCI_PUT: return MCIAVI_mciPut (dwDevID, dwParam1, (LPMCI_DGV_PUT_PARMS) dwParam2);
1235 case MCI_WINDOW: return MCIAVI_mciWindow (dwDevID, dwParam1, (LPMCI_DGV_WINDOW_PARMSA) dwParam2);
1236 case MCI_LOAD: return MCIAVI_mciLoad (dwDevID, dwParam1, (LPMCI_DGV_LOAD_PARMSA) dwParam2);
1237 case MCI_SAVE: return MCIAVI_mciSave (dwDevID, dwParam1, (LPMCI_DGV_SAVE_PARMSA) dwParam2);
1238 case MCI_FREEZE: return MCIAVI_mciFreeze (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
1239 case MCI_REALIZE: return MCIAVI_mciRealize (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1240 case MCI_UNFREEZE: return MCIAVI_mciUnFreeze (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
1241 case MCI_UPDATE: return MCIAVI_mciUpdate (dwDevID, dwParam1, (LPMCI_DGV_UPDATE_PARMS) dwParam2);
1242 case MCI_WHERE: return MCIAVI_mciWhere (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
1243 case MCI_STEP: return MCIAVI_mciStep (dwDevID, dwParam1, (LPMCI_DGV_STEP_PARMS) dwParam2);
1244 case MCI_COPY: return MCIAVI_mciCopy (dwDevID, dwParam1, (LPMCI_DGV_COPY_PARMS) dwParam2);
1245 case MCI_CUT: return MCIAVI_mciCut (dwDevID, dwParam1, (LPMCI_DGV_CUT_PARMS) dwParam2);
1246 case MCI_DELETE: return MCIAVI_mciDelete (dwDevID, dwParam1, (LPMCI_DGV_DELETE_PARMS) dwParam2);
1247 case MCI_PASTE: return MCIAVI_mciPaste (dwDevID, dwParam1, (LPMCI_DGV_PASTE_PARMS) dwParam2);
1248 case MCI_CUE: return MCIAVI_mciCue (dwDevID, dwParam1, (LPMCI_DGV_CUE_PARMS) dwParam2);
1249 /* Digital Video specific */
1250 case MCI_CAPTURE: return MCIAVI_mciCapture (dwDevID, dwParam1, (LPMCI_DGV_CAPTURE_PARMSA) dwParam2);
1251 case MCI_MONITOR: return MCIAVI_mciMonitor (dwDevID, dwParam1, (LPMCI_DGV_MONITOR_PARMS) dwParam2);
1252 case MCI_RESERVE: return MCIAVI_mciReserve (dwDevID, dwParam1, (LPMCI_DGV_RESERVE_PARMSA) dwParam2);
1253 case MCI_SETAUDIO: return MCIAVI_mciSetAudio (dwDevID, dwParam1, (LPMCI_DGV_SETAUDIO_PARMSA) dwParam2);
1254 case MCI_SIGNAL: return MCIAVI_mciSignal (dwDevID, dwParam1, (LPMCI_DGV_SIGNAL_PARMS) dwParam2);
1255 case MCI_SETVIDEO: return MCIAVI_mciSetVideo (dwDevID, dwParam1, (LPMCI_DGV_SETVIDEO_PARMSA) dwParam2);
1256 case MCI_QUALITY: return MCIAVI_mciQuality (dwDevID, dwParam1, (LPMCI_DGV_QUALITY_PARMSA) dwParam2);
1257 case MCI_LIST: return MCIAVI_mciList (dwDevID, dwParam1, (LPMCI_DGV_LIST_PARMSA) dwParam2);
1258 case MCI_UNDO: return MCIAVI_mciUndo (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1259 case MCI_CONFIGURE: return MCIAVI_mciConfigure (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1260 case MCI_RESTORE: return MCIAVI_mciRestore (dwDevID, dwParam1, (LPMCI_DGV_RESTORE_PARMSA) dwParam2);
1262 case MCI_SPIN:
1263 case MCI_ESCAPE:
1264 WARN("Unsupported command [%lu]\n", wMsg);
1265 break;
1266 case MCI_OPEN:
1267 case MCI_CLOSE:
1268 FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
1269 break;
1270 default:
1271 TRACE("Sending msg [%lu] to default driver proc\n", wMsg);
1272 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
1274 return MCIERR_UNRECOGNIZED_COMMAND;