Release 980628
[wine/gsoc-2012-control.git] / multimedia / mcianim.c
blobed74df64b2c1fd8ebf37b536e41ea0f82ff4aed4
1 /*
2 * Sample MCI ANIMATION Wine Driver for Linux
4 * Copyright 1994 Martin Ayotte
5 */
7 #include <stdlib.h>
8 #include <unistd.h>
9 #include <string.h>
10 #include <fcntl.h>
11 #include <sys/ioctl.h>
12 #include "windows.h"
13 #include "user.h"
14 #include "driver.h"
15 #include "mmsystem.h"
16 #include "debug.h"
18 #define MAX_ANIMDRV 2
20 #define ANIMFRAMES_PERSEC 30
21 #define ANIMFRAMES_PERMIN 1800
22 #define SECONDS_PERMIN 60
24 typedef struct {
25 int nUseCount; /* Incremented for each shared open */
26 BOOL16 fShareable; /* TRUE if first open was shareable */
27 WORD wNotifyDeviceID; /* MCI device ID with a pending notification */
28 HANDLE16 hCallback; /* Callback handle for pending notification */
29 MCI_OPEN_PARMS16 openParms;
30 DWORD dwTimeFormat;
31 int mode;
32 UINT16 nCurTrack;
33 DWORD dwCurFrame;
34 UINT16 nTracks;
35 DWORD dwTotalLen;
36 LPDWORD lpdwTrackLen;
37 LPDWORD lpdwTrackPos;
38 } LINUX_ANIM;
40 static LINUX_ANIM AnimDev[MAX_ANIMDRV];
43 /*-----------------------------------------------------------------------*/
45 /**************************************************************************
46 * ANIM_mciOpen [internal]
48 static DWORD ANIM_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_OPEN_PARMS16 lpParms)
50 LPSTR lpstrElementName;
51 char str[128];
53 TRACE(mcianim,"(%04X, %08lX, %p);\n",
54 wDevID, dwFlags, lpParms);
55 if (lpParms == NULL) return MCIERR_INTERNAL;
56 if (AnimDev[wDevID].nUseCount > 0) {
57 /* The driver already open on this channel */
58 /* If the driver was opened shareable before and this open specifies */
59 /* shareable then increment the use count */
60 if (AnimDev[wDevID].fShareable && (dwFlags & MCI_OPEN_SHAREABLE))
61 ++AnimDev[wDevID].nUseCount;
62 else
63 return MCIERR_MUST_USE_SHAREABLE;
65 else {
66 AnimDev[wDevID].nUseCount = 1;
67 AnimDev[wDevID].fShareable = dwFlags & MCI_OPEN_SHAREABLE;
69 TRACE(mcianim,"wDevID=%04X\n", wDevID);
70 lpParms->wDeviceID = wDevID;
71 TRACE(mcianim,"lpParms->wDevID=%04X\n", lpParms->wDeviceID);
72 if (dwFlags & MCI_OPEN_ELEMENT) {
73 lpstrElementName = (LPSTR)PTR_SEG_TO_LIN(lpParms->lpstrElementName);
74 TRACE(mcianim,"MCI_OPEN_ELEMENT '%s' !\n",
75 lpstrElementName);
76 if (strlen(lpstrElementName) > 0) {
77 strcpy(str, lpstrElementName);
78 CharUpper32A(str);
81 memcpy(&AnimDev[wDevID].openParms, lpParms, sizeof(MCI_OPEN_PARMS16));
82 AnimDev[wDevID].wNotifyDeviceID = lpParms->wDeviceID;
83 AnimDev[wDevID].mode = 0;
84 AnimDev[wDevID].dwTimeFormat = MCI_FORMAT_TMSF;
85 AnimDev[wDevID].nCurTrack = 0;
86 AnimDev[wDevID].nTracks = 0;
87 AnimDev[wDevID].dwTotalLen = 0;
88 AnimDev[wDevID].lpdwTrackLen = NULL;
89 AnimDev[wDevID].lpdwTrackPos = NULL;
91 Moved to mmsystem.c mciOpen routine
93 if (dwFlags & MCI_NOTIFY) {
94 TRACE(mcianim, "MCI_NOTIFY_SUCCESSFUL %08lX !\n",
95 lpParms->dwCallback);
96 mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback),
97 AnimDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
100 return 0;
103 /**************************************************************************
104 * ANIM_mciClose [internal]
106 static DWORD ANIM_mciClose(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpParms)
108 TRACE(mcianim,"(%u, %08lX, %p);\n",
109 wDevID, dwParam, lpParms);
110 if (AnimDev[wDevID].lpdwTrackLen != NULL) free(AnimDev[wDevID].lpdwTrackLen);
111 if (AnimDev[wDevID].lpdwTrackPos != NULL) free(AnimDev[wDevID].lpdwTrackPos);
112 return 0;
115 /**************************************************************************
116 * ANIM_mciGetDevCaps [internal]
118 static DWORD ANIM_mciGetDevCaps(UINT16 wDevID, DWORD dwFlags,
119 LPMCI_GETDEVCAPS_PARMS lpParms)
121 TRACE(mcianim,"(%u, %08lX, %p);\n",
122 wDevID, dwFlags, lpParms);
123 if (lpParms == NULL) return MCIERR_INTERNAL;
124 if (dwFlags & MCI_GETDEVCAPS_ITEM) {
125 TRACE(mcianim, "MCI_GETDEVCAPS_ITEM dwItem=%08lX;\n",
126 lpParms->dwItem);
127 switch(lpParms->dwItem) {
128 case MCI_GETDEVCAPS_CAN_RECORD:
129 lpParms->dwReturn = FALSE;
130 break;
131 case MCI_GETDEVCAPS_HAS_AUDIO:
132 lpParms->dwReturn = FALSE;
133 break;
134 case MCI_GETDEVCAPS_HAS_VIDEO:
135 lpParms->dwReturn = FALSE;
136 break;
137 case MCI_GETDEVCAPS_DEVICE_TYPE:
138 lpParms->dwReturn = MCI_DEVTYPE_ANIMATION;
139 break;
140 case MCI_GETDEVCAPS_USES_FILES:
141 lpParms->dwReturn = TRUE;
142 break;
143 case MCI_GETDEVCAPS_COMPOUND_DEVICE:
144 lpParms->dwReturn = FALSE;
145 break;
146 case MCI_GETDEVCAPS_CAN_EJECT:
147 lpParms->dwReturn = TRUE;
148 break;
149 case MCI_GETDEVCAPS_CAN_PLAY:
150 lpParms->dwReturn = FALSE;
151 break;
152 case MCI_GETDEVCAPS_CAN_SAVE:
153 lpParms->dwReturn = FALSE;
154 break;
155 default:
156 return MCIERR_UNRECOGNIZED_COMMAND;
159 TRACE(mcianim, "lpParms->dwReturn=%08lX;\n",
160 lpParms->dwReturn);
161 return 0;
165 /**************************************************************************
166 * ANIM_CalcTime [internal]
168 static DWORD ANIM_CalcTime(UINT16 wDevID, DWORD dwFormatType, DWORD dwFrame)
170 DWORD dwTime = 0;
171 UINT16 wTrack;
172 UINT16 wMinutes;
173 UINT16 wSeconds;
174 UINT16 wFrames;
175 TRACE(mcianim,"(%u, %08lX, %lu);\n",
176 wDevID, dwFormatType, dwFrame);
178 switch (dwFormatType) {
179 case MCI_FORMAT_MILLISECONDS:
180 dwTime = dwFrame / ANIMFRAMES_PERSEC * 1000;
181 TRACE(mcianim, "MILLISECONDS %lu\n", dwTime);
182 break;
183 case MCI_FORMAT_MSF:
184 wMinutes = dwFrame / ANIMFRAMES_PERMIN;
185 wSeconds = (dwFrame - ANIMFRAMES_PERMIN * wMinutes) / ANIMFRAMES_PERSEC;
186 wFrames = dwFrame - ANIMFRAMES_PERMIN * wMinutes -
187 ANIMFRAMES_PERSEC * wSeconds;
188 dwTime = MCI_MAKE_MSF(wMinutes, wSeconds, wFrames);
189 TRACE(mcianim,"MSF %02u:%02u:%02u -> dwTime=%lu\n",
190 wMinutes, wSeconds, wFrames, dwTime);
191 break;
192 default:
193 /* unknown format ! force TMSF ! ... */
194 dwFormatType = MCI_FORMAT_TMSF;
195 case MCI_FORMAT_TMSF:
196 for (wTrack = 0; wTrack < AnimDev[wDevID].nTracks; wTrack++) {
197 /* dwTime += AnimDev[wDevID].lpdwTrackLen[wTrack - 1];
198 TRACE(mcianim, "Adding trk#%u curpos=%u \n", dwTime);
199 if (dwTime >= dwFrame) break; */
200 if (AnimDev[wDevID].lpdwTrackPos[wTrack - 1] >= dwFrame) break;
202 wMinutes = dwFrame / ANIMFRAMES_PERMIN;
203 wSeconds = (dwFrame - ANIMFRAMES_PERMIN * wMinutes) / ANIMFRAMES_PERSEC;
204 wFrames = dwFrame - ANIMFRAMES_PERMIN * wMinutes -
205 ANIMFRAMES_PERSEC * wSeconds;
206 dwTime = MCI_MAKE_TMSF(wTrack, wMinutes, wSeconds, wFrames);
207 TRACE(mcianim, "%02u-%02u:%02u:%02u\n",
208 wTrack, wMinutes, wSeconds, wFrames);
209 break;
211 return dwTime;
215 /**************************************************************************
216 * ANIM_CalcFrame [internal]
218 static DWORD ANIM_CalcFrame(UINT16 wDevID, DWORD dwFormatType, DWORD dwTime)
220 DWORD dwFrame = 0;
221 UINT16 wTrack;
222 TRACE(mcianim,"(%u, %08lX, %lu);\n",
223 wDevID, dwFormatType, dwTime);
225 switch (dwFormatType) {
226 case MCI_FORMAT_MILLISECONDS:
227 dwFrame = dwTime * ANIMFRAMES_PERSEC / 1000;
228 TRACE(mcianim, "MILLISECONDS %lu\n", dwFrame);
229 break;
230 case MCI_FORMAT_MSF:
231 TRACE(mcianim, "MSF %02u:%02u:%02u\n",
232 MCI_MSF_MINUTE(dwTime), MCI_MSF_SECOND(dwTime),
233 MCI_MSF_FRAME(dwTime));
234 dwFrame += ANIMFRAMES_PERMIN * MCI_MSF_MINUTE(dwTime);
235 dwFrame += ANIMFRAMES_PERSEC * MCI_MSF_SECOND(dwTime);
236 dwFrame += MCI_MSF_FRAME(dwTime);
237 break;
238 default:
239 /* unknown format ! force TMSF ! ... */
240 dwFormatType = MCI_FORMAT_TMSF;
241 case MCI_FORMAT_TMSF:
242 wTrack = MCI_TMSF_TRACK(dwTime);
243 TRACE(mcianim, "TMSF %02u-%02u:%02u:%02u\n",
244 MCI_TMSF_TRACK(dwTime), MCI_TMSF_MINUTE(dwTime),
245 MCI_TMSF_SECOND(dwTime), MCI_TMSF_FRAME(dwTime));
246 TRACE(mcianim, "TMSF trackpos[%u]=%lu\n",
247 wTrack, AnimDev[wDevID].lpdwTrackPos[wTrack - 1]);
248 dwFrame = AnimDev[wDevID].lpdwTrackPos[wTrack - 1];
249 dwFrame += ANIMFRAMES_PERMIN * MCI_TMSF_MINUTE(dwTime);
250 dwFrame += ANIMFRAMES_PERSEC * MCI_TMSF_SECOND(dwTime);
251 dwFrame += MCI_TMSF_FRAME(dwTime);
252 break;
254 return dwFrame;
258 /**************************************************************************
259 * ANIM_mciInfo [internal]
261 static DWORD ANIM_mciInfo(UINT16 wDevID, DWORD dwFlags, LPMCI_INFO_PARMS16 lpParms)
263 TRACE(mcianim,"(%u, %08lX, %p);\n",
264 wDevID, dwFlags, lpParms);
265 if (lpParms == NULL) return MCIERR_INTERNAL;
266 lpParms->lpstrReturn = NULL;
267 switch(dwFlags) {
268 case MCI_INFO_PRODUCT:
269 lpParms->lpstrReturn = "Linux ANIMATION 0.5";
270 break;
271 case MCI_INFO_FILE:
272 lpParms->lpstrReturn =
273 (LPSTR)AnimDev[wDevID].openParms.lpstrElementName;
274 break;
275 case MCI_ANIM_INFO_TEXT:
276 lpParms->lpstrReturn = "Animation Window";
277 break;
278 default:
279 return MCIERR_UNRECOGNIZED_COMMAND;
281 if (lpParms->lpstrReturn != NULL)
282 lpParms->dwRetSize = strlen(lpParms->lpstrReturn);
283 else
284 lpParms->dwRetSize = 0;
285 return 0;
288 /**************************************************************************
289 * ANIM_mciStatus [internal]
291 static DWORD ANIM_mciStatus(UINT16 wDevID, DWORD dwFlags, LPMCI_STATUS_PARMS lpParms)
293 TRACE(mcianim,"(%u, %08lX, %p);\n",
294 wDevID, dwFlags, lpParms);
295 if (lpParms == NULL) return MCIERR_INTERNAL;
296 if (dwFlags & MCI_NOTIFY) {
297 TRACE(mcianim, "MCI_NOTIFY_SUCCESSFUL %08lX !\n",
298 lpParms->dwCallback);
299 mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback),
300 AnimDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
302 if (dwFlags & MCI_STATUS_ITEM) {
303 switch(lpParms->dwItem) {
304 case MCI_STATUS_CURRENT_TRACK:
305 lpParms->dwReturn = AnimDev[wDevID].nCurTrack;
306 TRACE(mcianim,"CURRENT_TRACK=%lu!\n", lpParms->dwReturn);
307 return 0;
308 case MCI_STATUS_LENGTH:
309 if (dwFlags & MCI_TRACK) {
310 TRACE(mcianim,"MCI_TRACK #%lu LENGTH=??? !\n",
311 lpParms->dwTrack);
312 if (lpParms->dwTrack > AnimDev[wDevID].nTracks)
313 return MCIERR_OUTOFRANGE;
314 lpParms->dwReturn = AnimDev[wDevID].lpdwTrackLen[lpParms->dwTrack];
316 else
317 lpParms->dwReturn = AnimDev[wDevID].dwTotalLen;
318 lpParms->dwReturn = ANIM_CalcTime(wDevID,
319 AnimDev[wDevID].dwTimeFormat, lpParms->dwReturn);
320 TRACE(mcianim,"LENGTH=%lu !\n", lpParms->dwReturn);
321 return 0;
322 case MCI_STATUS_MODE:
323 lpParms->dwReturn = AnimDev[wDevID].mode;
324 TRACE(mcianim,"MCI_STATUS_MODE=%08lX !\n",
325 lpParms->dwReturn);
326 return 0;
327 case MCI_STATUS_MEDIA_PRESENT:
328 lpParms->dwReturn = TRUE;
329 TRACE(mcianim,"MCI_STATUS_MEDIA_PRESENT !\n");
330 return 0;
331 case MCI_STATUS_NUMBER_OF_TRACKS:
332 lpParms->dwReturn = 1;
333 TRACE(mcianim,"MCI_STATUS_NUMBER_OF_TRACKS = %lu !\n",
334 lpParms->dwReturn);
335 if (lpParms->dwReturn == (WORD)-1) return MCIERR_INTERNAL;
336 return 0;
337 case MCI_STATUS_POSITION:
338 lpParms->dwReturn = AnimDev[wDevID].dwCurFrame;
339 if (dwFlags & MCI_STATUS_START) {
340 lpParms->dwReturn = 0;
341 TRACE(mcianim,"get MCI_STATUS_START !\n");
343 if (dwFlags & MCI_TRACK) {
344 if (lpParms->dwTrack > AnimDev[wDevID].nTracks)
345 return MCIERR_OUTOFRANGE;
346 lpParms->dwReturn = AnimDev[wDevID].lpdwTrackPos[lpParms->dwTrack - 1];
347 TRACE(mcianim,"get MCI_TRACK #%lu !\n", lpParms->dwTrack);
349 lpParms->dwReturn = ANIM_CalcTime(wDevID,
350 AnimDev[wDevID].dwTimeFormat, lpParms->dwReturn);
351 TRACE(mcianim,"MCI_STATUS_POSITION=%08lX !\n",
352 lpParms->dwReturn);
353 return 0;
354 case MCI_STATUS_READY:
355 TRACE(mcianim,"MCI_STATUS_READY !\n");
356 lpParms->dwReturn = TRUE;
357 return 0;
358 case MCI_STATUS_TIME_FORMAT:
359 TRACE(mcianim,"MCI_STATUS_TIME_FORMAT !\n");
360 lpParms->dwReturn = MCI_FORMAT_MILLISECONDS;
361 return 0;
362 default:
363 WARN(mcianim,"Unknown command %08lX !\n", lpParms->dwItem);
364 return MCIERR_UNRECOGNIZED_COMMAND;
367 WARN(mcianim,"Not MCI_STATUS_ITEM !\n");
368 return 0;
372 /**************************************************************************
373 * ANIM_mciPlay [internal]
375 static DWORD ANIM_mciPlay(UINT16 wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
377 int start, end;
378 TRACE(mcianim,"(%u, %08lX, %p);\n",
379 wDevID, dwFlags, lpParms);
380 if (lpParms == NULL) return MCIERR_INTERNAL;
381 start = 0; end = AnimDev[wDevID].dwTotalLen;
382 AnimDev[wDevID].nCurTrack = 1;
383 if (dwFlags & MCI_FROM) {
384 start = ANIM_CalcFrame(wDevID,
385 AnimDev[wDevID].dwTimeFormat, lpParms->dwFrom);
386 TRACE(mcianim,"MCI_FROM=%08lX -> %u \n",
387 lpParms->dwFrom, start);
389 if (dwFlags & MCI_TO) {
390 end = ANIM_CalcFrame(wDevID,
391 AnimDev[wDevID].dwTimeFormat, lpParms->dwTo);
392 TRACE(mcianim, "MCI_TO=%08lX -> %u \n",
393 lpParms->dwTo, end);
395 AnimDev[wDevID].mode = MCI_MODE_PLAY;
396 if (dwFlags & MCI_NOTIFY) {
397 TRACE(mcianim, "MCI_NOTIFY_SUCCESSFUL %08lX !\n",
398 lpParms->dwCallback);
399 mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback),
400 AnimDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
402 return 0;
405 /**************************************************************************
406 * ANIM_mciStop [internal]
408 static DWORD ANIM_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
410 TRACE(mcianim,"(%u, %08lX, %p);\n",
411 wDevID, dwFlags, lpParms);
412 if (lpParms == NULL) return MCIERR_INTERNAL;
413 AnimDev[wDevID].mode = MCI_MODE_STOP;
414 if (dwFlags & MCI_NOTIFY) {
415 TRACE(mcianim, "MCI_NOTIFY_SUCCESSFUL %08lX !\n",
416 lpParms->dwCallback);
417 mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback),
418 AnimDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
420 return 0;
423 /**************************************************************************
424 * ANIM_mciPause [internal]
426 static DWORD ANIM_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
428 TRACE(mcianim,"(%u, %08lX, %p);\n",
429 wDevID, dwFlags, lpParms);
430 if (lpParms == NULL) return MCIERR_INTERNAL;
431 AnimDev[wDevID].mode = MCI_MODE_PAUSE;
432 if (dwFlags & MCI_NOTIFY) {
433 TRACE(mcianim, "MCI_NOTIFY_SUCCESSFUL %08lX !\n",
434 lpParms->dwCallback);
435 mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback),
436 AnimDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
438 return 0;
441 /**************************************************************************
442 * ANIM_mciResume [internal]
444 static DWORD ANIM_mciResume(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
446 TRACE(mcianim,"(%u, %08lX, %p);\n",
447 wDevID, dwFlags, lpParms);
448 if (lpParms == NULL) return MCIERR_INTERNAL;
449 AnimDev[wDevID].mode = MCI_MODE_STOP;
450 if (dwFlags & MCI_NOTIFY) {
451 TRACE(mcianim, "MCI_NOTIFY_SUCCESSFUL %08lX !\n",
452 lpParms->dwCallback);
453 mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback),
454 AnimDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
456 return 0;
459 /**************************************************************************
460 * ANIM_mciSeek [internal]
462 static DWORD ANIM_mciSeek(UINT16 wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
464 DWORD dwRet;
465 MCI_PLAY_PARMS PlayParms;
466 TRACE(mcianim,"(%u, %08lX, %p);\n",
467 wDevID, dwFlags, lpParms);
468 if (lpParms == NULL) return MCIERR_INTERNAL;
469 AnimDev[wDevID].mode = MCI_MODE_SEEK;
470 switch(dwFlags) {
471 case MCI_SEEK_TO_START:
472 PlayParms.dwFrom = 0;
473 break;
474 case MCI_SEEK_TO_END:
475 PlayParms.dwFrom = AnimDev[wDevID].dwTotalLen;
476 break;
477 case MCI_TO:
478 PlayParms.dwFrom = lpParms->dwTo;
479 break;
481 dwRet = ANIM_mciPlay(wDevID, MCI_WAIT | MCI_FROM, &PlayParms);
482 if (dwRet != 0) return dwRet;
483 dwRet = ANIM_mciStop(wDevID, MCI_WAIT, (LPMCI_GENERIC_PARMS)&PlayParms);
484 if (dwFlags & MCI_NOTIFY) {
485 TRACE(mcianim, "MCI_NOTIFY_SUCCESSFUL %08lX !\n",
486 lpParms->dwCallback);
487 mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback),
488 AnimDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
490 return dwRet;
494 /**************************************************************************
495 * ANIM_mciSet [internal]
497 static DWORD ANIM_mciSet(UINT16 wDevID, DWORD dwFlags, LPMCI_SET_PARMS lpParms)
499 TRACE(mcianim,"(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
500 if (lpParms == NULL) return MCIERR_INTERNAL;
502 TRACE(mcianim,"(dwTimeFormat=%08lX)\n", lpParms->dwTimeFormat);
503 TRACE(mcianim,"(dwAudio=%08lX)\n", lpParms->dwAudio);
505 if (dwFlags & MCI_SET_TIME_FORMAT) {
506 switch (lpParms->dwTimeFormat) {
507 case MCI_FORMAT_MILLISECONDS:
508 TRACE(mcianim, "MCI_FORMAT_MILLISECONDS !\n");
509 break;
510 case MCI_FORMAT_MSF:
511 TRACE(mcianim,"MCI_FORMAT_MSF !\n");
512 break;
513 case MCI_FORMAT_TMSF:
514 TRACE(mcianim,"MCI_FORMAT_TMSF !\n");
515 break;
516 default:
517 WARN(mcianim,"Bad time format !\n");
518 return MCIERR_BAD_TIME_FORMAT;
520 AnimDev[wDevID].dwTimeFormat = lpParms->dwTimeFormat;
522 if (dwFlags & MCI_SET_VIDEO) return MCIERR_UNSUPPORTED_FUNCTION;
523 if (dwFlags & MCI_SET_ON) return MCIERR_UNSUPPORTED_FUNCTION;
524 if (dwFlags & MCI_SET_OFF) return MCIERR_UNSUPPORTED_FUNCTION;
525 if (dwFlags & MCI_NOTIFY) {
526 TRACE(mcianim, "MCI_NOTIFY_SUCCESSFUL %08lX !\n",
527 lpParms->dwCallback);
528 mciDriverNotify((HWND16)LOWORD(lpParms->dwCallback),
529 AnimDev[wDevID].wNotifyDeviceID, MCI_NOTIFY_SUCCESSFUL);
531 return 0;
535 /**************************************************************************
536 * ANIM_DriverProc [sample driver]
538 LONG ANIM_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
539 DWORD dwParam1, DWORD dwParam2)
541 switch(wMsg) {
542 case DRV_LOAD:
543 return 1;
544 case DRV_FREE:
545 return 1;
546 case DRV_OPEN:
547 case MCI_OPEN_DRIVER:
548 case MCI_OPEN:
549 return ANIM_mciOpen(dwDevID, dwParam1,
550 (LPMCI_OPEN_PARMS16)PTR_SEG_TO_LIN(dwParam2));
551 case DRV_CLOSE:
552 case MCI_CLOSE_DRIVER:
553 case MCI_CLOSE:
554 return ANIM_mciClose(dwDevID, dwParam1,
555 (LPMCI_GENERIC_PARMS)PTR_SEG_TO_LIN(dwParam2));
556 case DRV_ENABLE:
557 return 1;
558 case DRV_DISABLE:
559 return 1;
560 case DRV_QUERYCONFIGURE:
561 return 1;
562 case DRV_CONFIGURE:
563 MessageBox16(0, "Sample MultiMedia Linux Driver !",
564 "MMLinux Driver", MB_OK);
565 return 1;
566 case DRV_INSTALL:
567 return DRVCNF_RESTART;
568 case DRV_REMOVE:
569 return DRVCNF_RESTART;
570 case MCI_GETDEVCAPS:
571 return ANIM_mciGetDevCaps(dwDevID, dwParam1,
572 (LPMCI_GETDEVCAPS_PARMS)PTR_SEG_TO_LIN(dwParam2));
573 case MCI_INFO:
574 return ANIM_mciInfo(dwDevID, dwParam1,
575 (LPMCI_INFO_PARMS16)PTR_SEG_TO_LIN(dwParam2));
576 case MCI_STATUS:
577 return ANIM_mciStatus(dwDevID, dwParam1,
578 (LPMCI_STATUS_PARMS)PTR_SEG_TO_LIN(dwParam2));
579 case MCI_SET:
580 return ANIM_mciSet(dwDevID, dwParam1,
581 (LPMCI_SET_PARMS)PTR_SEG_TO_LIN(dwParam2));
582 case MCI_PLAY:
583 return ANIM_mciPlay(dwDevID, dwParam1,
584 (LPMCI_PLAY_PARMS)PTR_SEG_TO_LIN(dwParam2));
585 case MCI_STOP:
586 return ANIM_mciStop(dwDevID, dwParam1,
587 (LPMCI_GENERIC_PARMS)PTR_SEG_TO_LIN(dwParam2));
588 case MCI_PAUSE:
589 return ANIM_mciPause(dwDevID, dwParam1,
590 (LPMCI_GENERIC_PARMS)PTR_SEG_TO_LIN(dwParam2));
591 case MCI_RESUME:
592 return ANIM_mciResume(dwDevID, dwParam1,
593 (LPMCI_GENERIC_PARMS)PTR_SEG_TO_LIN(dwParam2));
594 case MCI_SEEK:
595 return ANIM_mciSeek(dwDevID, dwParam1,
596 (LPMCI_SEEK_PARMS)PTR_SEG_TO_LIN(dwParam2));
597 default:
598 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
603 /*-----------------------------------------------------------------------*/