2 * Sample MCI ANIMATION Wine Driver for Linux
4 * Copyright 1994 Martin Ayotte
6 static char Copyright
[] = "Copyright Martin Ayotte, 1994";
9 #define BUILTIN_MMSYSTEM
12 #ifdef BUILTIN_MMSYSTEM
19 #include <sys/ioctl.h>
25 /* #define DEBUG_MCIANIM /* */
26 /* #undef DEBUG_MCIANIM /* */
32 #define ANIMFRAMES_PERSEC 30
33 #define ANIMFRAMES_PERMIN 1800
34 #define SECONDS_PERMIN 60
38 int nUseCount
; /* Incremented for each shared open */
39 BOOL fShareable
; /* TRUE if first open was shareable */
40 WORD wNotifyDeviceID
; /* MCI device ID with a pending notification */
41 HANDLE hCallback
; /* Callback handle for pending notification */
42 MCI_OPEN_PARMS openParms
;
53 static LINUX_ANIM AnimDev
[MAX_ANIMDRV
];
57 DWORD
ANIM_CalcTime(UINT wDevID
, DWORD dwFormatType
, DWORD dwFrame
);
58 DWORD
ANIM_CalcFrame(UINT wDevID
, DWORD dwFormatType
, DWORD dwTime
);
61 /*-----------------------------------------------------------------------*/
63 /**************************************************************************
64 * ANIM_mciOpen [internal]
66 DWORD
ANIM_mciOpen(DWORD dwFlags
, LPMCI_OPEN_PARMS lpParms
)
71 dprintf_mcianim(stddeb
,"ANIM_mciOpen(%08X, %08X);\n",
73 printf("ANIM_mciOpen(%08X, %08X);\n", dwFlags
, lpParms
);
74 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
75 wDevID
= lpParms
->wDeviceID
;
76 if (AnimDev
[wDevID
].nUseCount
> 0) {
77 /* The driver already open on this channel */
78 /* If the driver was opened shareable before and this open specifies */
79 /* shareable then increment the use count */
80 if (AnimDev
[wDevID
].fShareable
&& (dwFlags
& MCI_OPEN_SHAREABLE
))
81 ++AnimDev
[wDevID
].nUseCount
;
83 return MCIERR_MUST_USE_SHAREABLE
;
86 AnimDev
[wDevID
].nUseCount
= 1;
87 AnimDev
[wDevID
].fShareable
= dwFlags
& MCI_OPEN_SHAREABLE
;
89 if (dwFlags
& MCI_OPEN_ELEMENT
) {
90 dprintf_mcianim(stddeb
,"ANIM_mciOpen // MCI_OPEN_ELEMENT !\n");
91 printf("ANIM_mciOpen // MCI_OPEN_ELEMENT !\n");
92 /* return MCIERR_NO_ELEMENT_ALLOWED; */
94 memcpy(&AnimDev
[wDevID
].openParms
, lpParms
, sizeof(MCI_OPEN_PARMS
));
95 AnimDev
[wDevID
].wNotifyDeviceID
= lpParms
->wDeviceID
;
96 AnimDev
[wDevID
].mode
= 0;
97 AnimDev
[wDevID
].dwTimeFormat
= MCI_FORMAT_TMSF
;
98 AnimDev
[wDevID
].nCurTrack
= 0;
99 AnimDev
[wDevID
].nTracks
= 0;
100 AnimDev
[wDevID
].dwTotalLen
= 0;
101 AnimDev
[wDevID
].lpdwTrackLen
= NULL
;
102 AnimDev
[wDevID
].lpdwTrackPos
= NULL
;
103 if (dwFlags
& MCI_NOTIFY
) {
104 dprintf_mcianim(stddeb
,
105 "ANIM_mciOpen // MCI_NOTIFY_SUCCESSFUL %08X !\n",
106 lpParms
->dwCallback
);
107 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
108 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
112 return MCIERR_HARDWARE
;
116 /**************************************************************************
117 * ANIM_mciClose [internal]
119 DWORD
ANIM_mciClose(UINT wDevID
, DWORD dwParam
, LPMCI_GENERIC_PARMS lpParms
)
122 dprintf_mcianim(stddeb
,"ANIM_mciClose(%u, %08X, %08X);\n",
123 wDevID
, dwParam
, lpParms
);
124 if (AnimDev
[wDevID
].lpdwTrackLen
!= NULL
) free(AnimDev
[wDevID
].lpdwTrackLen
);
125 if (AnimDev
[wDevID
].lpdwTrackPos
!= NULL
) free(AnimDev
[wDevID
].lpdwTrackPos
);
129 /**************************************************************************
130 * ANIM_mciGetDevCaps [internal]
132 DWORD
ANIM_mciGetDevCaps(UINT wDevID
, DWORD dwFlags
,
133 LPMCI_GETDEVCAPS_PARMS lpParms
)
136 dprintf_mcianim(stddeb
,"ANIM_mciGetDevCaps(%u, %08X, %08X);\n",
137 wDevID
, dwFlags
, lpParms
);
138 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
139 if (dwFlags
& MCI_GETDEVCAPS_ITEM
) {
140 dprintf_mcianim(stddeb
,
141 "ANIM_mciGetDevCaps // MCI_GETDEVCAPS_ITEM dwItem=%08X;\n",
143 switch(lpParms
->dwItem
) {
144 case MCI_GETDEVCAPS_CAN_RECORD
:
145 lpParms
->dwReturn
= FALSE
;
147 case MCI_GETDEVCAPS_HAS_AUDIO
:
148 lpParms
->dwReturn
= FALSE
;
150 case MCI_GETDEVCAPS_HAS_VIDEO
:
151 lpParms
->dwReturn
= FALSE
;
153 case MCI_GETDEVCAPS_DEVICE_TYPE
:
154 lpParms
->dwReturn
= MCI_DEVTYPE_ANIMATION
;
156 case MCI_GETDEVCAPS_USES_FILES
:
157 lpParms
->dwReturn
= TRUE
;
159 case MCI_GETDEVCAPS_COMPOUND_DEVICE
:
160 lpParms
->dwReturn
= FALSE
;
162 case MCI_GETDEVCAPS_CAN_EJECT
:
163 lpParms
->dwReturn
= TRUE
;
165 case MCI_GETDEVCAPS_CAN_PLAY
:
166 lpParms
->dwReturn
= FALSE
;
168 case MCI_GETDEVCAPS_CAN_SAVE
:
169 lpParms
->dwReturn
= FALSE
;
172 return MCIERR_UNRECOGNIZED_COMMAND
;
175 dprintf_mcianim(stddeb
,
176 "ANIM_mciGetDevCaps // lpParms->dwReturn=%08X;\n",
180 return MCIERR_INTERNAL
;
184 /**************************************************************************
185 * ANIM_mciInfo [internal]
187 DWORD
ANIM_mciInfo(UINT wDevID
, DWORD dwFlags
, LPMCI_INFO_PARMS lpParms
)
190 dprintf_mcianim(stddeb
,"ANIM_mciInfo(%u, %08X, %08X);\n",
191 wDevID
, dwFlags
, lpParms
);
192 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
193 lpParms
->lpstrReturn
= NULL
;
195 case MCI_INFO_PRODUCT
:
196 lpParms
->lpstrReturn
= "Linux ANIMATION 0.5";
199 lpParms
->lpstrReturn
=
200 (LPSTR
)AnimDev
[wDevID
].openParms
.lpstrElementName
;
202 case MCI_ANIM_INFO_TEXT
:
203 lpParms
->lpstrReturn
= "Animation Window";
206 return MCIERR_UNRECOGNIZED_COMMAND
;
208 if (lpParms
->lpstrReturn
!= NULL
)
209 lpParms
->dwRetSize
= strlen(lpParms
->lpstrReturn
);
211 lpParms
->dwRetSize
= 0;
214 return MCIERR_INTERNAL
;
218 /**************************************************************************
219 * ANIM_mciStatus [internal]
221 DWORD
ANIM_mciStatus(UINT wDevID
, DWORD dwFlags
, LPMCI_STATUS_PARMS lpParms
)
224 dprintf_mcianim(stddeb
,"ANIM_mciStatus(%u, %08X, %08X);\n",
225 wDevID
, dwFlags
, lpParms
);
226 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
227 if (dwFlags
& MCI_NOTIFY
) {
228 dprintf_mcianim(stddeb
,
229 "ANIM_mciStatus // MCI_NOTIFY_SUCCESSFUL %08X !\n",
230 lpParms
->dwCallback
);
231 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
232 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
234 if (dwFlags
& MCI_STATUS_ITEM
) {
235 switch(lpParms
->dwItem
) {
236 case MCI_STATUS_CURRENT_TRACK
:
237 lpParms
->dwReturn
= AnimDev
[wDevID
].nCurTrack
;
238 dprintf_mcianim(stddeb
,"ANIM_mciStatus // CURRENT_TRACK=%u!\n", lpParms
->dwReturn
);
240 case MCI_STATUS_LENGTH
:
241 if (dwFlags
& MCI_TRACK
) {
242 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_TRACK #%u LENGTH=??? !\n",
244 if (lpParms
->dwTrack
> AnimDev
[wDevID
].nTracks
)
245 return MCIERR_OUTOFRANGE
;
246 lpParms
->dwReturn
= AnimDev
[wDevID
].lpdwTrackLen
[lpParms
->dwTrack
];
249 lpParms
->dwReturn
= AnimDev
[wDevID
].dwTotalLen
;
250 lpParms
->dwReturn
= ANIM_CalcTime(wDevID
,
251 AnimDev
[wDevID
].dwTimeFormat
, lpParms
->dwReturn
);
252 dprintf_mcianim(stddeb
,"ANIM_mciStatus // LENGTH=%u !\n", lpParms
->dwReturn
);
254 case MCI_STATUS_MODE
:
255 lpParms
->dwReturn
= AnimDev
[wDevID
].mode
;
256 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_STATUS_MODE=%08X !\n",
259 case MCI_STATUS_MEDIA_PRESENT
:
260 lpParms
->dwReturn
= TRUE
;
261 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_STATUS_MEDIA_PRESENT !\n");
263 case MCI_STATUS_NUMBER_OF_TRACKS
:
264 lpParms
->dwReturn
= 1;
265 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_STATUS_NUMBER_OF_TRACKS = %u !\n",
267 if (lpParms
->dwReturn
== (WORD
)-1) return MCIERR_INTERNAL
;
269 case MCI_STATUS_POSITION
:
270 lpParms
->dwReturn
= AnimDev
[wDevID
].dwCurFrame
;
271 if (dwFlags
& MCI_STATUS_START
) {
272 lpParms
->dwReturn
= 0;
273 dprintf_mcianim(stddeb
,"CDAUDIO_mciStatus // get MCI_STATUS_START !\n");
275 if (dwFlags
& MCI_TRACK
) {
276 if (lpParms
->dwTrack
> AnimDev
[wDevID
].nTracks
)
277 return MCIERR_OUTOFRANGE
;
278 lpParms
->dwReturn
= AnimDev
[wDevID
].lpdwTrackPos
[lpParms
->dwTrack
- 1];
279 dprintf_mcianim(stddeb
,"ANIM_mciStatus // get MCI_TRACK #%u !\n", lpParms
->dwTrack
);
281 lpParms
->dwReturn
= ANIM_CalcTime(wDevID
,
282 AnimDev
[wDevID
].dwTimeFormat
, lpParms
->dwReturn
);
283 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_STATUS_POSITION=%08X !\n",
286 case MCI_STATUS_READY
:
287 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_STATUS_READY !\n");
288 lpParms
->dwReturn
= TRUE
;
290 case MCI_STATUS_TIME_FORMAT
:
291 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_STATUS_TIME_FORMAT !\n");
292 lpParms
->dwReturn
= MCI_FORMAT_MILLISECONDS
;
295 fprintf(stderr
,"ANIM_mciStatus // unknown command %04X !\n", lpParms
->dwItem
);
296 return MCIERR_UNRECOGNIZED_COMMAND
;
299 fprintf(stderr
,"ANIM_mciStatus // not MCI_STATUS_ITEM !\n");
302 return MMSYSERR_NOTENABLED
;
307 /**************************************************************************
308 * ANIM_CalcTime [internal]
310 DWORD
ANIM_CalcTime(UINT wDevID
, DWORD dwFormatType
, DWORD dwFrame
)
318 dprintf_mcianim(stddeb
,"ANIM_CalcTime(%u, %08X, %lu);\n",
319 wDevID
, dwFormatType
, dwFrame
);
321 switch (dwFormatType
) {
322 case MCI_FORMAT_MILLISECONDS
:
323 dwTime
= dwFrame
/ ANIMFRAMES_PERSEC
* 1000;
324 dprintf_mcianim(stddeb
,
325 "ANIM_CalcTime // MILLISECONDS %u\n", dwTime
);
328 wMinutes
= dwFrame
/ ANIMFRAMES_PERMIN
;
329 wSeconds
= (dwFrame
- ANIMFRAMES_PERMIN
* wMinutes
) / ANIMFRAMES_PERSEC
;
330 wFrames
= dwFrame
- ANIMFRAMES_PERMIN
* wMinutes
-
331 ANIMFRAMES_PERSEC
* wSeconds
;
332 dwTime
= MCI_MAKE_MSF(wMinutes
, wSeconds
, wFrames
);
333 dprintf_mcianim(stddeb
,"ANIM_CalcTime // MSF %02u:%02u:%02u -> dwTime=%u\n",
334 wMinutes
, wSeconds
, wFrames
, dwTime
);
336 case MCI_FORMAT_TMSF
:
337 for (wTrack
= 0; wTrack
< AnimDev
[wDevID
].nTracks
; wTrack
++) {
338 /* dwTime += AnimDev[wDevID].lpdwTrackLen[wTrack - 1];
339 printf("Adding trk#%u curpos=%u \n", dwTime);
340 if (dwTime >= dwFrame) break; */
341 if (AnimDev
[wDevID
].lpdwTrackPos
[wTrack
- 1] >= dwFrame
) break;
343 wMinutes
= dwFrame
/ ANIMFRAMES_PERMIN
;
344 wSeconds
= (dwFrame
- ANIMFRAMES_PERMIN
* wMinutes
) / ANIMFRAMES_PERSEC
;
345 wFrames
= dwFrame
- ANIMFRAMES_PERMIN
* wMinutes
-
346 ANIMFRAMES_PERSEC
* wSeconds
;
347 dwTime
= MCI_MAKE_TMSF(wTrack
, wMinutes
, wSeconds
, wFrames
);
348 dprintf_mcianim(stddeb
,
349 "ANIM_CalcTime // %02u-%02u:%02u:%02u\n",
350 wTrack
, wMinutes
, wSeconds
, wFrames
);
353 /* unknown format ! force TMSF ! ... */
354 dwFormatType
= MCI_FORMAT_TMSF
;
362 /**************************************************************************
363 * ANIM_CalcFrame [internal]
365 DWORD
ANIM_CalcFrame(UINT wDevID
, DWORD dwFormatType
, DWORD dwTime
)
370 dprintf_mcianim(stddeb
,"ANIM_CalcFrame(%u, %08X, %lu);\n",
371 wDevID
, dwFormatType
, dwTime
);
373 switch (dwFormatType
) {
374 case MCI_FORMAT_MILLISECONDS
:
375 dwFrame
= dwTime
* ANIMFRAMES_PERSEC
/ 1000;
376 dprintf_mcianim(stddeb
,
377 "ANIM_CalcFrame // MILLISECONDS %u\n", dwFrame
);
380 dprintf_mcianim(stddeb
,
381 "ANIM_CalcFrame // MSF %02u:%02u:%02u\n",
382 MCI_MSF_MINUTE(dwTime
), MCI_MSF_SECOND(dwTime
),
383 MCI_MSF_FRAME(dwTime
));
384 dwFrame
+= ANIMFRAMES_PERMIN
* MCI_MSF_MINUTE(dwTime
);
385 dwFrame
+= ANIMFRAMES_PERSEC
* MCI_MSF_SECOND(dwTime
);
386 dwFrame
+= MCI_MSF_FRAME(dwTime
);
388 case MCI_FORMAT_TMSF
:
389 wTrack
= MCI_TMSF_TRACK(dwTime
);
390 dprintf_mcianim(stddeb
,
391 "ANIM_CalcFrame // TMSF %02u-%02u:%02u:%02u\n",
392 MCI_TMSF_TRACK(dwTime
), MCI_TMSF_MINUTE(dwTime
),
393 MCI_TMSF_SECOND(dwTime
), MCI_TMSF_FRAME(dwTime
));
394 dprintf_mcianim(stddeb
,
395 "ANIM_CalcFrame // TMSF trackpos[%u]=%u\n",
396 wTrack
, AnimDev
[wDevID
].lpdwTrackPos
[wTrack
- 1]);
397 dwFrame
= AnimDev
[wDevID
].lpdwTrackPos
[wTrack
- 1];
398 dwFrame
+= ANIMFRAMES_PERMIN
* MCI_TMSF_MINUTE(dwTime
);
399 dwFrame
+= ANIMFRAMES_PERSEC
* MCI_TMSF_SECOND(dwTime
);
400 dwFrame
+= MCI_TMSF_FRAME(dwTime
);
403 /* unknown format ! force TMSF ! ... */
404 dwFormatType
= MCI_FORMAT_TMSF
;
413 /**************************************************************************
414 * ANIM_mciPlay [internal]
416 DWORD
ANIM_mciPlay(UINT wDevID
, DWORD dwFlags
, LPMCI_PLAY_PARMS lpParms
)
420 dprintf_mcianim(stddeb
,"ANIM_mciPlay(%u, %08X, %08X);\n",
421 wDevID
, dwFlags
, lpParms
);
422 printf("ANIM_mciPlay(%u, %08X, %08X);\n", wDevID
, dwFlags
, lpParms
);
423 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
424 start
= 0; end
= AnimDev
[wDevID
].dwTotalLen
;
425 AnimDev
[wDevID
].nCurTrack
= 1;
426 if (dwFlags
& MCI_FROM
) {
427 start
= ANIM_CalcFrame(wDevID
,
428 AnimDev
[wDevID
].dwTimeFormat
, lpParms
->dwFrom
);
429 dprintf_mcianim(stddeb
,"ANIM_mciPlay // MCI_FROM=%08X -> %u \n",
430 lpParms
->dwFrom
, start
);
432 if (dwFlags
& MCI_TO
) {
433 end
= ANIM_CalcFrame(wDevID
,
434 AnimDev
[wDevID
].dwTimeFormat
, lpParms
->dwTo
);
435 dprintf_mcianim(stddeb
,
436 "ANIM_mciPlay // MCI_TO=%08X -> %u \n",
439 AnimDev
[wDevID
].mode
= MCI_MODE_PLAY
;
440 if (dwFlags
& MCI_NOTIFY
) {
441 dprintf_mcianim(stddeb
,
442 "ANIM_mciPlay // MCI_NOTIFY_SUCCESSFUL %08X !\n",
443 lpParms
->dwCallback
);
444 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
445 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
449 return MCIERR_HARDWARE
;
453 /**************************************************************************
454 * ANIM_mciStop [internal]
456 DWORD
ANIM_mciStop(UINT wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
459 dprintf_mcianim(stddeb
,"ANIM_mciStop(%u, %08X, %08X);\n",
460 wDevID
, dwFlags
, lpParms
);
461 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
462 AnimDev
[wDevID
].mode
= MCI_MODE_STOP
;
463 if (dwFlags
& MCI_NOTIFY
) {
464 dprintf_mcianim(stddeb
,
465 "ANIM_mciStop // MCI_NOTIFY_SUCCESSFUL %08X !\n",
466 lpParms
->dwCallback
);
467 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
468 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
472 return MCIERR_HARDWARE
;
476 /**************************************************************************
477 * ANIM_mciPause [internal]
479 DWORD
ANIM_mciPause(UINT wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
482 dprintf_mcianim(stddeb
,"ANIM_mciPause(%u, %08X, %08X);\n",
483 wDevID
, dwFlags
, lpParms
);
484 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
485 AnimDev
[wDevID
].mode
= MCI_MODE_PAUSE
;
486 if (dwFlags
& MCI_NOTIFY
) {
487 dprintf_mcianim(stddeb
,
488 "ANIM_mciPause // MCI_NOTIFY_SUCCESSFUL %08X !\n",
489 lpParms
->dwCallback
);
490 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
491 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
495 return MCIERR_HARDWARE
;
499 /**************************************************************************
500 * ANIM_mciResume [internal]
502 DWORD
ANIM_mciResume(UINT wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
505 dprintf_mcianim(stddeb
,"ANIM_mciResume(%u, %08X, %08X);\n",
506 wDevID
, dwFlags
, lpParms
);
507 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
508 AnimDev
[wDevID
].mode
= MCI_MODE_STOP
;
509 if (dwFlags
& MCI_NOTIFY
) {
510 dprintf_mcianim(stddeb
,
511 "ANIM_mciResume // MCI_NOTIFY_SUCCESSFUL %08X !\n",
512 lpParms
->dwCallback
);
513 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
514 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
518 return MCIERR_HARDWARE
;
522 /**************************************************************************
523 * ANIM_mciSeek [internal]
525 DWORD
ANIM_mciSeek(UINT wDevID
, DWORD dwFlags
, LPMCI_SEEK_PARMS lpParms
)
529 MCI_PLAY_PARMS PlayParms
;
530 dprintf_mcianim(stddeb
,"ANIM_mciSeek(%u, %08X, %08X);\n",
531 wDevID
, dwFlags
, lpParms
);
532 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
533 AnimDev
[wDevID
].mode
= MCI_MODE_SEEK
;
535 case MCI_SEEK_TO_START
:
536 PlayParms
.dwFrom
= 0;
538 case MCI_SEEK_TO_END
:
539 PlayParms
.dwFrom
= AnimDev
[wDevID
].dwTotalLen
;
542 PlayParms
.dwFrom
= lpParms
->dwTo
;
545 dwRet
= ANIM_mciPlay(wDevID
, MCI_WAIT
| MCI_FROM
, &PlayParms
);
546 if (dwRet
!= 0) return dwRet
;
547 dwRet
= ANIM_mciStop(wDevID
, MCI_WAIT
, (LPMCI_GENERIC_PARMS
)&PlayParms
);
548 if (dwFlags
& MCI_NOTIFY
) {
549 dprintf_mcianim(stddeb
,
550 "ANIM_mciSeek // MCI_NOTIFY_SUCCESSFUL %08X !\n",
551 lpParms
->dwCallback
);
552 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
553 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
557 return MCIERR_HARDWARE
;
562 /**************************************************************************
563 * ANIM_mciSet [internal]
565 DWORD
ANIM_mciSet(UINT wDevID
, DWORD dwFlags
, LPMCI_SET_PARMS lpParms
)
568 dprintf_mcianim(stddeb
,"ANIM_mciSet(%u, %08X, %08X);\n",
569 wDevID
, dwFlags
, lpParms
);
570 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
572 printf("ANIM_mciSet // dwTimeFormat=%08X\n", lpParms->dwTimeFormat);
573 printf("ANIM_mciSet // dwAudio=%08X\n", lpParms->dwAudio);
575 if (dwFlags
& MCI_SET_TIME_FORMAT
) {
576 switch (lpParms
->dwTimeFormat
) {
577 case MCI_FORMAT_MILLISECONDS
:
578 dprintf_mcianim(stddeb
,
579 "ANIM_mciSet // MCI_FORMAT_MILLISECONDS !\n");
582 dprintf_mcianim(stddeb
,"ANIM_mciSet // MCI_FORMAT_MSF !\n");
584 case MCI_FORMAT_TMSF
:
585 dprintf_mcianim(stddeb
,"ANIM_mciSet // MCI_FORMAT_TMSF !\n");
588 fprintf(stderr
,"ANIM_mciSet // bad time format !\n");
589 return MCIERR_BAD_TIME_FORMAT
;
591 AnimDev
[wDevID
].dwTimeFormat
= lpParms
->dwTimeFormat
;
593 if (dwFlags
& MCI_SET_VIDEO
) return MCIERR_UNSUPPORTED_FUNCTION
;
594 if (dwFlags
& MCI_SET_ON
) return MCIERR_UNSUPPORTED_FUNCTION
;
595 if (dwFlags
& MCI_SET_OFF
) return MCIERR_UNSUPPORTED_FUNCTION
;
596 if (dwFlags
& MCI_NOTIFY
) {
597 dprintf_mcianim(stddeb
,
598 "ANIM_mciSet // MCI_NOTIFY_SUCCESSFUL %08X !\n",
599 lpParms
->dwCallback
);
600 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
601 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
605 return MCIERR_HARDWARE
;
610 /**************************************************************************
611 * ANIM_DriverProc [sample driver]
613 LRESULT
ANIM_DriverProc(DWORD dwDevID
, HDRVR hDriv
, WORD wMsg
,
614 DWORD dwParam1
, DWORD dwParam2
)
623 case MCI_OPEN_DRIVER
:
625 return ANIM_mciOpen(dwParam1
, (LPMCI_OPEN_PARMS
)dwParam2
);
627 case MCI_CLOSE_DRIVER
:
629 return ANIM_mciClose(dwDevID
, dwParam1
,
630 (LPMCI_GENERIC_PARMS
)dwParam2
);
635 case DRV_QUERYCONFIGURE
:
638 MessageBox((HWND
)NULL
, "Sample MultiMedia Linux Driver !",
639 "MMLinux Driver", MB_OK
);
642 return (LRESULT
)DRVCNF_RESTART
;
644 return (LRESULT
)DRVCNF_RESTART
;
646 return ANIM_mciGetDevCaps(dwDevID
, dwParam1
,
647 (LPMCI_GETDEVCAPS_PARMS
)dwParam2
);
649 return ANIM_mciInfo(dwDevID
, dwParam1
,
650 (LPMCI_INFO_PARMS
)dwParam2
);
652 return ANIM_mciStatus(dwDevID
, dwParam1
,
653 (LPMCI_STATUS_PARMS
)dwParam2
);
655 return ANIM_mciSet(dwDevID
, dwParam1
,
656 (LPMCI_SET_PARMS
)dwParam2
);
658 return ANIM_mciPlay(dwDevID
, dwParam1
,
659 (LPMCI_PLAY_PARMS
)dwParam2
);
661 return ANIM_mciStop(dwDevID
, dwParam1
,
662 (LPMCI_GENERIC_PARMS
)dwParam2
);
664 return ANIM_mciPause(dwDevID
, dwParam1
,
665 (LPMCI_GENERIC_PARMS
)dwParam2
);
667 return ANIM_mciResume(dwDevID
, dwParam1
,
668 (LPMCI_GENERIC_PARMS
)dwParam2
);
670 return ANIM_mciSeek(dwDevID
, dwParam1
,
671 (LPMCI_SEEK_PARMS
)dwParam2
);
673 return DefDriverProc(dwDevID
, hDriv
, wMsg
, dwParam1
, dwParam2
);
676 return MCIERR_HARDWARE
;
681 /*-----------------------------------------------------------------------*/
683 #endif /* #ifdef BUILTIN_MMSYSTEM */