d3d11: Use wined3d_device_context_draw().
[wine.git] / dlls / mciqtz32 / mciqtz.c
blob487a0d820cd2a8a1be1aeff189a2a7067b49978d
1 /*
2 * DirectShow MCI Driver
4 * Copyright 2009 Christian Costa
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.
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.
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
21 #include <stdarg.h>
22 #include <math.h>
23 #include "windef.h"
24 #include "winbase.h"
25 #include "winuser.h"
26 #include "mmddk.h"
27 #include "wine/debug.h"
28 #include "mciqtz_private.h"
29 #include "digitalv.h"
30 #include "wownt32.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(mciqtz);
34 static DWORD MCIQTZ_mciClose(UINT, DWORD, LPMCI_GENERIC_PARMS);
35 static DWORD MCIQTZ_mciStop(UINT, DWORD, LPMCI_GENERIC_PARMS);
37 /*======================================================================*
38 * MCI QTZ implementation *
39 *======================================================================*/
41 static HINSTANCE MCIQTZ_hInstance = 0;
43 /***********************************************************************
44 * DllMain (MCIQTZ.0)
46 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
48 switch (fdwReason) {
49 case DLL_PROCESS_ATTACH:
50 DisableThreadLibraryCalls(hInstDLL);
51 MCIQTZ_hInstance = hInstDLL;
52 break;
54 return TRUE;
57 /**************************************************************************
58 * MCIQTZ_mciGetOpenDev [internal]
60 static WINE_MCIQTZ* MCIQTZ_mciGetOpenDev(UINT wDevID)
62 WINE_MCIQTZ* wma = (WINE_MCIQTZ*)mciGetDriverData(wDevID);
64 if (!wma) {
65 WARN("Invalid wDevID=%u\n", wDevID);
66 return NULL;
68 return wma;
71 /**************************************************************************
72 * MCIQTZ_drvOpen [internal]
74 static DWORD MCIQTZ_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
76 WINE_MCIQTZ* wma;
78 TRACE("(%s, %p)\n", debugstr_w(str), modp);
80 /* session instance */
81 if (!modp)
82 return 0xFFFFFFFF;
84 wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIQTZ));
85 if (!wma)
86 return 0;
88 wma->stop_event = CreateEventW(NULL, FALSE, FALSE, NULL);
89 modp->wType = MCI_DEVTYPE_DIGITAL_VIDEO;
90 wma->wDevID = modp->wDeviceID;
91 modp->wCustomCommandTable = wma->command_table = mciLoadCommandResource(MCIQTZ_hInstance, L"MCIAVI", 0);
92 mciSetDriverData(wma->wDevID, (DWORD_PTR)wma);
94 return modp->wDeviceID;
97 /**************************************************************************
98 * MCIQTZ_drvClose [internal]
100 static DWORD MCIQTZ_drvClose(DWORD dwDevID)
102 WINE_MCIQTZ* wma;
104 TRACE("(%04x)\n", dwDevID);
106 wma = MCIQTZ_mciGetOpenDev(dwDevID);
108 if (wma) {
109 /* finish all outstanding things */
110 MCIQTZ_mciClose(dwDevID, MCI_WAIT, NULL);
112 mciFreeCommandResource(wma->command_table);
113 mciSetDriverData(dwDevID, 0);
114 CloseHandle(wma->stop_event);
115 HeapFree(GetProcessHeap(), 0, wma);
116 return 1;
119 return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
122 /**************************************************************************
123 * MCIQTZ_drvConfigure [internal]
125 static DWORD MCIQTZ_drvConfigure(DWORD dwDevID)
127 WINE_MCIQTZ* wma;
129 TRACE("(%04x)\n", dwDevID);
131 wma = MCIQTZ_mciGetOpenDev(dwDevID);
132 if (!wma)
133 return 0;
135 MCIQTZ_mciStop(dwDevID, MCI_WAIT, NULL);
137 MessageBoxA(0, "Sample QTZ Wine Driver !", "MM-Wine Driver", MB_OK);
139 return 1;
142 /**************************************************************************
143 * MCIQTZ_mciNotify [internal]
145 * Notifications in MCI work like a 1-element queue.
146 * Each new notification request supersedes the previous one.
148 static void MCIQTZ_mciNotify(DWORD_PTR hWndCallBack, WINE_MCIQTZ* wma, UINT wStatus)
150 MCIDEVICEID wDevID = wma->notify_devid;
151 HANDLE old = InterlockedExchangePointer(&wma->callback, NULL);
152 if (old) mciDriverNotify(old, wDevID, MCI_NOTIFY_SUPERSEDED);
153 mciDriverNotify(HWND_32(LOWORD(hWndCallBack)), wDevID, wStatus);
156 /***************************************************************************
157 * MCIQTZ_mciOpen [internal]
159 static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags,
160 LPMCI_DGV_OPEN_PARMSW lpOpenParms)
162 WINE_MCIQTZ* wma;
163 HRESULT hr;
164 DWORD style = 0;
165 RECT rc = { 0, 0, 0, 0 };
167 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpOpenParms);
169 if(!lpOpenParms)
170 return MCIERR_NULL_PARAMETER_BLOCK;
172 wma = MCIQTZ_mciGetOpenDev(wDevID);
173 if (!wma)
174 return MCIERR_INVALID_DEVICE_ID;
176 MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
178 hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
179 wma->uninit = SUCCEEDED(hr);
181 hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&wma->pgraph);
182 if (FAILED(hr)) {
183 TRACE("Cannot create filtergraph (hr = %x)\n", hr);
184 goto err;
187 hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaControl, (LPVOID*)&wma->pmctrl);
188 if (FAILED(hr)) {
189 TRACE("Cannot get IMediaControl interface (hr = %x)\n", hr);
190 goto err;
193 hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaSeeking, (void**)&wma->seek);
194 if (FAILED(hr)) {
195 TRACE("Cannot get IMediaSeeking interface (hr = %x)\n", hr);
196 goto err;
199 hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaEvent, (void**)&wma->mevent);
200 if (FAILED(hr)) {
201 TRACE("Cannot get IMediaEvent interface (hr = %x)\n", hr);
202 goto err;
205 hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IVideoWindow, (void**)&wma->vidwin);
206 if (FAILED(hr)) {
207 TRACE("Cannot get IVideoWindow interface (hr = %x)\n", hr);
208 goto err;
211 hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IBasicVideo, (void**)&wma->vidbasic);
212 if (FAILED(hr)) {
213 TRACE("Cannot get IBasicVideo interface (hr = %x)\n", hr);
214 goto err;
217 hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IBasicAudio, (void**)&wma->audio);
218 if (FAILED(hr)) {
219 TRACE("Cannot get IBasicAudio interface (hr = %x)\n", hr);
220 goto err;
223 if (!(dwFlags & MCI_OPEN_ELEMENT) || (dwFlags & MCI_OPEN_ELEMENT_ID)) {
224 TRACE("Wrong dwFlags %x\n", dwFlags);
225 goto err;
228 if (!lpOpenParms->lpstrElementName || !lpOpenParms->lpstrElementName[0]) {
229 TRACE("Invalid filename specified\n");
230 goto err;
233 TRACE("Open file %s\n", debugstr_w(lpOpenParms->lpstrElementName));
235 hr = IGraphBuilder_RenderFile(wma->pgraph, lpOpenParms->lpstrElementName, NULL);
236 if (FAILED(hr)) {
237 TRACE("Cannot render file (hr = %x)\n", hr);
238 goto err;
241 IVideoWindow_put_AutoShow(wma->vidwin, OAFALSE);
242 IVideoWindow_put_Visible(wma->vidwin, OAFALSE);
243 if (dwFlags & MCI_DGV_OPEN_WS)
244 style = lpOpenParms->dwStyle;
245 if (dwFlags & MCI_DGV_OPEN_PARENT) {
246 IVideoWindow_put_MessageDrain(wma->vidwin, (OAHWND)lpOpenParms->hWndParent);
247 IVideoWindow_put_WindowState(wma->vidwin, SW_HIDE);
248 IVideoWindow_put_WindowStyle(wma->vidwin, style|WS_CHILD);
249 IVideoWindow_put_Owner(wma->vidwin, (OAHWND)lpOpenParms->hWndParent);
250 GetClientRect(lpOpenParms->hWndParent, &rc);
251 IVideoWindow_SetWindowPosition(wma->vidwin, rc.left, rc.top, rc.right - rc.top, rc.bottom - rc.top);
252 wma->parent = (HWND)lpOpenParms->hWndParent;
254 else if (style)
255 IVideoWindow_put_WindowStyle(wma->vidwin, style);
256 IBasicVideo_GetVideoSize(wma->vidbasic, &rc.right, &rc.bottom);
257 wma->opened = TRUE;
259 if (dwFlags & MCI_NOTIFY)
260 mciDriverNotify(HWND_32(LOWORD(lpOpenParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL);
262 return 0;
264 err:
265 if (wma->audio)
266 IBasicAudio_Release(wma->audio);
267 wma->audio = NULL;
268 if (wma->vidbasic)
269 IBasicVideo_Release(wma->vidbasic);
270 wma->vidbasic = NULL;
271 if (wma->seek)
272 IMediaSeeking_Release(wma->seek);
273 wma->seek = NULL;
274 if (wma->vidwin)
275 IVideoWindow_Release(wma->vidwin);
276 wma->vidwin = NULL;
277 if (wma->pgraph)
278 IGraphBuilder_Release(wma->pgraph);
279 wma->pgraph = NULL;
280 if (wma->mevent)
281 IMediaEvent_Release(wma->mevent);
282 wma->mevent = NULL;
283 if (wma->pmctrl)
284 IMediaControl_Release(wma->pmctrl);
285 wma->pmctrl = NULL;
287 if (wma->uninit)
288 CoUninitialize();
289 wma->uninit = FALSE;
291 return MCIERR_INTERNAL;
294 /***************************************************************************
295 * MCIQTZ_mciClose [internal]
297 static DWORD MCIQTZ_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
299 WINE_MCIQTZ* wma;
301 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
303 wma = MCIQTZ_mciGetOpenDev(wDevID);
304 if (!wma)
305 return MCIERR_INVALID_DEVICE_ID;
307 MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
309 if (wma->opened) {
310 IVideoWindow_Release(wma->vidwin);
311 IBasicVideo_Release(wma->vidbasic);
312 IBasicAudio_Release(wma->audio);
313 IMediaSeeking_Release(wma->seek);
314 IMediaEvent_Release(wma->mevent);
315 IGraphBuilder_Release(wma->pgraph);
316 IMediaControl_Release(wma->pmctrl);
317 if (wma->uninit)
318 CoUninitialize();
319 wma->opened = FALSE;
322 return 0;
325 /***************************************************************************
326 * MCIQTZ_notifyThread [internal]
328 static DWORD CALLBACK MCIQTZ_notifyThread(LPVOID parm)
330 WINE_MCIQTZ* wma = (WINE_MCIQTZ *)parm;
331 HRESULT hr;
332 HANDLE handle[2];
333 DWORD n = 0, ret = 0;
335 handle[n++] = wma->stop_event;
336 IMediaEvent_GetEventHandle(wma->mevent, (OAEVENT *)&handle[n++]);
338 for (;;) {
339 DWORD r;
340 HANDLE old;
342 r = WaitForMultipleObjects(n, handle, FALSE, INFINITE);
343 if (r == WAIT_OBJECT_0) {
344 TRACE("got stop event\n");
345 old = InterlockedExchangePointer(&wma->callback, NULL);
346 if (old)
347 mciDriverNotify(old, wma->notify_devid, MCI_NOTIFY_ABORTED);
348 break;
350 else if (r == WAIT_OBJECT_0+1) {
351 LONG event_code;
352 LONG_PTR p1, p2;
353 do {
354 hr = IMediaEvent_GetEvent(wma->mevent, &event_code, &p1, &p2, 0);
355 if (SUCCEEDED(hr)) {
356 TRACE("got event_code = 0x%02x\n", event_code);
357 IMediaEvent_FreeEventParams(wma->mevent, event_code, p1, p2);
359 } while (hr == S_OK && event_code != EC_COMPLETE);
360 if (hr == S_OK && event_code == EC_COMPLETE) {
361 /* Repeat the music by seeking and running again */
362 if (wma->mci_flags & MCI_DGV_PLAY_REPEAT) {
363 TRACE("repeat media as requested\n");
364 IMediaControl_Stop(wma->pmctrl);
365 IMediaSeeking_SetPositions(wma->seek,
366 &wma->seek_start,
367 AM_SEEKING_AbsolutePositioning,
368 &wma->seek_stop,
369 AM_SEEKING_AbsolutePositioning);
370 IMediaControl_Run(wma->pmctrl);
371 continue;
373 old = InterlockedExchangePointer(&wma->callback, NULL);
374 if (old)
375 mciDriverNotify(old, wma->notify_devid, MCI_NOTIFY_SUCCESSFUL);
376 break;
379 else {
380 TRACE("Unknown error (%d)\n", (int)r);
381 break;
385 hr = IMediaControl_Stop(wma->pmctrl);
386 if (FAILED(hr)) {
387 TRACE("Cannot stop filtergraph (hr = %x)\n", hr);
388 ret = MCIERR_INTERNAL;
391 return ret;
394 /***************************************************************************
395 * MCIQTZ_mciPlay [internal]
397 static DWORD MCIQTZ_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
399 WINE_MCIQTZ* wma;
400 HRESULT hr;
401 GUID format;
402 DWORD start_flags;
404 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
406 if(!lpParms)
407 return MCIERR_NULL_PARAMETER_BLOCK;
409 wma = MCIQTZ_mciGetOpenDev(wDevID);
410 if (!wma)
411 return MCIERR_INVALID_DEVICE_ID;
413 ResetEvent(wma->stop_event);
414 if (dwFlags & MCI_NOTIFY) {
415 HANDLE old;
416 old = InterlockedExchangePointer(&wma->callback, HWND_32(LOWORD(lpParms->dwCallback)));
417 if (old)
418 mciDriverNotify(old, wma->notify_devid, MCI_NOTIFY_ABORTED);
421 wma->mci_flags = dwFlags;
422 IMediaSeeking_GetTimeFormat(wma->seek, &format);
423 if (dwFlags & MCI_FROM) {
424 wma->seek_start = lpParms->dwFrom;
425 if (IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME))
426 wma->seek_start *= 10000;
428 start_flags = AM_SEEKING_AbsolutePositioning;
429 } else {
430 wma->seek_start = 0;
431 start_flags = AM_SEEKING_NoPositioning;
433 if (dwFlags & MCI_TO) {
434 wma->seek_stop = lpParms->dwTo;
435 if (IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME))
436 wma->seek_stop *= 10000;
437 } else {
438 wma->seek_stop = 0;
439 IMediaSeeking_GetDuration(wma->seek, &wma->seek_stop);
441 IMediaSeeking_SetPositions(wma->seek, &wma->seek_start, start_flags,
442 &wma->seek_stop, AM_SEEKING_AbsolutePositioning);
444 hr = IMediaControl_Run(wma->pmctrl);
445 if (FAILED(hr)) {
446 TRACE("Cannot run filtergraph (hr = %x)\n", hr);
447 return MCIERR_INTERNAL;
450 IVideoWindow_put_Visible(wma->vidwin, OATRUE);
452 wma->thread = CreateThread(NULL, 0, MCIQTZ_notifyThread, wma, 0, NULL);
453 if (!wma->thread) {
454 TRACE("Can't create thread\n");
455 return MCIERR_INTERNAL;
457 return 0;
460 /***************************************************************************
461 * MCIQTZ_mciSeek [internal]
463 static DWORD MCIQTZ_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
465 WINE_MCIQTZ* wma;
466 HRESULT hr;
467 LONGLONG newpos;
469 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
471 if(!lpParms)
472 return MCIERR_NULL_PARAMETER_BLOCK;
474 wma = MCIQTZ_mciGetOpenDev(wDevID);
475 if (!wma)
476 return MCIERR_INVALID_DEVICE_ID;
478 MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
480 if (dwFlags & MCI_SEEK_TO_START) {
481 newpos = 0;
482 } else if (dwFlags & MCI_SEEK_TO_END) {
483 FIXME("MCI_SEEK_TO_END not implemented yet\n");
484 return MCIERR_INTERNAL;
485 } else if (dwFlags & MCI_TO) {
486 FIXME("MCI_TO not implemented yet\n");
487 return MCIERR_INTERNAL;
488 } else {
489 WARN("dwFlag doesn't tell where to seek to...\n");
490 return MCIERR_MISSING_PARAMETER;
493 hr = IMediaSeeking_SetPositions(wma->seek, &newpos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
494 if (FAILED(hr)) {
495 FIXME("Cannot set position (hr = %x)\n", hr);
496 return MCIERR_INTERNAL;
499 if (dwFlags & MCI_NOTIFY)
500 MCIQTZ_mciNotify(lpParms->dwCallback, wma, MCI_NOTIFY_SUCCESSFUL);
502 return 0;
505 /***************************************************************************
506 * MCIQTZ_mciStop [internal]
508 static DWORD MCIQTZ_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
510 WINE_MCIQTZ* wma;
512 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
514 wma = MCIQTZ_mciGetOpenDev(wDevID);
515 if (!wma)
516 return MCIERR_INVALID_DEVICE_ID;
518 if (!wma->opened)
519 return 0;
521 if (wma->thread) {
522 SetEvent(wma->stop_event);
523 WaitForSingleObject(wma->thread, INFINITE);
524 CloseHandle(wma->thread);
525 wma->thread = NULL;
528 if (!wma->parent)
529 IVideoWindow_put_Visible(wma->vidwin, OAFALSE);
531 return 0;
534 /***************************************************************************
535 * MCIQTZ_mciPause [internal]
537 static DWORD MCIQTZ_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
539 WINE_MCIQTZ* wma;
540 HRESULT hr;
542 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
544 wma = MCIQTZ_mciGetOpenDev(wDevID);
545 if (!wma)
546 return MCIERR_INVALID_DEVICE_ID;
548 hr = IMediaControl_Pause(wma->pmctrl);
549 if (FAILED(hr)) {
550 TRACE("Cannot pause filtergraph (hr = %x)\n", hr);
551 return MCIERR_INTERNAL;
554 return 0;
557 /***************************************************************************
558 * MCIQTZ_mciResume [internal]
560 static DWORD MCIQTZ_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
562 WINE_MCIQTZ* wma;
563 HRESULT hr;
565 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
567 wma = MCIQTZ_mciGetOpenDev(wDevID);
568 if (!wma)
569 return MCIERR_INVALID_DEVICE_ID;
571 hr = IMediaControl_Run(wma->pmctrl);
572 if (FAILED(hr)) {
573 TRACE("Cannot run filtergraph (hr = %x)\n", hr);
574 return MCIERR_INTERNAL;
577 return 0;
580 /***************************************************************************
581 * MCIQTZ_mciGetDevCaps [internal]
583 static DWORD MCIQTZ_mciGetDevCaps(UINT wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS lpParms)
585 WINE_MCIQTZ* wma;
587 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
589 if(!lpParms)
590 return MCIERR_NULL_PARAMETER_BLOCK;
592 wma = MCIQTZ_mciGetOpenDev(wDevID);
593 if (!wma)
594 return MCIERR_INVALID_DEVICE_ID;
596 if (!(dwFlags & MCI_GETDEVCAPS_ITEM))
597 return MCIERR_MISSING_PARAMETER;
599 switch (lpParms->dwItem) {
600 case MCI_GETDEVCAPS_CAN_RECORD:
601 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
602 TRACE("MCI_GETDEVCAPS_CAN_RECORD = %08x\n", lpParms->dwReturn);
603 break;
604 case MCI_GETDEVCAPS_HAS_AUDIO:
605 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
606 TRACE("MCI_GETDEVCAPS_HAS_AUDIO = %08x\n", lpParms->dwReturn);
607 break;
608 case MCI_GETDEVCAPS_HAS_VIDEO:
609 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
610 TRACE("MCI_GETDEVCAPS_HAS_VIDEO = %08x\n", lpParms->dwReturn);
611 break;
612 case MCI_GETDEVCAPS_DEVICE_TYPE:
613 lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_DIGITAL_VIDEO, MCI_DEVTYPE_DIGITAL_VIDEO);
614 TRACE("MCI_GETDEVCAPS_DEVICE_TYPE = %08x\n", lpParms->dwReturn);
615 break;
616 case MCI_GETDEVCAPS_USES_FILES:
617 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
618 TRACE("MCI_GETDEVCAPS_USES_FILES = %08x\n", lpParms->dwReturn);
619 break;
620 case MCI_GETDEVCAPS_COMPOUND_DEVICE:
621 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
622 TRACE("MCI_GETDEVCAPS_COMPOUND_DEVICE = %08x\n", lpParms->dwReturn);
623 break;
624 case MCI_GETDEVCAPS_CAN_EJECT:
625 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
626 TRACE("MCI_GETDEVCAPS_EJECT = %08x\n", lpParms->dwReturn);
627 break;
628 case MCI_GETDEVCAPS_CAN_PLAY:
629 lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
630 TRACE("MCI_GETDEVCAPS_CAN_PLAY = %08x\n", lpParms->dwReturn);
631 break;
632 case MCI_GETDEVCAPS_CAN_SAVE:
633 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
634 TRACE("MCI_GETDEVCAPS_CAN_SAVE = %08x\n", lpParms->dwReturn);
635 break;
636 case MCI_DGV_GETDEVCAPS_CAN_REVERSE:
637 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
638 TRACE("MCI_DGV_GETDEVCAPS_CAN_REVERSE = %08x\n", lpParms->dwReturn);
639 break;
640 case MCI_DGV_GETDEVCAPS_CAN_STRETCH:
641 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE); /* FIXME */
642 TRACE("MCI_DGV_GETDEVCAPS_CAN_STRETCH = %08x\n", lpParms->dwReturn);
643 break;
644 case MCI_DGV_GETDEVCAPS_CAN_LOCK:
645 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
646 TRACE("MCI_DGV_GETDEVCAPS_CAN_LOCK = %08x\n", lpParms->dwReturn);
647 break;
648 case MCI_DGV_GETDEVCAPS_CAN_FREEZE:
649 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
650 TRACE("MCI_DGV_GETDEVCAPS_CAN_FREEZE = %08x\n", lpParms->dwReturn);
651 break;
652 case MCI_DGV_GETDEVCAPS_CAN_STR_IN:
653 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
654 TRACE("MCI_DGV_GETDEVCAPS_CAN_STRETCH_INPUT = %08x\n", lpParms->dwReturn);
655 break;
656 case MCI_DGV_GETDEVCAPS_HAS_STILL:
657 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
658 TRACE("MCI_DGV_GETDEVCAPS_HAS_STILL = %08x\n", lpParms->dwReturn);
659 break;
660 case MCI_DGV_GETDEVCAPS_CAN_TEST:
661 lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE); /* FIXME */
662 TRACE("MCI_DGV_GETDEVCAPS_CAN_TEST = %08x\n", lpParms->dwReturn);
663 break;
664 case MCI_DGV_GETDEVCAPS_MAX_WINDOWS:
665 lpParms->dwReturn = 1;
666 TRACE("MCI_DGV_GETDEVCAPS_MAX_WINDOWS = %u\n", lpParms->dwReturn);
667 return 0;
668 default:
669 WARN("Unknown capability %08x\n", lpParms->dwItem);
670 /* Fall through */
671 case MCI_DGV_GETDEVCAPS_MAXIMUM_RATE: /* unknown to w2k */
672 case MCI_DGV_GETDEVCAPS_MINIMUM_RATE: /* unknown to w2k */
673 return MCIERR_UNSUPPORTED_FUNCTION;
676 return MCI_RESOURCE_RETURNED;
679 /***************************************************************************
680 * MCIQTZ_mciSet [internal]
682 static DWORD MCIQTZ_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
684 WINE_MCIQTZ* wma;
686 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
688 if(!lpParms)
689 return MCIERR_NULL_PARAMETER_BLOCK;
691 wma = MCIQTZ_mciGetOpenDev(wDevID);
692 if (!wma)
693 return MCIERR_INVALID_DEVICE_ID;
695 if (dwFlags & MCI_SET_TIME_FORMAT) {
696 switch (lpParms->dwTimeFormat) {
697 case MCI_FORMAT_MILLISECONDS:
698 TRACE("MCI_SET_TIME_FORMAT = MCI_FORMAT_MILLISECONDS\n");
699 wma->time_format = MCI_FORMAT_MILLISECONDS;
700 break;
701 case MCI_FORMAT_FRAMES:
702 TRACE("MCI_SET_TIME_FORMAT = MCI_FORMAT_FRAMES\n");
703 wma->time_format = MCI_FORMAT_FRAMES;
704 break;
705 default:
706 WARN("Bad time format %u\n", lpParms->dwTimeFormat);
707 return MCIERR_BAD_TIME_FORMAT;
711 if (dwFlags & MCI_SET_DOOR_OPEN)
712 FIXME("MCI_SET_DOOR_OPEN not implemented yet\n");
713 if (dwFlags & MCI_SET_DOOR_CLOSED)
714 FIXME("MCI_SET_DOOR_CLOSED not implemented yet\n");
715 if (dwFlags & MCI_SET_AUDIO)
716 FIXME("MCI_SET_AUDIO not implemented yet\n");
717 if (dwFlags & MCI_SET_VIDEO)
718 FIXME("MCI_SET_VIDEO not implemented yet\n");
719 if (dwFlags & MCI_SET_ON)
720 FIXME("MCI_SET_ON not implemented yet\n");
721 if (dwFlags & MCI_SET_OFF)
722 FIXME("MCI_SET_OFF not implemented yet\n");
723 if (dwFlags & MCI_SET_AUDIO_LEFT)
724 FIXME("MCI_SET_AUDIO_LEFT not implemented yet\n");
725 if (dwFlags & MCI_SET_AUDIO_RIGHT)
726 FIXME("MCI_SET_AUDIO_RIGHT not implemented yet\n");
728 if (dwFlags & ~0x7f03 /* All MCI_SET flags mask */)
729 ERR("Unknown flags %08x\n", dwFlags & ~0x7f03);
731 return 0;
734 /***************************************************************************
735 * MCIQTZ_mciStatus [internal]
737 static DWORD MCIQTZ_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSW lpParms)
739 WINE_MCIQTZ* wma;
740 HRESULT hr;
741 DWORD ret = MCI_INTEGER_RETURNED;
743 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
745 if(!lpParms)
746 return MCIERR_NULL_PARAMETER_BLOCK;
748 wma = MCIQTZ_mciGetOpenDev(wDevID);
749 if (!wma)
750 return MCIERR_INVALID_DEVICE_ID;
752 if (!(dwFlags & MCI_STATUS_ITEM)) {
753 WARN("No status item specified\n");
754 return MCIERR_UNRECOGNIZED_COMMAND;
757 switch (lpParms->dwItem) {
758 case MCI_STATUS_LENGTH: {
759 LONGLONG duration = -1;
760 GUID format;
761 switch (wma->time_format) {
762 case MCI_FORMAT_MILLISECONDS: format = TIME_FORMAT_MEDIA_TIME; break;
763 case MCI_FORMAT_FRAMES: format = TIME_FORMAT_FRAME; break;
764 default: ERR("Unhandled format %x\n", wma->time_format); break;
766 hr = IMediaSeeking_SetTimeFormat(wma->seek, &format);
767 if (FAILED(hr)) {
768 FIXME("Cannot set time format (hr = %x)\n", hr);
769 lpParms->dwReturn = 0;
770 break;
772 hr = IMediaSeeking_GetDuration(wma->seek, &duration);
773 if (FAILED(hr) || duration < 0) {
774 FIXME("Cannot read duration (hr = %x)\n", hr);
775 lpParms->dwReturn = 0;
776 } else if (wma->time_format != MCI_FORMAT_MILLISECONDS)
777 lpParms->dwReturn = duration;
778 else
779 lpParms->dwReturn = duration / 10000;
780 break;
782 case MCI_STATUS_POSITION: {
783 REFERENCE_TIME curpos;
785 hr = IMediaSeeking_GetCurrentPosition(wma->seek, &curpos);
786 if (FAILED(hr)) {
787 FIXME("Cannot get position (hr = %x)\n", hr);
788 return MCIERR_INTERNAL;
790 lpParms->dwReturn = curpos / 10000;
791 break;
793 case MCI_STATUS_NUMBER_OF_TRACKS:
794 FIXME("MCI_STATUS_NUMBER_OF_TRACKS not implemented yet\n");
795 return MCIERR_UNRECOGNIZED_COMMAND;
796 case MCI_STATUS_MODE: {
797 LONG state = State_Stopped;
798 IMediaControl_GetState(wma->pmctrl, -1, &state);
799 if (state == State_Stopped)
800 lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_STOP, MCI_MODE_STOP);
801 else if (state == State_Running) {
802 lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_PLAY, MCI_MODE_PLAY);
803 if (!wma->thread || WaitForSingleObject(wma->thread, 0) == WAIT_OBJECT_0)
804 lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_STOP, MCI_MODE_STOP);
805 } else if (state == State_Paused)
806 lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_PAUSE, MCI_MODE_PAUSE);
807 ret = MCI_RESOURCE_RETURNED;
808 break;
810 case MCI_STATUS_MEDIA_PRESENT:
811 FIXME("MCI_STATUS_MEDIA_PRESENT not implemented yet\n");
812 return MCIERR_UNRECOGNIZED_COMMAND;
813 case MCI_STATUS_TIME_FORMAT:
814 lpParms->dwReturn = MAKEMCIRESOURCE(wma->time_format,
815 MCI_FORMAT_RETURN_BASE + wma->time_format);
816 ret = MCI_RESOURCE_RETURNED;
817 break;
818 case MCI_STATUS_READY:
819 FIXME("MCI_STATUS_READY not implemented yet\n");
820 return MCIERR_UNRECOGNIZED_COMMAND;
821 case MCI_STATUS_CURRENT_TRACK:
822 FIXME("MCI_STATUS_CURRENT_TRACK not implemented yet\n");
823 return MCIERR_UNRECOGNIZED_COMMAND;
824 default:
825 FIXME("Unknown command %08X\n", lpParms->dwItem);
826 return MCIERR_UNRECOGNIZED_COMMAND;
829 if (dwFlags & MCI_NOTIFY)
830 MCIQTZ_mciNotify(lpParms->dwCallback, wma, MCI_NOTIFY_SUCCESSFUL);
832 return ret;
835 /***************************************************************************
836 * MCIQTZ_mciWhere [internal]
838 static DWORD MCIQTZ_mciWhere(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
840 WINE_MCIQTZ* wma;
841 HRESULT hr;
842 HWND hWnd;
843 RECT rc;
844 DWORD ret = MCIERR_UNRECOGNIZED_COMMAND;
846 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
848 if(!lpParms)
849 return MCIERR_NULL_PARAMETER_BLOCK;
851 wma = MCIQTZ_mciGetOpenDev(wDevID);
852 if (!wma)
853 return MCIERR_INVALID_DEVICE_ID;
855 hr = IVideoWindow_get_Owner(wma->vidwin, (OAHWND*)&hWnd);
856 if (FAILED(hr)) {
857 TRACE("No video stream, returning no window error\n");
858 return MCIERR_NO_WINDOW;
861 if (dwFlags & MCI_DGV_WHERE_SOURCE) {
862 if (dwFlags & MCI_DGV_WHERE_MAX)
863 FIXME("MCI_DGV_WHERE_SOURCE_MAX stub\n");
864 IBasicVideo_GetSourcePosition(wma->vidbasic, &rc.left, &rc.top, &rc.right, &rc.bottom);
865 TRACE("MCI_DGV_WHERE_SOURCE %s\n", wine_dbgstr_rect(&rc));
867 if (dwFlags & MCI_DGV_WHERE_DESTINATION) {
868 if (dwFlags & MCI_DGV_WHERE_MAX)
869 FIXME("MCI_DGV_WHERE_DESTINATION_MAX stub\n");
870 IBasicVideo_GetDestinationPosition(wma->vidbasic, &rc.left, &rc.top, &rc.right, &rc.bottom);
871 TRACE("MCI_DGV_WHERE_DESTINATION %s\n", wine_dbgstr_rect(&rc));
873 if (dwFlags & MCI_DGV_WHERE_FRAME) {
874 if (dwFlags & MCI_DGV_WHERE_MAX)
875 FIXME("MCI_DGV_WHERE_FRAME_MAX not supported yet\n");
876 else
877 FIXME("MCI_DGV_WHERE_FRAME not supported yet\n");
878 goto out;
880 if (dwFlags & MCI_DGV_WHERE_VIDEO) {
881 if (dwFlags & MCI_DGV_WHERE_MAX)
882 FIXME("MCI_DGV_WHERE_VIDEO_MAX not supported yet\n");
883 else
884 FIXME("MCI_DGV_WHERE_VIDEO not supported yet\n");
885 goto out;
887 if (dwFlags & MCI_DGV_WHERE_WINDOW) {
888 if (dwFlags & MCI_DGV_WHERE_MAX) {
889 GetWindowRect(GetDesktopWindow(), &rc);
890 rc.right -= rc.left;
891 rc.bottom -= rc.top;
892 TRACE("MCI_DGV_WHERE_WINDOW_MAX %s\n", wine_dbgstr_rect(&rc));
893 } else {
894 IVideoWindow_GetWindowPosition(wma->vidwin, &rc.left, &rc.top, &rc.right, &rc.bottom);
895 TRACE("MCI_DGV_WHERE_WINDOW %s\n", wine_dbgstr_rect(&rc));
898 ret = 0;
899 out:
900 lpParms->rc = rc;
901 return ret;
904 /***************************************************************************
905 * MCIQTZ_mciWindow [internal]
907 static DWORD MCIQTZ_mciWindow(UINT wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSW lpParms)
909 WINE_MCIQTZ *wma = MCIQTZ_mciGetOpenDev(wDevID);
911 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
913 if(!lpParms)
914 return MCIERR_NULL_PARAMETER_BLOCK;
916 if (!wma)
917 return MCIERR_INVALID_DEVICE_ID;
918 if (dwFlags & MCI_TEST)
919 return 0;
921 if (dwFlags & MCI_DGV_WINDOW_HWND && (IsWindow(lpParms->hWnd) || !lpParms->hWnd)) {
922 LONG visible = OATRUE;
923 LONG style = 0;
924 TRACE("Setting hWnd to %p\n", lpParms->hWnd);
925 IVideoWindow_get_Visible(wma->vidwin, &visible);
926 IVideoWindow_put_Visible(wma->vidwin, OAFALSE);
927 IVideoWindow_get_WindowStyle(wma->vidwin, &style);
928 style &= ~WS_CHILD;
929 if (lpParms->hWnd)
930 IVideoWindow_put_WindowStyle(wma->vidwin, style|WS_CHILD);
931 else
932 IVideoWindow_put_WindowStyle(wma->vidwin, style);
933 IVideoWindow_put_Owner(wma->vidwin, (OAHWND)lpParms->hWnd);
934 IVideoWindow_put_MessageDrain(wma->vidwin, (OAHWND)lpParms->hWnd);
935 IVideoWindow_put_Visible(wma->vidwin, visible);
936 wma->parent = lpParms->hWnd;
938 if (dwFlags & MCI_DGV_WINDOW_STATE) {
939 TRACE("Setting nCmdShow to %d\n", lpParms->nCmdShow);
940 IVideoWindow_put_WindowState(wma->vidwin, lpParms->nCmdShow);
942 if (dwFlags & MCI_DGV_WINDOW_TEXT) {
943 TRACE("Setting caption to %s\n", debugstr_w(lpParms->lpstrText));
944 IVideoWindow_put_Caption(wma->vidwin, lpParms->lpstrText);
946 return 0;
949 /***************************************************************************
950 * MCIQTZ_mciPut [internal]
952 static DWORD MCIQTZ_mciPut(UINT wDevID, DWORD dwFlags, MCI_GENERIC_PARMS *lpParms)
954 WINE_MCIQTZ *wma = MCIQTZ_mciGetOpenDev(wDevID);
955 MCI_DGV_RECT_PARMS *rectparms;
956 HRESULT hr;
958 TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
960 if(!lpParms)
961 return MCIERR_NULL_PARAMETER_BLOCK;
963 if (!wma)
964 return MCIERR_INVALID_DEVICE_ID;
966 if (!(dwFlags & MCI_DGV_RECT)) {
967 FIXME("No support for non-RECT MCI_PUT\n");
968 return 1;
971 if (dwFlags & MCI_TEST)
972 return 0;
974 dwFlags &= ~MCI_DGV_RECT;
975 rectparms = (MCI_DGV_RECT_PARMS*)lpParms;
977 if (dwFlags & MCI_DGV_PUT_DESTINATION) {
978 hr = IVideoWindow_SetWindowPosition(wma->vidwin,
979 rectparms->rc.left, rectparms->rc.top,
980 rectparms->rc.right - rectparms->rc.left,
981 rectparms->rc.bottom - rectparms->rc.top);
982 if(FAILED(hr))
983 WARN("IVideoWindow_SetWindowPosition failed: 0x%x\n", hr);
985 dwFlags &= ~MCI_DGV_PUT_DESTINATION;
988 if (dwFlags & MCI_NOTIFY) {
989 MCIQTZ_mciNotify(lpParms->dwCallback, wma, MCI_NOTIFY_SUCCESSFUL);
990 dwFlags &= ~MCI_NOTIFY;
993 if (dwFlags)
994 FIXME("No support for some flags: 0x%x\n", dwFlags);
996 return 0;
999 /******************************************************************************
1000 * MCIAVI_mciUpdate [internal]
1002 static DWORD MCIQTZ_mciUpdate(UINT wDevID, DWORD dwFlags, LPMCI_DGV_UPDATE_PARMS lpParms)
1004 WINE_MCIQTZ *wma;
1005 DWORD res = 0;
1007 TRACE("%04x, %08x, %p\n", wDevID, dwFlags, lpParms);
1009 if(!lpParms)
1010 return MCIERR_NULL_PARAMETER_BLOCK;
1012 wma = MCIQTZ_mciGetOpenDev(wDevID);
1013 if (!wma)
1014 return MCIERR_INVALID_DEVICE_ID;
1016 if (dwFlags & MCI_DGV_UPDATE_HDC) {
1017 LONG state, size;
1018 BYTE *data;
1019 BITMAPINFO *info;
1020 HRESULT hr;
1021 RECT src, dest;
1022 LONG visible = OATRUE;
1024 res = MCIERR_INTERNAL;
1025 IMediaControl_GetState(wma->pmctrl, -1, &state);
1026 if (state == State_Running)
1027 return MCIERR_UNSUPPORTED_FUNCTION;
1028 /* If in stopped state, nothing has been drawn to screen
1029 * moving to pause, which is needed for the old dib renderer, will result
1030 * in a single frame drawn, so hide the window here */
1031 IVideoWindow_get_Visible(wma->vidwin, &visible);
1032 if (wma->parent)
1033 IVideoWindow_put_Visible(wma->vidwin, OAFALSE);
1034 /* FIXME: Should we check the original state and restore it? */
1035 IMediaControl_Pause(wma->pmctrl);
1036 IMediaControl_GetState(wma->pmctrl, -1, &state);
1037 if (FAILED(hr = IBasicVideo_GetCurrentImage(wma->vidbasic, &size, NULL))) {
1038 WARN("Could not get image size (hr = %x)\n", hr);
1039 goto out;
1041 data = HeapAlloc(GetProcessHeap(), 0, size);
1042 info = (BITMAPINFO*)data;
1043 IBasicVideo_GetCurrentImage(wma->vidbasic, &size, (LONG*)data);
1044 data += info->bmiHeader.biSize;
1046 IBasicVideo_GetSourcePosition(wma->vidbasic, &src.left, &src.top, &src.right, &src.bottom);
1047 IBasicVideo_GetDestinationPosition(wma->vidbasic, &dest.left, &dest.top, &dest.right, &dest.bottom);
1048 StretchDIBits(lpParms->hDC,
1049 dest.left, dest.top, dest.right + dest.left, dest.bottom + dest.top,
1050 src.left, src.top, src.right + src.left, src.bottom + src.top,
1051 data, info, DIB_RGB_COLORS, SRCCOPY);
1052 HeapFree(GetProcessHeap(), 0, data);
1053 res = 0;
1054 out:
1055 if (wma->parent)
1056 IVideoWindow_put_Visible(wma->vidwin, visible);
1058 else if (dwFlags)
1059 FIXME("Unhandled flags %x\n", dwFlags);
1060 return res;
1063 /***************************************************************************
1064 * MCIQTZ_mciSetAudio [internal]
1066 static DWORD MCIQTZ_mciSetAudio(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETAUDIO_PARMSW lpParms)
1068 WINE_MCIQTZ *wma;
1069 DWORD ret = 0;
1071 TRACE("(%04x, %08x, %p)\n", wDevID, dwFlags, lpParms);
1073 if(!lpParms)
1074 return MCIERR_NULL_PARAMETER_BLOCK;
1076 wma = MCIQTZ_mciGetOpenDev(wDevID);
1077 if (!wma)
1078 return MCIERR_INVALID_DEVICE_ID;
1080 if (!(dwFlags & MCI_DGV_SETAUDIO_ITEM)) {
1081 FIXME("Unknown flags (%08x)\n", dwFlags);
1082 return 0;
1085 if (dwFlags & MCI_DGV_SETAUDIO_ITEM) {
1086 switch (lpParms->dwItem) {
1087 case MCI_DGV_SETAUDIO_VOLUME:
1088 if (dwFlags & MCI_DGV_SETAUDIO_VALUE) {
1089 long vol;
1090 HRESULT hr;
1091 if (lpParms->dwValue > 1000) {
1092 ret = MCIERR_OUTOFRANGE;
1093 break;
1095 if (dwFlags & MCI_TEST)
1096 break;
1097 if (lpParms->dwValue != 0)
1098 vol = (long)(2000.0 * (log10(lpParms->dwValue) - 3.0));
1099 else
1100 vol = -10000;
1101 TRACE("Setting volume to %ld\n", vol);
1102 hr = IBasicAudio_put_Volume(wma->audio, vol);
1103 if (FAILED(hr)) {
1104 WARN("Cannot set volume (hr = %x)\n", hr);
1105 ret = MCIERR_INTERNAL;
1108 break;
1109 default:
1110 FIXME("Unknown item %08x\n", lpParms->dwItem);
1111 break;
1115 return ret;
1118 /*======================================================================*
1119 * MCI QTZ entry points *
1120 *======================================================================*/
1122 /**************************************************************************
1123 * DriverProc (MCIQTZ.@)
1125 LRESULT CALLBACK MCIQTZ_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
1126 LPARAM dwParam1, LPARAM dwParam2)
1128 TRACE("(%08lX, %p, %08X, %08lX, %08lX)\n",
1129 dwDevID, hDriv, wMsg, dwParam1, dwParam2);
1131 switch (wMsg) {
1132 case DRV_LOAD: return 1;
1133 case DRV_FREE: return 1;
1134 case DRV_OPEN: return MCIQTZ_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
1135 case DRV_CLOSE: return MCIQTZ_drvClose(dwDevID);
1136 case DRV_ENABLE: return 1;
1137 case DRV_DISABLE: return 1;
1138 case DRV_QUERYCONFIGURE: return 1;
1139 case DRV_CONFIGURE: return MCIQTZ_drvConfigure(dwDevID);
1140 case DRV_INSTALL: return DRVCNF_RESTART;
1141 case DRV_REMOVE: return DRVCNF_RESTART;
1144 /* session instance */
1145 if (dwDevID == 0xFFFFFFFF)
1146 return 1;
1148 switch (wMsg) {
1149 case MCI_OPEN_DRIVER: return MCIQTZ_mciOpen (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSW) dwParam2);
1150 case MCI_CLOSE_DRIVER: return MCIQTZ_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1151 case MCI_PLAY: return MCIQTZ_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
1152 case MCI_SEEK: return MCIQTZ_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
1153 case MCI_STOP: return MCIQTZ_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1154 case MCI_PAUSE: return MCIQTZ_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1155 case MCI_RESUME: return MCIQTZ_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
1156 case MCI_GETDEVCAPS: return MCIQTZ_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
1157 case MCI_SET: return MCIQTZ_mciSet (dwDevID, dwParam1, (LPMCI_DGV_SET_PARMS) dwParam2);
1158 case MCI_STATUS: return MCIQTZ_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSW) dwParam2);
1159 case MCI_WHERE: return MCIQTZ_mciWhere (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
1160 /* Digital Video specific */
1161 case MCI_SETAUDIO: return MCIQTZ_mciSetAudio (dwDevID, dwParam1, (LPMCI_DGV_SETAUDIO_PARMSW) dwParam2);
1162 case MCI_UPDATE:
1163 return MCIQTZ_mciUpdate(dwDevID, dwParam1, (LPMCI_DGV_UPDATE_PARMS)dwParam2);
1164 case MCI_WINDOW:
1165 return MCIQTZ_mciWindow(dwDevID, dwParam1, (LPMCI_DGV_WINDOW_PARMSW)dwParam2);
1166 case MCI_PUT:
1167 return MCIQTZ_mciPut(dwDevID, dwParam1, (MCI_GENERIC_PARMS*)dwParam2);
1168 case MCI_RECORD:
1169 case MCI_INFO:
1170 case MCI_LOAD:
1171 case MCI_SAVE:
1172 case MCI_FREEZE:
1173 case MCI_REALIZE:
1174 case MCI_UNFREEZE:
1175 case MCI_STEP:
1176 case MCI_COPY:
1177 case MCI_CUT:
1178 case MCI_DELETE:
1179 case MCI_PASTE:
1180 case MCI_CUE:
1181 /* Digital Video specific */
1182 case MCI_CAPTURE:
1183 case MCI_MONITOR:
1184 case MCI_RESERVE:
1185 case MCI_SIGNAL:
1186 case MCI_SETVIDEO:
1187 case MCI_QUALITY:
1188 case MCI_LIST:
1189 case MCI_UNDO:
1190 case MCI_CONFIGURE:
1191 case MCI_RESTORE:
1192 FIXME("Unimplemented command [%08X]\n", wMsg);
1193 break;
1194 case MCI_SPIN:
1195 case MCI_ESCAPE:
1196 WARN("Unsupported command [%08X]\n", wMsg);
1197 break;
1198 case MCI_OPEN:
1199 case MCI_CLOSE:
1200 FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
1201 break;
1202 default:
1203 TRACE("Sending msg [%08X] to default driver proc\n", wMsg);
1204 return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
1207 return MCIERR_UNRECOGNIZED_COMMAND;