1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
4 * Digital video MCI Wine Driver
6 * Copyright 1999 Eric POUECH
9 #include "wine/winuser16.h"
10 #include "multimedia.h"
20 int nUseCount; /* Incremented for each shared open */
21 BOOL16 fShareable; /* TRUE if first open was shareable */
22 WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
23 HANDLE16 hCallback; /* Callback handle for pending notification */
24 HMMIO hFile; /* mmio file handle open as Element */
25 WORD wStatus; /* One of MCI_MODE_XXX */
26 MCI_OPEN_PARMSA openParms;
30 #define MAX_MCIAVIDRV (1)
31 static WINE_MCIAVI MCIAviDev[MAX_MCIAVIDRV];
33 /*======================================================================*
34 * MCI AVI implemantation *
35 *======================================================================*/
37 /**************************************************************************
38 * AVI_mciGetOpenDev [internal]
40 static WINE_MCIAVI* AVI_mciGetOpenDev(UINT16 wDevID)
42 if (wDevID >= MAX_MCIAVIDRV || MCIAviDev[wDevID].nUseCount == 0) {
43 WARN(mciavi, "Invalid wDevID=%u\n", wDevID);
46 return &MCIAviDev[wDevID];
49 static DWORD AVI_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms);
51 /***************************************************************************
52 * AVI_mciOpen [internal]
54 static DWORD AVI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSA lpParms)
58 TRACE(mciavi, "(%04x, %08lX, %p) : semi-stub\n", wDevID, dwFlags, lpParms);
60 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
61 if (wDevID > MAX_MCIAVIDRV) return MCIERR_INVALID_DEVICE_ID;
63 wma = &MCIAviDev[wDevID];
65 if (wma->nUseCount > 0) {
66 /* The driver is already open on this channel */
67 /* If the driver was opened shareable before and this open specifies */
68 /* shareable then increment the use count */
69 if (wma->fShareable && (dwFlags & MCI_OPEN_SHAREABLE))
72 return MCIERR_MUST_USE_SHAREABLE;
75 wma->fShareable = dwFlags & MCI_OPEN_SHAREABLE;
77 if (dwFlags & MCI_OPEN_ELEMENT) {
78 TRACE(cdaudio,"MCI_OPEN_ELEMENT !\n");
79 /* return MCIERR_NO_ELEMENT_ALLOWED; */
82 wma->openParms.dwCallback = lpParms->dwCallback;
83 wma->openParms.wDeviceID = (WORD)lpParms->wDeviceID;
84 wma->openParms.lpstrDeviceType = lpParms->lpstrDeviceType;
85 wma->openParms.lpstrElementName = lpParms->lpstrElementName;
86 wma->openParms.lpstrAlias = lpParms->lpstrAlias;
88 wma->wNotifyDeviceID = lpParms->wDeviceID;
89 /* FIXME: do real open */
90 wma->wStatus = MCI_MODE_STOP;
91 wma->dwTimeFormat = MCI_FORMAT_TMSF;
97 /***************************************************************************
98 * AVI_mciClose [internal]
100 static DWORD AVI_mciClose(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
102 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
104 TRACE(mciavi, "(%04x, %08lX, %p) : semi-stub\n", wDevID, dwFlags, lpParms);
106 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
108 if (wma->nUseCount == 1) {
109 AVI_mciStop(wDevID, 0, NULL);
110 /* FIXME: do real closing */
116 /***************************************************************************
117 * AVI_mciPlay [internal]
119 static DWORD AVI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
121 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
123 TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
125 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
126 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
128 wma->wStatus = MCI_MODE_PLAY;
129 if (lpParms && (dwFlags & MCI_NOTIFY)) {
130 TRACE(mcimidi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
131 mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
132 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
137 /***************************************************************************
138 * AVI_mciRecord [internal]
140 static DWORD AVI_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_RECORD_PARMS lpParms)
142 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
144 TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
146 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
147 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
149 wma->wStatus = MCI_MODE_RECORD;
153 /***************************************************************************
154 * AVI_mciStop [internal]
156 static DWORD AVI_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
158 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
160 TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
162 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
163 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
165 wma->wStatus = MCI_MODE_STOP;
169 /***************************************************************************
170 * AVI_mciPause [internal]
172 static DWORD AVI_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
174 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
176 TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
178 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
179 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
181 wma->wStatus = MCI_MODE_PAUSE;
185 /***************************************************************************
186 * AVI_mciResume [internal]
188 static DWORD AVI_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
190 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
192 TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
194 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
195 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
197 wma->wStatus = MCI_MODE_PLAY;
201 /***************************************************************************
202 * AVI_mciSeek [internal]
204 static DWORD AVI_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
206 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
208 TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
210 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
211 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
216 /***************************************************************************
217 * AVI_mciSet [internal]
219 static DWORD AVI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
221 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
223 TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
225 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
226 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
228 if (dwFlags & MCI_SET_TIME_FORMAT) {
229 switch (lpParms->dwTimeFormat) {
230 case MCI_FORMAT_MILLISECONDS:
231 TRACE(mciavi, "MCI_FORMAT_MILLISECONDS !\n");
232 wma->dwTimeFormat = MCI_FORMAT_MILLISECONDS;
234 case MCI_FORMAT_FRAMES:
235 TRACE(mciavi, "MCI_FORMAT_FRAMES !\n");
236 wma->dwTimeFormat = MCI_FORMAT_FRAMES;
239 WARN(mciavi, "Bad time format %lu!\n", lpParms->dwTimeFormat);
240 return MCIERR_BAD_TIME_FORMAT;
244 if (dwFlags & MCI_SET_DOOR_OPEN) {
245 TRACE(mciavi, "No support for door open !\n");
246 return MCIERR_UNSUPPORTED_FUNCTION;
248 if (dwFlags & MCI_SET_DOOR_CLOSED) {
249 TRACE(mciavi, "No support for door close !\n");
250 return MCIERR_UNSUPPORTED_FUNCTION;
252 if (dwFlags & MCI_SET_ON) {
253 dbg_decl_str(mciavi, 256);
255 dsprintf(mciavi, "MCI_SET_ON:");
257 if (dwFlags & MCI_SET_VIDEO) {
258 dsprintf(mciavi, " video");
260 if (dwFlags & MCI_SET_AUDIO) {
261 dsprintf(mciavi, " audio");
262 if (lpParms->dwAudio & MCI_SET_AUDIO_ALL)
263 dsprintf(mciavi, " all");
264 if (lpParms->dwAudio & MCI_SET_AUDIO_LEFT)
265 dsprintf(mciavi, " left");
266 if (lpParms->dwAudio & MCI_SET_AUDIO_RIGHT)
267 dsprintf(mciavi, " right");
269 if (dwFlags & MCI_DGV_SET_SEEK_EXACTLY) {
270 dsprintf(mciavi, " seek_exactly");
272 TRACE(mciavi, "%s\n", dbg_str(mciavi));
275 if (dwFlags & MCI_SET_OFF) {
276 dbg_decl_str(mciavi, 256);
278 dsprintf(mciavi, "MCI_SET_OFF:");
279 if (dwFlags & MCI_SET_VIDEO) {
280 dsprintf(mciavi, " video");
282 if (dwFlags & MCI_SET_AUDIO) {
283 dsprintf(mciavi, " audio");
284 if (lpParms->dwAudio & MCI_SET_AUDIO_ALL)
285 dsprintf(mciavi, " all");
286 if (lpParms->dwAudio & MCI_SET_AUDIO_LEFT)
287 dsprintf(mciavi, " left");
288 if (lpParms->dwAudio & MCI_SET_AUDIO_RIGHT)
289 dsprintf(mciavi, " right");
291 if (dwFlags & MCI_DGV_SET_SEEK_EXACTLY) {
292 dsprintf(mciavi, " seek_exactly");
294 TRACE(mciavi, "%s\n", dbg_str(mciavi));
296 if (dwFlags & MCI_DGV_SET_FILEFORMAT) {
298 if (dwFlags & MCI_DGV_SET_STILL)
301 switch (lpParms->dwFileFormat) {
302 case MCI_DGV_FF_AVI: TRACE(mciavi, "Setting file format (%s) to 'AVI'\n", str); break;
303 case MCI_DGV_FF_AVSS: TRACE(mciavi, "Setting file format (%s) to 'AVSS'\n", str); break;
304 case MCI_DGV_FF_DIB: TRACE(mciavi, "Setting file format (%s) to 'DIB'\n", str); break;
305 case MCI_DGV_FF_JFIF: TRACE(mciavi, "Setting file format (%s) to 'JFIF'\n", str); break;
306 case MCI_DGV_FF_JPEG: TRACE(mciavi, "Setting file format (%s) to 'JPEG'\n", str); break;
307 case MCI_DGV_FF_MPEG: TRACE(mciavi, "Setting file format (%s) to 'MPEG'\n", str); break;
308 case MCI_DGV_FF_RDIB: TRACE(mciavi, "Setting file format (%s) to 'RLE DIB'\n", str); break;
309 case MCI_DGV_FF_RJPEG: TRACE(mciavi, "Setting file format (%s) to 'RJPEG'\n", str); break;
310 default: TRACE(mciavi, "Setting unknown file format (%s): %ld\n", str, lpParms->dwFileFormat);
314 if (dwFlags & MCI_DGV_SET_SPEED) {
315 TRACE(mciavi, "Setting speed to %ld\n", lpParms->dwSpeed);
321 /***************************************************************************
322 * AVI_mciStatus [internal]
324 static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA lpParms)
326 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
328 TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
330 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
331 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
333 if (dwFlags & MCI_STATUS_ITEM) {
334 switch (lpParms->dwItem) {
335 case MCI_STATUS_CURRENT_TRACK:
336 lpParms->dwReturn = 1;
337 TRACE(mciavi, "MCI_STATUS_CURRENT_TRACK => %lu\n", lpParms->dwReturn);
339 case MCI_STATUS_LENGTH:
340 if (dwFlags & MCI_TRACK) {
341 /* lpParms->dwTrack contains track # */
342 lpParms->dwReturn = 0x1234;
344 lpParms->dwReturn = 0x4321;
346 TRACE(mciavi, "MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn);
348 case MCI_STATUS_MODE:
349 lpParms->dwReturn = wma->wStatus;
350 TRACE(mciavi, "MCI_STATUS_MODE => %lu\n", lpParms->dwReturn);
352 case MCI_STATUS_MEDIA_PRESENT:
353 TRACE(mciavi, "MCI_STATUS_MEDIA_PRESENT => TRUE\n");
354 lpParms->dwReturn = TRUE;
356 case MCI_STATUS_NUMBER_OF_TRACKS:
357 lpParms->dwReturn = 3;
358 TRACE(mciavi, "MCI_STATUS_NUMBER_OF_TRACKS => %lu\n", lpParms->dwReturn);
360 case MCI_STATUS_POSITION:
361 /* FIXME: do I need to use MCI_TRACK ? */
362 lpParms->dwReturn = 0x0123;
363 TRACE(mciavi, "MCI_STATUS_POSITION %s => %lu\n",
364 (dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn);
366 case MCI_STATUS_READY:
367 lpParms->dwReturn = (wma->wStatus != MCI_MODE_NOT_READY);
368 TRACE(mciavi, "MCI_STATUS_READY = %lu\n", lpParms->dwReturn);
370 case MCI_STATUS_TIME_FORMAT:
371 lpParms->dwReturn = wma->dwTimeFormat;
372 TRACE(mciavi, "MCI_STATUS_TIME_FORMAT => %lu\n", lpParms->dwReturn);
375 WARN(mciavi, "Unknowm command %08lX !\n", lpParms->dwItem);
376 return MCIERR_UNRECOGNIZED_COMMAND;
379 WARN(mciavi, "No Status-Item!\n");
380 return MCIERR_UNRECOGNIZED_COMMAND;
382 if (dwFlags & MCI_NOTIFY) {
383 TRACE(mciavi, "MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
384 mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
385 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
391 /***************************************************************************
392 * AVI_mciGetDevCaps [internal]
394 static DWORD AVI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS lpParms)
396 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
398 TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
400 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
401 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
403 if (dwFlags & MCI_GETDEVCAPS_ITEM) {
404 switch (lpParms->dwItem) {
405 case MCI_GETDEVCAPS_DEVICE_TYPE:
406 TRACE(mciavi, "MCI_GETDEVCAPS_DEVICE_TYPE !\n");
407 lpParms->dwReturn = MCI_DEVTYPE_DIGITAL_VIDEO;
409 case MCI_GETDEVCAPS_HAS_AUDIO:
410 TRACE(mciavi, "MCI_GETDEVCAPS_HAS_AUDIO !\n");
411 lpParms->dwReturn = TRUE;
413 case MCI_GETDEVCAPS_HAS_VIDEO:
414 TRACE(mciavi, "MCI_GETDEVCAPS_HAS_VIDEO !\n");
415 lpParms->dwReturn = TRUE;
417 case MCI_GETDEVCAPS_USES_FILES:
418 TRACE(mciavi, "MCI_GETDEVCAPS_USES_FILES !\n");
419 lpParms->dwReturn = TRUE;
421 case MCI_GETDEVCAPS_COMPOUND_DEVICE:
422 TRACE(mciavi, "MCI_GETDEVCAPS_COMPOUND_DEVICE !\n");
423 lpParms->dwReturn = TRUE;
425 case MCI_GETDEVCAPS_CAN_EJECT:
426 TRACE(mciavi, "MCI_GETDEVCAPS_CAN_EJECT !\n");
427 lpParms->dwReturn = FALSE;
429 case MCI_GETDEVCAPS_CAN_PLAY:
430 TRACE(mciavi, "MCI_GETDEVCAPS_CAN_PLAY !\n");
431 lpParms->dwReturn = TRUE;
433 case MCI_GETDEVCAPS_CAN_RECORD:
434 TRACE(mciavi, "MCI_GETDEVCAPS_CAN_RECORD !\n");
435 lpParms->dwReturn = FALSE;
437 case MCI_GETDEVCAPS_CAN_SAVE:
438 TRACE(mciavi, "MCI_GETDEVCAPS_CAN_SAVE !\n");
439 lpParms->dwReturn = FALSE;
442 TRACE(mciavi, "Unknown capability (%08lx) !\n", lpParms->dwItem);
443 return MCIERR_UNRECOGNIZED_COMMAND;
446 TRACE(mciavi, "No GetDevCaps-Item !\n");
447 return MCIERR_UNRECOGNIZED_COMMAND;
452 /***************************************************************************
453 * AVI_mciInfo [internal]
455 static DWORD AVI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSA lpParms)
459 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
461 TRACE(mciavi, "(%04X, %08lX, %p) : stub;\n", wDevID, dwFlags, lpParms);
463 if (lpParms == NULL || lpParms->lpstrReturn == NULL) {
464 ret = MCIERR_NULL_PARAMETER_BLOCK;
465 } else if (wma == NULL) {
466 ret = MCIERR_INVALID_DEVICE_ID;
468 TRACE(mciavi, "buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
471 case MCI_INFO_PRODUCT:
472 str = "Wine's AVI player";
478 /* FIXME: the following manifest constants are not defined in <WINE>/include/mmsystem.h */
479 case MCI_INFO_COPYRIGHT:
485 WARN(mciavi, "Don't know this info command (%lu)\n", dwFlags);
486 ret = MCIERR_UNRECOGNIZED_COMMAND;
490 ret = MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
492 lpParms->lpstrReturn[0] = 0;
498 /***************************************************************************
499 * AVI_mciPut [internal]
501 static DWORD AVI_mciPut(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_PUT_PARMS lpParms)
503 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
505 dbg_decl_str(mciavi, 256);
507 TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
509 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
510 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
512 if (dwFlags & MCI_DGV_RECT) {
518 if (dwFlags & MCI_DGV_PUT_CLIENT) {
519 dsprintf(mciavi, "PUT_CLIENT");
521 if (dwFlags & MCI_DGV_PUT_DESTINATION) {
522 dsprintf(mciavi, "PUT_DESTINATION");
524 if (dwFlags & MCI_DGV_PUT_FRAME) {
525 dsprintf(mciavi, "PUT_FRAME");
527 if (dwFlags & MCI_DGV_PUT_SOURCE) {
528 dsprintf(mciavi, "PUT_SOURCE");
530 if (dwFlags & MCI_DGV_PUT_VIDEO) {
531 dsprintf(mciavi, "PUT_VIDEO");
533 if (dwFlags & MCI_DGV_PUT_WINDOW) {
534 dsprintf(mciavi, "PUT_WINDOW");
536 dsprintf(mciavi, " (%d,%d,%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
541 /***************************************************************************
542 * AVI_mciWindow [internal]
544 static DWORD AVI_mciWindow(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSA lpParms)
546 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
548 TRACE(mciavi, "(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
550 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
551 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
553 if (dwFlags & MCI_DGV_WINDOW_HWND) {
554 TRACE(mciavi, "Setting hWnd to %08lx\n", (DWORD)lpParms->hWnd);
556 if (dwFlags & MCI_DGV_WINDOW_STATE) {
557 TRACE(mciavi, "Setting nCmdShow to %d\n", lpParms->nCmdShow);
559 if (dwFlags & MCI_DGV_WINDOW_TEXT) {
560 TRACE(mciavi, "Setting caption to '%s'\n", lpParms->lpstrText);
566 /*****************************************************************************
567 * AVI_mciLoad [internal]
569 static DWORD AVI_mciLoad(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_LOAD_PARMSA lpParms)
571 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
573 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
575 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
576 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
581 /******************************************************************************
582 * AVI_mciSave [internal]
584 static DWORD AVI_mciSave(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_SAVE_PARMSA lpParms)
586 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
588 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
590 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
591 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
596 /******************************************************************************
597 * AVI_mciFreeze [internal]
599 static DWORD AVI_mciFreeze(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
601 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
603 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
605 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
606 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
611 /******************************************************************************
612 * AVI_mciRealize [internal]
614 static DWORD AVI_mciRealize(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
616 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
618 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
620 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
621 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
626 /******************************************************************************
627 * AVI_mciUnFreeze [internal]
629 static DWORD AVI_mciUnFreeze(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
631 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
633 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
635 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
636 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
641 /******************************************************************************
642 * AVI_mciUpdate [internal]
644 static DWORD AVI_mciUpdate(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_UPDATE_PARMS lpParms)
646 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
648 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
650 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
651 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
656 /******************************************************************************
657 * AVI_mciWhere [internal]
659 static DWORD AVI_mciWhere(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
661 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
663 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
665 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
666 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
671 /******************************************************************************
672 * AVI_mciStep [internal]
674 static DWORD AVI_mciStep(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STEP_PARMS lpParms)
676 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
678 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
680 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
681 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
686 /******************************************************************************
687 * AVI_mciCopy [internal]
689 static DWORD AVI_mciCopy(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_COPY_PARMS lpParms)
691 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
693 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
695 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
696 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
701 /******************************************************************************
702 * AVI_mciCut [internal]
704 static DWORD AVI_mciCut(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_CUT_PARMS lpParms)
706 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
708 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
710 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
711 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
716 /******************************************************************************
717 * AVI_mciDelete [internal]
719 static DWORD AVI_mciDelete(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_DELETE_PARMS lpParms)
721 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
723 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
725 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
726 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
731 /******************************************************************************
732 * AVI_mciPaste [internal]
734 static DWORD AVI_mciPaste(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_PASTE_PARMS lpParms)
736 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
738 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
740 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
741 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
746 /******************************************************************************
747 * AVI_mciCue [internal]
749 static DWORD AVI_mciCue(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_CUE_PARMS lpParms)
751 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
753 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
755 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
756 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
761 /******************************************************************************
762 * AVI_mciCapture [internal]
764 static DWORD AVI_mciCapture(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_CAPTURE_PARMSA lpParms)
766 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
768 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
770 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
771 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
776 /******************************************************************************
777 * AVI_mciMonitor [internal]
779 static DWORD AVI_mciMonitor(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_MONITOR_PARMS lpParms)
781 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
783 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
785 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
786 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
791 /******************************************************************************
792 * AVI_mciReserve [internal]
794 static DWORD AVI_mciReserve(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_RESERVE_PARMSA lpParms)
796 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
798 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
800 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
801 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
806 /******************************************************************************
807 * AVI_mciSetAudio [internal]
809 static DWORD AVI_mciSetAudio(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_SETAUDIO_PARMSA lpParms)
811 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
813 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
815 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
816 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
821 /******************************************************************************
822 * AVI_mciSignal [internal]
824 static DWORD AVI_mciSignal(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_SIGNAL_PARMS lpParms)
826 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
828 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
830 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
831 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
836 /******************************************************************************
837 * AVI_mciSetVideo [internal]
839 static DWORD AVI_mciSetVideo(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_SETVIDEO_PARMSA lpParms)
841 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
843 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
845 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
846 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
851 /******************************************************************************
852 * AVI_mciQuality [internal]
854 static DWORD AVI_mciQuality(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_QUALITY_PARMSA lpParms)
856 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
858 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
860 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
861 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
866 /******************************************************************************
867 * AVI_mciList [internal]
869 static DWORD AVI_mciList(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_LIST_PARMSA lpParms)
871 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
873 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
875 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
876 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
881 /******************************************************************************
882 * AVI_mciUndo [internal]
884 static DWORD AVI_mciUndo(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
886 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
888 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
890 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
891 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
896 /******************************************************************************
897 * AVI_mciConfigure [internal]
899 static DWORD AVI_mciConfigure(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
901 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
903 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
905 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
906 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
911 /******************************************************************************
912 * AVI_mciRestore [internal]
914 static DWORD AVI_mciRestore(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_RESTORE_PARMSA lpParms)
916 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
918 TRACE(mciavi, "(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
920 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
921 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
926 /*======================================================================*
927 * MCI AVI entry points *
928 *======================================================================*/
930 /**************************************************************************
931 * MCIAVI_DriverProc [sample driver]
933 LONG MCIAVI_DriverProc(DWORD dwDevID, HDRVR16 hDriv, DWORD wMsg,
934 DWORD dwParam1, DWORD dwParam2)
937 case DRV_LOAD: return 1;
938 case DRV_FREE: return 1;
939 case DRV_OPEN: return 1;
940 case DRV_CLOSE: return 1;
941 case DRV_ENABLE: return 1;
942 case DRV_DISABLE: return 1;
943 case DRV_QUERYCONFIGURE: return 1;
944 case DRV_CONFIGURE: MessageBoxA(0, "Sample AVI Wine Driver !", "MM-Wine Driver", MB_OK); return 1;
945 case DRV_INSTALL: return DRVCNF_RESTART;
946 case DRV_REMOVE: return DRVCNF_RESTART;
948 case MCI_OPEN_DRIVER: return AVI_mciOpen (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSA) dwParam2);
949 case MCI_CLOSE_DRIVER: return AVI_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
950 case MCI_PLAY: return AVI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
951 case MCI_RECORD: return AVI_mciRecord (dwDevID, dwParam1, (LPMCI_DGV_RECORD_PARMS) dwParam2);
952 case MCI_STOP: return AVI_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
953 case MCI_SET: return AVI_mciSet (dwDevID, dwParam1, (LPMCI_DGV_SET_PARMS) dwParam2);
954 case MCI_PAUSE: return AVI_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
955 case MCI_RESUME: return AVI_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
956 case MCI_STATUS: return AVI_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSA) dwParam2);
957 case MCI_GETDEVCAPS: return AVI_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
958 case MCI_INFO: return AVI_mciInfo (dwDevID, dwParam1, (LPMCI_DGV_INFO_PARMSA) dwParam2);
959 case MCI_SEEK: return AVI_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
960 case MCI_PUT: return AVI_mciPut (dwDevID, dwParam1, (LPMCI_DGV_PUT_PARMS) dwParam2);
961 case MCI_WINDOW: return AVI_mciWindow (dwDevID, dwParam1, (LPMCI_DGV_WINDOW_PARMSA) dwParam2);
962 case MCI_LOAD: return AVI_mciLoad (dwDevID, dwParam1, (LPMCI_DGV_LOAD_PARMSA) dwParam2);
963 case MCI_SAVE: return AVI_mciSave (dwDevID, dwParam1, (LPMCI_DGV_SAVE_PARMSA) dwParam2);
964 case MCI_FREEZE: return AVI_mciFreeze (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
965 case MCI_REALIZE: return AVI_mciRealize (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
966 case MCI_UNFREEZE: return AVI_mciUnFreeze (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
967 case MCI_UPDATE: return AVI_mciUpdate (dwDevID, dwParam1, (LPMCI_DGV_UPDATE_PARMS) dwParam2);
968 case MCI_WHERE: return AVI_mciWhere (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
969 case MCI_STEP: return AVI_mciStep (dwDevID, dwParam1, (LPMCI_DGV_STEP_PARMS) dwParam2);
970 case MCI_COPY: return AVI_mciCopy (dwDevID, dwParam1, (LPMCI_DGV_COPY_PARMS) dwParam2);
971 case MCI_CUT: return AVI_mciCut (dwDevID, dwParam1, (LPMCI_DGV_CUT_PARMS) dwParam2);
972 case MCI_DELETE: return AVI_mciDelete (dwDevID, dwParam1, (LPMCI_DGV_DELETE_PARMS) dwParam2);
973 case MCI_PASTE: return AVI_mciPaste (dwDevID, dwParam1, (LPMCI_DGV_PASTE_PARMS) dwParam2);
974 case MCI_CUE: return AVI_mciCue (dwDevID, dwParam1, (LPMCI_DGV_CUE_PARMS) dwParam2);
975 /* Digital Video specific */
976 case MCI_CAPTURE: return AVI_mciCapture (dwDevID, dwParam1, (LPMCI_DGV_CAPTURE_PARMSA) dwParam2);
977 case MCI_MONITOR: return AVI_mciMonitor (dwDevID, dwParam1, (LPMCI_DGV_MONITOR_PARMS) dwParam2);
978 case MCI_RESERVE: return AVI_mciReserve (dwDevID, dwParam1, (LPMCI_DGV_RESERVE_PARMSA) dwParam2);
979 case MCI_SETAUDIO: return AVI_mciSetAudio (dwDevID, dwParam1, (LPMCI_DGV_SETAUDIO_PARMSA) dwParam2);
980 case MCI_SIGNAL: return AVI_mciSignal (dwDevID, dwParam1, (LPMCI_DGV_SIGNAL_PARMS) dwParam2);
981 case MCI_SETVIDEO: return AVI_mciSetVideo (dwDevID, dwParam1, (LPMCI_DGV_SETVIDEO_PARMSA) dwParam2);
982 case MCI_QUALITY: return AVI_mciQuality (dwDevID, dwParam1, (LPMCI_DGV_QUALITY_PARMSA) dwParam2);
983 case MCI_LIST: return AVI_mciList (dwDevID, dwParam1, (LPMCI_DGV_LIST_PARMSA) dwParam2);
984 case MCI_UNDO: return AVI_mciUndo (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
985 case MCI_CONFIGURE: return AVI_mciConfigure (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
986 case MCI_RESTORE: return AVI_mciRestore (dwDevID, dwParam1, (LPMCI_DGV_RESTORE_PARMSA) dwParam2);
990 WARN(mciavi, "Unsupported command=%s\n", MCI_CommandToString(wMsg));
994 FIXME(mciavi, "Shouldn't receive a MCI_OPEN or CLOSE message\n");
997 TRACE(mciavi, "Sending msg=%s to default driver proc\n", MCI_CommandToString(wMsg));
998 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
1000 return MCIERR_UNRECOGNIZED_COMMAND;