1 /* -*- tab-width: 8; c-basic-offset: 4 -*- */
3 * Sample MCI ANIMATION Wine Driver for Linux
5 * Copyright 1994 Martin Ayotte
12 #include <sys/ioctl.h>
17 #include "multimedia.h"
18 #include "debugtools.h"
20 DEFAULT_DEBUG_CHANNEL(mcianim
)
24 #define ANIMFRAMES_PERSEC 30
25 #define ANIMFRAMES_PERMIN 1800
26 #define SECONDS_PERMIN 60
30 int nUseCount
; /* Incremented for each shared open */
31 BOOL16 fShareable
; /* TRUE if first open was shareable */
32 WORD wNotifyDeviceID
; /* MCI device ID with a pending notification */
33 HANDLE16 hCallback
; /* Callback handle for pending notification */
34 MCI_OPEN_PARMSA openParms
;
45 static WINE_MCIANIM MCIAnimDev
[MAX_ANIMDRV
];
47 /*-----------------------------------------------------------------------*/
49 /**************************************************************************
50 * ANIM_drvGetDrv [internal]
52 static WINE_MCIANIM
* ANIM_drvGetDrv(UINT16 wDevID
)
56 for (i
= 0; i
< MAX_ANIMDRV
; i
++) {
57 if (MCIAnimDev
[i
].wDevID
== wDevID
) {
58 return &MCIAnimDev
[i
];
64 /**************************************************************************
65 * ANIM_drvOpen [internal]
67 static DWORD
ANIM_drvOpen(LPSTR str
, LPMCI_OPEN_DRIVER_PARMSA modp
)
71 for (i
= 0; i
< MAX_ANIMDRV
; i
++) {
72 if (MCIAnimDev
[i
].wDevID
== 0) {
73 MCIAnimDev
[i
].wDevID
= modp
->wDeviceID
;
74 modp
->wCustomCommandTable
= -1;
75 modp
->wType
= MCI_DEVTYPE_CD_AUDIO
;
76 return modp
->wDeviceID
;
82 /**************************************************************************
83 * ANIM_drvClose [internal]
85 static DWORD
ANIM_drvClose(DWORD dwDevID
)
87 WINE_MCIANIM
* wma
= ANIM_drvGetDrv(dwDevID
);
96 /**************************************************************************
97 * ANIM_mciGetOpenDrv [internal]
99 static WINE_MCIANIM
* ANIM_mciGetOpenDrv(UINT16 wDevID
)
101 WINE_MCIANIM
* wma
= ANIM_drvGetDrv(wDevID
);
103 if (wma
== NULL
|| wma
->nUseCount
== 0) {
104 WARN("Invalid wDevID=%u\n", wDevID
);
110 /**************************************************************************
111 * ANIM_mciOpen [internal]
113 static DWORD
ANIM_mciOpen(UINT16 wDevID
, DWORD dwFlags
, LPMCI_OPEN_PARMSA lpOpenParms
)
116 WINE_MCIANIM
* wma
= ANIM_drvGetDrv(wDevID
);
118 TRACE("(%04X, %08lX, %p);\n", wDevID
, dwFlags
, lpOpenParms
);
120 if (lpOpenParms
== NULL
) return MCIERR_INTERNAL
;
121 if (wma
== NULL
) return MCIERR_INVALID_DEVICE_ID
;
123 if (wma
->nUseCount
> 0) {
124 /* The driver already open on this channel */
125 /* If the driver was opened shareable before and this open specifies */
126 /* shareable then increment the use count */
127 if (wma
->fShareable
&& (dwFlags
& MCI_OPEN_SHAREABLE
))
130 return MCIERR_MUST_USE_SHAREABLE
;
133 wma
->fShareable
= dwFlags
& MCI_OPEN_SHAREABLE
;
136 dwDeviceID
= lpOpenParms
->wDeviceID
;
138 TRACE("wDevID=%04X\n", wDevID
);
139 /* FIXME this is not consistent with other implementations */
140 lpOpenParms
->wDeviceID
= wDevID
;
142 /*TRACE(mcianim,"lpParms->wDevID=%04X\n", lpParms->wDeviceID);*/
143 if (dwFlags
& MCI_OPEN_ELEMENT
) {
144 TRACE("MCI_OPEN_ELEMENT '%s' !\n", lpOpenParms
->lpstrElementName
);
145 if (lpOpenParms
->lpstrElementName
&& strlen(lpOpenParms
->lpstrElementName
) > 0) {
147 FIXME("element is not opened\n");
149 memcpy(&wma
->openParms
, lpOpenParms
, sizeof(MCI_OPEN_PARMSA
));
150 wma
->wNotifyDeviceID
= dwDeviceID
;
152 wma
->dwTimeFormat
= MCI_FORMAT_TMSF
;
156 wma
->lpdwTrackLen
= NULL
;
157 wma
->lpdwTrackPos
= NULL
;
159 Moved to mmsystem.c mciOpen routine
161 if (dwFlags & MCI_NOTIFY) {
162 TRACE(mcianim, "MCI_NOTIFY_SUCCESSFUL %08lX !\n",
163 lpParms->dwCallback);
164 mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback),
165 wma->wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
171 /**************************************************************************
172 * ANIM_mciClose [internal]
174 static DWORD
ANIM_mciClose(UINT16 wDevID
, DWORD dwParam
, LPMCI_GENERIC_PARMS lpParms
)
176 WINE_MCIANIM
* wma
= ANIM_mciGetOpenDrv(wDevID
);
178 TRACE("(%u, %08lX, %p);\n", wDevID
, dwParam
, lpParms
);
180 if (wma
== NULL
) return MCIERR_INVALID_DEVICE_ID
;
182 if (--wma
->nUseCount
== 0) {
183 if (wma
->lpdwTrackLen
!= NULL
) free(wma
->lpdwTrackLen
);
184 if (wma
->lpdwTrackPos
!= NULL
) free(wma
->lpdwTrackPos
);
189 /**************************************************************************
190 * ANIM_mciGetDevCaps [internal]
192 static DWORD
ANIM_mciGetDevCaps(UINT16 wDevID
, DWORD dwFlags
,
193 LPMCI_GETDEVCAPS_PARMS lpParms
)
195 WINE_MCIANIM
* wma
= ANIM_mciGetOpenDrv(wDevID
);
197 TRACE("(%u, %08lX, %p);\n", wDevID
, dwFlags
, lpParms
);
199 if (lpParms
== NULL
) return MCIERR_NULL_PARAMETER_BLOCK
;
200 if (wma
== NULL
) return MCIERR_INVALID_DEVICE_ID
;
202 if (dwFlags
& MCI_GETDEVCAPS_ITEM
) {
203 TRACE("MCI_GETDEVCAPS_ITEM dwItem=%08lX;\n", lpParms
->dwItem
);
204 switch(lpParms
->dwItem
) {
205 case MCI_GETDEVCAPS_CAN_RECORD
:
206 lpParms
->dwReturn
= FALSE
;
208 case MCI_GETDEVCAPS_HAS_AUDIO
:
209 lpParms
->dwReturn
= FALSE
;
211 case MCI_GETDEVCAPS_HAS_VIDEO
:
212 lpParms
->dwReturn
= FALSE
;
214 case MCI_GETDEVCAPS_DEVICE_TYPE
:
215 lpParms
->dwReturn
= MCI_DEVTYPE_ANIMATION
;
217 case MCI_GETDEVCAPS_USES_FILES
:
218 lpParms
->dwReturn
= TRUE
;
220 case MCI_GETDEVCAPS_COMPOUND_DEVICE
:
221 lpParms
->dwReturn
= FALSE
;
223 case MCI_GETDEVCAPS_CAN_EJECT
:
224 lpParms
->dwReturn
= TRUE
;
226 case MCI_GETDEVCAPS_CAN_PLAY
:
227 lpParms
->dwReturn
= FALSE
;
229 case MCI_GETDEVCAPS_CAN_SAVE
:
230 lpParms
->dwReturn
= FALSE
;
233 return MCIERR_UNRECOGNIZED_COMMAND
;
236 TRACE("lpParms->dwReturn=%08lX;\n", lpParms
->dwReturn
);
241 /**************************************************************************
242 * ANIM_CalcTime [internal]
244 static DWORD
ANIM_CalcTime(WINE_MCIANIM
* wma
, DWORD dwFormatType
, DWORD dwFrame
)
252 TRACE("(%p, %08lX, %lu);\n", wma
, dwFormatType
, dwFrame
);
254 switch (dwFormatType
) {
255 case MCI_FORMAT_MILLISECONDS
:
256 dwTime
= dwFrame
/ ANIMFRAMES_PERSEC
* 1000;
257 TRACE("MILLISECONDS %lu\n", dwTime
);
260 wMinutes
= dwFrame
/ ANIMFRAMES_PERMIN
;
261 wSeconds
= (dwFrame
- ANIMFRAMES_PERMIN
* wMinutes
) / ANIMFRAMES_PERSEC
;
262 wFrames
= dwFrame
- ANIMFRAMES_PERMIN
* wMinutes
-
263 ANIMFRAMES_PERSEC
* wSeconds
;
264 dwTime
= MCI_MAKE_MSF(wMinutes
, wSeconds
, wFrames
);
265 TRACE("MSF %02u:%02u:%02u -> dwTime=%lu\n",
266 wMinutes
, wSeconds
, wFrames
, dwTime
);
269 /* unknown format ! force TMSF ! ... */
270 dwFormatType
= MCI_FORMAT_TMSF
;
271 case MCI_FORMAT_TMSF
:
272 for (wTrack
= 0; wTrack
< wma
->nTracks
; wTrack
++) {
273 /* dwTime += wma->lpdwTrackLen[wTrack - 1];
274 TRACE(mcianim, "Adding trk#%u curpos=%u \n", dwTime);
275 if (dwTime >= dwFrame) break; */
276 if (wma
->lpdwTrackPos
[wTrack
- 1] >= dwFrame
) break;
278 wMinutes
= dwFrame
/ ANIMFRAMES_PERMIN
;
279 wSeconds
= (dwFrame
- ANIMFRAMES_PERMIN
* wMinutes
) / ANIMFRAMES_PERSEC
;
280 wFrames
= dwFrame
- ANIMFRAMES_PERMIN
* wMinutes
-
281 ANIMFRAMES_PERSEC
* wSeconds
;
282 dwTime
= MCI_MAKE_TMSF(wTrack
, wMinutes
, wSeconds
, wFrames
);
283 TRACE("%02u-%02u:%02u:%02u\n",
284 wTrack
, wMinutes
, wSeconds
, wFrames
);
291 /**************************************************************************
292 * ANIM_CalcFrame [internal]
294 static DWORD
ANIM_CalcFrame(WINE_MCIANIM
* wma
, DWORD dwFormatType
, DWORD dwTime
)
299 TRACE("(%p, %08lX, %lu);\n", wma
, dwFormatType
, dwTime
);
301 switch (dwFormatType
) {
302 case MCI_FORMAT_MILLISECONDS
:
303 dwFrame
= dwTime
* ANIMFRAMES_PERSEC
/ 1000;
304 TRACE("MILLISECONDS %lu\n", dwFrame
);
307 TRACE("MSF %02u:%02u:%02u\n",
308 MCI_MSF_MINUTE(dwTime
), MCI_MSF_SECOND(dwTime
),
309 MCI_MSF_FRAME(dwTime
));
310 dwFrame
+= ANIMFRAMES_PERMIN
* MCI_MSF_MINUTE(dwTime
);
311 dwFrame
+= ANIMFRAMES_PERSEC
* MCI_MSF_SECOND(dwTime
);
312 dwFrame
+= MCI_MSF_FRAME(dwTime
);
315 /* unknown format ! force TMSF ! ... */
316 dwFormatType
= MCI_FORMAT_TMSF
;
317 case MCI_FORMAT_TMSF
:
318 wTrack
= MCI_TMSF_TRACK(dwTime
);
319 TRACE("TMSF %02u-%02u:%02u:%02u\n",
320 MCI_TMSF_TRACK(dwTime
), MCI_TMSF_MINUTE(dwTime
),
321 MCI_TMSF_SECOND(dwTime
), MCI_TMSF_FRAME(dwTime
));
322 TRACE("TMSF trackpos[%u]=%lu\n",
323 wTrack
, wma
->lpdwTrackPos
[wTrack
- 1]);
324 dwFrame
= wma
->lpdwTrackPos
[wTrack
- 1];
325 dwFrame
+= ANIMFRAMES_PERMIN
* MCI_TMSF_MINUTE(dwTime
);
326 dwFrame
+= ANIMFRAMES_PERSEC
* MCI_TMSF_SECOND(dwTime
);
327 dwFrame
+= MCI_TMSF_FRAME(dwTime
);
334 /**************************************************************************
335 * ANIM_mciInfo [internal]
337 static DWORD
ANIM_mciInfo(UINT16 wDevID
, DWORD dwFlags
, LPMCI_INFO_PARMS16 lpParms
)
339 WINE_MCIANIM
* wma
= ANIM_mciGetOpenDrv(wDevID
);
343 TRACE("(%u, %08lX, %p);\n", wDevID
, dwFlags
, lpParms
);
345 if (lpParms
== NULL
|| lpParms
->lpstrReturn
== NULL
) {
346 ret
= MCIERR_NULL_PARAMETER_BLOCK
;
347 } else if (wma
== NULL
) {
348 ret
= MCIERR_INVALID_DEVICE_ID
;
350 TRACE("buf=%p, len=%lu\n", lpParms
->lpstrReturn
, lpParms
->dwRetSize
);
353 case MCI_INFO_PRODUCT
:
354 str
= "Wine's animation";
357 str
= wma
->openParms
.lpstrElementName
;
359 case MCI_ANIM_INFO_TEXT
:
360 str
= "Animation Window";
363 WARN("Don't know this info command (%lu)\n", dwFlags
);
364 ret
= MCIERR_UNRECOGNIZED_COMMAND
;
368 ret
= MCI_WriteString(lpParms
->lpstrReturn
, lpParms
->dwRetSize
, str
);
370 lpParms
->lpstrReturn
[0] = 0;
376 /**************************************************************************
377 * ANIM_mciStatus [internal]
379 static DWORD
ANIM_mciStatus(UINT16 wDevID
, DWORD dwFlags
, LPMCI_STATUS_PARMS lpParms
)
381 WINE_MCIANIM
* wma
= ANIM_mciGetOpenDrv(wDevID
);
383 TRACE("(%u, %08lX, %p);\n", wDevID
, dwFlags
, lpParms
);
385 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
386 if (wma
== NULL
) return MCIERR_INVALID_DEVICE_ID
;
388 if (dwFlags
& MCI_NOTIFY
) {
389 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n",
390 lpParms
->dwCallback
);
391 mciDriverNotify16((HWND16
)LOWORD(lpParms
->dwCallback
),
392 wma
->wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
394 if (dwFlags
& MCI_STATUS_ITEM
) {
395 switch(lpParms
->dwItem
) {
396 case MCI_STATUS_CURRENT_TRACK
:
397 lpParms
->dwReturn
= wma
->nCurTrack
;
398 TRACE("CURRENT_TRACK=%lu!\n", lpParms
->dwReturn
);
400 case MCI_STATUS_LENGTH
:
401 if (dwFlags
& MCI_TRACK
) {
402 TRACE("MCI_TRACK #%lu LENGTH=??? !\n",
404 if (lpParms
->dwTrack
> wma
->nTracks
)
405 return MCIERR_OUTOFRANGE
;
406 lpParms
->dwReturn
= wma
->lpdwTrackLen
[lpParms
->dwTrack
];
409 lpParms
->dwReturn
= wma
->dwTotalLen
;
410 lpParms
->dwReturn
= ANIM_CalcTime(wma
, wma
->dwTimeFormat
, lpParms
->dwReturn
);
411 TRACE("LENGTH=%lu !\n", lpParms
->dwReturn
);
413 case MCI_STATUS_MODE
:
414 lpParms
->dwReturn
= wma
->mode
;
415 TRACE("MCI_STATUS_MODE=%08lX !\n",
418 case MCI_STATUS_MEDIA_PRESENT
:
419 lpParms
->dwReturn
= TRUE
;
420 TRACE("MCI_STATUS_MEDIA_PRESENT !\n");
422 case MCI_STATUS_NUMBER_OF_TRACKS
:
423 lpParms
->dwReturn
= 1;
424 TRACE("MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n",
426 if (lpParms
->dwReturn
== (WORD
)-1) return MCIERR_INTERNAL
;
428 case MCI_STATUS_POSITION
:
429 lpParms
->dwReturn
= wma
->dwCurFrame
;
430 if (dwFlags
& MCI_STATUS_START
) {
431 lpParms
->dwReturn
= 0;
432 TRACE("get MCI_STATUS_START !\n");
434 if (dwFlags
& MCI_TRACK
) {
435 if (lpParms
->dwTrack
> wma
->nTracks
)
436 return MCIERR_OUTOFRANGE
;
437 lpParms
->dwReturn
= wma
->lpdwTrackPos
[lpParms
->dwTrack
- 1];
438 TRACE("get MCI_TRACK #%lu !\n", lpParms
->dwTrack
);
440 lpParms
->dwReturn
= ANIM_CalcTime(wma
, wma
->dwTimeFormat
, lpParms
->dwReturn
);
441 TRACE("MCI_STATUS_POSITION=%08lX !\n",
444 case MCI_STATUS_READY
:
445 TRACE("MCI_STATUS_READY !\n");
446 lpParms
->dwReturn
= TRUE
;
448 case MCI_STATUS_TIME_FORMAT
:
449 TRACE("MCI_STATUS_TIME_FORMAT !\n");
450 lpParms
->dwReturn
= MCI_FORMAT_MILLISECONDS
;
453 WARN("Unknown command %08lX !\n", lpParms
->dwItem
);
454 return MCIERR_UNRECOGNIZED_COMMAND
;
457 WARN("Not MCI_STATUS_ITEM !\n");
462 /**************************************************************************
463 * ANIM_mciPlay [internal]
465 static DWORD
ANIM_mciPlay(UINT16 wDevID
, DWORD dwFlags
, LPMCI_PLAY_PARMS lpParms
)
467 WINE_MCIANIM
* wma
= ANIM_mciGetOpenDrv(wDevID
);
470 TRACE("(%u, %08lX, %p);\n", wDevID
, dwFlags
, lpParms
);
472 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
473 if (wma
== NULL
) return MCIERR_INVALID_DEVICE_ID
;
475 start
= 0; end
= wma
->dwTotalLen
;
477 if (dwFlags
& MCI_FROM
) {
478 start
= ANIM_CalcFrame(wma
, wma
->dwTimeFormat
, lpParms
->dwFrom
);
479 TRACE("MCI_FROM=%08lX -> %u \n", lpParms
->dwFrom
, start
);
481 if (dwFlags
& MCI_TO
) {
482 end
= ANIM_CalcFrame(wma
, wma
->dwTimeFormat
, lpParms
->dwTo
);
483 TRACE("MCI_TO=%08lX -> %u \n", lpParms
->dwTo
, end
);
485 wma
->mode
= MCI_MODE_PLAY
;
486 if (dwFlags
& MCI_NOTIFY
) {
487 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n",
488 lpParms
->dwCallback
);
489 mciDriverNotify16((HWND16
)LOWORD(lpParms
->dwCallback
),
490 wma
->wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
495 /**************************************************************************
496 * ANIM_mciStop [internal]
498 static DWORD
ANIM_mciStop(UINT16 wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
500 WINE_MCIANIM
* wma
= ANIM_mciGetOpenDrv(wDevID
);
502 TRACE("(%u, %08lX, %p);\n", wDevID
, dwFlags
, lpParms
);
504 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
505 if (wma
== NULL
) return MCIERR_INVALID_DEVICE_ID
;
507 wma
->mode
= MCI_MODE_STOP
;
508 if (dwFlags
& MCI_NOTIFY
) {
509 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n",
510 lpParms
->dwCallback
);
511 mciDriverNotify16((HWND16
)LOWORD(lpParms
->dwCallback
),
512 wma
->wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
517 /**************************************************************************
518 * ANIM_mciPause [internal]
520 static DWORD
ANIM_mciPause(UINT16 wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
522 WINE_MCIANIM
* wma
= ANIM_mciGetOpenDrv(wDevID
);
524 TRACE("(%u, %08lX, %p);\n", wDevID
, dwFlags
, lpParms
);
525 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
526 wma
->mode
= MCI_MODE_PAUSE
;
527 if (dwFlags
& MCI_NOTIFY
) {
528 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n",
529 lpParms
->dwCallback
);
530 mciDriverNotify16((HWND16
)LOWORD(lpParms
->dwCallback
),
531 wma
->wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
536 /**************************************************************************
537 * ANIM_mciResume [internal]
539 static DWORD
ANIM_mciResume(UINT16 wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
541 WINE_MCIANIM
* wma
= ANIM_mciGetOpenDrv(wDevID
);
543 TRACE("(%u, %08lX, %p);\n", wDevID
, dwFlags
, lpParms
);
544 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
545 wma
->mode
= MCI_MODE_STOP
;
546 if (dwFlags
& MCI_NOTIFY
) {
547 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n",
548 lpParms
->dwCallback
);
549 mciDriverNotify16((HWND16
)LOWORD(lpParms
->dwCallback
),
550 wma
->wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
555 /**************************************************************************
556 * ANIM_mciSeek [internal]
558 static DWORD
ANIM_mciSeek(UINT16 wDevID
, DWORD dwFlags
, LPMCI_SEEK_PARMS lpParms
)
560 WINE_MCIANIM
* wma
= ANIM_mciGetOpenDrv(wDevID
);
562 MCI_PLAY_PARMS PlayParms
;
564 TRACE("(%u, %08lX, %p);\n", wDevID
, dwFlags
, lpParms
);
566 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
567 wma
->mode
= MCI_MODE_SEEK
;
569 case MCI_SEEK_TO_START
:
570 PlayParms
.dwFrom
= 0;
572 case MCI_SEEK_TO_END
:
573 PlayParms
.dwFrom
= wma
->dwTotalLen
;
576 PlayParms
.dwFrom
= lpParms
->dwTo
;
579 dwRet
= ANIM_mciPlay(wDevID
, MCI_WAIT
| MCI_FROM
, &PlayParms
);
580 if (dwRet
!= 0) return dwRet
;
581 dwRet
= ANIM_mciStop(wDevID
, MCI_WAIT
, (LPMCI_GENERIC_PARMS
)&PlayParms
);
582 if (dwFlags
& MCI_NOTIFY
) {
583 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n",
584 lpParms
->dwCallback
);
585 mciDriverNotify16((HWND16
)LOWORD(lpParms
->dwCallback
),
586 wma
->wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
592 /**************************************************************************
593 * ANIM_mciSet [internal]
595 static DWORD
ANIM_mciSet(UINT16 wDevID
, DWORD dwFlags
, LPMCI_SET_PARMS lpParms
)
597 WINE_MCIANIM
* wma
= ANIM_mciGetOpenDrv(wDevID
);
599 TRACE("(%u, %08lX, %p);\n", wDevID
, dwFlags
, lpParms
);
600 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
601 if (wma
== NULL
) return MCIERR_INVALID_DEVICE_ID
;
603 TRACE(mcianim,"(dwTimeFormat=%08lX)\n", lpParms->dwTimeFormat);
604 TRACE(mcianim,"(dwAudio=%08lX)\n", lpParms->dwAudio);
606 if (dwFlags
& MCI_SET_TIME_FORMAT
) {
607 switch (lpParms
->dwTimeFormat
) {
608 case MCI_FORMAT_MILLISECONDS
:
609 TRACE("MCI_FORMAT_MILLISECONDS !\n");
612 TRACE("MCI_FORMAT_MSF !\n");
614 case MCI_FORMAT_TMSF
:
615 TRACE("MCI_FORMAT_TMSF !\n");
618 WARN("Bad time format !\n");
619 return MCIERR_BAD_TIME_FORMAT
;
621 wma
->dwTimeFormat
= lpParms
->dwTimeFormat
;
623 if (dwFlags
& MCI_SET_VIDEO
) return MCIERR_UNSUPPORTED_FUNCTION
;
624 if (dwFlags
& MCI_SET_ON
) return MCIERR_UNSUPPORTED_FUNCTION
;
625 if (dwFlags
& MCI_SET_OFF
) return MCIERR_UNSUPPORTED_FUNCTION
;
626 if (dwFlags
& MCI_NOTIFY
) {
627 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n",
628 lpParms
->dwCallback
);
629 mciDriverNotify16((HWND16
)LOWORD(lpParms
->dwCallback
),
630 wma
->wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
635 /**************************************************************************
636 * ANIM_DriverProc [sample driver]
638 LONG
MCIANIM_DriverProc(DWORD dwDevID
, HDRVR hDriv
, DWORD wMsg
,
639 DWORD dwParam1
, DWORD dwParam2
)
642 case DRV_LOAD
: return 1;
643 case DRV_FREE
: return 1;
644 case DRV_OPEN
: return ANIM_drvOpen((LPSTR
)dwParam1
, (LPMCI_OPEN_DRIVER_PARMSA
)dwParam2
);
645 case DRV_CLOSE
: return ANIM_drvClose(dwDevID
);
646 case DRV_ENABLE
: return 1;
647 case DRV_DISABLE
: return 1;
648 case DRV_QUERYCONFIGURE
: return 1;
649 case DRV_CONFIGURE
: MessageBoxA(0, "Sample MultiMedia Driver !", "Wine Driver", MB_OK
); return 1;
650 case DRV_INSTALL
: return DRVCNF_RESTART
;
651 case DRV_REMOVE
: return DRVCNF_RESTART
;
653 case MCI_OPEN_DRIVER
: return ANIM_mciOpen(dwDevID
, dwParam1
, (LPMCI_OPEN_PARMSA
)dwParam2
);
654 case MCI_CLOSE_DRIVER
: return ANIM_mciClose(dwDevID
, dwParam1
, (LPMCI_GENERIC_PARMS
)dwParam2
);
655 case MCI_GETDEVCAPS
: return ANIM_mciGetDevCaps(dwDevID
, dwParam1
, (LPMCI_GETDEVCAPS_PARMS
)dwParam2
);
656 case MCI_INFO
: return ANIM_mciInfo(dwDevID
, dwParam1
, (LPMCI_INFO_PARMS16
)dwParam2
);
657 case MCI_STATUS
: return ANIM_mciStatus(dwDevID
, dwParam1
, (LPMCI_STATUS_PARMS
)dwParam2
);
658 case MCI_SET
: return ANIM_mciSet(dwDevID
, dwParam1
, (LPMCI_SET_PARMS
)dwParam2
);
659 case MCI_PLAY
: return ANIM_mciPlay(dwDevID
, dwParam1
, (LPMCI_PLAY_PARMS
)dwParam2
);
660 case MCI_STOP
: return ANIM_mciStop(dwDevID
, dwParam1
, (LPMCI_GENERIC_PARMS
)dwParam2
);
661 case MCI_PAUSE
: return ANIM_mciPause(dwDevID
, dwParam1
, (LPMCI_GENERIC_PARMS
)dwParam2
);
662 case MCI_RESUME
: return ANIM_mciResume(dwDevID
, dwParam1
, (LPMCI_GENERIC_PARMS
)dwParam2
);
663 case MCI_SEEK
: return ANIM_mciSeek(dwDevID
, dwParam1
, (LPMCI_SEEK_PARMS
)dwParam2
);
680 WARN("Unsupported command=%s\n", MCI_CommandToString(wMsg
));
684 FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
687 TRACE("Sending msg=%s to default driver proc\n", MCI_CommandToString(wMsg
));
688 return DefDriverProc(dwDevID
, hDriv
, wMsg
, dwParam1
, dwParam2
);
690 return MCIERR_UNRECOGNIZED_COMMAND
;
693 /*-----------------------------------------------------------------------*/