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 */
31 #define ANIMFRAMES_PERSEC 30
32 #define ANIMFRAMES_PERMIN 1800
33 #define SECONDS_PERMIN 60
37 int nUseCount
; /* Incremented for each shared open */
38 BOOL fShareable
; /* TRUE if first open was shareable */
39 WORD wNotifyDeviceID
; /* MCI device ID with a pending notification */
40 HANDLE hCallback
; /* Callback handle for pending notification */
41 MCI_OPEN_PARMS openParms
;
52 static LINUX_ANIM AnimDev
[MAX_ANIMDRV
];
56 DWORD
ANIM_CalcTime(UINT wDevID
, DWORD dwFormatType
, DWORD dwFrame
);
57 DWORD
ANIM_CalcFrame(UINT wDevID
, DWORD dwFormatType
, DWORD dwTime
);
60 /*-----------------------------------------------------------------------*/
62 /**************************************************************************
63 * ANIM_mciOpen [internal]
65 DWORD
ANIM_mciOpen(DWORD dwFlags
, LPMCI_OPEN_PARMS lpParms
)
70 dprintf_mcianim(stddeb
,"ANIM_mciOpen(%08X, %08X);\n",
72 printf("ANIM_mciOpen(%08X, %08X);\n", dwFlags
, lpParms
);
73 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
74 wDevID
= lpParms
->wDeviceID
;
75 if (AnimDev
[wDevID
].nUseCount
> 0) {
76 /* The driver already open on this channel */
77 /* If the driver was opened shareable before and this open specifies */
78 /* shareable then increment the use count */
79 if (AnimDev
[wDevID
].fShareable
&& (dwFlags
& MCI_OPEN_SHAREABLE
))
80 ++AnimDev
[wDevID
].nUseCount
;
82 return MCIERR_MUST_USE_SHAREABLE
;
85 AnimDev
[wDevID
].nUseCount
= 1;
86 AnimDev
[wDevID
].fShareable
= dwFlags
& MCI_OPEN_SHAREABLE
;
88 if (dwFlags
& MCI_OPEN_ELEMENT
) {
89 dprintf_mcianim(stddeb
,"ANIM_mciOpen // MCI_OPEN_ELEMENT !\n");
90 printf("ANIM_mciOpen // MCI_OPEN_ELEMENT !\n");
91 /* return MCIERR_NO_ELEMENT_ALLOWED; */
93 memcpy(&AnimDev
[wDevID
].openParms
, lpParms
, sizeof(MCI_OPEN_PARMS
));
94 AnimDev
[wDevID
].wNotifyDeviceID
= lpParms
->wDeviceID
;
95 AnimDev
[wDevID
].mode
= 0;
96 AnimDev
[wDevID
].dwTimeFormat
= MCI_FORMAT_TMSF
;
97 AnimDev
[wDevID
].nCurTrack
= 0;
98 AnimDev
[wDevID
].nTracks
= 0;
99 AnimDev
[wDevID
].dwTotalLen
= 0;
100 AnimDev
[wDevID
].lpdwTrackLen
= NULL
;
101 AnimDev
[wDevID
].lpdwTrackPos
= NULL
;
102 if (dwFlags
& MCI_NOTIFY
) {
103 dprintf_mcianim(stddeb
,
104 "ANIM_mciOpen // MCI_NOTIFY_SUCCESSFUL %08X !\n",
105 lpParms
->dwCallback
);
106 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
107 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
111 return MCIERR_HARDWARE
;
115 /**************************************************************************
116 * ANIM_mciClose [internal]
118 DWORD
ANIM_mciClose(UINT wDevID
, DWORD dwParam
, LPMCI_GENERIC_PARMS lpParms
)
121 dprintf_mcianim(stddeb
,"ANIM_mciClose(%u, %08X, %08X);\n",
122 wDevID
, dwParam
, lpParms
);
123 if (AnimDev
[wDevID
].lpdwTrackLen
!= NULL
) free(AnimDev
[wDevID
].lpdwTrackLen
);
124 if (AnimDev
[wDevID
].lpdwTrackPos
!= NULL
) free(AnimDev
[wDevID
].lpdwTrackPos
);
128 /**************************************************************************
129 * ANIM_mciGetDevCaps [internal]
131 DWORD
ANIM_mciGetDevCaps(UINT wDevID
, DWORD dwFlags
,
132 LPMCI_GETDEVCAPS_PARMS lpParms
)
135 dprintf_mcianim(stddeb
,"ANIM_mciGetDevCaps(%u, %08X, %08X);\n",
136 wDevID
, dwFlags
, lpParms
);
137 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
138 if (dwFlags
& MCI_GETDEVCAPS_ITEM
) {
139 dprintf_mcianim(stddeb
,
140 "ANIM_mciGetDevCaps // MCI_GETDEVCAPS_ITEM dwItem=%08X;\n",
142 switch(lpParms
->dwItem
) {
143 case MCI_GETDEVCAPS_CAN_RECORD
:
144 lpParms
->dwReturn
= FALSE
;
146 case MCI_GETDEVCAPS_HAS_AUDIO
:
147 lpParms
->dwReturn
= FALSE
;
149 case MCI_GETDEVCAPS_HAS_VIDEO
:
150 lpParms
->dwReturn
= FALSE
;
152 case MCI_GETDEVCAPS_DEVICE_TYPE
:
153 lpParms
->dwReturn
= MCI_DEVTYPE_ANIMATION
;
155 case MCI_GETDEVCAPS_USES_FILES
:
156 lpParms
->dwReturn
= TRUE
;
158 case MCI_GETDEVCAPS_COMPOUND_DEVICE
:
159 lpParms
->dwReturn
= FALSE
;
161 case MCI_GETDEVCAPS_CAN_EJECT
:
162 lpParms
->dwReturn
= TRUE
;
164 case MCI_GETDEVCAPS_CAN_PLAY
:
165 lpParms
->dwReturn
= FALSE
;
167 case MCI_GETDEVCAPS_CAN_SAVE
:
168 lpParms
->dwReturn
= FALSE
;
171 return MCIERR_UNRECOGNIZED_COMMAND
;
174 dprintf_mcianim(stddeb
,
175 "ANIM_mciGetDevCaps // lpParms->dwReturn=%08X;\n",
179 return MCIERR_INTERNAL
;
183 /**************************************************************************
184 * ANIM_mciInfo [internal]
186 DWORD
ANIM_mciInfo(UINT wDevID
, DWORD dwFlags
, LPMCI_INFO_PARMS lpParms
)
189 dprintf_mcianim(stddeb
,"ANIM_mciInfo(%u, %08X, %08X);\n",
190 wDevID
, dwFlags
, lpParms
);
191 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
192 lpParms
->lpstrReturn
= NULL
;
194 case MCI_INFO_PRODUCT
:
195 lpParms
->lpstrReturn
= "Linux ANIMATION 0.5";
198 lpParms
->lpstrReturn
=
199 (LPSTR
)AnimDev
[wDevID
].openParms
.lpstrElementName
;
201 case MCI_ANIM_INFO_TEXT
:
202 lpParms
->lpstrReturn
= "Animation Window";
205 return MCIERR_UNRECOGNIZED_COMMAND
;
207 if (lpParms
->lpstrReturn
!= NULL
)
208 lpParms
->dwRetSize
= strlen(lpParms
->lpstrReturn
);
210 lpParms
->dwRetSize
= 0;
213 return MCIERR_INTERNAL
;
217 /**************************************************************************
218 * ANIM_mciStatus [internal]
220 DWORD
ANIM_mciStatus(UINT wDevID
, DWORD dwFlags
, LPMCI_STATUS_PARMS lpParms
)
223 dprintf_mcianim(stddeb
,"ANIM_mciStatus(%u, %08X, %08X);\n",
224 wDevID
, dwFlags
, lpParms
);
225 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
226 if (dwFlags
& MCI_NOTIFY
) {
227 dprintf_mcianim(stddeb
,
228 "ANIM_mciStatus // MCI_NOTIFY_SUCCESSFUL %08X !\n",
229 lpParms
->dwCallback
);
230 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
231 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
233 if (dwFlags
& MCI_STATUS_ITEM
) {
234 switch(lpParms
->dwItem
) {
235 case MCI_STATUS_CURRENT_TRACK
:
236 lpParms
->dwReturn
= AnimDev
[wDevID
].nCurTrack
;
237 dprintf_mcianim(stddeb
,"ANIM_mciStatus // CURRENT_TRACK=%u!\n", lpParms
->dwReturn
);
239 case MCI_STATUS_LENGTH
:
240 if (dwFlags
& MCI_TRACK
) {
241 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_TRACK #%u LENGTH=??? !\n",
243 if (lpParms
->dwTrack
> AnimDev
[wDevID
].nTracks
)
244 return MCIERR_OUTOFRANGE
;
245 lpParms
->dwReturn
= AnimDev
[wDevID
].lpdwTrackLen
[lpParms
->dwTrack
];
248 lpParms
->dwReturn
= AnimDev
[wDevID
].dwTotalLen
;
249 lpParms
->dwReturn
= ANIM_CalcTime(wDevID
,
250 AnimDev
[wDevID
].dwTimeFormat
, lpParms
->dwReturn
);
251 dprintf_mcianim(stddeb
,"ANIM_mciStatus // LENGTH=%u !\n", lpParms
->dwReturn
);
253 case MCI_STATUS_MODE
:
254 lpParms
->dwReturn
= AnimDev
[wDevID
].mode
;
255 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_STATUS_MODE=%08X !\n",
258 case MCI_STATUS_MEDIA_PRESENT
:
259 lpParms
->dwReturn
= TRUE
;
260 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_STATUS_MEDIA_PRESENT !\n");
262 case MCI_STATUS_NUMBER_OF_TRACKS
:
263 lpParms
->dwReturn
= 1;
264 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_STATUS_NUMBER_OF_TRACKS = %u !\n",
266 if (lpParms
->dwReturn
== (WORD
)-1) return MCIERR_INTERNAL
;
268 case MCI_STATUS_POSITION
:
269 lpParms
->dwReturn
= AnimDev
[wDevID
].dwCurFrame
;
270 if (dwFlags
& MCI_STATUS_START
) {
271 lpParms
->dwReturn
= 0;
272 dprintf_mcianim(stddeb
,"CDAUDIO_mciStatus // get MCI_STATUS_START !\n");
274 if (dwFlags
& MCI_TRACK
) {
275 if (lpParms
->dwTrack
> AnimDev
[wDevID
].nTracks
)
276 return MCIERR_OUTOFRANGE
;
277 lpParms
->dwReturn
= AnimDev
[wDevID
].lpdwTrackPos
[lpParms
->dwTrack
- 1];
278 dprintf_mcianim(stddeb
,"ANIM_mciStatus // get MCI_TRACK #%u !\n", lpParms
->dwTrack
);
280 lpParms
->dwReturn
= ANIM_CalcTime(wDevID
,
281 AnimDev
[wDevID
].dwTimeFormat
, lpParms
->dwReturn
);
282 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_STATUS_POSITION=%08X !\n",
285 case MCI_STATUS_READY
:
286 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_STATUS_READY !\n");
287 lpParms
->dwReturn
= TRUE
;
289 case MCI_STATUS_TIME_FORMAT
:
290 dprintf_mcianim(stddeb
,"ANIM_mciStatus // MCI_STATUS_TIME_FORMAT !\n");
291 lpParms
->dwReturn
= MCI_FORMAT_MILLISECONDS
;
294 fprintf(stderr
,"ANIM_mciStatus // unknown command %04X !\n", lpParms
->dwItem
);
295 return MCIERR_UNRECOGNIZED_COMMAND
;
298 fprintf(stderr
,"ANIM_mciStatus // not MCI_STATUS_ITEM !\n");
301 return MMSYSERR_NOTENABLED
;
306 /**************************************************************************
307 * ANIM_CalcTime [internal]
309 DWORD
ANIM_CalcTime(UINT wDevID
, DWORD dwFormatType
, DWORD dwFrame
)
317 dprintf_mcianim(stddeb
,"ANIM_CalcTime(%u, %08X, %lu);\n",
318 wDevID
, dwFormatType
, dwFrame
);
320 switch (dwFormatType
) {
321 case MCI_FORMAT_MILLISECONDS
:
322 dwTime
= dwFrame
/ ANIMFRAMES_PERSEC
* 1000;
323 dprintf_mcianim(stddeb
,
324 "ANIM_CalcTime // MILLISECONDS %u\n", dwTime
);
327 wMinutes
= dwFrame
/ ANIMFRAMES_PERMIN
;
328 wSeconds
= (dwFrame
- ANIMFRAMES_PERMIN
* wMinutes
) / ANIMFRAMES_PERSEC
;
329 wFrames
= dwFrame
- ANIMFRAMES_PERMIN
* wMinutes
-
330 ANIMFRAMES_PERSEC
* wSeconds
;
331 dwTime
= MCI_MAKE_MSF(wMinutes
, wSeconds
, wFrames
);
332 dprintf_mcianim(stddeb
,"ANIM_CalcTime // MSF %02u:%02u:%02u -> dwTime=%u\n",
333 wMinutes
, wSeconds
, wFrames
, dwTime
);
335 case MCI_FORMAT_TMSF
:
336 for (wTrack
= 0; wTrack
< AnimDev
[wDevID
].nTracks
; wTrack
++) {
337 /* dwTime += AnimDev[wDevID].lpdwTrackLen[wTrack - 1];
338 printf("Adding trk#%u curpos=%u \n", dwTime);
339 if (dwTime >= dwFrame) break; */
340 if (AnimDev
[wDevID
].lpdwTrackPos
[wTrack
- 1] >= dwFrame
) break;
342 wMinutes
= dwFrame
/ ANIMFRAMES_PERMIN
;
343 wSeconds
= (dwFrame
- ANIMFRAMES_PERMIN
* wMinutes
) / ANIMFRAMES_PERSEC
;
344 wFrames
= dwFrame
- ANIMFRAMES_PERMIN
* wMinutes
-
345 ANIMFRAMES_PERSEC
* wSeconds
;
346 dwTime
= MCI_MAKE_TMSF(wTrack
, wMinutes
, wSeconds
, wFrames
);
347 dprintf_mcianim(stddeb
,
348 "ANIM_CalcTime // %02u-%02u:%02u:%02u\n",
349 wTrack
, wMinutes
, wSeconds
, wFrames
);
352 /* unknown format ! force TMSF ! ... */
353 dwFormatType
= MCI_FORMAT_TMSF
;
361 /**************************************************************************
362 * ANIM_CalcFrame [internal]
364 DWORD
ANIM_CalcFrame(UINT wDevID
, DWORD dwFormatType
, DWORD dwTime
)
369 dprintf_mcianim(stddeb
,"ANIM_CalcFrame(%u, %08X, %lu);\n",
370 wDevID
, dwFormatType
, dwTime
);
372 switch (dwFormatType
) {
373 case MCI_FORMAT_MILLISECONDS
:
374 dwFrame
= dwTime
* ANIMFRAMES_PERSEC
/ 1000;
375 dprintf_mcianim(stddeb
,
376 "ANIM_CalcFrame // MILLISECONDS %u\n", dwFrame
);
379 dprintf_mcianim(stddeb
,
380 "ANIM_CalcFrame // MSF %02u:%02u:%02u\n",
381 MCI_MSF_MINUTE(dwTime
), MCI_MSF_SECOND(dwTime
),
382 MCI_MSF_FRAME(dwTime
));
383 dwFrame
+= ANIMFRAMES_PERMIN
* MCI_MSF_MINUTE(dwTime
);
384 dwFrame
+= ANIMFRAMES_PERSEC
* MCI_MSF_SECOND(dwTime
);
385 dwFrame
+= MCI_MSF_FRAME(dwTime
);
387 case MCI_FORMAT_TMSF
:
388 wTrack
= MCI_TMSF_TRACK(dwTime
);
389 dprintf_mcianim(stddeb
,
390 "ANIM_CalcFrame // TMSF %02u-%02u:%02u:%02u\n",
391 MCI_TMSF_TRACK(dwTime
), MCI_TMSF_MINUTE(dwTime
),
392 MCI_TMSF_SECOND(dwTime
), MCI_TMSF_FRAME(dwTime
));
393 dprintf_mcianim(stddeb
,
394 "ANIM_CalcFrame // TMSF trackpos[%u]=%u\n",
395 wTrack
, AnimDev
[wDevID
].lpdwTrackPos
[wTrack
- 1]);
396 dwFrame
= AnimDev
[wDevID
].lpdwTrackPos
[wTrack
- 1];
397 dwFrame
+= ANIMFRAMES_PERMIN
* MCI_TMSF_MINUTE(dwTime
);
398 dwFrame
+= ANIMFRAMES_PERSEC
* MCI_TMSF_SECOND(dwTime
);
399 dwFrame
+= MCI_TMSF_FRAME(dwTime
);
402 /* unknown format ! force TMSF ! ... */
403 dwFormatType
= MCI_FORMAT_TMSF
;
412 /**************************************************************************
413 * ANIM_mciPlay [internal]
415 DWORD
ANIM_mciPlay(UINT wDevID
, DWORD dwFlags
, LPMCI_PLAY_PARMS lpParms
)
419 dprintf_mcianim(stddeb
,"ANIM_mciPlay(%u, %08X, %08X);\n",
420 wDevID
, dwFlags
, lpParms
);
421 printf("ANIM_mciPlay(%u, %08X, %08X);\n", wDevID
, dwFlags
, lpParms
);
422 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
423 start
= 0; end
= AnimDev
[wDevID
].dwTotalLen
;
424 AnimDev
[wDevID
].nCurTrack
= 1;
425 if (dwFlags
& MCI_FROM
) {
426 start
= ANIM_CalcFrame(wDevID
,
427 AnimDev
[wDevID
].dwTimeFormat
, lpParms
->dwFrom
);
428 dprintf_mcianim(stddeb
,"ANIM_mciPlay // MCI_FROM=%08X -> %u \n",
429 lpParms
->dwFrom
, start
);
431 if (dwFlags
& MCI_TO
) {
432 end
= ANIM_CalcFrame(wDevID
,
433 AnimDev
[wDevID
].dwTimeFormat
, lpParms
->dwTo
);
434 dprintf_mcianim(stddeb
,
435 "ANIM_mciPlay // MCI_TO=%08X -> %u \n",
438 AnimDev
[wDevID
].mode
= MCI_MODE_PLAY
;
439 if (dwFlags
& MCI_NOTIFY
) {
440 dprintf_mcianim(stddeb
,
441 "ANIM_mciPlay // MCI_NOTIFY_SUCCESSFUL %08X !\n",
442 lpParms
->dwCallback
);
443 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
444 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
448 return MCIERR_HARDWARE
;
452 /**************************************************************************
453 * ANIM_mciStop [internal]
455 DWORD
ANIM_mciStop(UINT wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
458 dprintf_mcianim(stddeb
,"ANIM_mciStop(%u, %08X, %08X);\n",
459 wDevID
, dwFlags
, lpParms
);
460 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
461 AnimDev
[wDevID
].mode
= MCI_MODE_STOP
;
462 if (dwFlags
& MCI_NOTIFY
) {
463 dprintf_mcianim(stddeb
,
464 "ANIM_mciStop // MCI_NOTIFY_SUCCESSFUL %08X !\n",
465 lpParms
->dwCallback
);
466 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
467 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
471 return MCIERR_HARDWARE
;
475 /**************************************************************************
476 * ANIM_mciPause [internal]
478 DWORD
ANIM_mciPause(UINT wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
481 dprintf_mcianim(stddeb
,"ANIM_mciPause(%u, %08X, %08X);\n",
482 wDevID
, dwFlags
, lpParms
);
483 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
484 AnimDev
[wDevID
].mode
= MCI_MODE_PAUSE
;
485 if (dwFlags
& MCI_NOTIFY
) {
486 dprintf_mcianim(stddeb
,
487 "ANIM_mciPause // MCI_NOTIFY_SUCCESSFUL %08X !\n",
488 lpParms
->dwCallback
);
489 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
490 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
494 return MCIERR_HARDWARE
;
498 /**************************************************************************
499 * ANIM_mciResume [internal]
501 DWORD
ANIM_mciResume(UINT wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
504 dprintf_mcianim(stddeb
,"ANIM_mciResume(%u, %08X, %08X);\n",
505 wDevID
, dwFlags
, lpParms
);
506 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
507 AnimDev
[wDevID
].mode
= MCI_MODE_STOP
;
508 if (dwFlags
& MCI_NOTIFY
) {
509 dprintf_mcianim(stddeb
,
510 "ANIM_mciResume // MCI_NOTIFY_SUCCESSFUL %08X !\n",
511 lpParms
->dwCallback
);
512 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
513 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
517 return MCIERR_HARDWARE
;
521 /**************************************************************************
522 * ANIM_mciSeek [internal]
524 DWORD
ANIM_mciSeek(UINT wDevID
, DWORD dwFlags
, LPMCI_SEEK_PARMS lpParms
)
528 MCI_PLAY_PARMS PlayParms
;
529 dprintf_mcianim(stddeb
,"ANIM_mciSeek(%u, %08X, %08X);\n",
530 wDevID
, dwFlags
, lpParms
);
531 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
532 AnimDev
[wDevID
].mode
= MCI_MODE_SEEK
;
534 case MCI_SEEK_TO_START
:
535 PlayParms
.dwFrom
= 0;
537 case MCI_SEEK_TO_END
:
538 PlayParms
.dwFrom
= AnimDev
[wDevID
].dwTotalLen
;
541 PlayParms
.dwFrom
= lpParms
->dwTo
;
544 dwRet
= ANIM_mciPlay(wDevID
, MCI_WAIT
| MCI_FROM
, &PlayParms
);
545 if (dwRet
!= 0) return dwRet
;
546 dwRet
= ANIM_mciStop(wDevID
, MCI_WAIT
, (LPMCI_GENERIC_PARMS
)&PlayParms
);
547 if (dwFlags
& MCI_NOTIFY
) {
548 dprintf_mcianim(stddeb
,
549 "ANIM_mciSeek // MCI_NOTIFY_SUCCESSFUL %08X !\n",
550 lpParms
->dwCallback
);
551 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
552 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
556 return MCIERR_HARDWARE
;
561 /**************************************************************************
562 * ANIM_mciSet [internal]
564 DWORD
ANIM_mciSet(UINT wDevID
, DWORD dwFlags
, LPMCI_SET_PARMS lpParms
)
567 dprintf_mcianim(stddeb
,"ANIM_mciSet(%u, %08X, %08X);\n",
568 wDevID
, dwFlags
, lpParms
);
569 if (lpParms
== NULL
) return MCIERR_INTERNAL
;
571 printf("ANIM_mciSet // dwTimeFormat=%08X\n", lpParms->dwTimeFormat);
572 printf("ANIM_mciSet // dwAudio=%08X\n", lpParms->dwAudio);
574 if (dwFlags
& MCI_SET_TIME_FORMAT
) {
575 switch (lpParms
->dwTimeFormat
) {
576 case MCI_FORMAT_MILLISECONDS
:
577 dprintf_mcianim(stddeb
,
578 "ANIM_mciSet // MCI_FORMAT_MILLISECONDS !\n");
581 dprintf_mcianim(stddeb
,"ANIM_mciSet // MCI_FORMAT_MSF !\n");
583 case MCI_FORMAT_TMSF
:
584 dprintf_mcianim(stddeb
,"ANIM_mciSet // MCI_FORMAT_TMSF !\n");
587 fprintf(stderr
,"ANIM_mciSet // bad time format !\n");
588 return MCIERR_BAD_TIME_FORMAT
;
590 AnimDev
[wDevID
].dwTimeFormat
= lpParms
->dwTimeFormat
;
592 if (dwFlags
& MCI_SET_VIDEO
) return MCIERR_UNSUPPORTED_FUNCTION
;
593 if (dwFlags
& MCI_SET_ON
) return MCIERR_UNSUPPORTED_FUNCTION
;
594 if (dwFlags
& MCI_SET_OFF
) return MCIERR_UNSUPPORTED_FUNCTION
;
595 if (dwFlags
& MCI_NOTIFY
) {
596 dprintf_mcianim(stddeb
,
597 "ANIM_mciSet // MCI_NOTIFY_SUCCESSFUL %08X !\n",
598 lpParms
->dwCallback
);
599 mciDriverNotify((HWND
)LOWORD(lpParms
->dwCallback
),
600 AnimDev
[wDevID
].wNotifyDeviceID
, MCI_NOTIFY_SUCCESSFUL
);
604 return MCIERR_HARDWARE
;
609 /**************************************************************************
610 * ANIM_DriverProc [sample driver]
612 LRESULT
ANIM_DriverProc(DWORD dwDevID
, HDRVR hDriv
, WORD wMsg
,
613 DWORD dwParam1
, DWORD dwParam2
)
622 case MCI_OPEN_DRIVER
:
624 return ANIM_mciOpen(dwParam1
, (LPMCI_OPEN_PARMS
)dwParam2
);
626 case MCI_CLOSE_DRIVER
:
628 return ANIM_mciClose(dwDevID
, dwParam1
,
629 (LPMCI_GENERIC_PARMS
)dwParam2
);
634 case DRV_QUERYCONFIGURE
:
637 MessageBox((HWND
)NULL
, "Sample MultiMedia Linux Driver !",
638 "MMLinux Driver", MB_OK
);
641 return (LRESULT
)DRVCNF_RESTART
;
643 return (LRESULT
)DRVCNF_RESTART
;
645 return ANIM_mciGetDevCaps(dwDevID
, dwParam1
,
646 (LPMCI_GETDEVCAPS_PARMS
)dwParam2
);
648 return ANIM_mciInfo(dwDevID
, dwParam1
,
649 (LPMCI_INFO_PARMS
)dwParam2
);
651 return ANIM_mciStatus(dwDevID
, dwParam1
,
652 (LPMCI_STATUS_PARMS
)dwParam2
);
654 return ANIM_mciSet(dwDevID
, dwParam1
,
655 (LPMCI_SET_PARMS
)dwParam2
);
657 return ANIM_mciPlay(dwDevID
, dwParam1
,
658 (LPMCI_PLAY_PARMS
)dwParam2
);
660 return ANIM_mciStop(dwDevID
, dwParam1
,
661 (LPMCI_GENERIC_PARMS
)dwParam2
);
663 return ANIM_mciPause(dwDevID
, dwParam1
,
664 (LPMCI_GENERIC_PARMS
)dwParam2
);
666 return ANIM_mciResume(dwDevID
, dwParam1
,
667 (LPMCI_GENERIC_PARMS
)dwParam2
);
669 return ANIM_mciSeek(dwDevID
, dwParam1
,
670 (LPMCI_SEEK_PARMS
)dwParam2
);
672 return DefDriverProc(dwDevID
, hDriv
, wMsg
, dwParam1
, dwParam2
);
675 return MCIERR_HARDWARE
;
680 /*-----------------------------------------------------------------------*/
682 #endif /* #ifdef BUILTIN_MMSYSTEM */