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