1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
4 * Digital video MCI Wine Driver
6 * Copyright 1999 Eric POUECH
10 #include "multimedia.h"
14 #include "debugtools.h"
18 DECLARE_DEBUG_CHANNEL(mciavi)
22 int nUseCount; /* Incremented for each shared open */
23 BOOL16 fShareable; /* TRUE if first open was shareable */
24 WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
25 HANDLE16 hCallback; /* Callback handle for pending notification */
26 HMMIO hFile; /* mmio file handle open as Element */
27 WORD wStatus; /* One of MCI_MODE_XXX */
28 MCI_OPEN_PARMSA openParms;
32 #define MAX_MCIAVIDRV (1)
33 static WINE_MCIAVI MCIAviDev[MAX_MCIAVIDRV];
35 /*======================================================================*
36 * MCI AVI implemantation *
37 *======================================================================*/
39 /**************************************************************************
40 * AVI_drvGetDrv [internal]
42 static WINE_MCIAVI* AVI_drvGetDrv(UINT16 wDevID)
46 for (i = 0; i < MAX_MCIAVIDRV; i++) {
47 if (MCIAviDev[i].wDevID == wDevID) {
54 /**************************************************************************
55 * AVI_drvOpen [internal]
57 static DWORD AVI_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
61 for (i = 0; i < MAX_MCIAVIDRV; i++) {
62 if (MCIAviDev[i].wDevID == 0) {
63 MCIAviDev[i].wDevID = modp->wDeviceID;
64 modp->wCustomCommandTable = -1;
65 modp->wType = MCI_DEVTYPE_CD_AUDIO;
66 return modp->wDeviceID;
72 /**************************************************************************
73 * MCIAVI_drvClose [internal]
75 static DWORD AVI_drvClose(DWORD dwDevID)
77 WINE_MCIAVI* wma = AVI_drvGetDrv(dwDevID);
86 /**************************************************************************
87 * AVI_mciGetOpenDev [internal]
89 static WINE_MCIAVI* AVI_mciGetOpenDev(UINT16 wDevID)
91 WINE_MCIAVI* wma = AVI_drvGetDrv(wDevID);
93 if (wma == NULL || wma->nUseCount == 0) {
94 WARN_(mciavi)("Invalid wDevID=%u\n", wDevID);
100 static DWORD AVI_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms);
102 /***************************************************************************
103 * AVI_mciOpen [internal]
105 static DWORD AVI_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_OPEN_PARMSA lpParms)
107 WINE_MCIAVI* wma = AVI_drvGetDrv(wDevID);
109 TRACE_(mciavi)("(%04x, %08lX, %p) : semi-stub\n", wDevID, dwFlags, lpParms);
111 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
112 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
114 if (wma->nUseCount > 0) {
115 /* The driver is already open on this channel */
116 /* If the driver was opened shareable before and this open specifies */
117 /* shareable then increment the use count */
118 if (wma->fShareable && (dwFlags & MCI_OPEN_SHAREABLE))
121 return MCIERR_MUST_USE_SHAREABLE;
124 wma->fShareable = dwFlags & MCI_OPEN_SHAREABLE;
126 if (dwFlags & MCI_OPEN_ELEMENT) {
127 TRACE_(mciavi)("MCI_OPEN_ELEMENT !\n");
128 /* return MCIERR_NO_ELEMENT_ALLOWED; */
131 wma->openParms.dwCallback = lpParms->dwCallback;
132 wma->openParms.wDeviceID = (WORD)lpParms->wDeviceID;
133 wma->openParms.lpstrDeviceType = lpParms->lpstrDeviceType;
134 wma->openParms.lpstrElementName = lpParms->lpstrElementName;
135 wma->openParms.lpstrAlias = lpParms->lpstrAlias;
137 wma->wNotifyDeviceID = lpParms->wDeviceID;
138 /* FIXME: do real open */
139 wma->wStatus = MCI_MODE_STOP;
140 wma->dwTimeFormat = MCI_FORMAT_TMSF;
146 /***************************************************************************
147 * AVI_mciClose [internal]
149 static DWORD AVI_mciClose(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
151 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
153 TRACE_(mciavi)("(%04x, %08lX, %p) : semi-stub\n", wDevID, dwFlags, lpParms);
155 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
157 if (wma->nUseCount == 1) {
158 AVI_mciStop(wDevID, 0, NULL);
159 /* FIXME: do real closing */
165 /***************************************************************************
166 * AVI_mciPlay [internal]
168 static DWORD AVI_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
170 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
172 TRACE_(mciavi)("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
174 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
175 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
177 wma->wStatus = MCI_MODE_PLAY;
178 if (lpParms && (dwFlags & MCI_NOTIFY)) {
179 TRACE_(mciavi)("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
180 mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
181 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
186 /***************************************************************************
187 * AVI_mciRecord [internal]
189 static DWORD AVI_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_RECORD_PARMS lpParms)
191 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
193 TRACE_(mciavi)("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
195 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
196 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
198 wma->wStatus = MCI_MODE_RECORD;
202 /***************************************************************************
203 * AVI_mciStop [internal]
205 static DWORD AVI_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
207 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
209 TRACE_(mciavi)("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
211 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
212 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
214 wma->wStatus = MCI_MODE_STOP;
218 /***************************************************************************
219 * AVI_mciPause [internal]
221 static DWORD AVI_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
223 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
225 TRACE_(mciavi)("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
227 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
228 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
230 wma->wStatus = MCI_MODE_PAUSE;
234 /***************************************************************************
235 * AVI_mciResume [internal]
237 static DWORD AVI_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
239 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
241 TRACE_(mciavi)("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
243 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
244 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
246 wma->wStatus = MCI_MODE_PLAY;
250 /***************************************************************************
251 * AVI_mciSeek [internal]
253 static DWORD AVI_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
255 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
257 TRACE_(mciavi)("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
259 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
260 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
265 /***************************************************************************
266 * AVI_mciSet [internal]
268 static DWORD AVI_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
270 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
272 TRACE_(mciavi)("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
274 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
275 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
277 if (dwFlags & MCI_SET_TIME_FORMAT) {
278 switch (lpParms->dwTimeFormat) {
279 case MCI_FORMAT_MILLISECONDS:
280 TRACE_(mciavi)("MCI_FORMAT_MILLISECONDS !\n");
281 wma->dwTimeFormat = MCI_FORMAT_MILLISECONDS;
283 case MCI_FORMAT_FRAMES:
284 TRACE_(mciavi)("MCI_FORMAT_FRAMES !\n");
285 wma->dwTimeFormat = MCI_FORMAT_FRAMES;
288 WARN_(mciavi)("Bad time format %lu!\n", lpParms->dwTimeFormat);
289 return MCIERR_BAD_TIME_FORMAT;
293 if (dwFlags & MCI_SET_DOOR_OPEN) {
294 TRACE_(mciavi)("No support for door open !\n");
295 return MCIERR_UNSUPPORTED_FUNCTION;
297 if (dwFlags & MCI_SET_DOOR_CLOSED) {
298 TRACE_(mciavi)("No support for door close !\n");
299 return MCIERR_UNSUPPORTED_FUNCTION;
301 if (dwFlags & MCI_SET_ON) {
302 dbg_decl_str(mciavi, 256);
304 dsprintf(mciavi, "MCI_SET_ON:");
306 if (dwFlags & MCI_SET_VIDEO) {
307 dsprintf(mciavi, " video");
309 if (dwFlags & MCI_SET_AUDIO) {
310 dsprintf(mciavi, " audio");
311 if (lpParms->dwAudio & MCI_SET_AUDIO_ALL)
312 dsprintf(mciavi, " all");
313 if (lpParms->dwAudio & MCI_SET_AUDIO_LEFT)
314 dsprintf(mciavi, " left");
315 if (lpParms->dwAudio & MCI_SET_AUDIO_RIGHT)
316 dsprintf(mciavi, " right");
318 if (dwFlags & MCI_DGV_SET_SEEK_EXACTLY) {
319 dsprintf(mciavi, " seek_exactly");
321 TRACE_(mciavi)("%s\n", dbg_str(mciavi));
324 if (dwFlags & MCI_SET_OFF) {
325 dbg_decl_str(mciavi, 256);
327 dsprintf(mciavi, "MCI_SET_OFF:");
328 if (dwFlags & MCI_SET_VIDEO) {
329 dsprintf(mciavi, " video");
331 if (dwFlags & MCI_SET_AUDIO) {
332 dsprintf(mciavi, " audio");
333 if (lpParms->dwAudio & MCI_SET_AUDIO_ALL)
334 dsprintf(mciavi, " all");
335 if (lpParms->dwAudio & MCI_SET_AUDIO_LEFT)
336 dsprintf(mciavi, " left");
337 if (lpParms->dwAudio & MCI_SET_AUDIO_RIGHT)
338 dsprintf(mciavi, " right");
340 if (dwFlags & MCI_DGV_SET_SEEK_EXACTLY) {
341 dsprintf(mciavi, " seek_exactly");
343 TRACE_(mciavi)("%s\n", dbg_str(mciavi));
345 if (dwFlags & MCI_DGV_SET_FILEFORMAT) {
347 if (dwFlags & MCI_DGV_SET_STILL)
350 switch (lpParms->dwFileFormat) {
351 case MCI_DGV_FF_AVI: TRACE_(mciavi)("Setting file format (%s) to 'AVI'\n", str); break;
352 case MCI_DGV_FF_AVSS: TRACE_(mciavi)("Setting file format (%s) to 'AVSS'\n", str); break;
353 case MCI_DGV_FF_DIB: TRACE_(mciavi)("Setting file format (%s) to 'DIB'\n", str); break;
354 case MCI_DGV_FF_JFIF: TRACE_(mciavi)("Setting file format (%s) to 'JFIF'\n", str); break;
355 case MCI_DGV_FF_JPEG: TRACE_(mciavi)("Setting file format (%s) to 'JPEG'\n", str); break;
356 case MCI_DGV_FF_MPEG: TRACE_(mciavi)("Setting file format (%s) to 'MPEG'\n", str); break;
357 case MCI_DGV_FF_RDIB: TRACE_(mciavi)("Setting file format (%s) to 'RLE DIB'\n", str); break;
358 case MCI_DGV_FF_RJPEG: TRACE_(mciavi)("Setting file format (%s) to 'RJPEG'\n", str); break;
359 default: TRACE_(mciavi)("Setting unknown file format (%s): %ld\n", str, lpParms->dwFileFormat);
363 if (dwFlags & MCI_DGV_SET_SPEED) {
364 TRACE_(mciavi)("Setting speed to %ld\n", lpParms->dwSpeed);
370 /***************************************************************************
371 * AVI_mciStatus [internal]
373 static DWORD AVI_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSA lpParms)
375 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
377 TRACE_(mciavi)("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
379 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
380 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
382 if (dwFlags & MCI_STATUS_ITEM) {
383 switch (lpParms->dwItem) {
384 case MCI_STATUS_CURRENT_TRACK:
385 lpParms->dwReturn = 1;
386 TRACE_(mciavi)("MCI_STATUS_CURRENT_TRACK => %lu\n", lpParms->dwReturn);
388 case MCI_STATUS_LENGTH:
389 if (dwFlags & MCI_TRACK) {
390 /* lpParms->dwTrack contains track # */
391 lpParms->dwReturn = 0x1234;
393 lpParms->dwReturn = 0x4321;
395 TRACE_(mciavi)("MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn);
397 case MCI_STATUS_MODE:
398 lpParms->dwReturn = wma->wStatus;
399 TRACE_(mciavi)("MCI_STATUS_MODE => %lu\n", lpParms->dwReturn);
401 case MCI_STATUS_MEDIA_PRESENT:
402 TRACE_(mciavi)("MCI_STATUS_MEDIA_PRESENT => TRUE\n");
403 lpParms->dwReturn = TRUE;
405 case MCI_STATUS_NUMBER_OF_TRACKS:
406 lpParms->dwReturn = 3;
407 TRACE_(mciavi)("MCI_STATUS_NUMBER_OF_TRACKS => %lu\n", lpParms->dwReturn);
409 case MCI_STATUS_POSITION:
410 /* FIXME: do I need to use MCI_TRACK ? */
411 lpParms->dwReturn = 0x0123;
412 TRACE_(mciavi)("MCI_STATUS_POSITION %s => %lu\n",
413 (dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn);
415 case MCI_STATUS_READY:
416 lpParms->dwReturn = (wma->wStatus != MCI_MODE_NOT_READY);
417 TRACE_(mciavi)("MCI_STATUS_READY = %lu\n", lpParms->dwReturn);
419 case MCI_STATUS_TIME_FORMAT:
420 lpParms->dwReturn = wma->dwTimeFormat;
421 TRACE_(mciavi)("MCI_STATUS_TIME_FORMAT => %lu\n", lpParms->dwReturn);
424 WARN_(mciavi)("Unknowm command %08lX !\n", lpParms->dwItem);
425 return MCIERR_UNRECOGNIZED_COMMAND;
428 WARN_(mciavi)("No Status-Item!\n");
429 return MCIERR_UNRECOGNIZED_COMMAND;
431 if (dwFlags & MCI_NOTIFY) {
432 TRACE_(mciavi)("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
433 mciDriverNotify16((HWND16)LOWORD(lpParms->dwCallback),
434 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
440 /***************************************************************************
441 * AVI_mciGetDevCaps [internal]
443 static DWORD AVI_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS lpParms)
445 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
447 TRACE_(mciavi)("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
449 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
450 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
452 if (dwFlags & MCI_GETDEVCAPS_ITEM) {
453 switch (lpParms->dwItem) {
454 case MCI_GETDEVCAPS_DEVICE_TYPE:
455 TRACE_(mciavi)("MCI_GETDEVCAPS_DEVICE_TYPE !\n");
456 lpParms->dwReturn = MCI_DEVTYPE_DIGITAL_VIDEO;
458 case MCI_GETDEVCAPS_HAS_AUDIO:
459 TRACE_(mciavi)("MCI_GETDEVCAPS_HAS_AUDIO !\n");
460 lpParms->dwReturn = TRUE;
462 case MCI_GETDEVCAPS_HAS_VIDEO:
463 TRACE_(mciavi)("MCI_GETDEVCAPS_HAS_VIDEO !\n");
464 lpParms->dwReturn = TRUE;
466 case MCI_GETDEVCAPS_USES_FILES:
467 TRACE_(mciavi)("MCI_GETDEVCAPS_USES_FILES !\n");
468 lpParms->dwReturn = TRUE;
470 case MCI_GETDEVCAPS_COMPOUND_DEVICE:
471 TRACE_(mciavi)("MCI_GETDEVCAPS_COMPOUND_DEVICE !\n");
472 lpParms->dwReturn = TRUE;
474 case MCI_GETDEVCAPS_CAN_EJECT:
475 TRACE_(mciavi)("MCI_GETDEVCAPS_CAN_EJECT !\n");
476 lpParms->dwReturn = FALSE;
478 case MCI_GETDEVCAPS_CAN_PLAY:
479 TRACE_(mciavi)("MCI_GETDEVCAPS_CAN_PLAY !\n");
480 lpParms->dwReturn = TRUE;
482 case MCI_GETDEVCAPS_CAN_RECORD:
483 TRACE_(mciavi)("MCI_GETDEVCAPS_CAN_RECORD !\n");
484 lpParms->dwReturn = FALSE;
486 case MCI_GETDEVCAPS_CAN_SAVE:
487 TRACE_(mciavi)("MCI_GETDEVCAPS_CAN_SAVE !\n");
488 lpParms->dwReturn = FALSE;
491 TRACE_(mciavi)("Unknown capability (%08lx) !\n", lpParms->dwItem);
492 return MCIERR_UNRECOGNIZED_COMMAND;
495 TRACE_(mciavi)("No GetDevCaps-Item !\n");
496 return MCIERR_UNRECOGNIZED_COMMAND;
501 /***************************************************************************
502 * AVI_mciInfo [internal]
504 static DWORD AVI_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSA lpParms)
508 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
510 TRACE_(mciavi)("(%04X, %08lX, %p) : stub;\n", wDevID, dwFlags, lpParms);
512 if (lpParms == NULL || lpParms->lpstrReturn == NULL) {
513 ret = MCIERR_NULL_PARAMETER_BLOCK;
514 } else if (wma == NULL) {
515 ret = MCIERR_INVALID_DEVICE_ID;
517 TRACE_(mciavi)("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
520 case MCI_INFO_PRODUCT:
521 str = "Wine's AVI player";
527 /* FIXME: the following manifest constants are not defined in <WINE>/include/mmsystem.h */
528 case MCI_INFO_COPYRIGHT:
534 WARN_(mciavi)("Don't know this info command (%lu)\n", dwFlags);
535 ret = MCIERR_UNRECOGNIZED_COMMAND;
539 ret = MCI_WriteString(lpParms->lpstrReturn, lpParms->dwRetSize, str);
541 lpParms->lpstrReturn[0] = 0;
547 /***************************************************************************
548 * AVI_mciPut [internal]
550 static DWORD AVI_mciPut(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_PUT_PARMS lpParms)
552 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
554 dbg_decl_str(mciavi, 256);
556 TRACE_(mciavi)("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
558 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
559 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
561 if (dwFlags & MCI_DGV_RECT) {
567 if (dwFlags & MCI_DGV_PUT_CLIENT) {
568 dsprintf(mciavi, "PUT_CLIENT");
570 if (dwFlags & MCI_DGV_PUT_DESTINATION) {
571 dsprintf(mciavi, "PUT_DESTINATION");
573 if (dwFlags & MCI_DGV_PUT_FRAME) {
574 dsprintf(mciavi, "PUT_FRAME");
576 if (dwFlags & MCI_DGV_PUT_SOURCE) {
577 dsprintf(mciavi, "PUT_SOURCE");
579 if (dwFlags & MCI_DGV_PUT_VIDEO) {
580 dsprintf(mciavi, "PUT_VIDEO");
582 if (dwFlags & MCI_DGV_PUT_WINDOW) {
583 dsprintf(mciavi, "PUT_WINDOW");
585 dsprintf(mciavi, " (%d,%d,%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
590 /***************************************************************************
591 * AVI_mciWindow [internal]
593 static DWORD AVI_mciWindow(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSA lpParms)
595 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
597 TRACE_(mciavi)("(%04x, %08lX, %p) : stub\n", wDevID, dwFlags, lpParms);
599 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
600 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
602 if (dwFlags & MCI_DGV_WINDOW_HWND) {
603 TRACE_(mciavi)("Setting hWnd to %08lx\n", (DWORD)lpParms->hWnd);
605 if (dwFlags & MCI_DGV_WINDOW_STATE) {
606 TRACE_(mciavi)("Setting nCmdShow to %d\n", lpParms->nCmdShow);
608 if (dwFlags & MCI_DGV_WINDOW_TEXT) {
609 TRACE_(mciavi)("Setting caption to '%s'\n", lpParms->lpstrText);
615 /*****************************************************************************
616 * AVI_mciLoad [internal]
618 static DWORD AVI_mciLoad(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_LOAD_PARMSA lpParms)
620 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
622 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
624 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
625 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
630 /******************************************************************************
631 * AVI_mciSave [internal]
633 static DWORD AVI_mciSave(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_SAVE_PARMSA lpParms)
635 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
637 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
639 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
640 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
645 /******************************************************************************
646 * AVI_mciFreeze [internal]
648 static DWORD AVI_mciFreeze(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
650 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
652 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
654 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
655 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
660 /******************************************************************************
661 * AVI_mciRealize [internal]
663 static DWORD AVI_mciRealize(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
665 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
667 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
669 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
670 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
675 /******************************************************************************
676 * AVI_mciUnFreeze [internal]
678 static DWORD AVI_mciUnFreeze(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
680 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
682 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
684 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
685 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
690 /******************************************************************************
691 * AVI_mciUpdate [internal]
693 static DWORD AVI_mciUpdate(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_UPDATE_PARMS lpParms)
695 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
697 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
699 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
700 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
705 /******************************************************************************
706 * AVI_mciWhere [internal]
708 static DWORD AVI_mciWhere(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
710 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
712 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
714 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
715 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
720 /******************************************************************************
721 * AVI_mciStep [internal]
723 static DWORD AVI_mciStep(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_STEP_PARMS lpParms)
725 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
727 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
729 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
730 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
735 /******************************************************************************
736 * AVI_mciCopy [internal]
738 static DWORD AVI_mciCopy(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_COPY_PARMS lpParms)
740 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
742 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
744 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
745 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
750 /******************************************************************************
751 * AVI_mciCut [internal]
753 static DWORD AVI_mciCut(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_CUT_PARMS lpParms)
755 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
757 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
759 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
760 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
765 /******************************************************************************
766 * AVI_mciDelete [internal]
768 static DWORD AVI_mciDelete(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_DELETE_PARMS lpParms)
770 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
772 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
774 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
775 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
780 /******************************************************************************
781 * AVI_mciPaste [internal]
783 static DWORD AVI_mciPaste(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_PASTE_PARMS lpParms)
785 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
787 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
789 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
790 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
795 /******************************************************************************
796 * AVI_mciCue [internal]
798 static DWORD AVI_mciCue(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_CUE_PARMS lpParms)
800 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
802 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
804 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
805 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
810 /******************************************************************************
811 * AVI_mciCapture [internal]
813 static DWORD AVI_mciCapture(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_CAPTURE_PARMSA lpParms)
815 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
817 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
819 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
820 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
825 /******************************************************************************
826 * AVI_mciMonitor [internal]
828 static DWORD AVI_mciMonitor(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_MONITOR_PARMS lpParms)
830 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
832 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
834 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
835 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
840 /******************************************************************************
841 * AVI_mciReserve [internal]
843 static DWORD AVI_mciReserve(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_RESERVE_PARMSA lpParms)
845 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
847 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
849 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
850 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
855 /******************************************************************************
856 * AVI_mciSetAudio [internal]
858 static DWORD AVI_mciSetAudio(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_SETAUDIO_PARMSA lpParms)
860 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
862 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
864 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
865 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
870 /******************************************************************************
871 * AVI_mciSignal [internal]
873 static DWORD AVI_mciSignal(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_SIGNAL_PARMS lpParms)
875 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
877 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
879 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
880 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
885 /******************************************************************************
886 * AVI_mciSetVideo [internal]
888 static DWORD AVI_mciSetVideo(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_SETVIDEO_PARMSA lpParms)
890 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
892 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
894 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
895 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
900 /******************************************************************************
901 * AVI_mciQuality [internal]
903 static DWORD AVI_mciQuality(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_QUALITY_PARMSA lpParms)
905 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
907 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
909 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
910 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
915 /******************************************************************************
916 * AVI_mciList [internal]
918 static DWORD AVI_mciList(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_LIST_PARMSA lpParms)
920 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
922 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
924 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
925 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
930 /******************************************************************************
931 * AVI_mciUndo [internal]
933 static DWORD AVI_mciUndo(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
935 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
937 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
939 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
940 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
945 /******************************************************************************
946 * AVI_mciConfigure [internal]
948 static DWORD AVI_mciConfigure(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
950 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
952 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
954 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
955 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
960 /******************************************************************************
961 * AVI_mciRestore [internal]
963 static DWORD AVI_mciRestore(UINT16 wDevID, DWORD dwFlags, LPMCI_DGV_RESTORE_PARMSA lpParms)
965 WINE_MCIAVI* wma = AVI_mciGetOpenDev(wDevID);
967 TRACE_(mciavi)("(%04x, %08lx, %p) : stub\n", wDevID, dwFlags, lpParms);
969 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
970 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
975 /*======================================================================*
976 * MCI AVI entry points *
977 *======================================================================*/
979 /**************************************************************************
980 * MCIAVI_DriverProc [sample driver]
982 LONG MCIAVI_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
983 DWORD dwParam1, DWORD dwParam2)
986 case DRV_LOAD: return 1;
987 case DRV_FREE: return 1;
988 case DRV_OPEN: return AVI_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
989 case DRV_CLOSE: return AVI_drvClose(dwDevID);
990 case DRV_ENABLE: return 1;
991 case DRV_DISABLE: return 1;
992 case DRV_QUERYCONFIGURE: return 1;
993 case DRV_CONFIGURE: MessageBoxA(0, "Sample AVI Wine Driver !", "MM-Wine Driver", MB_OK); return 1;
994 case DRV_INSTALL: return DRVCNF_RESTART;
995 case DRV_REMOVE: return DRVCNF_RESTART;
997 case MCI_OPEN_DRIVER: return AVI_mciOpen (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSA) dwParam2);
998 case MCI_CLOSE_DRIVER: return AVI_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
999 case MCI_PLAY: return AVI_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
1000 case MCI_RECORD: return AVI_mciRecord (dwDevID, dwParam1, (LPMCI_DGV_RECORD_PARMS) dwParam2);
1001 case MCI_STOP: return AVI_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1002 case MCI_SET: return AVI_mciSet (dwDevID, dwParam1, (LPMCI_DGV_SET_PARMS) dwParam2);
1003 case MCI_PAUSE: return AVI_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1004 case MCI_RESUME: return AVI_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1005 case MCI_STATUS: return AVI_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSA) dwParam2);
1006 case MCI_GETDEVCAPS: return AVI_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
1007 case MCI_INFO: return AVI_mciInfo (dwDevID, dwParam1, (LPMCI_DGV_INFO_PARMSA) dwParam2);
1008 case MCI_SEEK: return AVI_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
1009 case MCI_PUT: return AVI_mciPut (dwDevID, dwParam1, (LPMCI_DGV_PUT_PARMS) dwParam2);
1010 case MCI_WINDOW: return AVI_mciWindow (dwDevID, dwParam1, (LPMCI_DGV_WINDOW_PARMSA) dwParam2);
1011 case MCI_LOAD: return AVI_mciLoad (dwDevID, dwParam1, (LPMCI_DGV_LOAD_PARMSA) dwParam2);
1012 case MCI_SAVE: return AVI_mciSave (dwDevID, dwParam1, (LPMCI_DGV_SAVE_PARMSA) dwParam2);
1013 case MCI_FREEZE: return AVI_mciFreeze (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
1014 case MCI_REALIZE: return AVI_mciRealize (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1015 case MCI_UNFREEZE: return AVI_mciUnFreeze (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
1016 case MCI_UPDATE: return AVI_mciUpdate (dwDevID, dwParam1, (LPMCI_DGV_UPDATE_PARMS) dwParam2);
1017 case MCI_WHERE: return AVI_mciWhere (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
1018 case MCI_STEP: return AVI_mciStep (dwDevID, dwParam1, (LPMCI_DGV_STEP_PARMS) dwParam2);
1019 case MCI_COPY: return AVI_mciCopy (dwDevID, dwParam1, (LPMCI_DGV_COPY_PARMS) dwParam2);
1020 case MCI_CUT: return AVI_mciCut (dwDevID, dwParam1, (LPMCI_DGV_CUT_PARMS) dwParam2);
1021 case MCI_DELETE: return AVI_mciDelete (dwDevID, dwParam1, (LPMCI_DGV_DELETE_PARMS) dwParam2);
1022 case MCI_PASTE: return AVI_mciPaste (dwDevID, dwParam1, (LPMCI_DGV_PASTE_PARMS) dwParam2);
1023 case MCI_CUE: return AVI_mciCue (dwDevID, dwParam1, (LPMCI_DGV_CUE_PARMS) dwParam2);
1024 /* Digital Video specific */
1025 case MCI_CAPTURE: return AVI_mciCapture (dwDevID, dwParam1, (LPMCI_DGV_CAPTURE_PARMSA) dwParam2);
1026 case MCI_MONITOR: return AVI_mciMonitor (dwDevID, dwParam1, (LPMCI_DGV_MONITOR_PARMS) dwParam2);
1027 case MCI_RESERVE: return AVI_mciReserve (dwDevID, dwParam1, (LPMCI_DGV_RESERVE_PARMSA) dwParam2);
1028 case MCI_SETAUDIO: return AVI_mciSetAudio (dwDevID, dwParam1, (LPMCI_DGV_SETAUDIO_PARMSA) dwParam2);
1029 case MCI_SIGNAL: return AVI_mciSignal (dwDevID, dwParam1, (LPMCI_DGV_SIGNAL_PARMS) dwParam2);
1030 case MCI_SETVIDEO: return AVI_mciSetVideo (dwDevID, dwParam1, (LPMCI_DGV_SETVIDEO_PARMSA) dwParam2);
1031 case MCI_QUALITY: return AVI_mciQuality (dwDevID, dwParam1, (LPMCI_DGV_QUALITY_PARMSA) dwParam2);
1032 case MCI_LIST: return AVI_mciList (dwDevID, dwParam1, (LPMCI_DGV_LIST_PARMSA) dwParam2);
1033 case MCI_UNDO: return AVI_mciUndo (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1034 case MCI_CONFIGURE: return AVI_mciConfigure (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1035 case MCI_RESTORE: return AVI_mciRestore (dwDevID, dwParam1, (LPMCI_DGV_RESTORE_PARMSA) dwParam2);
1039 WARN_(mciavi)("Unsupported command=%s\n", MCI_CommandToString(wMsg));
1043 FIXME_(mciavi)("Shouldn't receive a MCI_OPEN or CLOSE message\n");
1046 TRACE_(mciavi)("Sending msg=%s to default driver proc\n", MCI_CommandToString(wMsg));
1047 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
1049 return MCIERR_UNRECOGNIZED_COMMAND;