cc6abdcabb340b29e75004c8069de0d02588a834
[reactos.git] / dll / win32 / mciavi32 / info.c
1 /*
2 * Digital video MCI Wine Driver
3 *
4 * Copyright 1999, 2000 Eric POUECH
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 */
20
21 #include "private_mciavi.h"
22
23 /**************************************************************************
24 * MCIAVI_ConvertFrameToTimeFormat [internal]
25 */
26 static DWORD MCIAVI_ConvertFrameToTimeFormat(WINE_MCIAVI* wma, DWORD val, LPDWORD lpRet)
27 {
28 DWORD ret = 0;
29
30 switch (wma->dwMciTimeFormat) {
31 case MCI_FORMAT_MILLISECONDS:
32 ret = (val * wma->mah.dwMicroSecPerFrame) / 1000;
33 break;
34 case MCI_FORMAT_FRAMES:
35 ret = val;
36 break;
37 default:
38 WARN("Bad time format %u!\n", wma->dwMciTimeFormat);
39 }
40 TRACE("val=%u=0x%08x [tf=%u] => ret=%u\n", val, val, wma->dwMciTimeFormat, ret);
41 *lpRet = 0;
42 return ret;
43 }
44
45 /**************************************************************************
46 * MCIAVI_ConvertTimeFormatToFrame [internal]
47 */
48 DWORD MCIAVI_ConvertTimeFormatToFrame(WINE_MCIAVI* wma, DWORD val)
49 {
50 DWORD ret = 0;
51
52 switch (wma->dwMciTimeFormat) {
53 case MCI_FORMAT_MILLISECONDS:
54 ret = (val * 1000) / wma->mah.dwMicroSecPerFrame;
55 break;
56 case MCI_FORMAT_FRAMES:
57 ret = val;
58 break;
59 default:
60 WARN("Bad time format %u!\n", wma->dwMciTimeFormat);
61 }
62 TRACE("val=%u=0x%08x [tf=%u] => ret=%u\n", val, val, wma->dwMciTimeFormat, ret);
63 return ret;
64 }
65
66 /***************************************************************************
67 * MCIAVI_mciGetDevCaps [internal]
68 */
69 DWORD MCIAVI_mciGetDevCaps(UINT wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS lpParms)
70 {
71 WINE_MCIAVI* wma = MCIAVI_mciGetOpenDev(wDevID);
72 DWORD ret = MCIERR_UNSUPPORTED_FUNCTION;
73
74 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
75
76 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
77 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
78 if (!(dwFlags & MCI_GETDEVCAPS_ITEM)) return MCIERR_MISSING_PARAMETER;
79 if (dwFlags & MCI_TEST) return 0;
80
81 EnterCriticalSection(&wma->cs);
82
83 if (dwFlags & MCI_GETDEVCAPS_ITEM) {
84 switch (lpParms->dwItem) {
85 case MCI_GETDEVCAPS_DEVICE_TYPE:
86 TRACE("MCI_GETDEVCAPS_DEVICE_TYPE !\n");
87 lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_DIGITAL_VIDEO, MCI_DEVTYPE_DIGITAL_VIDEO);
88 ret = MCI_RESOURCE_RETURNED;
89 break;
90 case MCI_GETDEVCAPS_HAS_AUDIO:
91 TRACE("MCI_GETDEVCAPS_HAS_AUDIO !\n");
92 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
93 ret = MCI_RESOURCE_RETURNED;
94 break;
95 case MCI_GETDEVCAPS_HAS_VIDEO:
96 TRACE("MCI_GETDEVCAPS_HAS_VIDEO !\n");
97 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
98 ret = MCI_RESOURCE_RETURNED;
99 break;
100 case MCI_GETDEVCAPS_USES_FILES:
101 TRACE("MCI_GETDEVCAPS_USES_FILES !\n");
102 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
103 ret = MCI_RESOURCE_RETURNED;
104 break;
105 case MCI_GETDEVCAPS_COMPOUND_DEVICE:
106 TRACE("MCI_GETDEVCAPS_COMPOUND_DEVICE !\n");
107 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
108 ret = MCI_RESOURCE_RETURNED;
109 break;
110 case MCI_GETDEVCAPS_CAN_EJECT:
111 TRACE("MCI_GETDEVCAPS_CAN_EJECT !\n");
112 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
113 ret = MCI_RESOURCE_RETURNED;
114 break;
115 case MCI_GETDEVCAPS_CAN_PLAY:
116 TRACE("MCI_GETDEVCAPS_CAN_PLAY !\n");
117 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
118 ret = MCI_RESOURCE_RETURNED;
119 break;
120 case MCI_GETDEVCAPS_CAN_RECORD:
121 TRACE("MCI_GETDEVCAPS_CAN_RECORD !\n");
122 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
123 ret = MCI_RESOURCE_RETURNED;
124 break;
125 case MCI_GETDEVCAPS_CAN_SAVE:
126 TRACE("MCI_GETDEVCAPS_CAN_SAVE !\n");
127 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
128 ret = MCI_RESOURCE_RETURNED;
129 break;
130 case MCI_DGV_GETDEVCAPS_CAN_REVERSE:
131 TRACE("MCI_DGV_GETDEVCAPS_CAN_REVERSE !\n");
132 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE); /* FIXME */
133 ret = MCI_RESOURCE_RETURNED;
134 break;
135 case MCI_DGV_GETDEVCAPS_CAN_STRETCH:
136 TRACE("MCI_DGV_GETDEVCAPS_CAN_STRETCH !\n");
137 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE); /* FIXME */
138 ret = MCI_RESOURCE_RETURNED;
139 break;
140 case MCI_DGV_GETDEVCAPS_CAN_LOCK:
141 TRACE("MCI_DGV_GETDEVCAPS_CAN_LOCK !\n");
142 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
143 ret = MCI_RESOURCE_RETURNED;
144 break;
145 case MCI_DGV_GETDEVCAPS_CAN_FREEZE:
146 TRACE("MCI_DGV_GETDEVCAPS_CAN_FREEZE !\n");
147 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
148 ret = MCI_RESOURCE_RETURNED;
149 break;
150 case MCI_DGV_GETDEVCAPS_CAN_STR_IN:
151 TRACE("MCI_DGV_GETDEVCAPS_CAN_STRETCH_INPUT !\n");
152 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
153 ret = MCI_RESOURCE_RETURNED;
154 break;
155 case MCI_DGV_GETDEVCAPS_HAS_STILL:
156 TRACE("MCI_DGV_GETDEVCAPS_HAS_STILL !\n");
157 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
158 ret = MCI_RESOURCE_RETURNED;
159 break;
160 case MCI_DGV_GETDEVCAPS_CAN_TEST:
161 TRACE("MCI_DGV_GETDEVCAPS_CAN_TEST !\n");
162 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
163 ret = MCI_RESOURCE_RETURNED;
164 break;
165 case MCI_DGV_GETDEVCAPS_PALETTES:
166 TRACE("MCI_DGV_GETDEVCAPS_PALETTES !\n");
167 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE); /* FIXME */
168 ret = MCI_RESOURCE_RETURNED;
169 break;
170 /* w2k does not know MAX_WINDOWS or MAX/MINIMUM_RATE */
171 default:
172 FIXME("Unknown capability (%08x) !\n", lpParms->dwItem);
173 break;
174 }
175 }
176
177 LeaveCriticalSection(&wma->cs);
178 return ret;
179 }
180
181 /***************************************************************************
182 * MCIAVI_mciInfo [internal]
183 */
184 DWORD MCIAVI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSW lpParms)
185 {
186 LPCWSTR str = 0;
187 WINE_MCIAVI* wma = MCIAVI_mciGetOpenDev(wDevID);
188 DWORD ret = 0;
189 static const WCHAR wszAviPlayer[] = {'W','i','n','e','\'','s',' ','A','V','I',' ','p','l','a','y','e','r',0};
190 static const WCHAR wszVersion[] = {'1','.','1',0};
191
192 if (lpParms == NULL || lpParms->lpstrReturn == NULL)
193 return MCIERR_NULL_PARAMETER_BLOCK;
194 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
195 if (dwFlags & MCI_TEST) return 0;
196
197 TRACE("buf=%p, len=%u\n", lpParms->lpstrReturn, lpParms->dwRetSize);
198
199 EnterCriticalSection(&wma->cs);
200
201 if (dwFlags & MCI_INFO_PRODUCT)
202 str = wszAviPlayer;
203 else if (dwFlags & MCI_INFO_VERSION)
204 str = wszVersion;
205 else if (dwFlags & MCI_INFO_FILE)
206 str = wma->lpFileName;
207 else {
208 WARN("Don't know this info command (%u)\n", dwFlags);
209 ret = MCIERR_UNRECOGNIZED_COMMAND;
210 }
211 if (!ret) {
212 WCHAR zero = 0;
213 /* Only mciwave, mciseq and mcicda set dwRetSize (since NT). */
214 lstrcpynW(lpParms->lpstrReturn, str ? str : &zero, lpParms->dwRetSize);
215 }
216 LeaveCriticalSection(&wma->cs);
217 return ret;
218 }
219
220 /***************************************************************************
221 * MCIAVI_mciSet [internal]
222 */
223 DWORD MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
224 {
225 WINE_MCIAVI* wma = MCIAVI_mciGetOpenDev(wDevID);
226
227 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
228 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
229 if (dwFlags & MCI_TEST) return 0;
230
231 EnterCriticalSection(&wma->cs);
232
233 if (dwFlags & MCI_SET_TIME_FORMAT) {
234 switch (lpParms->dwTimeFormat) {
235 case MCI_FORMAT_MILLISECONDS:
236 TRACE("MCI_FORMAT_MILLISECONDS !\n");
237 wma->dwMciTimeFormat = MCI_FORMAT_MILLISECONDS;
238 break;
239 case MCI_FORMAT_FRAMES:
240 TRACE("MCI_FORMAT_FRAMES !\n");
241 wma->dwMciTimeFormat = MCI_FORMAT_FRAMES;
242 break;
243 default:
244 WARN("Bad time format %u!\n", lpParms->dwTimeFormat);
245 LeaveCriticalSection(&wma->cs);
246 return MCIERR_BAD_TIME_FORMAT;
247 }
248 }
249
250 if (dwFlags & MCI_SET_DOOR_OPEN) {
251 TRACE("No support for door open !\n");
252 LeaveCriticalSection(&wma->cs);
253 return MCIERR_UNSUPPORTED_FUNCTION;
254 }
255 if (dwFlags & MCI_SET_DOOR_CLOSED) {
256 TRACE("No support for door close !\n");
257 LeaveCriticalSection(&wma->cs);
258 return MCIERR_UNSUPPORTED_FUNCTION;
259 }
260
261 if (dwFlags & MCI_SET_ON) {
262 const char *szVideo="";
263 const char *szAudio="";
264 const char *szSeek="";
265
266 if (dwFlags & MCI_SET_VIDEO) {
267 szVideo = " video";
268 wma->dwSet |= 4;
269 }
270 if (dwFlags & MCI_SET_AUDIO) {
271 switch (lpParms->dwAudio) {
272 case MCI_SET_AUDIO_ALL:
273 szAudio = " audio all";
274 wma->dwSet |= 3;
275 break;
276 case MCI_SET_AUDIO_LEFT:
277 szAudio = " audio left";
278 wma->dwSet |= 1;
279 break;
280 case MCI_SET_AUDIO_RIGHT:
281 szAudio = " audio right";
282 wma->dwSet |= 2;
283 break;
284 default:
285 szAudio = " audio unknown";
286 WARN("Unknown audio channel %u\n", lpParms->dwAudio);
287 break;
288 }
289 }
290 if (dwFlags & MCI_DGV_SET_SEEK_EXACTLY) {
291 szSeek = " seek_exactly";
292 }
293 FIXME("MCI_SET_ON:%s%s%s\n", szVideo, szAudio, szSeek);
294 }
295
296 if (dwFlags & MCI_SET_OFF) {
297 const char *szVideo="";
298 const char *szAudio="";
299 const char *szSeek="";
300
301 if (dwFlags & MCI_SET_VIDEO) {
302 szVideo = " video";
303 wma->dwSet &= ~4;
304 }
305 if (dwFlags & MCI_SET_AUDIO) {
306 switch (lpParms->dwAudio) {
307 case MCI_SET_AUDIO_ALL:
308 szAudio = " audio all";
309 wma->dwSet &= ~3;
310 break;
311 case MCI_SET_AUDIO_LEFT:
312 szAudio = " audio left";
313 wma->dwSet &= ~2;
314 break;
315 case MCI_SET_AUDIO_RIGHT:
316 szAudio = " audio right";
317 wma->dwSet &= ~2;
318 break;
319 default:
320 szAudio = " audio unknown";
321 WARN("Unknown audio channel %u\n", lpParms->dwAudio);
322 break;
323 }
324 }
325 if (dwFlags & MCI_DGV_SET_SEEK_EXACTLY) {
326 szSeek = " seek_exactly";
327 }
328 FIXME("MCI_SET_OFF:%s%s%s\n", szVideo, szAudio, szSeek);
329 }
330 if (dwFlags & MCI_DGV_SET_FILEFORMAT) {
331 LPCSTR str = "save";
332 if (dwFlags & MCI_DGV_SET_STILL)
333 str = "capture";
334
335 switch (lpParms->dwFileFormat) {
336 case MCI_DGV_FF_AVI: FIXME("Setting file format (%s) to 'AVI'\n", str); break;
337 case MCI_DGV_FF_AVSS: FIXME("Setting file format (%s) to 'AVSS'\n", str); break;
338 case MCI_DGV_FF_DIB: FIXME("Setting file format (%s) to 'DIB'\n", str); break;
339 case MCI_DGV_FF_JFIF: FIXME("Setting file format (%s) to 'JFIF'\n", str); break;
340 case MCI_DGV_FF_JPEG: FIXME("Setting file format (%s) to 'JPEG'\n", str); break;
341 case MCI_DGV_FF_MPEG: FIXME("Setting file format (%s) to 'MPEG'\n", str); break;
342 case MCI_DGV_FF_RDIB: FIXME("Setting file format (%s) to 'RLE DIB'\n", str); break;
343 case MCI_DGV_FF_RJPEG: FIXME("Setting file format (%s) to 'RJPEG'\n", str); break;
344 default: FIXME("Setting unknown file format (%s): %d\n", str, lpParms->dwFileFormat);
345 }
346 }
347
348 if (dwFlags & MCI_DGV_SET_SPEED) {
349 FIXME("Setting speed to %d\n", lpParms->dwSpeed);
350 }
351
352 LeaveCriticalSection(&wma->cs);
353 return 0;
354 }
355
356 /***************************************************************************
357 * MCIAVI_mciStatus [internal]
358 */
359 DWORD MCIAVI_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSW lpParms)
360 {
361 WINE_MCIAVI* wma = MCIAVI_mciGetOpenDev(wDevID);
362 DWORD ret = 0;
363
364 if (lpParms == NULL) return MCIERR_NULL_PARAMETER_BLOCK;
365 if (wma == NULL) return MCIERR_INVALID_DEVICE_ID;
366 if (!(dwFlags & MCI_STATUS_ITEM)) return MCIERR_MISSING_PARAMETER;
367 if (dwFlags & MCI_TEST) return 0;
368
369 EnterCriticalSection(&wma->cs);
370
371 if (dwFlags & MCI_STATUS_ITEM) {
372 switch (lpParms->dwItem) {
373 case MCI_STATUS_CURRENT_TRACK:
374 lpParms->dwReturn = 1;
375 TRACE("MCI_STATUS_CURRENT_TRACK => %lu\n", lpParms->dwReturn);
376 break;
377 case MCI_STATUS_LENGTH:
378 if (!wma->hFile) {
379 lpParms->dwReturn = 0;
380 LeaveCriticalSection(&wma->cs);
381 return MCIERR_UNSUPPORTED_FUNCTION;
382 }
383 /* only one track in file is currently handled, so don't take care of MCI_TRACK flag */
384 lpParms->dwReturn = MCIAVI_ConvertFrameToTimeFormat(wma, wma->mah.dwTotalFrames, &ret);
385 TRACE("MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn);
386 break;
387 case MCI_STATUS_MODE:
388 lpParms->dwReturn = MAKEMCIRESOURCE(wma->dwStatus, wma->dwStatus);
389 ret = MCI_RESOURCE_RETURNED;
390 TRACE("MCI_STATUS_MODE => 0x%04x\n", LOWORD(lpParms->dwReturn));
391 break;
392 case MCI_STATUS_MEDIA_PRESENT:
393 TRACE("MCI_STATUS_MEDIA_PRESENT => TRUE\n");
394 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
395 ret = MCI_RESOURCE_RETURNED;
396 break;
397 case MCI_STATUS_NUMBER_OF_TRACKS:
398 lpParms->dwReturn = 1;
399 TRACE("MCI_STATUS_NUMBER_OF_TRACKS => %lu\n", lpParms->dwReturn);
400 break;
401 case MCI_STATUS_POSITION:
402 if (!wma->hFile) {
403 lpParms->dwReturn = 0;
404 LeaveCriticalSection(&wma->cs);
405 return MCIERR_UNSUPPORTED_FUNCTION;
406 }
407 /* only one track in file is currently handled, so don't take care of MCI_TRACK flag */
408 lpParms->dwReturn = MCIAVI_ConvertFrameToTimeFormat(wma,
409 (dwFlags & MCI_STATUS_START) ? 0 : wma->dwCurrVideoFrame,
410 &ret);
411 TRACE("MCI_STATUS_POSITION %s => %lu\n",
412 (dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn);
413 break;
414 case MCI_STATUS_READY:
415 lpParms->dwReturn = (wma->dwStatus == MCI_MODE_NOT_READY) ?
416 MAKEMCIRESOURCE(FALSE, MCI_FALSE) : MAKEMCIRESOURCE(TRUE, MCI_TRUE);
417 ret = MCI_RESOURCE_RETURNED;
418 TRACE("MCI_STATUS_READY = %u\n", LOWORD(lpParms->dwReturn));
419 break;
420 case MCI_STATUS_TIME_FORMAT:
421 lpParms->dwReturn = MAKEMCIRESOURCE(wma->dwMciTimeFormat,
422 wma->dwMciTimeFormat + MCI_FORMAT_RETURN_BASE);
423 TRACE("MCI_STATUS_TIME_FORMAT => %u\n", LOWORD(lpParms->dwReturn));
424 ret = MCI_RESOURCE_RETURNED;
425 break;
426 case MCI_DGV_STATUS_AUDIO:
427 lpParms->dwReturn = (wma->dwSet & 3) ?
428 MAKEMCIRESOURCE(MCI_ON, MCI_ON_S) : MAKEMCIRESOURCE(MCI_OFF, MCI_OFF_S);
429 ret = MCI_RESOURCE_RETURNED|MCI_RESOURCE_DRIVER;
430 TRACE("MCI_STATUS_AUDIO = %u\n", LOWORD(lpParms->dwReturn));
431 break;
432 case MCI_DGV_STATUS_VIDEO:
433 lpParms->dwReturn = (wma->dwSet & 4) ?
434 MAKEMCIRESOURCE(MCI_ON, MCI_ON_S) : MAKEMCIRESOURCE(MCI_OFF, MCI_OFF_S);
435 ret = MCI_RESOURCE_RETURNED|MCI_RESOURCE_DRIVER;
436 TRACE("MCI_STATUS_VIDEO = %u\n", LOWORD(lpParms->dwReturn));
437 break;
438
439 #if 0
440 case MCI_AVI_STATUS_AUDIO_BREAKS:
441 case MCI_AVI_STATUS_FRAMES_SKIPPED:
442 case MCI_AVI_STATUS_LAST_PLAY_SPEED:
443 case MCI_DGV_STATUS_AUDIO_INPUT:
444 case MCI_DGV_STATUS_AUDIO_RECORD:
445 case MCI_DGV_STATUS_AUDIO_SOURCE:
446 case MCI_DGV_STATUS_AVGBYTESPERSEC:
447 case MCI_DGV_STATUS_BASS:
448 case MCI_DGV_STATUS_BITSPERSAMPLE:
449 case MCI_DGV_STATUS_BLOCKALIGN:
450 case MCI_DGV_STATUS_BRIGHTNESS:
451 case MCI_DGV_STATUS_COLOR:
452 case MCI_DGV_STATUS_CONTRAST:
453 case MCI_DGV_STATUS_FILEFORMAT:
454 case MCI_DGV_STATUS_FILE_MODE:
455 case MCI_DGV_STATUS_FILE_COMPLETION:
456 case MCI_DGV_STATUS_GAMMA:
457 #endif
458 case MCI_DGV_STATUS_BITSPERPEL:
459 lpParms->dwReturn = wma->inbih->biBitCount;
460 TRACE("MCI_DGV_STATUS_BITSPERPEL => %lu\n", lpParms->dwReturn);
461 break;
462 case MCI_DGV_STATUS_HPAL:
463 lpParms->dwReturn = 0;
464 TRACE("MCI_DGV_STATUS_HPAL => %lx\n", lpParms->dwReturn);
465 break;
466 case MCI_DGV_STATUS_HWND:
467 lpParms->dwReturn = (DWORD_PTR)wma->hWndPaint;
468 TRACE("MCI_DGV_STATUS_HWND => %p\n", wma->hWndPaint);
469 break;
470 case MCI_DGV_STATUS_WINDOW_VISIBLE:
471 lpParms->dwReturn = IsWindowVisible(wma->hWndPaint) ?
472 MAKEMCIRESOURCE(TRUE, MCI_TRUE) : MAKEMCIRESOURCE(FALSE, MCI_FALSE);
473 ret = MCI_RESOURCE_RETURNED;
474 TRACE("MCI_STATUS_WINDOW_VISIBLE = %u\n", LOWORD(lpParms->dwReturn));
475 break;
476 case MCI_DGV_STATUS_WINDOW_MINIMIZED:
477 lpParms->dwReturn = IsIconic(wma->hWndPaint) ?
478 MAKEMCIRESOURCE(TRUE, MCI_TRUE) : MAKEMCIRESOURCE(FALSE, MCI_FALSE);
479 ret = MCI_RESOURCE_RETURNED;
480 TRACE("MCI_STATUS_WINDOW_MINIMIZED = %u\n", LOWORD(lpParms->dwReturn));
481 break;
482 case MCI_DGV_STATUS_WINDOW_MAXIMIZED:
483 lpParms->dwReturn = IsZoomed(wma->hWndPaint) ?
484 MAKEMCIRESOURCE(TRUE, MCI_TRUE) : MAKEMCIRESOURCE(FALSE, MCI_FALSE);
485 ret = MCI_RESOURCE_RETURNED;
486 TRACE("MCI_STATUS_WINDOW_MMAXIMIZED = %u\n", LOWORD(lpParms->dwReturn));
487 break;
488 case MCI_DGV_STATUS_SPEED:
489 lpParms->dwReturn = 1000;
490 TRACE("MCI_DGV_STATUS_SPEED = %lu\n", lpParms->dwReturn);
491 break;
492 case MCI_DGV_STATUS_FRAME_RATE:
493 /* FIXME: 1000 is a settable speed multiplier */
494 lpParms->dwReturn = MulDiv(1000000,1000,wma->mah.dwMicroSecPerFrame);
495 TRACE("MCI_DGV_STATUS_FRAME_RATE = %lu\n", lpParms->dwReturn);
496 break;
497 case MCI_DGV_STATUS_FORWARD:
498 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
499 ret = MCI_RESOURCE_RETURNED;
500 TRACE("MCI_DGV_STATUS_FORWARD = %u\n", LOWORD(lpParms->dwReturn));
501 break;
502 case MCI_DGV_STATUS_PAUSE_MODE:
503 if (wma->dwStatus != MCI_MODE_PAUSE) {
504 LeaveCriticalSection(&wma->cs);
505 return MCIERR_NONAPPLICABLE_FUNCTION;
506 }
507 lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_PLAY, MCI_MODE_PLAY);
508 ret = MCI_RESOURCE_RETURNED;
509 TRACE("MCI_STATUS_MODE => 0x%04x\n", LOWORD(lpParms->dwReturn));
510 break;
511 case MCI_DGV_STATUS_AUDIO_STREAM:
512 lpParms->dwReturn = wma->audio_stream_n;
513 TRACE("MCI_DGV_STATUS_AUDIO_STREAM => %lu\n", lpParms->dwReturn);
514 break;
515 #if 0
516 case MCI_DGV_STATUS_KEY_COLOR:
517 case MCI_DGV_STATUS_KEY_INDEX:
518 case MCI_DGV_STATUS_MONITOR:
519 case MCI_DGV_MONITOR_FILE:
520 case MCI_DGV_MONITOR_INPUT:
521 case MCI_DGV_STATUS_MONITOR_METHOD:
522 case MCI_DGV_STATUS_SAMPLESPERSECOND:
523 case MCI_DGV_STATUS_SEEK_EXACTLY:
524 case MCI_DGV_STATUS_SHARPNESS:
525 case MCI_DGV_STATUS_SIZE:
526 case MCI_DGV_STATUS_SMPTE:
527 case MCI_DGV_STATUS_STILL_FILEFORMAT:
528 case MCI_DGV_STATUS_TINT:
529 case MCI_DGV_STATUS_TREBLE:
530 case MCI_DGV_STATUS_UNSAVED:
531 case MCI_DGV_STATUS_VIDEO_RECORD:
532 case MCI_DGV_STATUS_VIDEO_SOURCE:
533 case MCI_DGV_STATUS_VIDEO_SRC_NUM:
534 case MCI_DGV_STATUS_VIDEO_STREAM:
535 case MCI_DGV_STATUS_VOLUME:
536 #endif
537 default:
538 FIXME("Unknown command %08X !\n", lpParms->dwItem);
539 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
540 LeaveCriticalSection(&wma->cs);
541 return MCIERR_UNSUPPORTED_FUNCTION;
542 }
543 }
544
545 if (dwFlags & MCI_NOTIFY) {
546 TRACE("MCI_NOTIFY_SUCCESSFUL %08lX !\n", lpParms->dwCallback);
547 mciDriverNotify(HWND_32(LOWORD(lpParms->dwCallback)),
548 wDevID, MCI_NOTIFY_SUCCESSFUL);
549 }
550 LeaveCriticalSection(&wma->cs);
551 return ret;
552 }