info.c 18.6 KB
Newer Older
1 2 3 4
/*
 * Digital video MCI Wine Driver
 *
 * Copyright 1999, 2000 Eric POUECH
5 6 7 8 9 10 11 12 13 14 15 16 17
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * 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 22
 */

#include <string.h>
#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 36 37 38 39 40 41 42
    switch (wma->dwMciTimeFormat) {
    case MCI_FORMAT_MILLISECONDS:
        ret = (val * wma->mah.dwMicroSecPerFrame) / 1000;
	break;
    case MCI_FORMAT_FRAMES:
	ret = val;
	break;
    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 47 48 49 50
    *lpRet = 0;
    return ret;
}

/**************************************************************************
51
 * 				MCIAVI_ConvertTimeFormatToFrame	[internal]
52 53 54 55
 */
DWORD 	MCIAVI_ConvertTimeFormatToFrame(WINE_MCIAVI* wma, DWORD val)
{
    DWORD	ret = 0;
56

57 58 59 60 61 62 63 64
    switch (wma->dwMciTimeFormat) {
    case MCI_FORMAT_MILLISECONDS:
	ret = (val * 1000) / wma->mah.dwMicroSecPerFrame;
	break;
    case MCI_FORMAT_FRAMES:
	ret = val;
	break;
    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 69 70 71 72 73 74 75 76
    return ret;
}

/***************************************************************************
 * 				MCIAVI_mciGetDevCaps		[internal]
 */
DWORD	MCIAVI_mciGetDevCaps(UINT wDevID, DWORD dwFlags,  LPMCI_GETDEVCAPS_PARMS lpParms)
{
    WINE_MCIAVI*	wma = MCIAVI_mciGetOpenDev(wDevID);
77
    DWORD		ret = MCIERR_UNSUPPORTED_FUNCTION;
78

79
    TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
80

81 82
    if (lpParms == NULL) 	return MCIERR_NULL_PARAMETER_BLOCK;
    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 87
    EnterCriticalSection(&wma->cs);

88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134
    if (dwFlags & MCI_GETDEVCAPS_ITEM) {
	switch (lpParms->dwItem) {
	case MCI_GETDEVCAPS_DEVICE_TYPE:
	    TRACE("MCI_GETDEVCAPS_DEVICE_TYPE !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_DIGITAL_VIDEO, MCI_DEVTYPE_DIGITAL_VIDEO);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_GETDEVCAPS_HAS_AUDIO:
	    TRACE("MCI_GETDEVCAPS_HAS_AUDIO !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_GETDEVCAPS_HAS_VIDEO:
	    TRACE("MCI_GETDEVCAPS_HAS_VIDEO !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_GETDEVCAPS_USES_FILES:
	    TRACE("MCI_GETDEVCAPS_USES_FILES !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_GETDEVCAPS_COMPOUND_DEVICE:
	    TRACE("MCI_GETDEVCAPS_COMPOUND_DEVICE !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_GETDEVCAPS_CAN_EJECT:
	    TRACE("MCI_GETDEVCAPS_CAN_EJECT !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_GETDEVCAPS_CAN_PLAY:
	    TRACE("MCI_GETDEVCAPS_CAN_PLAY !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_GETDEVCAPS_CAN_RECORD:
	    TRACE("MCI_GETDEVCAPS_CAN_RECORD !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_GETDEVCAPS_CAN_SAVE:
	    TRACE("MCI_GETDEVCAPS_CAN_SAVE !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166
	case MCI_DGV_GETDEVCAPS_CAN_REVERSE:
	    TRACE("MCI_DGV_GETDEVCAPS_CAN_REVERSE !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE); /* FIXME */
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_DGV_GETDEVCAPS_CAN_STRETCH:
	    TRACE("MCI_DGV_GETDEVCAPS_CAN_STRETCH !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE); /* FIXME */
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_DGV_GETDEVCAPS_CAN_LOCK:
	    TRACE("MCI_DGV_GETDEVCAPS_CAN_LOCK !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_DGV_GETDEVCAPS_CAN_FREEZE:
	    TRACE("MCI_DGV_GETDEVCAPS_CAN_FREEZE !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_DGV_GETDEVCAPS_CAN_STR_IN:
	    TRACE("MCI_DGV_GETDEVCAPS_CAN_STRETCH_INPUT !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_DGV_GETDEVCAPS_HAS_STILL:
	    TRACE("MCI_DGV_GETDEVCAPS_HAS_STILL !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_DGV_GETDEVCAPS_CAN_TEST:
	    TRACE("MCI_DGV_GETDEVCAPS_CAN_TEST !\n");
167
	    lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
168 169 170 171 172 173 174 175
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_DGV_GETDEVCAPS_PALETTES:
	    TRACE("MCI_DGV_GETDEVCAPS_PALETTES !\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE); /* FIXME */
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	/* 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 184 185 186 187 188
    return ret;
}

/***************************************************************************
 * 				MCIAVI_mciInfo			[internal]
 */
189
DWORD	MCIAVI_mciInfo(UINT wDevID, DWORD dwFlags, LPMCI_DGV_INFO_PARMSW lpParms)
190
{
191
    LPCWSTR		str = 0;
192 193
    WINE_MCIAVI*	wma = MCIAVI_mciGetOpenDev(wDevID);
    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 198 199
    if (lpParms == NULL || lpParms->lpstrReturn == NULL)
	return MCIERR_NULL_PARAMETER_BLOCK;
    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 205
    EnterCriticalSection(&wma->cs);

206 207
    if (dwFlags & MCI_INFO_PRODUCT)
	str = wszAviPlayer;
208 209
    else if (dwFlags & MCI_INFO_VERSION)
	str = wszVersion;
210 211 212
    else if (dwFlags & MCI_INFO_FILE)
	str = wma->lpFileName;
    else {
213
	WARN("Don't know this info command (%u)\n", dwFlags);
214
	ret = MCIERR_UNRECOGNIZED_COMMAND;
215
    }
216 217 218 219
    if (!ret) {
	WCHAR zero = 0;
	/* Only mciwave, mciseq and mcicda set dwRetSize (since NT). */
	lstrcpynW(lpParms->lpstrReturn, str ? str : &zero, lpParms->dwRetSize);
220
    }
221
    LeaveCriticalSection(&wma->cs);
222 223 224 225 226 227 228 229 230
    return ret;
}

/***************************************************************************
 * 				MCIAVI_mciSet			[internal]
 */
DWORD	MCIAVI_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
{
    WINE_MCIAVI*	wma = MCIAVI_mciGetOpenDev(wDevID);
231

232 233
    if (lpParms == NULL)	return MCIERR_NULL_PARAMETER_BLOCK;
    if (wma == NULL)		return MCIERR_INVALID_DEVICE_ID;
234
    if (dwFlags & MCI_TEST)	return 0;
235

236 237
    EnterCriticalSection(&wma->cs);

238 239 240 241 242 243 244 245 246 247 248
    if (dwFlags & MCI_SET_TIME_FORMAT) {
	switch (lpParms->dwTimeFormat) {
	case MCI_FORMAT_MILLISECONDS:
	    TRACE("MCI_FORMAT_MILLISECONDS !\n");
	    wma->dwMciTimeFormat = MCI_FORMAT_MILLISECONDS;
	    break;
	case MCI_FORMAT_FRAMES:
	    TRACE("MCI_FORMAT_FRAMES !\n");
	    wma->dwMciTimeFormat = MCI_FORMAT_FRAMES;
	    break;
	default:
249
            WARN("Bad time format %u!\n", lpParms->dwTimeFormat);
250
            LeaveCriticalSection(&wma->cs);
251 252 253
	    return MCIERR_BAD_TIME_FORMAT;
	}
    }
254

255 256
    if (dwFlags & MCI_SET_DOOR_OPEN) {
	TRACE("No support for door open !\n");
257
        LeaveCriticalSection(&wma->cs);
258 259 260 261
	return MCIERR_UNSUPPORTED_FUNCTION;
    }
    if (dwFlags & MCI_SET_DOOR_CLOSED) {
	TRACE("No support for door close !\n");
262
        LeaveCriticalSection(&wma->cs);
263 264
	return MCIERR_UNSUPPORTED_FUNCTION;
    }
265

266
    if (dwFlags & MCI_SET_ON) {
267 268 269
	const char *szVideo="";
	const char *szAudio="";
	const char *szSeek="";
270

271
	if (dwFlags & MCI_SET_VIDEO) {
272
	    szVideo = " video";
273 274 275 276 277
	    wma->dwSet |= 4;
	}
	if (dwFlags & MCI_SET_AUDIO) {
	    switch (lpParms->dwAudio) {
	    case MCI_SET_AUDIO_ALL:
278
		szAudio = " audio all";
279 280 281
		wma->dwSet |= 3;
		break;
	    case MCI_SET_AUDIO_LEFT:
282
		szAudio = " audio left";
283 284 285
		wma->dwSet |= 1;
		break;
	    case MCI_SET_AUDIO_RIGHT:
286
		szAudio = " audio right";
287 288 289
		wma->dwSet |= 2;
		break;
	    default:
290
		szAudio = " audio unknown";
291
		WARN("Unknown audio channel %u\n", lpParms->dwAudio);
292 293 294 295
		break;
	    }
	}
	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 303 304
	const char *szVideo="";
	const char *szAudio="";
	const char *szSeek="";
305

306
	if (dwFlags & MCI_SET_VIDEO) {
307
	    szVideo = " video";
308 309 310 311 312
	    wma->dwSet &= ~4;
	}
	if (dwFlags & MCI_SET_AUDIO) {
	    switch (lpParms->dwAudio) {
	    case MCI_SET_AUDIO_ALL:
313
		szAudio = " audio all";
314 315 316
		wma->dwSet &= ~3;
		break;
	    case MCI_SET_AUDIO_LEFT:
317
		szAudio = " audio left";
318 319 320
		wma->dwSet &= ~2;
		break;
	    case MCI_SET_AUDIO_RIGHT:
321
		szAudio = " audio right";
322 323 324
		wma->dwSet &= ~2;
		break;
	    default:
325
		szAudio = " audio unknown";
326
		WARN("Unknown audio channel %u\n", lpParms->dwAudio);
327 328 329 330
		break;
	    }
	}
	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 341 342 343 344 345 346 347 348
	switch (lpParms->dwFileFormat) {
	case MCI_DGV_FF_AVI: 	FIXME("Setting file format (%s) to 'AVI'\n", str); 	break;
	case MCI_DGV_FF_AVSS: 	FIXME("Setting file format (%s) to 'AVSS'\n", str);	break;
	case MCI_DGV_FF_DIB: 	FIXME("Setting file format (%s) to 'DIB'\n", str);	break;
	case MCI_DGV_FF_JFIF: 	FIXME("Setting file format (%s) to 'JFIF'\n", str);	break;
	case MCI_DGV_FF_JPEG: 	FIXME("Setting file format (%s) to 'JPEG'\n", str);	break;
	case MCI_DGV_FF_MPEG: 	FIXME("Setting file format (%s) to 'MPEG'\n", str); 	break;
	case MCI_DGV_FF_RDIB:	FIXME("Setting file format (%s) to 'RLE DIB'\n", str);	break;
	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 359 360 361 362 363
    return 0;
}

/***************************************************************************
 * 				MCIAVI_mciStatus			[internal]
 */
364
DWORD	MCIAVI_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSW lpParms)
365 366 367
{
    WINE_MCIAVI*	wma = MCIAVI_mciGetOpenDev(wDevID);
    DWORD		ret = 0;
368

369 370
    if (lpParms == NULL)	return MCIERR_NULL_PARAMETER_BLOCK;
    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 375
    EnterCriticalSection(&wma->cs);

376 377 378 379 380 381 382 383 384
    if (dwFlags & MCI_STATUS_ITEM) {
	switch (lpParms->dwItem) {
	case MCI_STATUS_CURRENT_TRACK:
	    lpParms->dwReturn = 1;
	    TRACE("MCI_STATUS_CURRENT_TRACK => %lu\n", lpParms->dwReturn);
	    break;
	case MCI_STATUS_LENGTH:
	    if (!wma->hFile) {
		lpParms->dwReturn = 0;
385
                LeaveCriticalSection(&wma->cs);
386 387 388 389 390 391 392 393 394
		return MCIERR_UNSUPPORTED_FUNCTION;
	    }
	    /* only one track in file is currently handled, so don't take care of MCI_TRACK flag */
	    lpParms->dwReturn = MCIAVI_ConvertFrameToTimeFormat(wma, wma->mah.dwTotalFrames, &ret);
	    TRACE("MCI_STATUS_LENGTH => %lu\n", lpParms->dwReturn);
	    break;
	case MCI_STATUS_MODE:
 	    lpParms->dwReturn = MAKEMCIRESOURCE(wma->dwStatus, wma->dwStatus);
	    ret = MCI_RESOURCE_RETURNED;
395
           TRACE("MCI_STATUS_MODE => 0x%04x\n", LOWORD(lpParms->dwReturn));
396 397 398 399 400 401 402 403 404 405 406 407 408
	    break;
	case MCI_STATUS_MEDIA_PRESENT:
	    TRACE("MCI_STATUS_MEDIA_PRESENT => TRUE\n");
	    lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
	    ret = MCI_RESOURCE_RETURNED;
	    break;
	case MCI_STATUS_NUMBER_OF_TRACKS:
	    lpParms->dwReturn = 1;
	    TRACE("MCI_STATUS_NUMBER_OF_TRACKS => %lu\n", lpParms->dwReturn);
	    break;
	case MCI_STATUS_POSITION:
	    if (!wma->hFile) {
		lpParms->dwReturn = 0;
409
                LeaveCriticalSection(&wma->cs);
410 411 412
		return MCIERR_UNSUPPORTED_FUNCTION;
	    }
	    /* only one track in file is currently handled, so don't take care of MCI_TRACK flag */
413
	    lpParms->dwReturn = MCIAVI_ConvertFrameToTimeFormat(wma,
414 415
							     (dwFlags & MCI_STATUS_START) ? 0 : wma->dwCurrVideoFrame,
							     &ret);
416
	    TRACE("MCI_STATUS_POSITION %s => %lu\n",
417 418 419 420 421 422 423 424 425
		  (dwFlags & MCI_STATUS_START) ? "start" : "current", lpParms->dwReturn);
	    break;
	case MCI_STATUS_READY:
	    lpParms->dwReturn = (wma->dwStatus == MCI_MODE_NOT_READY) ?
		MAKEMCIRESOURCE(FALSE, MCI_FALSE) : MAKEMCIRESOURCE(TRUE, MCI_TRUE);
	    ret = MCI_RESOURCE_RETURNED;
	    TRACE("MCI_STATUS_READY = %u\n", LOWORD(lpParms->dwReturn));
	    break;
	case MCI_STATUS_TIME_FORMAT:
426 427
	    lpParms->dwReturn = MAKEMCIRESOURCE(wma->dwMciTimeFormat,
                                wma->dwMciTimeFormat + MCI_FORMAT_RETURN_BASE);
428 429 430
	    TRACE("MCI_STATUS_TIME_FORMAT => %u\n", LOWORD(lpParms->dwReturn));
	    ret = MCI_RESOURCE_RETURNED;
	    break;
431 432 433 434 435 436 437 438 439 440 441 442 443
	case MCI_DGV_STATUS_AUDIO:
	    lpParms->dwReturn = (wma->dwSet & 3) ?
		MAKEMCIRESOURCE(MCI_ON, MCI_ON_S) : MAKEMCIRESOURCE(MCI_OFF, MCI_OFF_S);
	    ret = MCI_RESOURCE_RETURNED|MCI_RESOURCE_DRIVER;
	    TRACE("MCI_STATUS_AUDIO = %u\n", LOWORD(lpParms->dwReturn));
	    break;
	case MCI_DGV_STATUS_VIDEO:
	    lpParms->dwReturn = (wma->dwSet & 4) ?
		MAKEMCIRESOURCE(MCI_ON, MCI_ON_S) : MAKEMCIRESOURCE(MCI_OFF, MCI_OFF_S);
	    ret = MCI_RESOURCE_RETURNED|MCI_RESOURCE_DRIVER;
	    TRACE("MCI_STATUS_VIDEO = %u\n", LOWORD(lpParms->dwReturn));
	    break;

444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462
#if 0
	case MCI_AVI_STATUS_AUDIO_BREAKS:
	case MCI_AVI_STATUS_FRAMES_SKIPPED:
	case MCI_AVI_STATUS_LAST_PLAY_SPEED:
	case MCI_DGV_STATUS_AUDIO_INPUT:
	case MCI_DGV_STATUS_AUDIO_RECORD:
	case MCI_DGV_STATUS_AUDIO_SOURCE:
	case MCI_DGV_STATUS_AVGBYTESPERSEC:
	case MCI_DGV_STATUS_BASS:
	case MCI_DGV_STATUS_BITSPERSAMPLE:
	case MCI_DGV_STATUS_BLOCKALIGN:
	case MCI_DGV_STATUS_BRIGHTNESS:
	case MCI_DGV_STATUS_COLOR:
	case MCI_DGV_STATUS_CONTRAST:
	case MCI_DGV_STATUS_FILEFORMAT:
	case MCI_DGV_STATUS_FILE_MODE:
	case MCI_DGV_STATUS_FILE_COMPLETION:
	case MCI_DGV_STATUS_GAMMA:
#endif
463 464 465 466
	case MCI_DGV_STATUS_BITSPERPEL:
	    lpParms->dwReturn = wma->inbih->biBitCount;
	    TRACE("MCI_DGV_STATUS_BITSPERPEL => %lu\n", lpParms->dwReturn);
	    break;
467 468 469 470 471
	case MCI_DGV_STATUS_HPAL:
	    lpParms->dwReturn = 0;
	    TRACE("MCI_DGV_STATUS_HPAL => %lx\n", lpParms->dwReturn);
	    break;
	case MCI_DGV_STATUS_HWND:
472
           lpParms->dwReturn = (DWORD_PTR)wma->hWndPaint;
473
           TRACE("MCI_DGV_STATUS_HWND => %p\n", wma->hWndPaint);
474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514
	   break;
	case MCI_DGV_STATUS_WINDOW_VISIBLE:
	    lpParms->dwReturn = IsWindowVisible(wma->hWndPaint) ?
		MAKEMCIRESOURCE(TRUE, MCI_TRUE) : MAKEMCIRESOURCE(FALSE, MCI_FALSE);
	    ret = MCI_RESOURCE_RETURNED;
	    TRACE("MCI_STATUS_WINDOW_VISIBLE = %u\n", LOWORD(lpParms->dwReturn));
	    break;
	case MCI_DGV_STATUS_WINDOW_MINIMIZED:
	    lpParms->dwReturn = IsIconic(wma->hWndPaint) ?
		MAKEMCIRESOURCE(TRUE, MCI_TRUE) : MAKEMCIRESOURCE(FALSE, MCI_FALSE);
	    ret = MCI_RESOURCE_RETURNED;
	    TRACE("MCI_STATUS_WINDOW_MINIMIZED = %u\n", LOWORD(lpParms->dwReturn));
	    break;
	case MCI_DGV_STATUS_WINDOW_MAXIMIZED:
	    lpParms->dwReturn = IsZoomed(wma->hWndPaint) ?
		MAKEMCIRESOURCE(TRUE, MCI_TRUE) : MAKEMCIRESOURCE(FALSE, MCI_FALSE);
	    ret = MCI_RESOURCE_RETURNED;
	    TRACE("MCI_STATUS_WINDOW_MMAXIMIZED = %u\n", LOWORD(lpParms->dwReturn));
	    break;
	case MCI_DGV_STATUS_SPEED:
	    lpParms->dwReturn = 1000;
	    TRACE("MCI_DGV_STATUS_SPEED = %lu\n", lpParms->dwReturn);
	    break;
	case MCI_DGV_STATUS_FRAME_RATE:
	    /* FIXME: 1000 is a settable speed multiplier */
	    lpParms->dwReturn = MulDiv(1000000,1000,wma->mah.dwMicroSecPerFrame);
	    TRACE("MCI_DGV_STATUS_FRAME_RATE = %lu\n", lpParms->dwReturn);
	    break;
	case MCI_DGV_STATUS_FORWARD:
	    lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
	    ret = MCI_RESOURCE_RETURNED;
	    TRACE("MCI_DGV_STATUS_FORWARD = %u\n", LOWORD(lpParms->dwReturn));
	    break;
	case MCI_DGV_STATUS_PAUSE_MODE:
	    if (wma->dwStatus != MCI_MODE_PAUSE) {
		LeaveCriticalSection(&wma->cs);
		return MCIERR_NONAPPLICABLE_FUNCTION;
	    }
	    lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_PLAY, MCI_MODE_PLAY);
	    ret = MCI_RESOURCE_RETURNED;
	    TRACE("MCI_STATUS_MODE => 0x%04x\n", LOWORD(lpParms->dwReturn));
515
	    break;
516 517 518 519
	case MCI_DGV_STATUS_AUDIO_STREAM:
	   lpParms->dwReturn = wma->audio_stream_n;
	   TRACE("MCI_DGV_STATUS_AUDIO_STREAM => %lu\n", lpParms->dwReturn);
	   break;
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542
#if 0
	case MCI_DGV_STATUS_KEY_COLOR:
	case MCI_DGV_STATUS_KEY_INDEX:
	case MCI_DGV_STATUS_MONITOR:
	case MCI_DGV_MONITOR_FILE:
	case MCI_DGV_MONITOR_INPUT:
	case MCI_DGV_STATUS_MONITOR_METHOD:
	case MCI_DGV_STATUS_SAMPLESPERSECOND:
	case MCI_DGV_STATUS_SEEK_EXACTLY:
	case MCI_DGV_STATUS_SHARPNESS:
	case MCI_DGV_STATUS_SIZE:
	case MCI_DGV_STATUS_SMPTE:
	case MCI_DGV_STATUS_STILL_FILEFORMAT:
	case MCI_DGV_STATUS_TINT:
	case MCI_DGV_STATUS_TREBLE:
	case MCI_DGV_STATUS_UNSAVED:
	case MCI_DGV_STATUS_VIDEO_RECORD:
	case MCI_DGV_STATUS_VIDEO_SOURCE:
	case MCI_DGV_STATUS_VIDEO_SRC_NUM:
	case MCI_DGV_STATUS_VIDEO_STREAM:
	case MCI_DGV_STATUS_VOLUME:
#endif
	default:
Anders Jonsson's avatar
Anders Jonsson committed
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 551
    if (dwFlags & MCI_NOTIFY) {
	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 557
    return ret;
}