2009-02-26 23:27:36 +01:00
|
|
|
/*
|
|
|
|
* DirectShow MCI Driver
|
|
|
|
*
|
|
|
|
* Copyright 2009 Christian Costa
|
|
|
|
*
|
|
|
|
* 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
|
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
2016-07-09 10:50:52 +02:00
|
|
|
#include <math.h>
|
2009-02-26 23:27:36 +01:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winbase.h"
|
2009-03-29 23:50:26 +02:00
|
|
|
#include "winuser.h"
|
2009-02-26 23:27:36 +01:00
|
|
|
#include "mmddk.h"
|
|
|
|
#include "wine/debug.h"
|
2009-03-29 23:50:26 +02:00
|
|
|
#include "mciqtz_private.h"
|
2009-03-29 23:51:49 +02:00
|
|
|
#include "digitalv.h"
|
2009-03-31 21:38:02 +02:00
|
|
|
#include "wownt32.h"
|
2009-02-26 23:27:36 +01:00
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(mciqtz);
|
|
|
|
|
2016-05-04 19:42:53 +02:00
|
|
|
static DWORD MCIQTZ_mciClose(UINT, DWORD, LPMCI_GENERIC_PARMS);
|
2009-03-29 23:50:26 +02:00
|
|
|
static DWORD MCIQTZ_mciStop(UINT, DWORD, LPMCI_GENERIC_PARMS);
|
|
|
|
|
2009-02-26 23:27:36 +01:00
|
|
|
/*======================================================================*
|
2009-04-21 23:32:09 +02:00
|
|
|
* MCI QTZ implementation *
|
2009-02-26 23:27:36 +01:00
|
|
|
*======================================================================*/
|
|
|
|
|
2011-05-13 17:23:56 +02:00
|
|
|
static HINSTANCE MCIQTZ_hInstance = 0;
|
2009-02-26 23:27:36 +01:00
|
|
|
|
|
|
|
/***********************************************************************
|
2009-04-21 23:32:09 +02:00
|
|
|
* DllMain (MCIQTZ.0)
|
2009-02-26 23:27:36 +01:00
|
|
|
*/
|
|
|
|
BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID fImpLoad)
|
|
|
|
{
|
|
|
|
switch (fdwReason) {
|
|
|
|
case DLL_PROCESS_ATTACH:
|
|
|
|
DisableThreadLibraryCalls(hInstDLL);
|
2009-04-21 23:32:09 +02:00
|
|
|
MCIQTZ_hInstance = hInstDLL;
|
|
|
|
break;
|
2009-02-26 23:27:36 +01:00
|
|
|
}
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2009-04-23 00:03:52 +02:00
|
|
|
/**************************************************************************
|
|
|
|
* MCIQTZ_mciGetOpenDev [internal]
|
|
|
|
*/
|
|
|
|
static WINE_MCIQTZ* MCIQTZ_mciGetOpenDev(UINT wDevID)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma = (WINE_MCIQTZ*)mciGetDriverData(wDevID);
|
|
|
|
|
|
|
|
if (!wma) {
|
|
|
|
WARN("Invalid wDevID=%u\n", wDevID);
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
return wma;
|
|
|
|
}
|
|
|
|
|
2009-03-29 23:50:26 +02:00
|
|
|
/**************************************************************************
|
|
|
|
* MCIQTZ_drvOpen [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_drvOpen(LPCWSTR str, LPMCI_OPEN_DRIVER_PARMSW modp)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
|
2009-04-16 20:29:06 +02:00
|
|
|
TRACE("(%s, %p)\n", debugstr_w(str), modp);
|
2009-03-29 23:50:26 +02:00
|
|
|
|
|
|
|
/* session instance */
|
|
|
|
if (!modp)
|
|
|
|
return 0xFFFFFFFF;
|
|
|
|
|
|
|
|
wma = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(WINE_MCIQTZ));
|
|
|
|
if (!wma)
|
|
|
|
return 0;
|
|
|
|
|
2015-03-17 16:04:59 +01:00
|
|
|
wma->stop_event = CreateEventW(NULL, FALSE, FALSE, NULL);
|
2010-05-18 15:07:34 +02:00
|
|
|
modp->wType = MCI_DEVTYPE_DIGITAL_VIDEO;
|
2009-03-29 23:50:26 +02:00
|
|
|
wma->wDevID = modp->wDeviceID;
|
2020-10-01 23:26:31 +02:00
|
|
|
modp->wCustomCommandTable = wma->command_table = mciLoadCommandResource(MCIQTZ_hInstance, L"MCIAVI", 0);
|
2009-03-29 23:50:26 +02:00
|
|
|
mciSetDriverData(wma->wDevID, (DWORD_PTR)wma);
|
|
|
|
|
|
|
|
return modp->wDeviceID;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* MCIQTZ_drvClose [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_drvClose(DWORD dwDevID)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04lx)\n", dwDevID);
|
2009-03-29 23:50:26 +02:00
|
|
|
|
2009-04-23 00:03:52 +02:00
|
|
|
wma = MCIQTZ_mciGetOpenDev(dwDevID);
|
2009-03-29 23:50:26 +02:00
|
|
|
|
|
|
|
if (wma) {
|
2009-04-23 00:04:04 +02:00
|
|
|
/* finish all outstanding things */
|
2016-05-04 19:42:53 +02:00
|
|
|
MCIQTZ_mciClose(dwDevID, MCI_WAIT, NULL);
|
2009-04-23 00:04:04 +02:00
|
|
|
|
2010-05-18 15:07:34 +02:00
|
|
|
mciFreeCommandResource(wma->command_table);
|
2009-11-23 09:28:00 +01:00
|
|
|
mciSetDriverData(dwDevID, 0);
|
2015-03-17 16:04:59 +01:00
|
|
|
CloseHandle(wma->stop_event);
|
2009-03-29 23:50:26 +02:00
|
|
|
HeapFree(GetProcessHeap(), 0, wma);
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return (dwDevID == 0xFFFFFFFF) ? 1 : 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**************************************************************************
|
|
|
|
* MCIQTZ_drvConfigure [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_drvConfigure(DWORD dwDevID)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04lx)\n", dwDevID);
|
2009-03-29 23:50:26 +02:00
|
|
|
|
2009-04-23 00:03:52 +02:00
|
|
|
wma = MCIQTZ_mciGetOpenDev(dwDevID);
|
2009-04-23 00:04:04 +02:00
|
|
|
if (!wma)
|
|
|
|
return 0;
|
2009-03-29 23:50:26 +02:00
|
|
|
|
2009-04-23 00:04:04 +02:00
|
|
|
MCIQTZ_mciStop(dwDevID, MCI_WAIT, NULL);
|
2009-03-29 23:50:26 +02:00
|
|
|
|
2009-04-23 00:04:04 +02:00
|
|
|
MessageBoxA(0, "Sample QTZ Wine Driver !", "MM-Wine Driver", MB_OK);
|
|
|
|
|
|
|
|
return 1;
|
2009-03-29 23:50:26 +02:00
|
|
|
}
|
|
|
|
|
2015-03-17 16:04:59 +01:00
|
|
|
/**************************************************************************
|
|
|
|
* MCIQTZ_mciNotify [internal]
|
|
|
|
*
|
|
|
|
* Notifications in MCI work like a 1-element queue.
|
|
|
|
* Each new notification request supersedes the previous one.
|
|
|
|
*/
|
|
|
|
static void MCIQTZ_mciNotify(DWORD_PTR hWndCallBack, WINE_MCIQTZ* wma, UINT wStatus)
|
|
|
|
{
|
|
|
|
MCIDEVICEID wDevID = wma->notify_devid;
|
|
|
|
HANDLE old = InterlockedExchangePointer(&wma->callback, NULL);
|
|
|
|
if (old) mciDriverNotify(old, wDevID, MCI_NOTIFY_SUPERSEDED);
|
|
|
|
mciDriverNotify(HWND_32(LOWORD(hWndCallBack)), wDevID, wStatus);
|
|
|
|
}
|
|
|
|
|
2009-03-29 23:51:49 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciOpen [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags,
|
|
|
|
LPMCI_DGV_OPEN_PARMSW lpOpenParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
HRESULT hr;
|
2010-06-03 21:08:15 +02:00
|
|
|
DWORD style = 0;
|
|
|
|
RECT rc = { 0, 0, 0, 0 };
|
2009-03-29 23:51:49 +02:00
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpOpenParms);
|
2009-03-29 23:51:49 +02:00
|
|
|
|
2016-05-04 19:42:53 +02:00
|
|
|
if(!lpOpenParms)
|
|
|
|
return MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
|
2009-04-23 00:03:52 +02:00
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
2009-03-29 23:51:49 +02:00
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
2009-04-23 00:04:04 +02:00
|
|
|
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
|
|
|
|
|
2010-04-12 11:21:27 +02:00
|
|
|
hr = CoInitializeEx(NULL, COINIT_MULTITHREADED);
|
|
|
|
wma->uninit = SUCCEEDED(hr);
|
2009-03-29 23:51:49 +02:00
|
|
|
|
|
|
|
hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&wma->pgraph);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Cannot create filtergraph (hr = %lx)\n", hr);
|
2009-03-29 23:51:49 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaControl, (LPVOID*)&wma->pmctrl);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Cannot get IMediaControl interface (hr = %lx)\n", hr);
|
2009-03-29 23:51:49 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
2010-06-03 21:08:15 +02:00
|
|
|
hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaSeeking, (void**)&wma->seek);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Cannot get IMediaSeeking interface (hr = %lx)\n", hr);
|
2010-06-03 21:08:15 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
2012-03-28 18:09:32 +02:00
|
|
|
hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaEvent, (void**)&wma->mevent);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Cannot get IMediaEvent interface (hr = %lx)\n", hr);
|
2012-03-28 18:09:32 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
2010-06-03 21:08:15 +02:00
|
|
|
hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IVideoWindow, (void**)&wma->vidwin);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Cannot get IVideoWindow interface (hr = %lx)\n", hr);
|
2010-06-03 21:08:15 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IBasicVideo, (void**)&wma->vidbasic);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Cannot get IBasicVideo interface (hr = %lx)\n", hr);
|
2010-06-03 21:08:15 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
2015-03-05 15:34:42 +01:00
|
|
|
hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IBasicAudio, (void**)&wma->audio);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Cannot get IBasicAudio interface (hr = %lx)\n", hr);
|
2015-03-05 15:34:42 +01:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
2009-11-23 09:28:00 +01:00
|
|
|
if (!(dwFlags & MCI_OPEN_ELEMENT) || (dwFlags & MCI_OPEN_ELEMENT_ID)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Wrong dwFlags %lx\n", dwFlags);
|
2009-03-29 23:51:49 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
2009-04-04 17:43:57 +02:00
|
|
|
if (!lpOpenParms->lpstrElementName || !lpOpenParms->lpstrElementName[0]) {
|
2009-03-29 23:51:49 +02:00
|
|
|
TRACE("Invalid filename specified\n");
|
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
|
|
|
TRACE("Open file %s\n", debugstr_w(lpOpenParms->lpstrElementName));
|
|
|
|
|
|
|
|
hr = IGraphBuilder_RenderFile(wma->pgraph, lpOpenParms->lpstrElementName, NULL);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Cannot render file (hr = %lx)\n", hr);
|
2009-03-29 23:51:49 +02:00
|
|
|
goto err;
|
|
|
|
}
|
|
|
|
|
2010-06-03 21:08:15 +02:00
|
|
|
IVideoWindow_put_AutoShow(wma->vidwin, OAFALSE);
|
|
|
|
IVideoWindow_put_Visible(wma->vidwin, OAFALSE);
|
|
|
|
if (dwFlags & MCI_DGV_OPEN_WS)
|
|
|
|
style = lpOpenParms->dwStyle;
|
|
|
|
if (dwFlags & MCI_DGV_OPEN_PARENT) {
|
|
|
|
IVideoWindow_put_MessageDrain(wma->vidwin, (OAHWND)lpOpenParms->hWndParent);
|
|
|
|
IVideoWindow_put_WindowState(wma->vidwin, SW_HIDE);
|
|
|
|
IVideoWindow_put_WindowStyle(wma->vidwin, style|WS_CHILD);
|
|
|
|
IVideoWindow_put_Owner(wma->vidwin, (OAHWND)lpOpenParms->hWndParent);
|
|
|
|
GetClientRect(lpOpenParms->hWndParent, &rc);
|
|
|
|
IVideoWindow_SetWindowPosition(wma->vidwin, rc.left, rc.top, rc.right - rc.top, rc.bottom - rc.top);
|
|
|
|
wma->parent = (HWND)lpOpenParms->hWndParent;
|
2010-05-18 20:14:07 +02:00
|
|
|
}
|
2010-06-03 21:08:15 +02:00
|
|
|
else if (style)
|
|
|
|
IVideoWindow_put_WindowStyle(wma->vidwin, style);
|
2010-07-26 15:54:22 +02:00
|
|
|
IBasicVideo_GetVideoSize(wma->vidbasic, &rc.right, &rc.bottom);
|
2009-04-16 20:29:00 +02:00
|
|
|
wma->opened = TRUE;
|
|
|
|
|
2010-05-19 05:42:18 +02:00
|
|
|
if (dwFlags & MCI_NOTIFY)
|
|
|
|
mciDriverNotify(HWND_32(LOWORD(lpOpenParms->dwCallback)), wDevID, MCI_NOTIFY_SUCCESSFUL);
|
|
|
|
|
2009-03-29 23:51:49 +02:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
err:
|
2015-03-05 15:34:42 +01:00
|
|
|
if (wma->audio)
|
|
|
|
IBasicAudio_Release(wma->audio);
|
|
|
|
wma->audio = NULL;
|
2010-06-03 21:08:15 +02:00
|
|
|
if (wma->vidbasic)
|
2012-08-19 17:53:45 +02:00
|
|
|
IBasicVideo_Release(wma->vidbasic);
|
2010-06-03 21:08:15 +02:00
|
|
|
wma->vidbasic = NULL;
|
|
|
|
if (wma->seek)
|
2012-08-19 17:53:45 +02:00
|
|
|
IMediaSeeking_Release(wma->seek);
|
2010-06-03 21:08:15 +02:00
|
|
|
wma->seek = NULL;
|
|
|
|
if (wma->vidwin)
|
2012-08-19 17:53:45 +02:00
|
|
|
IVideoWindow_Release(wma->vidwin);
|
2010-06-03 21:08:15 +02:00
|
|
|
wma->vidwin = NULL;
|
2009-03-29 23:51:49 +02:00
|
|
|
if (wma->pgraph)
|
|
|
|
IGraphBuilder_Release(wma->pgraph);
|
|
|
|
wma->pgraph = NULL;
|
2012-03-28 18:09:32 +02:00
|
|
|
if (wma->mevent)
|
|
|
|
IMediaEvent_Release(wma->mevent);
|
|
|
|
wma->mevent = NULL;
|
2009-03-29 23:51:49 +02:00
|
|
|
if (wma->pmctrl)
|
|
|
|
IMediaControl_Release(wma->pmctrl);
|
|
|
|
wma->pmctrl = NULL;
|
|
|
|
|
2010-04-12 11:21:27 +02:00
|
|
|
if (wma->uninit)
|
|
|
|
CoUninitialize();
|
2013-10-24 00:40:25 +02:00
|
|
|
wma->uninit = FALSE;
|
2009-03-29 23:51:49 +02:00
|
|
|
|
|
|
|
return MCIERR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
2009-03-29 23:50:26 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciClose [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
2009-03-29 23:50:26 +02:00
|
|
|
|
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
2009-04-23 00:04:04 +02:00
|
|
|
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
|
|
|
|
|
2009-04-16 20:29:00 +02:00
|
|
|
if (wma->opened) {
|
2012-08-19 17:53:45 +02:00
|
|
|
IVideoWindow_Release(wma->vidwin);
|
|
|
|
IBasicVideo_Release(wma->vidbasic);
|
2015-03-05 15:34:42 +01:00
|
|
|
IBasicAudio_Release(wma->audio);
|
2012-08-19 17:53:45 +02:00
|
|
|
IMediaSeeking_Release(wma->seek);
|
2012-03-28 18:09:32 +02:00
|
|
|
IMediaEvent_Release(wma->mevent);
|
2009-03-29 23:51:49 +02:00
|
|
|
IGraphBuilder_Release(wma->pgraph);
|
|
|
|
IMediaControl_Release(wma->pmctrl);
|
2010-04-12 11:21:27 +02:00
|
|
|
if (wma->uninit)
|
|
|
|
CoUninitialize();
|
2009-04-16 20:29:00 +02:00
|
|
|
wma->opened = FALSE;
|
|
|
|
}
|
2009-03-29 23:51:49 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2015-03-17 16:04:59 +01:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_notifyThread [internal]
|
|
|
|
*/
|
|
|
|
static DWORD CALLBACK MCIQTZ_notifyThread(LPVOID parm)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma = (WINE_MCIQTZ *)parm;
|
|
|
|
HRESULT hr;
|
|
|
|
HANDLE handle[2];
|
|
|
|
DWORD n = 0, ret = 0;
|
|
|
|
|
|
|
|
handle[n++] = wma->stop_event;
|
|
|
|
IMediaEvent_GetEventHandle(wma->mevent, (OAEVENT *)&handle[n++]);
|
|
|
|
|
|
|
|
for (;;) {
|
|
|
|
DWORD r;
|
|
|
|
HANDLE old;
|
|
|
|
|
|
|
|
r = WaitForMultipleObjects(n, handle, FALSE, INFINITE);
|
|
|
|
if (r == WAIT_OBJECT_0) {
|
|
|
|
TRACE("got stop event\n");
|
|
|
|
old = InterlockedExchangePointer(&wma->callback, NULL);
|
|
|
|
if (old)
|
|
|
|
mciDriverNotify(old, wma->notify_devid, MCI_NOTIFY_ABORTED);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
else if (r == WAIT_OBJECT_0+1) {
|
|
|
|
LONG event_code;
|
|
|
|
LONG_PTR p1, p2;
|
|
|
|
do {
|
|
|
|
hr = IMediaEvent_GetEvent(wma->mevent, &event_code, &p1, &p2, 0);
|
|
|
|
if (SUCCEEDED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("got event_code = 0x%02lx\n", event_code);
|
2015-03-17 16:04:59 +01:00
|
|
|
IMediaEvent_FreeEventParams(wma->mevent, event_code, p1, p2);
|
|
|
|
}
|
|
|
|
} while (hr == S_OK && event_code != EC_COMPLETE);
|
|
|
|
if (hr == S_OK && event_code == EC_COMPLETE) {
|
2017-01-26 02:01:25 +01:00
|
|
|
/* Repeat the music by seeking and running again */
|
|
|
|
if (wma->mci_flags & MCI_DGV_PLAY_REPEAT) {
|
|
|
|
TRACE("repeat media as requested\n");
|
|
|
|
IMediaControl_Stop(wma->pmctrl);
|
|
|
|
IMediaSeeking_SetPositions(wma->seek,
|
|
|
|
&wma->seek_start,
|
|
|
|
AM_SEEKING_AbsolutePositioning,
|
|
|
|
&wma->seek_stop,
|
|
|
|
AM_SEEKING_AbsolutePositioning);
|
|
|
|
IMediaControl_Run(wma->pmctrl);
|
|
|
|
continue;
|
|
|
|
}
|
2015-03-17 16:04:59 +01:00
|
|
|
old = InterlockedExchangePointer(&wma->callback, NULL);
|
|
|
|
if (old)
|
|
|
|
mciDriverNotify(old, wma->notify_devid, MCI_NOTIFY_SUCCESSFUL);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
TRACE("Unknown error (%d)\n", (int)r);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
hr = IMediaControl_Stop(wma->pmctrl);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Cannot stop filtergraph (hr = %lx)\n", hr);
|
2015-03-17 16:04:59 +01:00
|
|
|
ret = MCIERR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2009-03-29 23:51:49 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciPlay [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
HRESULT hr;
|
2010-07-26 15:55:11 +02:00
|
|
|
GUID format;
|
2017-01-26 02:01:25 +01:00
|
|
|
DWORD start_flags;
|
2009-03-29 23:51:49 +02:00
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
2009-03-29 23:51:49 +02:00
|
|
|
|
2016-05-04 19:42:53 +02:00
|
|
|
if(!lpParms)
|
|
|
|
return MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
|
2009-03-29 23:51:49 +02:00
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
2009-04-23 00:03:58 +02:00
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
2009-03-29 23:51:49 +02:00
|
|
|
|
2015-03-17 16:04:59 +01:00
|
|
|
ResetEvent(wma->stop_event);
|
|
|
|
if (dwFlags & MCI_NOTIFY) {
|
|
|
|
HANDLE old;
|
|
|
|
old = InterlockedExchangePointer(&wma->callback, HWND_32(LOWORD(lpParms->dwCallback)));
|
|
|
|
if (old)
|
|
|
|
mciDriverNotify(old, wma->notify_devid, MCI_NOTIFY_ABORTED);
|
|
|
|
}
|
|
|
|
|
2017-01-26 02:01:25 +01:00
|
|
|
wma->mci_flags = dwFlags;
|
2010-07-26 15:55:11 +02:00
|
|
|
IMediaSeeking_GetTimeFormat(wma->seek, &format);
|
|
|
|
if (dwFlags & MCI_FROM) {
|
2019-05-29 08:42:10 +02:00
|
|
|
wma->seek_start = lpParms->dwFrom;
|
2010-07-26 15:55:11 +02:00
|
|
|
if (IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME))
|
2019-05-29 08:42:10 +02:00
|
|
|
wma->seek_start *= 10000;
|
|
|
|
|
2017-01-26 02:01:25 +01:00
|
|
|
start_flags = AM_SEEKING_AbsolutePositioning;
|
|
|
|
} else {
|
|
|
|
wma->seek_start = 0;
|
|
|
|
start_flags = AM_SEEKING_NoPositioning;
|
|
|
|
}
|
2010-07-26 15:55:11 +02:00
|
|
|
if (dwFlags & MCI_TO) {
|
2019-05-29 08:42:10 +02:00
|
|
|
wma->seek_stop = lpParms->dwTo;
|
2010-07-26 15:55:11 +02:00
|
|
|
if (IsEqualGUID(&format, &TIME_FORMAT_MEDIA_TIME))
|
2019-05-29 08:42:10 +02:00
|
|
|
wma->seek_stop *= 10000;
|
2017-01-26 02:01:25 +01:00
|
|
|
} else {
|
|
|
|
wma->seek_stop = 0;
|
|
|
|
IMediaSeeking_GetDuration(wma->seek, &wma->seek_stop);
|
|
|
|
}
|
|
|
|
IMediaSeeking_SetPositions(wma->seek, &wma->seek_start, start_flags,
|
|
|
|
&wma->seek_stop, AM_SEEKING_AbsolutePositioning);
|
2010-07-26 15:55:11 +02:00
|
|
|
|
2009-03-29 23:51:49 +02:00
|
|
|
hr = IMediaControl_Run(wma->pmctrl);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Cannot run filtergraph (hr = %lx)\n", hr);
|
2009-03-29 23:51:49 +02:00
|
|
|
return MCIERR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
2010-08-09 14:24:31 +02:00
|
|
|
IVideoWindow_put_Visible(wma->vidwin, OATRUE);
|
2009-03-29 23:51:49 +02:00
|
|
|
|
2015-03-17 16:04:59 +01:00
|
|
|
wma->thread = CreateThread(NULL, 0, MCIQTZ_notifyThread, wma, 0, NULL);
|
|
|
|
if (!wma->thread) {
|
|
|
|
TRACE("Can't create thread\n");
|
|
|
|
return MCIERR_INTERNAL;
|
|
|
|
}
|
2009-03-29 23:50:26 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-31 21:38:02 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciSeek [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciSeek(UINT wDevID, DWORD dwFlags, LPMCI_SEEK_PARMS lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
HRESULT hr;
|
|
|
|
LONGLONG newpos;
|
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
2009-03-31 21:38:02 +02:00
|
|
|
|
2016-05-04 19:42:53 +02:00
|
|
|
if(!lpParms)
|
|
|
|
return MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
|
2009-03-31 21:38:02 +02:00
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
2009-04-23 00:04:04 +02:00
|
|
|
MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
|
|
|
|
|
2009-03-31 21:38:02 +02:00
|
|
|
if (dwFlags & MCI_SEEK_TO_START) {
|
|
|
|
newpos = 0;
|
|
|
|
} else if (dwFlags & MCI_SEEK_TO_END) {
|
|
|
|
FIXME("MCI_SEEK_TO_END not implemented yet\n");
|
|
|
|
return MCIERR_INTERNAL;
|
|
|
|
} else if (dwFlags & MCI_TO) {
|
|
|
|
FIXME("MCI_TO not implemented yet\n");
|
|
|
|
return MCIERR_INTERNAL;
|
|
|
|
} else {
|
|
|
|
WARN("dwFlag doesn't tell where to seek to...\n");
|
|
|
|
return MCIERR_MISSING_PARAMETER;
|
|
|
|
}
|
|
|
|
|
2010-06-03 21:08:15 +02:00
|
|
|
hr = IMediaSeeking_SetPositions(wma->seek, &newpos, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning);
|
2009-03-31 21:38:02 +02:00
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
FIXME("Cannot set position (hr = %lx)\n", hr);
|
2009-03-31 21:38:02 +02:00
|
|
|
return MCIERR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dwFlags & MCI_NOTIFY)
|
2015-03-17 16:04:59 +01:00
|
|
|
MCIQTZ_mciNotify(lpParms->dwCallback, wma, MCI_NOTIFY_SUCCESSFUL);
|
2009-03-31 21:38:02 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-03-29 23:50:26 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciStop [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
2009-03-29 23:50:26 +02:00
|
|
|
|
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
2010-05-20 00:24:28 +02:00
|
|
|
if (!wma->opened)
|
2009-03-29 23:51:49 +02:00
|
|
|
return 0;
|
|
|
|
|
2015-03-17 16:04:59 +01:00
|
|
|
if (wma->thread) {
|
|
|
|
SetEvent(wma->stop_event);
|
|
|
|
WaitForSingleObject(wma->thread, INFINITE);
|
|
|
|
CloseHandle(wma->thread);
|
|
|
|
wma->thread = NULL;
|
2009-03-29 23:51:49 +02:00
|
|
|
}
|
|
|
|
|
2010-06-03 21:08:15 +02:00
|
|
|
if (!wma->parent)
|
|
|
|
IVideoWindow_put_Visible(wma->vidwin, OAFALSE);
|
2009-03-29 23:51:49 +02:00
|
|
|
|
2009-03-29 23:50:26 +02:00
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-05-20 00:27:25 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciPause [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciPause(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
2010-05-20 00:27:25 +02:00
|
|
|
|
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
|
|
|
hr = IMediaControl_Pause(wma->pmctrl);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Cannot pause filtergraph (hr = %lx)\n", hr);
|
2010-05-20 00:27:25 +02:00
|
|
|
return MCIERR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-02-19 17:48:52 +01:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciResume [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciResume(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
2016-02-19 17:48:52 +01:00
|
|
|
|
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
|
|
|
hr = IMediaControl_Run(wma->pmctrl);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("Cannot run filtergraph (hr = %lx)\n", hr);
|
2016-02-19 17:48:52 +01:00
|
|
|
return MCIERR_INTERNAL;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-04-26 23:06:51 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciGetDevCaps [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciGetDevCaps(UINT wDevID, DWORD dwFlags, LPMCI_GETDEVCAPS_PARMS lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
2009-04-26 23:06:51 +02:00
|
|
|
|
2016-05-04 19:42:53 +02:00
|
|
|
if(!lpParms)
|
|
|
|
return MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
|
2009-04-26 23:06:51 +02:00
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
2009-12-09 18:13:51 +01:00
|
|
|
if (!(dwFlags & MCI_GETDEVCAPS_ITEM))
|
|
|
|
return MCIERR_MISSING_PARAMETER;
|
2009-04-26 23:06:51 +02:00
|
|
|
|
|
|
|
switch (lpParms->dwItem) {
|
|
|
|
case MCI_GETDEVCAPS_CAN_RECORD:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_GETDEVCAPS_CAN_RECORD = %08lx\n", lpParms->dwReturn);
|
2009-04-26 23:06:51 +02:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_HAS_AUDIO:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_GETDEVCAPS_HAS_AUDIO = %08lx\n", lpParms->dwReturn);
|
2009-04-26 23:06:51 +02:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_HAS_VIDEO:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_GETDEVCAPS_HAS_VIDEO = %08lx\n", lpParms->dwReturn);
|
2009-04-26 23:06:51 +02:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_DEVICE_TYPE:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(MCI_DEVTYPE_DIGITAL_VIDEO, MCI_DEVTYPE_DIGITAL_VIDEO);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_GETDEVCAPS_DEVICE_TYPE = %08lx\n", lpParms->dwReturn);
|
2009-04-26 23:06:51 +02:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_USES_FILES:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_GETDEVCAPS_USES_FILES = %08lx\n", lpParms->dwReturn);
|
2009-04-26 23:06:51 +02:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_COMPOUND_DEVICE:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_GETDEVCAPS_COMPOUND_DEVICE = %08lx\n", lpParms->dwReturn);
|
2009-04-26 23:06:51 +02:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_CAN_EJECT:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_GETDEVCAPS_EJECT = %08lx\n", lpParms->dwReturn);
|
2009-04-26 23:06:51 +02:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_CAN_PLAY:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(TRUE, MCI_TRUE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_GETDEVCAPS_CAN_PLAY = %08lx\n", lpParms->dwReturn);
|
2009-04-26 23:06:51 +02:00
|
|
|
break;
|
|
|
|
case MCI_GETDEVCAPS_CAN_SAVE:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_GETDEVCAPS_CAN_SAVE = %08lx\n", lpParms->dwReturn);
|
2009-04-26 23:06:51 +02:00
|
|
|
break;
|
2009-12-09 18:13:51 +01:00
|
|
|
case MCI_DGV_GETDEVCAPS_CAN_REVERSE:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_DGV_GETDEVCAPS_CAN_REVERSE = %08lx\n", lpParms->dwReturn);
|
2009-12-09 18:13:51 +01:00
|
|
|
break;
|
|
|
|
case MCI_DGV_GETDEVCAPS_CAN_STRETCH:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE); /* FIXME */
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_DGV_GETDEVCAPS_CAN_STRETCH = %08lx\n", lpParms->dwReturn);
|
2009-12-09 18:13:51 +01:00
|
|
|
break;
|
|
|
|
case MCI_DGV_GETDEVCAPS_CAN_LOCK:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_DGV_GETDEVCAPS_CAN_LOCK = %08lx\n", lpParms->dwReturn);
|
2009-12-09 18:13:51 +01:00
|
|
|
break;
|
|
|
|
case MCI_DGV_GETDEVCAPS_CAN_FREEZE:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_DGV_GETDEVCAPS_CAN_FREEZE = %08lx\n", lpParms->dwReturn);
|
2009-12-09 18:13:51 +01:00
|
|
|
break;
|
|
|
|
case MCI_DGV_GETDEVCAPS_CAN_STR_IN:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_DGV_GETDEVCAPS_CAN_STRETCH_INPUT = %08lx\n", lpParms->dwReturn);
|
2009-12-09 18:13:51 +01:00
|
|
|
break;
|
|
|
|
case MCI_DGV_GETDEVCAPS_HAS_STILL:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE);
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_DGV_GETDEVCAPS_HAS_STILL = %08lx\n", lpParms->dwReturn);
|
2009-12-09 18:13:51 +01:00
|
|
|
break;
|
|
|
|
case MCI_DGV_GETDEVCAPS_CAN_TEST:
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(FALSE, MCI_FALSE); /* FIXME */
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_DGV_GETDEVCAPS_CAN_TEST = %08lx\n", lpParms->dwReturn);
|
2009-12-09 18:13:51 +01:00
|
|
|
break;
|
|
|
|
case MCI_DGV_GETDEVCAPS_MAX_WINDOWS:
|
|
|
|
lpParms->dwReturn = 1;
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("MCI_DGV_GETDEVCAPS_MAX_WINDOWS = %lu\n", lpParms->dwReturn);
|
2009-12-09 18:13:51 +01:00
|
|
|
return 0;
|
2009-04-26 23:06:51 +02:00
|
|
|
default:
|
2022-02-14 09:27:07 +01:00
|
|
|
WARN("Unknown capability %08lx\n", lpParms->dwItem);
|
2009-12-09 18:13:51 +01:00
|
|
|
/* Fall through */
|
|
|
|
case MCI_DGV_GETDEVCAPS_MAXIMUM_RATE: /* unknown to w2k */
|
|
|
|
case MCI_DGV_GETDEVCAPS_MINIMUM_RATE: /* unknown to w2k */
|
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
2009-04-26 23:06:51 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return MCI_RESOURCE_RETURNED;
|
|
|
|
}
|
|
|
|
|
2009-04-28 23:18:29 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciSet [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciSet(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SET_PARMS lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
2009-04-28 23:18:29 +02:00
|
|
|
|
2016-05-04 19:42:53 +02:00
|
|
|
if(!lpParms)
|
|
|
|
return MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
|
2009-04-28 23:18:29 +02:00
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
|
|
|
if (dwFlags & MCI_SET_TIME_FORMAT) {
|
|
|
|
switch (lpParms->dwTimeFormat) {
|
|
|
|
case MCI_FORMAT_MILLISECONDS:
|
|
|
|
TRACE("MCI_SET_TIME_FORMAT = MCI_FORMAT_MILLISECONDS\n");
|
|
|
|
wma->time_format = MCI_FORMAT_MILLISECONDS;
|
|
|
|
break;
|
|
|
|
case MCI_FORMAT_FRAMES:
|
|
|
|
TRACE("MCI_SET_TIME_FORMAT = MCI_FORMAT_FRAMES\n");
|
|
|
|
wma->time_format = MCI_FORMAT_FRAMES;
|
|
|
|
break;
|
|
|
|
default:
|
2022-02-14 09:27:07 +01:00
|
|
|
WARN("Bad time format %lu\n", lpParms->dwTimeFormat);
|
2009-04-28 23:18:29 +02:00
|
|
|
return MCIERR_BAD_TIME_FORMAT;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2009-12-30 11:38:30 +01:00
|
|
|
if (dwFlags & MCI_SET_DOOR_OPEN)
|
|
|
|
FIXME("MCI_SET_DOOR_OPEN not implemented yet\n");
|
|
|
|
if (dwFlags & MCI_SET_DOOR_CLOSED)
|
|
|
|
FIXME("MCI_SET_DOOR_CLOSED not implemented yet\n");
|
|
|
|
if (dwFlags & MCI_SET_AUDIO)
|
|
|
|
FIXME("MCI_SET_AUDIO not implemented yet\n");
|
|
|
|
if (dwFlags & MCI_SET_VIDEO)
|
|
|
|
FIXME("MCI_SET_VIDEO not implemented yet\n");
|
|
|
|
if (dwFlags & MCI_SET_ON)
|
|
|
|
FIXME("MCI_SET_ON not implemented yet\n");
|
|
|
|
if (dwFlags & MCI_SET_OFF)
|
|
|
|
FIXME("MCI_SET_OFF not implemented yet\n");
|
|
|
|
if (dwFlags & MCI_SET_AUDIO_LEFT)
|
|
|
|
FIXME("MCI_SET_AUDIO_LEFT not implemented yet\n");
|
|
|
|
if (dwFlags & MCI_SET_AUDIO_RIGHT)
|
|
|
|
FIXME("MCI_SET_AUDIO_RIGHT not implemented yet\n");
|
|
|
|
|
|
|
|
if (dwFlags & ~0x7f03 /* All MCI_SET flags mask */)
|
2022-02-14 09:27:07 +01:00
|
|
|
ERR("Unknown flags %08lx\n", dwFlags & ~0x7f03);
|
2009-04-28 23:18:29 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2009-04-08 23:22:50 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciStatus [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciStatus(UINT wDevID, DWORD dwFlags, LPMCI_DGV_STATUS_PARMSW lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
2010-05-18 15:08:31 +02:00
|
|
|
HRESULT hr;
|
2015-01-31 06:16:32 +01:00
|
|
|
DWORD ret = MCI_INTEGER_RETURNED;
|
2009-04-08 23:22:50 +02:00
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
2009-04-08 23:22:50 +02:00
|
|
|
|
2016-05-04 19:42:53 +02:00
|
|
|
if(!lpParms)
|
|
|
|
return MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
|
2009-04-08 23:22:50 +02:00
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
|
|
|
if (!(dwFlags & MCI_STATUS_ITEM)) {
|
|
|
|
WARN("No status item specified\n");
|
|
|
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
|
|
|
}
|
|
|
|
|
|
|
|
switch (lpParms->dwItem) {
|
2010-05-18 15:08:31 +02:00
|
|
|
case MCI_STATUS_LENGTH: {
|
|
|
|
LONGLONG duration = -1;
|
|
|
|
GUID format;
|
|
|
|
switch (wma->time_format) {
|
|
|
|
case MCI_FORMAT_MILLISECONDS: format = TIME_FORMAT_MEDIA_TIME; break;
|
|
|
|
case MCI_FORMAT_FRAMES: format = TIME_FORMAT_FRAME; break;
|
2022-02-14 09:27:07 +01:00
|
|
|
default: ERR("Unhandled format %lx\n", wma->time_format); break;
|
2010-05-18 15:08:31 +02:00
|
|
|
}
|
2010-06-03 21:08:15 +02:00
|
|
|
hr = IMediaSeeking_SetTimeFormat(wma->seek, &format);
|
2010-05-18 15:08:31 +02:00
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
FIXME("Cannot set time format (hr = %lx)\n", hr);
|
2010-05-18 15:08:31 +02:00
|
|
|
lpParms->dwReturn = 0;
|
|
|
|
break;
|
|
|
|
}
|
2010-06-03 21:08:15 +02:00
|
|
|
hr = IMediaSeeking_GetDuration(wma->seek, &duration);
|
2010-05-18 15:08:31 +02:00
|
|
|
if (FAILED(hr) || duration < 0) {
|
2022-02-14 09:27:07 +01:00
|
|
|
FIXME("Cannot read duration (hr = %lx)\n", hr);
|
2010-05-18 15:08:31 +02:00
|
|
|
lpParms->dwReturn = 0;
|
|
|
|
} else if (wma->time_format != MCI_FORMAT_MILLISECONDS)
|
|
|
|
lpParms->dwReturn = duration;
|
|
|
|
else
|
|
|
|
lpParms->dwReturn = duration / 10000;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MCI_STATUS_POSITION: {
|
2010-06-03 21:08:15 +02:00
|
|
|
REFERENCE_TIME curpos;
|
2009-04-08 23:22:50 +02:00
|
|
|
|
2010-06-03 21:08:15 +02:00
|
|
|
hr = IMediaSeeking_GetCurrentPosition(wma->seek, &curpos);
|
2009-04-08 23:22:50 +02:00
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
FIXME("Cannot get position (hr = %lx)\n", hr);
|
2009-04-08 23:22:50 +02:00
|
|
|
return MCIERR_INTERNAL;
|
|
|
|
}
|
|
|
|
lpParms->dwReturn = curpos / 10000;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case MCI_STATUS_NUMBER_OF_TRACKS:
|
|
|
|
FIXME("MCI_STATUS_NUMBER_OF_TRACKS not implemented yet\n");
|
|
|
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
2010-05-21 22:06:00 +02:00
|
|
|
case MCI_STATUS_MODE: {
|
|
|
|
LONG state = State_Stopped;
|
|
|
|
IMediaControl_GetState(wma->pmctrl, -1, &state);
|
|
|
|
if (state == State_Stopped)
|
2015-01-31 06:16:32 +01:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_STOP, MCI_MODE_STOP);
|
2012-03-28 18:09:32 +02:00
|
|
|
else if (state == State_Running) {
|
2015-01-31 06:16:32 +01:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_PLAY, MCI_MODE_PLAY);
|
2015-03-17 16:04:59 +01:00
|
|
|
if (!wma->thread || WaitForSingleObject(wma->thread, 0) == WAIT_OBJECT_0)
|
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_STOP, MCI_MODE_STOP);
|
2012-03-28 18:09:32 +02:00
|
|
|
} else if (state == State_Paused)
|
2015-01-31 06:16:32 +01:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(MCI_MODE_PAUSE, MCI_MODE_PAUSE);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
2010-05-21 22:06:00 +02:00
|
|
|
break;
|
|
|
|
}
|
2009-04-08 23:22:50 +02:00
|
|
|
case MCI_STATUS_MEDIA_PRESENT:
|
|
|
|
FIXME("MCI_STATUS_MEDIA_PRESENT not implemented yet\n");
|
|
|
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
|
|
|
case MCI_STATUS_TIME_FORMAT:
|
2015-01-31 06:16:32 +01:00
|
|
|
lpParms->dwReturn = MAKEMCIRESOURCE(wma->time_format,
|
|
|
|
MCI_FORMAT_RETURN_BASE + wma->time_format);
|
|
|
|
ret = MCI_RESOURCE_RETURNED;
|
2010-05-20 00:26:44 +02:00
|
|
|
break;
|
2009-04-08 23:22:50 +02:00
|
|
|
case MCI_STATUS_READY:
|
|
|
|
FIXME("MCI_STATUS_READY not implemented yet\n");
|
|
|
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
|
|
|
case MCI_STATUS_CURRENT_TRACK:
|
|
|
|
FIXME("MCI_STATUS_CURRENT_TRACK not implemented yet\n");
|
|
|
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
|
|
|
default:
|
2022-02-14 09:27:07 +01:00
|
|
|
FIXME("Unknown command %08lX\n", lpParms->dwItem);
|
2009-04-08 23:22:50 +02:00
|
|
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dwFlags & MCI_NOTIFY)
|
2015-03-17 16:04:59 +01:00
|
|
|
MCIQTZ_mciNotify(lpParms->dwCallback, wma, MCI_NOTIFY_SUCCESSFUL);
|
2009-04-08 23:22:50 +02:00
|
|
|
|
2015-01-31 06:16:32 +01:00
|
|
|
return ret;
|
2009-04-08 23:22:50 +02:00
|
|
|
}
|
|
|
|
|
2009-04-26 23:07:02 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciWhere [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciWhere(UINT wDevID, DWORD dwFlags, LPMCI_DGV_RECT_PARMS lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ* wma;
|
|
|
|
HRESULT hr;
|
|
|
|
HWND hWnd;
|
|
|
|
RECT rc;
|
2010-05-18 20:16:18 +02:00
|
|
|
DWORD ret = MCIERR_UNRECOGNIZED_COMMAND;
|
2009-04-26 23:07:02 +02:00
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
2009-04-26 23:07:02 +02:00
|
|
|
|
2016-05-04 19:42:53 +02:00
|
|
|
if(!lpParms)
|
|
|
|
return MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
|
2009-04-26 23:07:02 +02:00
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
2010-06-03 21:08:15 +02:00
|
|
|
hr = IVideoWindow_get_Owner(wma->vidwin, (OAHWND*)&hWnd);
|
2009-04-26 23:07:02 +02:00
|
|
|
if (FAILED(hr)) {
|
|
|
|
TRACE("No video stream, returning no window error\n");
|
|
|
|
return MCIERR_NO_WINDOW;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dwFlags & MCI_DGV_WHERE_SOURCE) {
|
|
|
|
if (dwFlags & MCI_DGV_WHERE_MAX)
|
2013-08-31 13:17:56 +02:00
|
|
|
FIXME("MCI_DGV_WHERE_SOURCE_MAX stub\n");
|
2010-07-26 15:44:22 +02:00
|
|
|
IBasicVideo_GetSourcePosition(wma->vidbasic, &rc.left, &rc.top, &rc.right, &rc.bottom);
|
2010-05-18 20:16:18 +02:00
|
|
|
TRACE("MCI_DGV_WHERE_SOURCE %s\n", wine_dbgstr_rect(&rc));
|
2009-04-26 23:07:02 +02:00
|
|
|
}
|
|
|
|
if (dwFlags & MCI_DGV_WHERE_DESTINATION) {
|
2010-07-26 15:44:22 +02:00
|
|
|
if (dwFlags & MCI_DGV_WHERE_MAX)
|
2013-08-31 13:17:56 +02:00
|
|
|
FIXME("MCI_DGV_WHERE_DESTINATION_MAX stub\n");
|
2010-07-26 15:44:22 +02:00
|
|
|
IBasicVideo_GetDestinationPosition(wma->vidbasic, &rc.left, &rc.top, &rc.right, &rc.bottom);
|
|
|
|
TRACE("MCI_DGV_WHERE_DESTINATION %s\n", wine_dbgstr_rect(&rc));
|
2009-04-26 23:07:02 +02:00
|
|
|
}
|
|
|
|
if (dwFlags & MCI_DGV_WHERE_FRAME) {
|
|
|
|
if (dwFlags & MCI_DGV_WHERE_MAX)
|
|
|
|
FIXME("MCI_DGV_WHERE_FRAME_MAX not supported yet\n");
|
|
|
|
else
|
|
|
|
FIXME("MCI_DGV_WHERE_FRAME not supported yet\n");
|
2010-05-18 20:16:18 +02:00
|
|
|
goto out;
|
2009-04-26 23:07:02 +02:00
|
|
|
}
|
|
|
|
if (dwFlags & MCI_DGV_WHERE_VIDEO) {
|
|
|
|
if (dwFlags & MCI_DGV_WHERE_MAX)
|
|
|
|
FIXME("MCI_DGV_WHERE_VIDEO_MAX not supported yet\n");
|
|
|
|
else
|
|
|
|
FIXME("MCI_DGV_WHERE_VIDEO not supported yet\n");
|
2010-05-18 20:16:18 +02:00
|
|
|
goto out;
|
2009-04-26 23:07:02 +02:00
|
|
|
}
|
|
|
|
if (dwFlags & MCI_DGV_WHERE_WINDOW) {
|
|
|
|
if (dwFlags & MCI_DGV_WHERE_MAX) {
|
|
|
|
GetWindowRect(GetDesktopWindow(), &rc);
|
2010-07-26 15:44:22 +02:00
|
|
|
rc.right -= rc.left;
|
|
|
|
rc.bottom -= rc.top;
|
2009-04-26 23:07:02 +02:00
|
|
|
TRACE("MCI_DGV_WHERE_WINDOW_MAX %s\n", wine_dbgstr_rect(&rc));
|
|
|
|
} else {
|
2010-07-26 15:44:22 +02:00
|
|
|
IVideoWindow_GetWindowPosition(wma->vidwin, &rc.left, &rc.top, &rc.right, &rc.bottom);
|
2009-04-26 23:07:02 +02:00
|
|
|
TRACE("MCI_DGV_WHERE_WINDOW %s\n", wine_dbgstr_rect(&rc));
|
|
|
|
}
|
|
|
|
}
|
2010-05-18 20:16:18 +02:00
|
|
|
ret = 0;
|
|
|
|
out:
|
2010-07-26 15:44:22 +02:00
|
|
|
lpParms->rc = rc;
|
2010-05-18 20:16:18 +02:00
|
|
|
return ret;
|
2009-04-26 23:07:02 +02:00
|
|
|
}
|
|
|
|
|
2010-05-21 12:17:58 +02:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciWindow [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciWindow(UINT wDevID, DWORD dwFlags, LPMCI_DGV_WINDOW_PARMSW lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ *wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
2010-05-21 12:17:58 +02:00
|
|
|
|
2016-05-04 19:42:53 +02:00
|
|
|
if(!lpParms)
|
|
|
|
return MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
|
2010-05-21 12:17:58 +02:00
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
if (dwFlags & MCI_TEST)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
if (dwFlags & MCI_DGV_WINDOW_HWND && (IsWindow(lpParms->hWnd) || !lpParms->hWnd)) {
|
2010-08-09 14:24:31 +02:00
|
|
|
LONG visible = OATRUE;
|
2010-05-21 12:17:58 +02:00
|
|
|
LONG style = 0;
|
|
|
|
TRACE("Setting hWnd to %p\n", lpParms->hWnd);
|
2010-08-09 14:24:31 +02:00
|
|
|
IVideoWindow_get_Visible(wma->vidwin, &visible);
|
2010-05-21 12:17:58 +02:00
|
|
|
IVideoWindow_put_Visible(wma->vidwin, OAFALSE);
|
|
|
|
IVideoWindow_get_WindowStyle(wma->vidwin, &style);
|
|
|
|
style &= ~WS_CHILD;
|
|
|
|
if (lpParms->hWnd)
|
|
|
|
IVideoWindow_put_WindowStyle(wma->vidwin, style|WS_CHILD);
|
|
|
|
else
|
|
|
|
IVideoWindow_put_WindowStyle(wma->vidwin, style);
|
|
|
|
IVideoWindow_put_Owner(wma->vidwin, (OAHWND)lpParms->hWnd);
|
|
|
|
IVideoWindow_put_MessageDrain(wma->vidwin, (OAHWND)lpParms->hWnd);
|
2010-08-09 14:24:31 +02:00
|
|
|
IVideoWindow_put_Visible(wma->vidwin, visible);
|
2010-05-21 12:17:58 +02:00
|
|
|
wma->parent = lpParms->hWnd;
|
|
|
|
}
|
|
|
|
if (dwFlags & MCI_DGV_WINDOW_STATE) {
|
|
|
|
TRACE("Setting nCmdShow to %d\n", lpParms->nCmdShow);
|
|
|
|
IVideoWindow_put_WindowState(wma->vidwin, lpParms->nCmdShow);
|
|
|
|
}
|
|
|
|
if (dwFlags & MCI_DGV_WINDOW_TEXT) {
|
|
|
|
TRACE("Setting caption to %s\n", debugstr_w(lpParms->lpstrText));
|
|
|
|
IVideoWindow_put_Caption(wma->vidwin, lpParms->lpstrText);
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2016-01-15 20:43:52 +01:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciPut [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciPut(UINT wDevID, DWORD dwFlags, MCI_GENERIC_PARMS *lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ *wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
MCI_DGV_RECT_PARMS *rectparms;
|
|
|
|
HRESULT hr;
|
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lX, %p)\n", wDevID, dwFlags, lpParms);
|
2016-01-15 20:43:52 +01:00
|
|
|
|
2016-05-04 19:42:53 +02:00
|
|
|
if(!lpParms)
|
|
|
|
return MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
|
2016-01-15 20:43:52 +01:00
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
|
|
|
if (!(dwFlags & MCI_DGV_RECT)) {
|
|
|
|
FIXME("No support for non-RECT MCI_PUT\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dwFlags & MCI_TEST)
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
dwFlags &= ~MCI_DGV_RECT;
|
|
|
|
rectparms = (MCI_DGV_RECT_PARMS*)lpParms;
|
|
|
|
|
|
|
|
if (dwFlags & MCI_DGV_PUT_DESTINATION) {
|
|
|
|
hr = IVideoWindow_SetWindowPosition(wma->vidwin,
|
|
|
|
rectparms->rc.left, rectparms->rc.top,
|
|
|
|
rectparms->rc.right - rectparms->rc.left,
|
|
|
|
rectparms->rc.bottom - rectparms->rc.top);
|
|
|
|
if(FAILED(hr))
|
2022-02-14 09:27:07 +01:00
|
|
|
WARN("IVideoWindow_SetWindowPosition failed: 0x%lx\n", hr);
|
2016-01-15 20:43:52 +01:00
|
|
|
|
|
|
|
dwFlags &= ~MCI_DGV_PUT_DESTINATION;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dwFlags & MCI_NOTIFY) {
|
|
|
|
MCIQTZ_mciNotify(lpParms->dwCallback, wma, MCI_NOTIFY_SUCCESSFUL);
|
|
|
|
dwFlags &= ~MCI_NOTIFY;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (dwFlags)
|
2022-02-14 09:27:07 +01:00
|
|
|
FIXME("No support for some flags: 0x%lx\n", dwFlags);
|
2016-01-15 20:43:52 +01:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2010-05-18 20:16:57 +02:00
|
|
|
/******************************************************************************
|
|
|
|
* MCIAVI_mciUpdate [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciUpdate(UINT wDevID, DWORD dwFlags, LPMCI_DGV_UPDATE_PARMS lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ *wma;
|
|
|
|
DWORD res = 0;
|
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("%04x, %08lx, %p\n", wDevID, dwFlags, lpParms);
|
2010-05-18 20:16:57 +02:00
|
|
|
|
2016-05-04 19:42:53 +02:00
|
|
|
if(!lpParms)
|
|
|
|
return MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
|
2010-05-18 20:16:57 +02:00
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
|
|
|
if (dwFlags & MCI_DGV_UPDATE_HDC) {
|
2010-06-03 21:08:15 +02:00
|
|
|
LONG state, size;
|
|
|
|
BYTE *data;
|
|
|
|
BITMAPINFO *info;
|
|
|
|
HRESULT hr;
|
|
|
|
RECT src, dest;
|
2010-08-09 14:24:31 +02:00
|
|
|
LONG visible = OATRUE;
|
2010-06-03 21:08:15 +02:00
|
|
|
|
2010-05-18 20:16:57 +02:00
|
|
|
res = MCIERR_INTERNAL;
|
2010-09-27 20:29:39 +02:00
|
|
|
IMediaControl_GetState(wma->pmctrl, -1, &state);
|
|
|
|
if (state == State_Running)
|
|
|
|
return MCIERR_UNSUPPORTED_FUNCTION;
|
2010-06-03 21:08:15 +02:00
|
|
|
/* If in stopped state, nothing has been drawn to screen
|
|
|
|
* moving to pause, which is needed for the old dib renderer, will result
|
|
|
|
* in a single frame drawn, so hide the window here */
|
2010-08-09 14:24:31 +02:00
|
|
|
IVideoWindow_get_Visible(wma->vidwin, &visible);
|
|
|
|
if (wma->parent)
|
|
|
|
IVideoWindow_put_Visible(wma->vidwin, OAFALSE);
|
2010-06-03 21:08:15 +02:00
|
|
|
/* FIXME: Should we check the original state and restore it? */
|
|
|
|
IMediaControl_Pause(wma->pmctrl);
|
|
|
|
IMediaControl_GetState(wma->pmctrl, -1, &state);
|
|
|
|
if (FAILED(hr = IBasicVideo_GetCurrentImage(wma->vidbasic, &size, NULL))) {
|
2022-02-14 09:27:07 +01:00
|
|
|
WARN("Could not get image size (hr = %lx)\n", hr);
|
2010-06-03 21:08:15 +02:00
|
|
|
goto out;
|
2010-05-18 20:16:57 +02:00
|
|
|
}
|
2010-06-03 21:08:15 +02:00
|
|
|
data = HeapAlloc(GetProcessHeap(), 0, size);
|
|
|
|
info = (BITMAPINFO*)data;
|
|
|
|
IBasicVideo_GetCurrentImage(wma->vidbasic, &size, (LONG*)data);
|
|
|
|
data += info->bmiHeader.biSize;
|
|
|
|
|
|
|
|
IBasicVideo_GetSourcePosition(wma->vidbasic, &src.left, &src.top, &src.right, &src.bottom);
|
|
|
|
IBasicVideo_GetDestinationPosition(wma->vidbasic, &dest.left, &dest.top, &dest.right, &dest.bottom);
|
|
|
|
StretchDIBits(lpParms->hDC,
|
|
|
|
dest.left, dest.top, dest.right + dest.left, dest.bottom + dest.top,
|
|
|
|
src.left, src.top, src.right + src.left, src.bottom + src.top,
|
|
|
|
data, info, DIB_RGB_COLORS, SRCCOPY);
|
|
|
|
HeapFree(GetProcessHeap(), 0, data);
|
2010-05-18 20:16:57 +02:00
|
|
|
res = 0;
|
|
|
|
out:
|
2010-06-03 21:08:15 +02:00
|
|
|
if (wma->parent)
|
2010-08-09 14:24:31 +02:00
|
|
|
IVideoWindow_put_Visible(wma->vidwin, visible);
|
2010-05-18 20:16:57 +02:00
|
|
|
}
|
|
|
|
else if (dwFlags)
|
2022-02-14 09:27:07 +01:00
|
|
|
FIXME("Unhandled flags %lx\n", dwFlags);
|
2010-05-18 20:16:57 +02:00
|
|
|
return res;
|
|
|
|
}
|
|
|
|
|
2009-12-30 09:40:29 +01:00
|
|
|
/***************************************************************************
|
|
|
|
* MCIQTZ_mciSetAudio [internal]
|
|
|
|
*/
|
|
|
|
static DWORD MCIQTZ_mciSetAudio(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETAUDIO_PARMSW lpParms)
|
|
|
|
{
|
|
|
|
WINE_MCIQTZ *wma;
|
2015-03-05 15:34:42 +01:00
|
|
|
DWORD ret = 0;
|
2009-12-30 09:40:29 +01:00
|
|
|
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%04x, %08lx, %p)\n", wDevID, dwFlags, lpParms);
|
2009-12-30 09:40:29 +01:00
|
|
|
|
2016-05-04 19:42:53 +02:00
|
|
|
if(!lpParms)
|
|
|
|
return MCIERR_NULL_PARAMETER_BLOCK;
|
|
|
|
|
2009-12-30 09:40:29 +01:00
|
|
|
wma = MCIQTZ_mciGetOpenDev(wDevID);
|
|
|
|
if (!wma)
|
|
|
|
return MCIERR_INVALID_DEVICE_ID;
|
|
|
|
|
2015-03-05 15:34:42 +01:00
|
|
|
if (!(dwFlags & MCI_DGV_SETAUDIO_ITEM)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
FIXME("Unknown flags (%08lx)\n", dwFlags);
|
2015-03-05 15:34:42 +01:00
|
|
|
return 0;
|
|
|
|
}
|
2009-12-30 09:40:29 +01:00
|
|
|
|
2015-03-05 15:34:42 +01:00
|
|
|
if (dwFlags & MCI_DGV_SETAUDIO_ITEM) {
|
|
|
|
switch (lpParms->dwItem) {
|
|
|
|
case MCI_DGV_SETAUDIO_VOLUME:
|
|
|
|
if (dwFlags & MCI_DGV_SETAUDIO_VALUE) {
|
2016-07-09 10:50:52 +02:00
|
|
|
long vol;
|
2015-03-05 15:34:42 +01:00
|
|
|
HRESULT hr;
|
|
|
|
if (lpParms->dwValue > 1000) {
|
|
|
|
ret = MCIERR_OUTOFRANGE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
if (dwFlags & MCI_TEST)
|
|
|
|
break;
|
2016-07-09 10:50:52 +02:00
|
|
|
if (lpParms->dwValue != 0)
|
|
|
|
vol = (long)(2000.0 * (log10(lpParms->dwValue) - 3.0));
|
|
|
|
else
|
|
|
|
vol = -10000;
|
|
|
|
TRACE("Setting volume to %ld\n", vol);
|
2015-03-05 15:34:42 +01:00
|
|
|
hr = IBasicAudio_put_Volume(wma->audio, vol);
|
|
|
|
if (FAILED(hr)) {
|
2022-02-14 09:27:07 +01:00
|
|
|
WARN("Cannot set volume (hr = %lx)\n", hr);
|
2015-03-05 15:34:42 +01:00
|
|
|
ret = MCIERR_INTERNAL;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
break;
|
|
|
|
default:
|
2022-02-14 09:27:07 +01:00
|
|
|
FIXME("Unknown item %08lx\n", lpParms->dwItem);
|
2015-03-05 15:34:42 +01:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return ret;
|
2009-12-30 09:40:29 +01:00
|
|
|
}
|
|
|
|
|
2009-02-26 23:27:36 +01:00
|
|
|
/*======================================================================*
|
2009-04-21 23:32:09 +02:00
|
|
|
* MCI QTZ entry points *
|
2009-02-26 23:27:36 +01:00
|
|
|
*======================================================================*/
|
|
|
|
|
|
|
|
/**************************************************************************
|
2009-04-21 23:32:09 +02:00
|
|
|
* DriverProc (MCIQTZ.@)
|
2009-02-26 23:27:36 +01:00
|
|
|
*/
|
|
|
|
LRESULT CALLBACK MCIQTZ_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
|
|
|
|
LPARAM dwParam1, LPARAM dwParam2)
|
|
|
|
{
|
2022-02-14 09:27:07 +01:00
|
|
|
TRACE("(%08IX, %p, %08X, %08IX, %08IX)\n",
|
2009-03-29 23:50:26 +02:00
|
|
|
dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
|
|
|
|
|
|
|
switch (wMsg) {
|
|
|
|
case DRV_LOAD: return 1;
|
|
|
|
case DRV_FREE: return 1;
|
|
|
|
case DRV_OPEN: return MCIQTZ_drvOpen((LPCWSTR)dwParam1, (LPMCI_OPEN_DRIVER_PARMSW)dwParam2);
|
|
|
|
case DRV_CLOSE: return MCIQTZ_drvClose(dwDevID);
|
|
|
|
case DRV_ENABLE: return 1;
|
|
|
|
case DRV_DISABLE: return 1;
|
|
|
|
case DRV_QUERYCONFIGURE: return 1;
|
|
|
|
case DRV_CONFIGURE: return MCIQTZ_drvConfigure(dwDevID);
|
|
|
|
case DRV_INSTALL: return DRVCNF_RESTART;
|
|
|
|
case DRV_REMOVE: return DRVCNF_RESTART;
|
|
|
|
}
|
|
|
|
|
|
|
|
/* session instance */
|
|
|
|
if (dwDevID == 0xFFFFFFFF)
|
|
|
|
return 1;
|
|
|
|
|
2009-03-29 23:51:49 +02:00
|
|
|
switch (wMsg) {
|
2016-05-04 19:42:53 +02:00
|
|
|
case MCI_OPEN_DRIVER: return MCIQTZ_mciOpen (dwDevID, dwParam1, (LPMCI_DGV_OPEN_PARMSW) dwParam2);
|
|
|
|
case MCI_CLOSE_DRIVER: return MCIQTZ_mciClose (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_PLAY: return MCIQTZ_mciPlay (dwDevID, dwParam1, (LPMCI_PLAY_PARMS) dwParam2);
|
|
|
|
case MCI_SEEK: return MCIQTZ_mciSeek (dwDevID, dwParam1, (LPMCI_SEEK_PARMS) dwParam2);
|
|
|
|
case MCI_STOP: return MCIQTZ_mciStop (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_PAUSE: return MCIQTZ_mciPause (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_RESUME: return MCIQTZ_mciResume (dwDevID, dwParam1, (LPMCI_GENERIC_PARMS) dwParam2);
|
|
|
|
case MCI_GETDEVCAPS: return MCIQTZ_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS) dwParam2);
|
|
|
|
case MCI_SET: return MCIQTZ_mciSet (dwDevID, dwParam1, (LPMCI_DGV_SET_PARMS) dwParam2);
|
|
|
|
case MCI_STATUS: return MCIQTZ_mciStatus (dwDevID, dwParam1, (LPMCI_DGV_STATUS_PARMSW) dwParam2);
|
|
|
|
case MCI_WHERE: return MCIQTZ_mciWhere (dwDevID, dwParam1, (LPMCI_DGV_RECT_PARMS) dwParam2);
|
2009-12-30 09:40:29 +01:00
|
|
|
/* Digital Video specific */
|
2016-05-04 19:42:53 +02:00
|
|
|
case MCI_SETAUDIO: return MCIQTZ_mciSetAudio (dwDevID, dwParam1, (LPMCI_DGV_SETAUDIO_PARMSW) dwParam2);
|
2010-05-18 20:16:57 +02:00
|
|
|
case MCI_UPDATE:
|
2016-05-04 19:42:53 +02:00
|
|
|
return MCIQTZ_mciUpdate(dwDevID, dwParam1, (LPMCI_DGV_UPDATE_PARMS)dwParam2);
|
2010-05-21 12:17:58 +02:00
|
|
|
case MCI_WINDOW:
|
2016-05-04 19:42:53 +02:00
|
|
|
return MCIQTZ_mciWindow(dwDevID, dwParam1, (LPMCI_DGV_WINDOW_PARMSW)dwParam2);
|
2016-01-15 20:43:52 +01:00
|
|
|
case MCI_PUT:
|
2016-05-04 19:42:53 +02:00
|
|
|
return MCIQTZ_mciPut(dwDevID, dwParam1, (MCI_GENERIC_PARMS*)dwParam2);
|
2009-03-29 23:51:49 +02:00
|
|
|
case MCI_RECORD:
|
|
|
|
case MCI_INFO:
|
|
|
|
case MCI_LOAD:
|
|
|
|
case MCI_SAVE:
|
|
|
|
case MCI_FREEZE:
|
|
|
|
case MCI_REALIZE:
|
|
|
|
case MCI_UNFREEZE:
|
|
|
|
case MCI_STEP:
|
|
|
|
case MCI_COPY:
|
|
|
|
case MCI_CUT:
|
|
|
|
case MCI_DELETE:
|
|
|
|
case MCI_PASTE:
|
|
|
|
case MCI_CUE:
|
|
|
|
/* Digital Video specific */
|
|
|
|
case MCI_CAPTURE:
|
|
|
|
case MCI_MONITOR:
|
|
|
|
case MCI_RESERVE:
|
|
|
|
case MCI_SIGNAL:
|
|
|
|
case MCI_SETVIDEO:
|
|
|
|
case MCI_QUALITY:
|
|
|
|
case MCI_LIST:
|
|
|
|
case MCI_UNDO:
|
|
|
|
case MCI_CONFIGURE:
|
|
|
|
case MCI_RESTORE:
|
2009-04-16 20:29:17 +02:00
|
|
|
FIXME("Unimplemented command [%08X]\n", wMsg);
|
2009-03-29 23:51:49 +02:00
|
|
|
break;
|
|
|
|
case MCI_SPIN:
|
|
|
|
case MCI_ESCAPE:
|
2009-04-16 20:29:17 +02:00
|
|
|
WARN("Unsupported command [%08X]\n", wMsg);
|
2009-03-29 23:51:49 +02:00
|
|
|
break;
|
|
|
|
case MCI_OPEN:
|
|
|
|
case MCI_CLOSE:
|
|
|
|
FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
|
|
|
|
break;
|
|
|
|
default:
|
2009-04-16 20:29:17 +02:00
|
|
|
TRACE("Sending msg [%08X] to default driver proc\n", wMsg);
|
2009-03-29 23:51:49 +02:00
|
|
|
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
|
|
|
|
}
|
2009-02-26 23:27:36 +01:00
|
|
|
|
|
|
|
return MCIERR_UNRECOGNIZED_COMMAND;
|
|
|
|
}
|