1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
3 * Sample MCI ANIMATION Wine Driver for Linux
5 * Copyright 1994 Martin Ayotte
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mcianim);
34 #define ANIMFRAMES_PERSEC 30
35 #define ANIMFRAMES_PERMIN 1800
36 #define SECONDS_PERMIN 60
40 int nUseCount; /* Incremented for each shared open */
41 BOOL fShareable; /* TRUE if first open was shareable */
42 WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
43 MCI_OPEN_PARMSA openParms;
54 /*-----------------------------------------------------------------------*/
56 /**************************************************************************
57 * MCIANIM_drvOpen [internal]
59 static DWORD MCIANIM_drvOpen(LPSTR str, LPMCI_OPEN_DRIVER_PARMSA modp)
63 if (!modp) return 0xFFFFFFFF;
65 wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIANIM));
70 wma->wDevID = modp->wDeviceID;
71 mciSetDriverData(wma->wDevID, (DWORD)wma);
72 modp->wCustomCommandTable = MCI_NO_COMMAND_TABLE;
73 modp->wType = MCI_DEVTYPE_DIGITAL_VIDEO;
74 return modp->wDeviceID;
77 /**************************************************************************
78 * MCIANIM_drvClose [internal]
80 static DWORD MCIANIM_drvClose(DWORD dwDevID)
82 WINE_MCIANIM* wma = (WINE_MCIANIM*)mciGetDriverData(dwDevID);
85 HeapFree(GetProcessHeap(), 0, wma);
88 return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
91 /**************************************************************************
92 * MCIANIM_mciGetOpenDrv [internal]
94 static WINE_MCIANIM* MCIANIM_mciGetOpenDrv(UINT16 wDevID)
96 WINE_MCIANIM* wma = (WINE_MCIANIM*)mciGetDriverData(wDevID);
98 if (wma == NULL || wma->nUseCount == 0) {
99 WARN("Invalid wDevID=%u\n", wDevID);
105 /**************************************************************************
106 * MCIANIM_mciOpen [internal]
108 static DWORD MCIANIM_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMSA lpOpenParms)
111 WINE_MCIANIM* wma = (WINE_MCIANIM*)mciGetDriverData(wDevID);
113 TRACE("(%04X, %08lX, %p);\n", wDevID, dwFlags, lpOpenParms);
115 if (lpOpenParms == NULL) return MCIERR_INTERNAL;
116 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
118 if (wma->nUseCount > 0) {
119 /* The driver already open on this channel */
120 /* If the driver was opened shareable before and this open specifies */
121 /* shareable then increment the use count */
122 if (wma->fShareable && (dwFlags & MCI_OPEN_SHAREABLE))
125 return MCIERR_MUST_USE_SHAREABLE;
128 wma->fShareable = dwFlags & MCI_OPEN_SHAREABLE;
131 dwDeviceID = lpOpenParms->wDeviceID;
133 TRACE("wDevID=%04X\n", wDevID);
134 /* FIXME this is not consistent with other implementations */
135 lpOpenParms->wDeviceID = wDevID;
137 /*TRACE("lpParms->wDevID=%04X\n", lpParms->wDeviceID);*/
138 if (dwFlags & MCI_OPEN_ELEMENT) {
139 TRACE("MCI_OPEN_ELEMENT '%s' !\n", lpOpenParms->lpstrElementName);
140 if (lpOpenParms->lpstrElementName && strlen(lpOpenParms->lpstrElementName) > 0) {
142 FIXME("element is not opened\n");
144 memcpy(&wma->openParms, lpOpenParms, sizeof(MCI_OPEN_PARMSA));
145 wma->wNotifyDeviceID = dwDeviceID;
147 wma->dwTimeFormat = MCI_FORMAT_TMSF;
151 wma->lpdwTrackLen = NULL;
152 wma->lpdwTrackPos = NULL;
154 Moved to mmsystem.c mciOpen routine
156 if (dwFlags & MCI_NOTIFY) {
157 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n",
158 lpParms->dwCallback);
159 mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback),
160 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
166 /**************************************************************************
167 * MCIANIM_mciClose [internal]
169 static DWORD MCIANIM_mciClose(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
171 WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID);
173 TRACE("(%u, %08lX, %p);\n", wDevID, dwParam, lpParms);
175 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
177 if (--wma->nUseCount == 0) {
178 /* do the actual clean-up */
183 /**************************************************************************
184 * MCIANIM_mciGetDevCaps [internal]
186 static DWORD MCIANIM_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
187 LPMCI_GETDEVCAPS_PARMS lpParms)
189 WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID);
192 TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
194 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
195 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
197 if (dwFlags & MCI_GETDEVCAPS_ITEM) {
198 TRACE("MCI_GETDEVCAPS_ITEM dwItem=%08lX;\n", lpParms->dwItem);
200 switch(lpParms->dwItem) {
201 case MCI_GETDEVCAPS_CAN_RECORD:
202 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
203 ret = MCI_RESOURCE_RETURNED;
205 case MCI_GETDEVCAPS_HAS_AUDIO:
206 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
207 ret = MCI_RESOURCE_RETURNED;
209 case MCI_GETDEVCAPS_HAS_VIDEO:
210 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
211 ret = MCI_RESOURCE_RETURNED;
213 case MCI_GETDEVCAPS_DEVICE_TYPE:
214 lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_ANIMATION, MCI_DEVTYPE_ANIMATION);
215 ret = MCI_RESOURCE_RETURNED;
217 case MCI_GETDEVCAPS_USES_FILES:
218 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
219 ret = MCI_RESOURCE_RETURNED;
221 case MCI_GETDEVCAPS_COMPOUND_DEVICE:
222 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
223 ret = MCI_RESOURCE_RETURNED;
225 case MCI_GETDEVCAPS_CAN_EJECT:
226 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
227 ret = MCI_RESOURCE_RETURNED;
229 case MCI_GETDEVCAPS_CAN_PLAY:
230 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
231 ret = MCI_RESOURCE_RETURNED;
233 case MCI_GETDEVCAPS_CAN_SAVE:
234 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
235 ret = MCI_RESOURCE_RETURNED;
238 FIXME("Unknown capability (%08lx) !\n", lpParms->dwItem);
239 return MCIERR_UNRECOGNIZED_COMMAND;
242 WARN("No GETDEVCAPS_ITEM !\n");
243 return MCIERR_UNRECOGNIZED_COMMAND;
245 TRACE("lpParms->dwReturn=%08lX;\n", lpParms->dwReturn);
250 /**************************************************************************
251 * MCIANIM_CalcTime [internal]
253 static DWORD MCIANIM_CalcTime(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwFrame, LPDWORD lpRet)
261 TRACE("(%p, %08lX, %lu);\n", wma, dwFormatType, dwFrame);
263 switch (dwFormatType) {
264 case MCI_FORMAT_MILLISECONDS:
265 dwTime = dwFrame / ANIMFRAMES_PERSEC * 1000;
267 TRACE("MILLISECONDS %lu\n", dwTime);
270 wMinutes = dwFrame / ANIMFRAMES_PERMIN;
271 wSeconds = (dwFrame - ANIMFRAMES_PERMIN * wMinutes) / ANIMFRAMES_PERSEC;
272 wFrames = dwFrame - ANIMFRAMES_PERMIN * wMinutes -
273 ANIMFRAMES_PERSEC * wSeconds;
274 dwTime = MCI_MAKE_MSF(wMinutes, wSeconds, wFrames);
275 TRACE("MSF %02u:%02u:%02u -> dwTime=%lu\n",wMinutes, wSeconds, wFrames, dwTime);
276 *lpRet = MCI_COLONIZED3_RETURN;
279 /* unknown format ! force TMSF ! ... */
280 dwFormatType = MCI_FORMAT_TMSF;
281 case MCI_FORMAT_TMSF:
282 for (wTrack = 0; wTrack < wma->nTracks; wTrack++) {
283 /* dwTime += wma->lpdwTrackLen[wTrack - 1];
284 TRACE("Adding trk#%u curpos=%u \n", dwTime);
285 if (dwTime >= dwFrame) break; */
286 if (wma->lpdwTrackPos[wTrack - 1] >= dwFrame) break;
288 wMinutes = dwFrame / ANIMFRAMES_PERMIN;
289 wSeconds = (dwFrame - ANIMFRAMES_PERMIN * wMinutes) / ANIMFRAMES_PERSEC;
290 wFrames = dwFrame - ANIMFRAMES_PERMIN * wMinutes -
291 ANIMFRAMES_PERSEC * wSeconds;
292 dwTime = MCI_MAKE_TMSF(wTrack, wMinutes, wSeconds, wFrames);
293 *lpRet = MCI_COLONIZED4_RETURN;
294 TRACE("%02u-%02u:%02u:%02u\n", wTrack, wMinutes, wSeconds, wFrames);
301 /**************************************************************************
302 * MCIANIM_CalcFrame [internal]
304 static DWORD MCIANIM_CalcFrame(WINE_MCIANIM* wma, DWORD dwFormatType, DWORD dwTime)
309 TRACE("(%p, %08lX, %lu);\n", wma, dwFormatType, dwTime);
311 switch (dwFormatType) {
312 case MCI_FORMAT_MILLISECONDS:
313 dwFrame = dwTime * ANIMFRAMES_PERSEC / 1000;
314 TRACE("MILLISECONDS %lu\n", dwFrame);
317 TRACE("MSF %02u:%02u:%02u\n",
318 MCI_MSF_MINUTE(dwTime), MCI_MSF_SECOND(dwTime),
319 MCI_MSF_FRAME(dwTime));
320 dwFrame += ANIMFRAMES_PERMIN * MCI_MSF_MINUTE(dwTime);
321 dwFrame += ANIMFRAMES_PERSEC * MCI_MSF_SECOND(dwTime);
322 dwFrame += MCI_MSF_FRAME(dwTime);
325 /* unknown format ! force TMSF ! ... */
326 dwFormatType = MCI_FORMAT_TMSF;
327 case MCI_FORMAT_TMSF:
328 wTrack = MCI_TMSF_TRACK(dwTime);
329 TRACE("TMSF %02u-%02u:%02u:%02u\n",
330 MCI_TMSF_TRACK(dwTime), MCI_TMSF_MINUTE(dwTime),
331 MCI_TMSF_SECOND(dwTime), MCI_TMSF_FRAME(dwTime));
332 TRACE("TMSF trackpos[%u]=%lu\n",
333 wTrack, wma->lpdwTrackPos[wTrack - 1]);
334 dwFrame = wma->lpdwTrackPos[wTrack - 1];
335 dwFrame += ANIMFRAMES_PERMIN * MCI_TMSF_MINUTE(dwTime);
336 dwFrame += ANIMFRAMES_PERSEC * MCI_TMSF_SECOND(dwTime);
337 dwFrame += MCI_TMSF_FRAME(dwTime);
343 /**************************************************************************
344 * MCIANIM_mciInfo [internal]
346 static DWORD MCIANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMSA lpParms)
348 WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID);
352 TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
354 if (lpParms == NULL || lpParms->lpstrReturn == NULL)
355 return MCIERR_NULL_PARAMETER_BLOCK;
358 return MCIERR_INVALID_DEVICE_ID;
360 TRACE("buf=%p, len=%lu\n", lpParms->lpstrReturn, lpParms->dwRetSize);
363 case MCI_INFO_PRODUCT:
364 str = "Wine's animation";
367 str = wma->openParms.lpstrElementName;
369 case MCI_ANIM_INFO_TEXT:
370 str = "Animation Window";
373 WARN("Don't know this info command (%lu)\n", dwFlags);
374 return MCIERR_UNRECOGNIZED_COMMAND;
378 if (lpParms->dwRetSize <= strlen(str)) {
379 lstrcpynA(lpParms->lpstrReturn, str, lpParms->dwRetSize - 1);
380 ret = MCIERR_PARAM_OVERFLOW;
382 strcpy(lpParms->lpstrReturn, str);
385 *lpParms->lpstrReturn = 0;
390 /**************************************************************************
391 * MCIANIM_mciStatus [internal]
393 static DWORD MCIANIM_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
395 WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID);
398 TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
400 if (lpParms == NULL) return MCIERR_INTERNAL;
401 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
403 if (dwFlags & MCI_NOTIFY) {
404 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
406 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
407 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
409 if (dwFlags & MCI_STATUS_ITEM) {
410 switch(lpParms->dwItem) {
411 case MCI_STATUS_CURRENT_TRACK:
412 lpParms->dwReturn = wma->nCurTrack;
413 TRACE("CURRENT_TRACK=%lu!\n", lpParms->dwReturn);
415 case MCI_STATUS_LENGTH:
416 if (dwFlags & MCI_TRACK) {
417 TRACE("MCI_TRACK #%lu LENGTH=??? !\n", lpParms->dwTrack);
418 if (lpParms->dwTrack > wma->nTracks)
419 return MCIERR_OUTOFRANGE;
420 lpParms->dwReturn = wma->lpdwTrackLen[lpParms->dwTrack];
423 lpParms->dwReturn = wma->dwTotalLen;
424 lpParms->dwReturn = MCIANIM_CalcTime(wma, wma->dwTimeFormat, lpParms->dwReturn, &ret);
425 TRACE("LENGTH=%lu !\n", lpParms->dwReturn);
427 case MCI_STATUS_MODE:
428 TRACE("MCI_STATUS_MODE=%04X !\n", wma->mode);
429 lpParms->dwReturn = MAKEMCIRESOURCE(wma->mode, wma->mode);
430 ret = MCI_RESOURCE_RETURNED;
432 case MCI_STATUS_MEDIA_PRESENT:
433 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
434 ret = MCI_RESOURCE_RETURNED;
435 TRACE("MCI_STATUS_MEDIA_PRESENT !\n");
437 case MCI_STATUS_NUMBER_OF_TRACKS:
438 lpParms->dwReturn = 1;
439 TRACE("MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n", lpParms->dwReturn);
441 case MCI_STATUS_POSITION:
442 lpParms->dwReturn = wma->dwCurFrame;
443 if (dwFlags & MCI_STATUS_START) {
444 lpParms->dwReturn = 0;
445 TRACE("get MCI_STATUS_START !\n");
447 if (dwFlags & MCI_TRACK) {
448 if (lpParms->dwTrack > wma->nTracks)
449 return MCIERR_OUTOFRANGE;
450 lpParms->dwReturn = wma->lpdwTrackPos[lpParms->dwTrack - 1];
451 TRACE("get MCI_TRACK #%lu !\n", lpParms->dwTrack);
453 lpParms->dwReturn = MCIANIM_CalcTime(wma, wma->dwTimeFormat, lpParms->dwReturn, &ret);
454 TRACE("MCI_STATUS_POSITION=%08lX !\n", lpParms->dwReturn);
456 case MCI_STATUS_READY:
457 TRACE("MCI_STATUS_READY !\n");
458 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
459 ret = MCI_RESOURCE_RETURNED;
461 case MCI_STATUS_TIME_FORMAT:
462 TRACE("MCI_STATUS_TIME_FORMAT !\n");
463 lpParms->dwReturn = MAKEMCIRESOURCE(MCI_FORMAT_MILLISECONDS, MCI_FORMAT_MILLISECONDS_S);
464 TRACE("MCI_STATUS_TIME_FORMAT => %u\n", LOWORD(lpParms->dwReturn));
465 ret = MCI_RESOURCE_RETURNED;
468 FIXME("Unknown command %08lX !\n", lpParms->dwItem);
469 return MCIERR_UNRECOGNIZED_COMMAND;
472 WARN("No MCI_STATUS_ITEM !\n");
473 return MCIERR_UNRECOGNIZED_COMMAND;
479 /**************************************************************************
480 * MCIANIM_mciPlay [internal]
482 static DWORD MCIANIM_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
484 WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID);
487 TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
489 if (lpParms == NULL) return MCIERR_INTERNAL;
490 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
492 start = 0; end = wma->dwTotalLen;
494 if (dwFlags & MCI_FROM) {
495 start = MCIANIM_CalcFrame(wma, wma->dwTimeFormat, lpParms->dwFrom);
496 TRACE("MCI_FROM=%08lX -> %u \n", lpParms->dwFrom, start);
498 if (dwFlags & MCI_TO) {
499 end = MCIANIM_CalcFrame(wma, wma->dwTimeFormat, lpParms->dwTo);
500 TRACE("MCI_TO=%08lX -> %u \n", lpParms->dwTo, end);
502 wma->mode = MCI_MODE_PLAY;
503 if (dwFlags & MCI_NOTIFY) {
504 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n",
505 lpParms->dwCallback);
506 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
507 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
512 /**************************************************************************
513 * MCIANIM_mciStop [internal]
515 static DWORD MCIANIM_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
517 WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID);
519 TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
521 if (lpParms == NULL) return MCIERR_INTERNAL;
522 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
524 wma->mode = MCI_MODE_STOP;
525 if (dwFlags & MCI_NOTIFY) {
526 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
528 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
529 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
534 /**************************************************************************
535 * MCIANIM_mciPause [internal]
537 static DWORD MCIANIM_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
539 WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID);
541 TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
542 if (lpParms == NULL) return MCIERR_INTERNAL;
543 wma->mode = MCI_MODE_PAUSE;
544 if (dwFlags & MCI_NOTIFY) {
545 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
547 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
548 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
553 /**************************************************************************
554 * MCIANIM_mciResume [internal]
556 static DWORD MCIANIM_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
558 WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID);
560 TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
561 if (lpParms == NULL) return MCIERR_INTERNAL;
562 wma->mode = MCI_MODE_STOP;
563 if (dwFlags & MCI_NOTIFY) {
564 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
566 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
567 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
572 /**************************************************************************
573 * MCIANIM_mciSeek [internal]
575 static DWORD MCIANIM_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
577 WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID);
579 MCI_PLAY_PARMS PlayParms;
581 TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
583 if (lpParms == NULL) return MCIERR_INTERNAL;
584 wma->mode = MCI_MODE_SEEK;
586 case MCI_SEEK_TO_START:
587 PlayParms.dwFrom = 0;
589 case MCI_SEEK_TO_END:
590 PlayParms.dwFrom = wma->dwTotalLen;
593 PlayParms.dwFrom = lpParms->dwTo;
596 dwRet = MCIANIM_mciPlay(wDevID, MCI_WAIT | MCI_FROM, &PlayParms);
597 if (dwRet != 0) return dwRet;
598 dwRet = MCIANIM_mciStop(wDevID, MCI_WAIT, (LPMCI_GENERIC_PARMS)&PlayParms);
599 if (dwFlags & MCI_NOTIFY) {
600 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
602 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
603 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
609 /**************************************************************************
610 * MCIANIM_mciSet [internal]
612 static DWORD MCIANIM_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
614 WINE_MCIANIM* wma = MCIANIM_mciGetOpenDrv(wDevID);
616 TRACE("(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
618 if (lpParms == NULL) return MCIERR_INTERNAL;
619 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
621 TRACE("(dwTimeFormat=%08lX)\n", lpParms->dwTimeFormat);
622 TRACE("(dwAudio=%08lX)\n", lpParms->dwAudio);
624 if (dwFlags & MCI_SET_TIME_FORMAT) {
625 switch (lpParms->dwTimeFormat) {
626 case MCI_FORMAT_MILLISECONDS:
627 TRACE("MCI_FORMAT_MILLISECONDS !\n");
630 TRACE("MCI_FORMAT_MSF !\n");
632 case MCI_FORMAT_TMSF:
633 TRACE("MCI_FORMAT_TMSF !\n");
636 WARN("Bad time format !\n");
637 return MCIERR_BAD_TIME_FORMAT;
639 wma->dwTimeFormat = lpParms->dwTimeFormat;
641 if (dwFlags & MCI_SET_VIDEO) return MCIERR_UNSUPPORTED_FUNCTION;
642 if (dwFlags & MCI_SET_ON) return MCIERR_UNSUPPORTED_FUNCTION;
643 if (dwFlags & MCI_SET_OFF) return MCIERR_UNSUPPORTED_FUNCTION;
644 if (dwFlags & MCI_NOTIFY) {
645 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
646 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
647 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
652 /**************************************************************************
653 * DriverProc (MCIANIM.@)
655 LONG WINAPI MCIANIM_DriverProc(DWORD dwDevID, HDRVR hDriv, DWORD wMsg,
656 DWORD dwParam1, DWORD dwParam2)
659 case DRV_LOAD: return 1;
660 case DRV_FREE: return 1;
661 case DRV_OPEN: return MCIANIM_drvOpen((LPSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSA)dwParam2);
662 case DRV_CLOSE: return MCIANIM_drvClose(dwDevID);
663 case DRV_ENABLE: return 1;
664 case DRV_DISABLE: return 1;
665 case DRV_QUERYCONFIGURE: return 1;
666 case DRV_CONFIGURE: MessageBoxA(0, "Sample MultiMedia Driver !", "Wine Driver", MB_OK); return 1;
667 case DRV_INSTALL: return DRVCNF_RESTART;
668 case DRV_REMOVE: return DRVCNF_RESTART;
671 if (dwDevID == 0xFFFFFFFF) return MCIERR_UNSUPPORTED_FUNCTION;
674 case MCI_OPEN_DRIVER: return MCIANIM_mciOpen(dwDevID, dwParam1, (LPMCI_OPEN_PARMSA)dwParam2);
675 case MCI_CLOSE_DRIVER: return MCIANIM_mciClose(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
676 case MCI_GETDEVCAPS: return MCIANIM_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)dwParam2);
677 case MCI_INFO: return MCIANIM_mciInfo(dwDevID, dwParam1, (LPMCI_INFO_PARMSA)dwParam2);
678 case MCI_STATUS: return MCIANIM_mciStatus(dwDevID, dwParam1, (LPMCI_STATUS_PARMS)dwParam2);
679 case MCI_SET: return MCIANIM_mciSet(dwDevID, dwParam1, (LPMCI_SET_PARMS)dwParam2);
680 case MCI_PLAY: return MCIANIM_mciPlay(dwDevID, dwParam1, (LPMCI_PLAY_PARMS)dwParam2);
681 case MCI_STOP: return MCIANIM_mciStop(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
682 case MCI_PAUSE: return MCIANIM_mciPause(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
683 case MCI_RESUME: return MCIANIM_mciResume(dwDevID, dwParam1, (LPMCI_GENERIC_PARMS)dwParam2);
684 case MCI_SEEK: return MCIANIM_mciSeek(dwDevID, dwParam1, (LPMCI_SEEK_PARMS)dwParam2);
701 FIXME("Unsupported message [%lu]\n", wMsg);
705 ERR("Shouldn't receive a MCI_OPEN or CLOSE message\n");
708 TRACE("Sending msg [%lu] to default driver proc\n", wMsg);
709 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
711 return MCIERR_UNRECOGNIZED_COMMAND;
714 /*-----------------------------------------------------------------------*/