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
26 #include "wine/debug.h"
27 #include "mciqtz_private.h"
31 WINE_DEFAULT_DEBUG_CHANNEL(mciqtz
);
33 static DWORD CALLBACK
MCIQTZ_taskThread(LPVOID arg
);
34 static DWORD
MCIQTZ_mciStop(UINT
, DWORD
, LPMCI_GENERIC_PARMS
);
36 /*======================================================================*
37 * MCI QTZ implementation *
38 *======================================================================*/
40 static HINSTANCE MCIQTZ_hInstance
= 0;
42 /***********************************************************************
45 BOOL WINAPI
DllMain(HINSTANCE hInstDLL
, DWORD fdwReason
, LPVOID fImpLoad
)
48 case DLL_PROCESS_ATTACH
:
49 DisableThreadLibraryCalls(hInstDLL
);
50 MCIQTZ_hInstance
= hInstDLL
;
56 /**************************************************************************
57 * MCIQTZ_mciGetOpenDev [internal]
59 static WINE_MCIQTZ
* MCIQTZ_mciGetOpenDev(UINT wDevID
)
61 WINE_MCIQTZ
* wma
= (WINE_MCIQTZ
*)mciGetDriverData(wDevID
);
64 WARN("Invalid wDevID=%u\n", wDevID
);
70 /***************************************************************************
71 * MCIQTZ_relayTaskMessage [internal]
73 static LRESULT
MCIQTZ_relayTaskMessage(DWORD_PTR dwDevID
, UINT wMsg
,
74 DWORD dwFlags
, LPARAM lpParms
)
80 TRACE("(%08lX, %08x, %08x, %08lx)\n", dwDevID
, wMsg
, dwFlags
, lpParms
);
82 wma
= MCIQTZ_mciGetOpenDev(dwDevID
);
84 return MCIERR_INVALID_DEVICE_ID
;
85 EnterCriticalSection(&wma
->cs
);
86 wma
->task
.devid
= dwDevID
;
88 wma
->task
.flags
= dwFlags
;
89 wma
->task
.parms
= lpParms
;
90 SetEvent(wma
->task
.notify
);
91 handles
[0] = wma
->task
.done
;
92 handles
[1] = wma
->task
.thread
;
93 ret
= WaitForMultipleObjects(sizeof(handles
)/sizeof(handles
[0]), handles
,
95 if (ret
== WAIT_OBJECT_0
)
98 res
= MCIERR_INTERNAL
;
99 LeaveCriticalSection(&wma
->cs
);
104 /**************************************************************************
105 * MCIQTZ_drvOpen [internal]
107 static DWORD
MCIQTZ_drvOpen(LPCWSTR str
, LPMCI_OPEN_DRIVER_PARMSW modp
)
110 static const WCHAR mciAviWStr
[] = {'M','C','I','A','V','I',0};
112 TRACE("(%s, %p)\n", debugstr_w(str
), modp
);
114 /* session instance */
118 wma
= HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY
, sizeof(WINE_MCIQTZ
));
122 wma
->stop_event
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
123 wma
->task
.notify
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
124 if (!wma
->task
.notify
) goto err
;
125 wma
->task
.done
= CreateEventW(NULL
, FALSE
, FALSE
, NULL
);
126 if (!wma
->task
.done
) goto err
;
127 wma
->task
.thread
= CreateThread(NULL
, 0, MCIQTZ_taskThread
, &wma
->task
, 0, NULL
);
128 if (!wma
->task
.thread
) goto err
;
129 InitializeCriticalSection(&wma
->cs
);
130 wma
->cs
.DebugInfo
->Spare
[0] = (DWORD_PTR
)(__FILE__
": WINE_MCIQTZ");
131 modp
->wType
= MCI_DEVTYPE_DIGITAL_VIDEO
;
132 wma
->wDevID
= modp
->wDeviceID
;
133 modp
->wCustomCommandTable
= wma
->command_table
= mciLoadCommandResource(MCIQTZ_hInstance
, mciAviWStr
, 0);
134 mciSetDriverData(wma
->wDevID
, (DWORD_PTR
)wma
);
136 return modp
->wDeviceID
;
138 if (wma
->task
.notify
) CloseHandle(wma
->task
.notify
);
139 if (wma
->task
.done
) CloseHandle(wma
->task
.done
);
140 HeapFree(GetProcessHeap(), 0, wma
);
144 /**************************************************************************
145 * MCIQTZ_drvClose [internal]
147 static DWORD
MCIQTZ_drvClose(DWORD dwDevID
)
151 TRACE("(%04x)\n", dwDevID
);
153 wma
= MCIQTZ_mciGetOpenDev(dwDevID
);
156 /* finish all outstanding things */
157 MCIQTZ_relayTaskMessage(dwDevID
, MCI_CLOSE_DRIVER
, MCI_WAIT
, 0);
159 mciFreeCommandResource(wma
->command_table
);
160 MCIQTZ_relayTaskMessage(dwDevID
, MCI_CLOSE
, MCI_WAIT
, 0);
161 WaitForSingleObject(wma
->task
.thread
, INFINITE
);
162 CloseHandle(wma
->task
.notify
);
163 CloseHandle(wma
->task
.done
);
164 CloseHandle(wma
->task
.thread
);
165 wma
->cs
.DebugInfo
->Spare
[0] = 0;
166 DeleteCriticalSection(&wma
->cs
);
167 mciSetDriverData(dwDevID
, 0);
168 CloseHandle(wma
->stop_event
);
169 HeapFree(GetProcessHeap(), 0, wma
);
173 return (dwDevID
== 0xFFFFFFFF) ? 1 : 0;
176 /**************************************************************************
177 * MCIQTZ_drvConfigure [internal]
179 static DWORD
MCIQTZ_drvConfigure(DWORD dwDevID
)
183 TRACE("(%04x)\n", dwDevID
);
185 wma
= MCIQTZ_mciGetOpenDev(dwDevID
);
189 MCIQTZ_mciStop(dwDevID
, MCI_WAIT
, NULL
);
191 MessageBoxA(0, "Sample QTZ Wine Driver !", "MM-Wine Driver", MB_OK
);
196 /**************************************************************************
197 * MCIQTZ_mciNotify [internal]
199 * Notifications in MCI work like a 1-element queue.
200 * Each new notification request supersedes the previous one.
202 static void MCIQTZ_mciNotify(DWORD_PTR hWndCallBack
, WINE_MCIQTZ
* wma
, UINT wStatus
)
204 MCIDEVICEID wDevID
= wma
->notify_devid
;
205 HANDLE old
= InterlockedExchangePointer(&wma
->callback
, NULL
);
206 if (old
) mciDriverNotify(old
, wDevID
, MCI_NOTIFY_SUPERSEDED
);
207 mciDriverNotify(HWND_32(LOWORD(hWndCallBack
)), wDevID
, wStatus
);
210 /***************************************************************************
211 * MCIQTZ_mciOpen [internal]
213 static DWORD
MCIQTZ_mciOpen(UINT wDevID
, DWORD dwFlags
,
214 LPMCI_DGV_OPEN_PARMSW lpOpenParms
)
219 RECT rc
= { 0, 0, 0, 0 };
221 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpOpenParms
);
223 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
225 return MCIERR_INVALID_DEVICE_ID
;
227 MCIQTZ_mciStop(wDevID
, MCI_WAIT
, NULL
);
229 hr
= CoInitializeEx(NULL
, COINIT_MULTITHREADED
);
230 wma
->uninit
= SUCCEEDED(hr
);
232 hr
= CoCreateInstance(&CLSID_FilterGraph
, NULL
, CLSCTX_INPROC_SERVER
, &IID_IGraphBuilder
, (LPVOID
*)&wma
->pgraph
);
234 TRACE("Cannot create filtergraph (hr = %x)\n", hr
);
238 hr
= IGraphBuilder_QueryInterface(wma
->pgraph
, &IID_IMediaControl
, (LPVOID
*)&wma
->pmctrl
);
240 TRACE("Cannot get IMediaControl interface (hr = %x)\n", hr
);
244 hr
= IGraphBuilder_QueryInterface(wma
->pgraph
, &IID_IMediaSeeking
, (void**)&wma
->seek
);
246 TRACE("Cannot get IMediaSeeking interface (hr = %x)\n", hr
);
250 hr
= IGraphBuilder_QueryInterface(wma
->pgraph
, &IID_IMediaEvent
, (void**)&wma
->mevent
);
252 TRACE("Cannot get IMediaEvent interface (hr = %x)\n", hr
);
256 hr
= IGraphBuilder_QueryInterface(wma
->pgraph
, &IID_IVideoWindow
, (void**)&wma
->vidwin
);
258 TRACE("Cannot get IVideoWindow interface (hr = %x)\n", hr
);
262 hr
= IGraphBuilder_QueryInterface(wma
->pgraph
, &IID_IBasicVideo
, (void**)&wma
->vidbasic
);
264 TRACE("Cannot get IBasicVideo interface (hr = %x)\n", hr
);
268 hr
= IGraphBuilder_QueryInterface(wma
->pgraph
, &IID_IBasicAudio
, (void**)&wma
->audio
);
270 TRACE("Cannot get IBasicAudio interface (hr = %x)\n", hr
);
274 if (!(dwFlags
& MCI_OPEN_ELEMENT
) || (dwFlags
& MCI_OPEN_ELEMENT_ID
)) {
275 TRACE("Wrong dwFlags %x\n", dwFlags
);
279 if (!lpOpenParms
->lpstrElementName
|| !lpOpenParms
->lpstrElementName
[0]) {
280 TRACE("Invalid filename specified\n");
284 TRACE("Open file %s\n", debugstr_w(lpOpenParms
->lpstrElementName
));
286 hr
= IGraphBuilder_RenderFile(wma
->pgraph
, lpOpenParms
->lpstrElementName
, NULL
);
288 TRACE("Cannot render file (hr = %x)\n", hr
);
292 IVideoWindow_put_AutoShow(wma
->vidwin
, OAFALSE
);
293 IVideoWindow_put_Visible(wma
->vidwin
, OAFALSE
);
294 if (dwFlags
& MCI_DGV_OPEN_WS
)
295 style
= lpOpenParms
->dwStyle
;
296 if (dwFlags
& MCI_DGV_OPEN_PARENT
) {
297 IVideoWindow_put_MessageDrain(wma
->vidwin
, (OAHWND
)lpOpenParms
->hWndParent
);
298 IVideoWindow_put_WindowState(wma
->vidwin
, SW_HIDE
);
299 IVideoWindow_put_WindowStyle(wma
->vidwin
, style
|WS_CHILD
);
300 IVideoWindow_put_Owner(wma
->vidwin
, (OAHWND
)lpOpenParms
->hWndParent
);
301 GetClientRect(lpOpenParms
->hWndParent
, &rc
);
302 IVideoWindow_SetWindowPosition(wma
->vidwin
, rc
.left
, rc
.top
, rc
.right
- rc
.top
, rc
.bottom
- rc
.top
);
303 wma
->parent
= (HWND
)lpOpenParms
->hWndParent
;
306 IVideoWindow_put_WindowStyle(wma
->vidwin
, style
);
307 IBasicVideo_GetVideoSize(wma
->vidbasic
, &rc
.right
, &rc
.bottom
);
310 if (dwFlags
& MCI_NOTIFY
)
311 mciDriverNotify(HWND_32(LOWORD(lpOpenParms
->dwCallback
)), wDevID
, MCI_NOTIFY_SUCCESSFUL
);
317 IBasicAudio_Release(wma
->audio
);
320 IBasicVideo_Release(wma
->vidbasic
);
321 wma
->vidbasic
= NULL
;
323 IMediaSeeking_Release(wma
->seek
);
326 IVideoWindow_Release(wma
->vidwin
);
329 IGraphBuilder_Release(wma
->pgraph
);
332 IMediaEvent_Release(wma
->mevent
);
335 IMediaControl_Release(wma
->pmctrl
);
342 return MCIERR_INTERNAL
;
345 /***************************************************************************
346 * MCIQTZ_mciClose [internal]
348 static DWORD
MCIQTZ_mciClose(UINT wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
352 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
354 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
356 return MCIERR_INVALID_DEVICE_ID
;
358 MCIQTZ_mciStop(wDevID
, MCI_WAIT
, NULL
);
361 IVideoWindow_Release(wma
->vidwin
);
362 IBasicVideo_Release(wma
->vidbasic
);
363 IBasicAudio_Release(wma
->audio
);
364 IMediaSeeking_Release(wma
->seek
);
365 IMediaEvent_Release(wma
->mevent
);
366 IGraphBuilder_Release(wma
->pgraph
);
367 IMediaControl_Release(wma
->pmctrl
);
376 /***************************************************************************
377 * MCIQTZ_notifyThread [internal]
379 static DWORD CALLBACK
MCIQTZ_notifyThread(LPVOID parm
)
381 WINE_MCIQTZ
* wma
= (WINE_MCIQTZ
*)parm
;
384 DWORD n
= 0, ret
= 0;
386 handle
[n
++] = wma
->stop_event
;
387 IMediaEvent_GetEventHandle(wma
->mevent
, (OAEVENT
*)&handle
[n
++]);
393 r
= WaitForMultipleObjects(n
, handle
, FALSE
, INFINITE
);
394 if (r
== WAIT_OBJECT_0
) {
395 TRACE("got stop event\n");
396 old
= InterlockedExchangePointer(&wma
->callback
, NULL
);
398 mciDriverNotify(old
, wma
->notify_devid
, MCI_NOTIFY_ABORTED
);
401 else if (r
== WAIT_OBJECT_0
+1) {
405 hr
= IMediaEvent_GetEvent(wma
->mevent
, &event_code
, &p1
, &p2
, 0);
407 TRACE("got event_code = 0x%02x\n", event_code
);
408 IMediaEvent_FreeEventParams(wma
->mevent
, event_code
, p1
, p2
);
410 } while (hr
== S_OK
&& event_code
!= EC_COMPLETE
);
411 if (hr
== S_OK
&& event_code
== EC_COMPLETE
) {
412 old
= InterlockedExchangePointer(&wma
->callback
, NULL
);
414 mciDriverNotify(old
, wma
->notify_devid
, MCI_NOTIFY_SUCCESSFUL
);
419 TRACE("Unknown error (%d)\n", (int)r
);
424 hr
= IMediaControl_Stop(wma
->pmctrl
);
426 TRACE("Cannot stop filtergraph (hr = %x)\n", hr
);
427 ret
= MCIERR_INTERNAL
;
433 /***************************************************************************
434 * MCIQTZ_mciPlay [internal]
436 static DWORD
MCIQTZ_mciPlay(UINT wDevID
, DWORD dwFlags
, LPMCI_PLAY_PARMS lpParms
)
440 REFERENCE_TIME time1
= 0, time2
= 0;
444 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
446 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
448 return MCIERR_INVALID_DEVICE_ID
;
450 ResetEvent(wma
->stop_event
);
451 if (dwFlags
& MCI_NOTIFY
) {
453 old
= InterlockedExchangePointer(&wma
->callback
, HWND_32(LOWORD(lpParms
->dwCallback
)));
455 mciDriverNotify(old
, wma
->notify_devid
, MCI_NOTIFY_ABORTED
);
458 IMediaSeeking_GetTimeFormat(wma
->seek
, &format
);
459 if (dwFlags
& MCI_FROM
) {
460 if (IsEqualGUID(&format
, &TIME_FORMAT_MEDIA_TIME
))
461 time1
= lpParms
->dwFrom
* 10000;
463 time1
= lpParms
->dwFrom
;
464 pos1
= AM_SEEKING_AbsolutePositioning
;
466 pos1
= AM_SEEKING_NoPositioning
;
467 if (dwFlags
& MCI_TO
) {
468 if (IsEqualGUID(&format
, &TIME_FORMAT_MEDIA_TIME
))
469 time2
= lpParms
->dwTo
* 10000;
471 time2
= lpParms
->dwTo
;
473 IMediaSeeking_GetDuration(wma
->seek
, &time2
);
474 IMediaSeeking_SetPositions(wma
->seek
, &time1
, pos1
, &time2
, AM_SEEKING_AbsolutePositioning
);
476 hr
= IMediaControl_Run(wma
->pmctrl
);
478 TRACE("Cannot run filtergraph (hr = %x)\n", hr
);
479 return MCIERR_INTERNAL
;
482 IVideoWindow_put_Visible(wma
->vidwin
, OATRUE
);
484 wma
->thread
= CreateThread(NULL
, 0, MCIQTZ_notifyThread
, wma
, 0, NULL
);
486 TRACE("Can't create thread\n");
487 return MCIERR_INTERNAL
;
492 /***************************************************************************
493 * MCIQTZ_mciSeek [internal]
495 static DWORD
MCIQTZ_mciSeek(UINT wDevID
, DWORD dwFlags
, LPMCI_SEEK_PARMS lpParms
)
501 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
503 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
505 return MCIERR_INVALID_DEVICE_ID
;
507 MCIQTZ_mciStop(wDevID
, MCI_WAIT
, NULL
);
509 if (dwFlags
& MCI_SEEK_TO_START
) {
511 } else if (dwFlags
& MCI_SEEK_TO_END
) {
512 FIXME("MCI_SEEK_TO_END not implemented yet\n");
513 return MCIERR_INTERNAL
;
514 } else if (dwFlags
& MCI_TO
) {
515 FIXME("MCI_TO not implemented yet\n");
516 return MCIERR_INTERNAL
;
518 WARN("dwFlag doesn't tell where to seek to...\n");
519 return MCIERR_MISSING_PARAMETER
;
522 hr
= IMediaSeeking_SetPositions(wma
->seek
, &newpos
, AM_SEEKING_AbsolutePositioning
, NULL
, AM_SEEKING_NoPositioning
);
524 FIXME("Cannot set position (hr = %x)\n", hr
);
525 return MCIERR_INTERNAL
;
528 if (dwFlags
& MCI_NOTIFY
)
529 MCIQTZ_mciNotify(lpParms
->dwCallback
, wma
, MCI_NOTIFY_SUCCESSFUL
);
534 /***************************************************************************
535 * MCIQTZ_mciStop [internal]
537 static DWORD
MCIQTZ_mciStop(UINT wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
541 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
543 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
545 return MCIERR_INVALID_DEVICE_ID
;
551 SetEvent(wma
->stop_event
);
552 WaitForSingleObject(wma
->thread
, INFINITE
);
553 CloseHandle(wma
->thread
);
558 IVideoWindow_put_Visible(wma
->vidwin
, OAFALSE
);
563 /***************************************************************************
564 * MCIQTZ_mciPause [internal]
566 static DWORD
MCIQTZ_mciPause(UINT wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
571 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
573 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
575 return MCIERR_INVALID_DEVICE_ID
;
577 hr
= IMediaControl_Pause(wma
->pmctrl
);
579 TRACE("Cannot pause filtergraph (hr = %x)\n", hr
);
580 return MCIERR_INTERNAL
;
586 /***************************************************************************
587 * MCIQTZ_mciResume [internal]
589 static DWORD
MCIQTZ_mciResume(UINT wDevID
, DWORD dwFlags
, LPMCI_GENERIC_PARMS lpParms
)
594 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
596 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
598 return MCIERR_INVALID_DEVICE_ID
;
600 hr
= IMediaControl_Run(wma
->pmctrl
);
602 TRACE("Cannot run filtergraph (hr = %x)\n", hr
);
603 return MCIERR_INTERNAL
;
609 /***************************************************************************
610 * MCIQTZ_mciGetDevCaps [internal]
612 static DWORD
MCIQTZ_mciGetDevCaps(UINT wDevID
, DWORD dwFlags
, LPMCI_GETDEVCAPS_PARMS lpParms
)
616 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
618 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
620 return MCIERR_INVALID_DEVICE_ID
;
622 if (!(dwFlags
& MCI_GETDEVCAPS_ITEM
))
623 return MCIERR_MISSING_PARAMETER
;
625 switch (lpParms
->dwItem
) {
626 case MCI_GETDEVCAPS_CAN_RECORD
:
627 lpParms
->dwReturn
= MAKEMCIRESOURCE(FALSE
, MCI_FALSE
);
628 TRACE("MCI_GETDEVCAPS_CAN_RECORD = %08x\n", lpParms
->dwReturn
);
630 case MCI_GETDEVCAPS_HAS_AUDIO
:
631 lpParms
->dwReturn
= MAKEMCIRESOURCE(TRUE
, MCI_TRUE
);
632 TRACE("MCI_GETDEVCAPS_HAS_AUDIO = %08x\n", lpParms
->dwReturn
);
634 case MCI_GETDEVCAPS_HAS_VIDEO
:
635 lpParms
->dwReturn
= MAKEMCIRESOURCE(TRUE
, MCI_TRUE
);
636 TRACE("MCI_GETDEVCAPS_HAS_VIDEO = %08x\n", lpParms
->dwReturn
);
638 case MCI_GETDEVCAPS_DEVICE_TYPE
:
639 lpParms
->dwReturn
= MAKEMCIRESOURCE(MCI_DEVTYPE_DIGITAL_VIDEO
, MCI_DEVTYPE_DIGITAL_VIDEO
);
640 TRACE("MCI_GETDEVCAPS_DEVICE_TYPE = %08x\n", lpParms
->dwReturn
);
642 case MCI_GETDEVCAPS_USES_FILES
:
643 lpParms
->dwReturn
= MAKEMCIRESOURCE(TRUE
, MCI_TRUE
);
644 TRACE("MCI_GETDEVCAPS_USES_FILES = %08x\n", lpParms
->dwReturn
);
646 case MCI_GETDEVCAPS_COMPOUND_DEVICE
:
647 lpParms
->dwReturn
= MAKEMCIRESOURCE(TRUE
, MCI_TRUE
);
648 TRACE("MCI_GETDEVCAPS_COMPOUND_DEVICE = %08x\n", lpParms
->dwReturn
);
650 case MCI_GETDEVCAPS_CAN_EJECT
:
651 lpParms
->dwReturn
= MAKEMCIRESOURCE(FALSE
, MCI_FALSE
);
652 TRACE("MCI_GETDEVCAPS_EJECT = %08x\n", lpParms
->dwReturn
);
654 case MCI_GETDEVCAPS_CAN_PLAY
:
655 lpParms
->dwReturn
= MAKEMCIRESOURCE(TRUE
, MCI_TRUE
);
656 TRACE("MCI_GETDEVCAPS_CAN_PLAY = %08x\n", lpParms
->dwReturn
);
658 case MCI_GETDEVCAPS_CAN_SAVE
:
659 lpParms
->dwReturn
= MAKEMCIRESOURCE(FALSE
, MCI_FALSE
);
660 TRACE("MCI_GETDEVCAPS_CAN_SAVE = %08x\n", lpParms
->dwReturn
);
662 case MCI_DGV_GETDEVCAPS_CAN_REVERSE
:
663 lpParms
->dwReturn
= MAKEMCIRESOURCE(FALSE
, MCI_FALSE
);
664 TRACE("MCI_DGV_GETDEVCAPS_CAN_REVERSE = %08x\n", lpParms
->dwReturn
);
666 case MCI_DGV_GETDEVCAPS_CAN_STRETCH
:
667 lpParms
->dwReturn
= MAKEMCIRESOURCE(FALSE
, MCI_FALSE
); /* FIXME */
668 TRACE("MCI_DGV_GETDEVCAPS_CAN_STRETCH = %08x\n", lpParms
->dwReturn
);
670 case MCI_DGV_GETDEVCAPS_CAN_LOCK
:
671 lpParms
->dwReturn
= MAKEMCIRESOURCE(FALSE
, MCI_FALSE
);
672 TRACE("MCI_DGV_GETDEVCAPS_CAN_LOCK = %08x\n", lpParms
->dwReturn
);
674 case MCI_DGV_GETDEVCAPS_CAN_FREEZE
:
675 lpParms
->dwReturn
= MAKEMCIRESOURCE(FALSE
, MCI_FALSE
);
676 TRACE("MCI_DGV_GETDEVCAPS_CAN_FREEZE = %08x\n", lpParms
->dwReturn
);
678 case MCI_DGV_GETDEVCAPS_CAN_STR_IN
:
679 lpParms
->dwReturn
= MAKEMCIRESOURCE(FALSE
, MCI_FALSE
);
680 TRACE("MCI_DGV_GETDEVCAPS_CAN_STRETCH_INPUT = %08x\n", lpParms
->dwReturn
);
682 case MCI_DGV_GETDEVCAPS_HAS_STILL
:
683 lpParms
->dwReturn
= MAKEMCIRESOURCE(FALSE
, MCI_FALSE
);
684 TRACE("MCI_DGV_GETDEVCAPS_HAS_STILL = %08x\n", lpParms
->dwReturn
);
686 case MCI_DGV_GETDEVCAPS_CAN_TEST
:
687 lpParms
->dwReturn
= MAKEMCIRESOURCE(FALSE
, MCI_FALSE
); /* FIXME */
688 TRACE("MCI_DGV_GETDEVCAPS_CAN_TEST = %08x\n", lpParms
->dwReturn
);
690 case MCI_DGV_GETDEVCAPS_MAX_WINDOWS
:
691 lpParms
->dwReturn
= 1;
692 TRACE("MCI_DGV_GETDEVCAPS_MAX_WINDOWS = %u\n", lpParms
->dwReturn
);
695 WARN("Unknown capability %08x\n", lpParms
->dwItem
);
697 case MCI_DGV_GETDEVCAPS_MAXIMUM_RATE
: /* unknown to w2k */
698 case MCI_DGV_GETDEVCAPS_MINIMUM_RATE
: /* unknown to w2k */
699 return MCIERR_UNSUPPORTED_FUNCTION
;
702 return MCI_RESOURCE_RETURNED
;
705 /***************************************************************************
706 * MCIQTZ_mciSet [internal]
708 static DWORD
MCIQTZ_mciSet(UINT wDevID
, DWORD dwFlags
, LPMCI_DGV_SET_PARMS lpParms
)
712 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
714 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
716 return MCIERR_INVALID_DEVICE_ID
;
718 if (dwFlags
& MCI_SET_TIME_FORMAT
) {
719 switch (lpParms
->dwTimeFormat
) {
720 case MCI_FORMAT_MILLISECONDS
:
721 TRACE("MCI_SET_TIME_FORMAT = MCI_FORMAT_MILLISECONDS\n");
722 wma
->time_format
= MCI_FORMAT_MILLISECONDS
;
724 case MCI_FORMAT_FRAMES
:
725 TRACE("MCI_SET_TIME_FORMAT = MCI_FORMAT_FRAMES\n");
726 wma
->time_format
= MCI_FORMAT_FRAMES
;
729 WARN("Bad time format %u\n", lpParms
->dwTimeFormat
);
730 return MCIERR_BAD_TIME_FORMAT
;
734 if (dwFlags
& MCI_SET_DOOR_OPEN
)
735 FIXME("MCI_SET_DOOR_OPEN not implemented yet\n");
736 if (dwFlags
& MCI_SET_DOOR_CLOSED
)
737 FIXME("MCI_SET_DOOR_CLOSED not implemented yet\n");
738 if (dwFlags
& MCI_SET_AUDIO
)
739 FIXME("MCI_SET_AUDIO not implemented yet\n");
740 if (dwFlags
& MCI_SET_VIDEO
)
741 FIXME("MCI_SET_VIDEO not implemented yet\n");
742 if (dwFlags
& MCI_SET_ON
)
743 FIXME("MCI_SET_ON not implemented yet\n");
744 if (dwFlags
& MCI_SET_OFF
)
745 FIXME("MCI_SET_OFF not implemented yet\n");
746 if (dwFlags
& MCI_SET_AUDIO_LEFT
)
747 FIXME("MCI_SET_AUDIO_LEFT not implemented yet\n");
748 if (dwFlags
& MCI_SET_AUDIO_RIGHT
)
749 FIXME("MCI_SET_AUDIO_RIGHT not implemented yet\n");
751 if (dwFlags
& ~0x7f03 /* All MCI_SET flags mask */)
752 ERR("Unknown flags %08x\n", dwFlags
& ~0x7f03);
757 /***************************************************************************
758 * MCIQTZ_mciStatus [internal]
760 static DWORD
MCIQTZ_mciStatus(UINT wDevID
, DWORD dwFlags
, LPMCI_DGV_STATUS_PARMSW lpParms
)
764 DWORD ret
= MCI_INTEGER_RETURNED
;
766 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
768 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
770 return MCIERR_INVALID_DEVICE_ID
;
772 if (!(dwFlags
& MCI_STATUS_ITEM
)) {
773 WARN("No status item specified\n");
774 return MCIERR_UNRECOGNIZED_COMMAND
;
777 switch (lpParms
->dwItem
) {
778 case MCI_STATUS_LENGTH
: {
779 LONGLONG duration
= -1;
781 switch (wma
->time_format
) {
782 case MCI_FORMAT_MILLISECONDS
: format
= TIME_FORMAT_MEDIA_TIME
; break;
783 case MCI_FORMAT_FRAMES
: format
= TIME_FORMAT_FRAME
; break;
784 default: ERR("Unhandled format %x\n", wma
->time_format
); break;
786 hr
= IMediaSeeking_SetTimeFormat(wma
->seek
, &format
);
788 FIXME("Cannot set time format (hr = %x)\n", hr
);
789 lpParms
->dwReturn
= 0;
792 hr
= IMediaSeeking_GetDuration(wma
->seek
, &duration
);
793 if (FAILED(hr
) || duration
< 0) {
794 FIXME("Cannot read duration (hr = %x)\n", hr
);
795 lpParms
->dwReturn
= 0;
796 } else if (wma
->time_format
!= MCI_FORMAT_MILLISECONDS
)
797 lpParms
->dwReturn
= duration
;
799 lpParms
->dwReturn
= duration
/ 10000;
802 case MCI_STATUS_POSITION
: {
803 REFERENCE_TIME curpos
;
805 hr
= IMediaSeeking_GetCurrentPosition(wma
->seek
, &curpos
);
807 FIXME("Cannot get position (hr = %x)\n", hr
);
808 return MCIERR_INTERNAL
;
810 lpParms
->dwReturn
= curpos
/ 10000;
813 case MCI_STATUS_NUMBER_OF_TRACKS
:
814 FIXME("MCI_STATUS_NUMBER_OF_TRACKS not implemented yet\n");
815 return MCIERR_UNRECOGNIZED_COMMAND
;
816 case MCI_STATUS_MODE
: {
817 LONG state
= State_Stopped
;
818 IMediaControl_GetState(wma
->pmctrl
, -1, &state
);
819 if (state
== State_Stopped
)
820 lpParms
->dwReturn
= MAKEMCIRESOURCE(MCI_MODE_STOP
, MCI_MODE_STOP
);
821 else if (state
== State_Running
) {
822 lpParms
->dwReturn
= MAKEMCIRESOURCE(MCI_MODE_PLAY
, MCI_MODE_PLAY
);
823 if (!wma
->thread
|| WaitForSingleObject(wma
->thread
, 0) == WAIT_OBJECT_0
)
824 lpParms
->dwReturn
= MAKEMCIRESOURCE(MCI_MODE_STOP
, MCI_MODE_STOP
);
825 } else if (state
== State_Paused
)
826 lpParms
->dwReturn
= MAKEMCIRESOURCE(MCI_MODE_PAUSE
, MCI_MODE_PAUSE
);
827 ret
= MCI_RESOURCE_RETURNED
;
830 case MCI_STATUS_MEDIA_PRESENT
:
831 FIXME("MCI_STATUS_MEDIA_PRESENT not implemented yet\n");
832 return MCIERR_UNRECOGNIZED_COMMAND
;
833 case MCI_STATUS_TIME_FORMAT
:
834 lpParms
->dwReturn
= MAKEMCIRESOURCE(wma
->time_format
,
835 MCI_FORMAT_RETURN_BASE
+ wma
->time_format
);
836 ret
= MCI_RESOURCE_RETURNED
;
838 case MCI_STATUS_READY
:
839 FIXME("MCI_STATUS_READY not implemented yet\n");
840 return MCIERR_UNRECOGNIZED_COMMAND
;
841 case MCI_STATUS_CURRENT_TRACK
:
842 FIXME("MCI_STATUS_CURRENT_TRACK not implemented yet\n");
843 return MCIERR_UNRECOGNIZED_COMMAND
;
845 FIXME("Unknown command %08X\n", lpParms
->dwItem
);
846 return MCIERR_UNRECOGNIZED_COMMAND
;
849 if (dwFlags
& MCI_NOTIFY
)
850 MCIQTZ_mciNotify(lpParms
->dwCallback
, wma
, MCI_NOTIFY_SUCCESSFUL
);
855 /***************************************************************************
856 * MCIQTZ_mciWhere [internal]
858 static DWORD
MCIQTZ_mciWhere(UINT wDevID
, DWORD dwFlags
, LPMCI_DGV_RECT_PARMS lpParms
)
864 DWORD ret
= MCIERR_UNRECOGNIZED_COMMAND
;
866 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
868 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
870 return MCIERR_INVALID_DEVICE_ID
;
872 hr
= IVideoWindow_get_Owner(wma
->vidwin
, (OAHWND
*)&hWnd
);
874 TRACE("No video stream, returning no window error\n");
875 return MCIERR_NO_WINDOW
;
878 if (dwFlags
& MCI_DGV_WHERE_SOURCE
) {
879 if (dwFlags
& MCI_DGV_WHERE_MAX
)
880 FIXME("MCI_DGV_WHERE_SOURCE_MAX stub\n");
881 IBasicVideo_GetSourcePosition(wma
->vidbasic
, &rc
.left
, &rc
.top
, &rc
.right
, &rc
.bottom
);
882 TRACE("MCI_DGV_WHERE_SOURCE %s\n", wine_dbgstr_rect(&rc
));
884 if (dwFlags
& MCI_DGV_WHERE_DESTINATION
) {
885 if (dwFlags
& MCI_DGV_WHERE_MAX
)
886 FIXME("MCI_DGV_WHERE_DESTINATION_MAX stub\n");
887 IBasicVideo_GetDestinationPosition(wma
->vidbasic
, &rc
.left
, &rc
.top
, &rc
.right
, &rc
.bottom
);
888 TRACE("MCI_DGV_WHERE_DESTINATION %s\n", wine_dbgstr_rect(&rc
));
890 if (dwFlags
& MCI_DGV_WHERE_FRAME
) {
891 if (dwFlags
& MCI_DGV_WHERE_MAX
)
892 FIXME("MCI_DGV_WHERE_FRAME_MAX not supported yet\n");
894 FIXME("MCI_DGV_WHERE_FRAME not supported yet\n");
897 if (dwFlags
& MCI_DGV_WHERE_VIDEO
) {
898 if (dwFlags
& MCI_DGV_WHERE_MAX
)
899 FIXME("MCI_DGV_WHERE_VIDEO_MAX not supported yet\n");
901 FIXME("MCI_DGV_WHERE_VIDEO not supported yet\n");
904 if (dwFlags
& MCI_DGV_WHERE_WINDOW
) {
905 if (dwFlags
& MCI_DGV_WHERE_MAX
) {
906 GetWindowRect(GetDesktopWindow(), &rc
);
909 TRACE("MCI_DGV_WHERE_WINDOW_MAX %s\n", wine_dbgstr_rect(&rc
));
911 IVideoWindow_GetWindowPosition(wma
->vidwin
, &rc
.left
, &rc
.top
, &rc
.right
, &rc
.bottom
);
912 TRACE("MCI_DGV_WHERE_WINDOW %s\n", wine_dbgstr_rect(&rc
));
921 /***************************************************************************
922 * MCIQTZ_mciWindow [internal]
924 static DWORD
MCIQTZ_mciWindow(UINT wDevID
, DWORD dwFlags
, LPMCI_DGV_WINDOW_PARMSW lpParms
)
926 WINE_MCIQTZ
*wma
= MCIQTZ_mciGetOpenDev(wDevID
);
928 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
931 return MCIERR_INVALID_DEVICE_ID
;
932 if (dwFlags
& MCI_TEST
)
935 if (dwFlags
& MCI_DGV_WINDOW_HWND
&& (IsWindow(lpParms
->hWnd
) || !lpParms
->hWnd
)) {
936 LONG visible
= OATRUE
;
938 TRACE("Setting hWnd to %p\n", lpParms
->hWnd
);
939 IVideoWindow_get_Visible(wma
->vidwin
, &visible
);
940 IVideoWindow_put_Visible(wma
->vidwin
, OAFALSE
);
941 IVideoWindow_get_WindowStyle(wma
->vidwin
, &style
);
944 IVideoWindow_put_WindowStyle(wma
->vidwin
, style
|WS_CHILD
);
946 IVideoWindow_put_WindowStyle(wma
->vidwin
, style
);
947 IVideoWindow_put_Owner(wma
->vidwin
, (OAHWND
)lpParms
->hWnd
);
948 IVideoWindow_put_MessageDrain(wma
->vidwin
, (OAHWND
)lpParms
->hWnd
);
949 IVideoWindow_put_Visible(wma
->vidwin
, visible
);
950 wma
->parent
= lpParms
->hWnd
;
952 if (dwFlags
& MCI_DGV_WINDOW_STATE
) {
953 TRACE("Setting nCmdShow to %d\n", lpParms
->nCmdShow
);
954 IVideoWindow_put_WindowState(wma
->vidwin
, lpParms
->nCmdShow
);
956 if (dwFlags
& MCI_DGV_WINDOW_TEXT
) {
957 TRACE("Setting caption to %s\n", debugstr_w(lpParms
->lpstrText
));
958 IVideoWindow_put_Caption(wma
->vidwin
, lpParms
->lpstrText
);
963 /***************************************************************************
964 * MCIQTZ_mciPut [internal]
966 static DWORD
MCIQTZ_mciPut(UINT wDevID
, DWORD dwFlags
, MCI_GENERIC_PARMS
*lpParms
)
968 WINE_MCIQTZ
*wma
= MCIQTZ_mciGetOpenDev(wDevID
);
969 MCI_DGV_RECT_PARMS
*rectparms
;
972 TRACE("(%04x, %08X, %p)\n", wDevID
, dwFlags
, lpParms
);
975 return MCIERR_INVALID_DEVICE_ID
;
977 if (!(dwFlags
& MCI_DGV_RECT
)) {
978 FIXME("No support for non-RECT MCI_PUT\n");
982 if (dwFlags
& MCI_TEST
)
985 dwFlags
&= ~MCI_DGV_RECT
;
986 rectparms
= (MCI_DGV_RECT_PARMS
*)lpParms
;
988 if (dwFlags
& MCI_DGV_PUT_DESTINATION
) {
989 hr
= IVideoWindow_SetWindowPosition(wma
->vidwin
,
990 rectparms
->rc
.left
, rectparms
->rc
.top
,
991 rectparms
->rc
.right
- rectparms
->rc
.left
,
992 rectparms
->rc
.bottom
- rectparms
->rc
.top
);
994 WARN("IVideoWindow_SetWindowPosition failed: 0x%x\n", hr
);
996 dwFlags
&= ~MCI_DGV_PUT_DESTINATION
;
999 if (dwFlags
& MCI_NOTIFY
) {
1000 MCIQTZ_mciNotify(lpParms
->dwCallback
, wma
, MCI_NOTIFY_SUCCESSFUL
);
1001 dwFlags
&= ~MCI_NOTIFY
;
1005 FIXME("No support for some flags: 0x%x\n", dwFlags
);
1010 /******************************************************************************
1011 * MCIAVI_mciUpdate [internal]
1013 static DWORD
MCIQTZ_mciUpdate(UINT wDevID
, DWORD dwFlags
, LPMCI_DGV_UPDATE_PARMS lpParms
)
1018 TRACE("%04x, %08x, %p\n", wDevID
, dwFlags
, lpParms
);
1020 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
1022 return MCIERR_INVALID_DEVICE_ID
;
1024 if (dwFlags
& MCI_DGV_UPDATE_HDC
) {
1030 LONG visible
= OATRUE
;
1032 res
= MCIERR_INTERNAL
;
1033 IMediaControl_GetState(wma
->pmctrl
, -1, &state
);
1034 if (state
== State_Running
)
1035 return MCIERR_UNSUPPORTED_FUNCTION
;
1036 /* If in stopped state, nothing has been drawn to screen
1037 * moving to pause, which is needed for the old dib renderer, will result
1038 * in a single frame drawn, so hide the window here */
1039 IVideoWindow_get_Visible(wma
->vidwin
, &visible
);
1041 IVideoWindow_put_Visible(wma
->vidwin
, OAFALSE
);
1042 /* FIXME: Should we check the original state and restore it? */
1043 IMediaControl_Pause(wma
->pmctrl
);
1044 IMediaControl_GetState(wma
->pmctrl
, -1, &state
);
1045 if (FAILED(hr
= IBasicVideo_GetCurrentImage(wma
->vidbasic
, &size
, NULL
))) {
1046 WARN("Could not get image size (hr = %x)\n", hr
);
1049 data
= HeapAlloc(GetProcessHeap(), 0, size
);
1050 info
= (BITMAPINFO
*)data
;
1051 IBasicVideo_GetCurrentImage(wma
->vidbasic
, &size
, (LONG
*)data
);
1052 data
+= info
->bmiHeader
.biSize
;
1054 IBasicVideo_GetSourcePosition(wma
->vidbasic
, &src
.left
, &src
.top
, &src
.right
, &src
.bottom
);
1055 IBasicVideo_GetDestinationPosition(wma
->vidbasic
, &dest
.left
, &dest
.top
, &dest
.right
, &dest
.bottom
);
1056 StretchDIBits(lpParms
->hDC
,
1057 dest
.left
, dest
.top
, dest
.right
+ dest
.left
, dest
.bottom
+ dest
.top
,
1058 src
.left
, src
.top
, src
.right
+ src
.left
, src
.bottom
+ src
.top
,
1059 data
, info
, DIB_RGB_COLORS
, SRCCOPY
);
1060 HeapFree(GetProcessHeap(), 0, data
);
1064 IVideoWindow_put_Visible(wma
->vidwin
, visible
);
1067 FIXME("Unhandled flags %x\n", dwFlags
);
1071 /***************************************************************************
1072 * MCIQTZ_mciSetAudio [internal]
1074 static DWORD
MCIQTZ_mciSetAudio(UINT wDevID
, DWORD dwFlags
, LPMCI_DGV_SETAUDIO_PARMSW lpParms
)
1079 TRACE("(%04x, %08x, %p)\n", wDevID
, dwFlags
, lpParms
);
1081 wma
= MCIQTZ_mciGetOpenDev(wDevID
);
1083 return MCIERR_INVALID_DEVICE_ID
;
1085 if (!(dwFlags
& MCI_DGV_SETAUDIO_ITEM
)) {
1086 FIXME("Unknown flags (%08x)\n", dwFlags
);
1090 if (dwFlags
& MCI_DGV_SETAUDIO_ITEM
) {
1091 switch (lpParms
->dwItem
) {
1092 case MCI_DGV_SETAUDIO_VOLUME
:
1093 if (dwFlags
& MCI_DGV_SETAUDIO_VALUE
) {
1096 if (lpParms
->dwValue
> 1000) {
1097 ret
= MCIERR_OUTOFRANGE
;
1100 if (dwFlags
& MCI_TEST
)
1102 vol
+= (long)lpParms
->dwValue
* 10;
1103 hr
= IBasicAudio_put_Volume(wma
->audio
, vol
);
1105 WARN("Cannot set volume (hr = %x)\n", hr
);
1106 ret
= MCIERR_INTERNAL
;
1111 FIXME("Unknown item %08x\n", lpParms
->dwItem
);
1119 /***************************************************************************
1120 * MCIQTZ_taskThread [internal]
1122 static DWORD CALLBACK
MCIQTZ_taskThread(LPVOID arg
)
1124 WINE_MCIQTZ_TASK
*task
= (WINE_MCIQTZ_TASK
*)arg
;
1127 DWORD ret
= WaitForSingleObject(task
->notify
, INFINITE
);
1128 if (ret
!= WAIT_OBJECT_0
) {
1129 TRACE("Got error (%u)\n", ret
);
1133 switch (task
->msg
) {
1134 case MCI_OPEN_DRIVER
:
1135 task
->res
= MCIQTZ_mciOpen(task
->devid
, task
->flags
, (LPMCI_DGV_OPEN_PARMSW
)task
->parms
);
1137 case MCI_CLOSE_DRIVER
:
1138 task
->res
= MCIQTZ_mciClose(task
->devid
, task
->flags
, (LPMCI_GENERIC_PARMS
)task
->parms
);
1141 task
->res
= MCIQTZ_mciPlay(task
->devid
, task
->flags
, (LPMCI_PLAY_PARMS
)task
->parms
);
1144 task
->res
= MCIQTZ_mciSeek(task
->devid
, task
->flags
, (LPMCI_SEEK_PARMS
)task
->parms
);
1147 task
->res
= MCIQTZ_mciStop(task
->devid
, task
->flags
, (LPMCI_GENERIC_PARMS
)task
->parms
);
1150 task
->res
= MCIQTZ_mciPause(task
->devid
, task
->flags
, (LPMCI_GENERIC_PARMS
)task
->parms
);
1153 task
->res
= MCIQTZ_mciResume(task
->devid
, task
->flags
, (LPMCI_GENERIC_PARMS
)task
->parms
);
1155 case MCI_GETDEVCAPS
:
1156 task
->res
= MCIQTZ_mciGetDevCaps(task
->devid
, task
->flags
, (LPMCI_GETDEVCAPS_PARMS
)task
->parms
);
1159 task
->res
= MCIQTZ_mciSet(task
->devid
, task
->flags
, (LPMCI_DGV_SET_PARMS
)task
->parms
);
1162 task
->res
= MCIQTZ_mciStatus(task
->devid
, task
->flags
, (LPMCI_DGV_STATUS_PARMSW
)task
->parms
);
1165 task
->res
= MCIQTZ_mciWhere(task
->devid
, task
->flags
, (LPMCI_DGV_RECT_PARMS
)task
->parms
);
1168 task
->res
= MCIQTZ_mciSetAudio(task
->devid
, task
->flags
, (LPMCI_DGV_SETAUDIO_PARMSW
)task
->parms
);
1171 task
->res
= MCIQTZ_mciUpdate(task
->devid
, task
->flags
, (LPMCI_DGV_UPDATE_PARMS
)task
->parms
);
1174 task
->res
= MCIQTZ_mciWindow(task
->devid
, task
->flags
, (LPMCI_DGV_WINDOW_PARMSW
)task
->parms
);
1177 task
->res
= MCIQTZ_mciPut(task
->devid
, task
->flags
, (MCI_GENERIC_PARMS
*)task
->parms
);
1180 /* Special internal message */
1181 SetEvent(task
->done
);
1184 FIXME("Shouldn't receive another message (%04x)\n", task
->msg
);
1185 task
->res
= MCIERR_UNRECOGNIZED_COMMAND
;
1188 SetEvent(task
->done
);
1195 /*======================================================================*
1196 * MCI QTZ entry points *
1197 *======================================================================*/
1199 /**************************************************************************
1200 * DriverProc (MCIQTZ.@)
1202 LRESULT CALLBACK
MCIQTZ_DriverProc(DWORD_PTR dwDevID
, HDRVR hDriv
, UINT wMsg
,
1203 LPARAM dwParam1
, LPARAM dwParam2
)
1205 TRACE("(%08lX, %p, %08X, %08lX, %08lX)\n",
1206 dwDevID
, hDriv
, wMsg
, dwParam1
, dwParam2
);
1209 case DRV_LOAD
: return 1;
1210 case DRV_FREE
: return 1;
1211 case DRV_OPEN
: return MCIQTZ_drvOpen((LPCWSTR
)dwParam1
, (LPMCI_OPEN_DRIVER_PARMSW
)dwParam2
);
1212 case DRV_CLOSE
: return MCIQTZ_drvClose(dwDevID
);
1213 case DRV_ENABLE
: return 1;
1214 case DRV_DISABLE
: return 1;
1215 case DRV_QUERYCONFIGURE
: return 1;
1216 case DRV_CONFIGURE
: return MCIQTZ_drvConfigure(dwDevID
);
1217 case DRV_INSTALL
: return DRVCNF_RESTART
;
1218 case DRV_REMOVE
: return DRVCNF_RESTART
;
1221 /* session instance */
1222 if (dwDevID
== 0xFFFFFFFF)
1226 case MCI_OPEN_DRIVER
:
1229 case MCI_GETDEVCAPS
:
1233 if (!dwParam2
) return MCIERR_NULL_PARAMETER_BLOCK
;
1234 return MCIQTZ_relayTaskMessage(dwDevID
, wMsg
, dwParam1
, dwParam2
);
1235 case MCI_CLOSE_DRIVER
:
1239 return MCIQTZ_relayTaskMessage(dwDevID
, wMsg
, dwParam1
, dwParam2
);
1240 /* Digital Video specific */
1245 if (!dwParam2
) return MCIERR_NULL_PARAMETER_BLOCK
;
1246 return MCIQTZ_relayTaskMessage(dwDevID
, wMsg
, dwParam1
, dwParam2
);
1260 /* Digital Video specific */
1271 FIXME("Unimplemented command [%08X]\n", wMsg
);
1275 WARN("Unsupported command [%08X]\n", wMsg
);
1279 FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
1282 TRACE("Sending msg [%08X] to default driver proc\n", wMsg
);
1283 return DefDriverProc(dwDevID
, hDriv
, wMsg
, dwParam1
, dwParam2
);
1286 return MCIERR_UNRECOGNIZED_COMMAND
;