Christian Costa : mciqtz32: Add basic play capability.
Alexandre Julliard
julliard at winehq.org
Mon Mar 30 12:08:52 CDT 2009
Module: wine
Branch: master
Commit: 893fc77332e7542189006ca4debc4e994ce297b7
URL: http://source.winehq.org/git/wine.git/?a=commit;h=893fc77332e7542189006ca4debc4e994ce297b7
Author: Christian Costa <titan.costa at wanadoo.fr>
Date: Sun Mar 29 23:51:49 2009 +0200
mciqtz32: Add basic play capability.
---
dlls/mciqtz32/Makefile.in | 2 +-
dlls/mciqtz32/mciqtz.c | 170 +++++++++++++++++++++++++++++++++++++++-
dlls/mciqtz32/mciqtz_private.h | 9 ++-
3 files changed, 178 insertions(+), 3 deletions(-)
diff --git a/dlls/mciqtz32/Makefile.in b/dlls/mciqtz32/Makefile.in
index 8321d2d..9bac216 100644
--- a/dlls/mciqtz32/Makefile.in
+++ b/dlls/mciqtz32/Makefile.in
@@ -3,7 +3,7 @@ TOPOBJDIR = ../..
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = mciqtz32.dll
-IMPORTS = winmm user32 kernel32
+IMPORTS = strmiids oleaut32 ole32 winmm user32 kernel32
C_SRCS = \
mciqtz.c
diff --git a/dlls/mciqtz32/mciqtz.c b/dlls/mciqtz32/mciqtz.c
index 786105a..ea3a9f7 100644
--- a/dlls/mciqtz32/mciqtz.c
+++ b/dlls/mciqtz32/mciqtz.c
@@ -25,6 +25,7 @@
#include "mmddk.h"
#include "wine/debug.h"
#include "mciqtz_private.h"
+#include "digitalv.h"
WINE_DEFAULT_DEBUG_CHANNEL(mciqtz);
@@ -132,6 +133,73 @@ static WINE_MCIQTZ* MCIQTZ_mciGetOpenDev(UINT wDevID)
}
/***************************************************************************
+ * MCIQTZ_mciOpen [internal]
+ */
+static DWORD MCIQTZ_mciOpen(UINT wDevID, DWORD dwFlags,
+ LPMCI_DGV_OPEN_PARMSW lpOpenParms)
+{
+ WINE_MCIQTZ* wma;
+ HRESULT hr;
+
+ TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpOpenParms);
+
+ MCIQTZ_mciStop(wDevID, MCI_WAIT, NULL);
+
+ if (!lpOpenParms)
+ return MCIERR_NULL_PARAMETER_BLOCK;
+
+ wma = (WINE_MCIQTZ*)mciGetDriverData(wDevID);
+ if (!wma)
+ return MCIERR_INVALID_DEVICE_ID;
+
+ CoInitializeEx(NULL, COINIT_MULTITHREADED);
+
+ hr = CoCreateInstance(&CLSID_FilterGraph, NULL, CLSCTX_INPROC_SERVER, &IID_IGraphBuilder, (LPVOID*)&wma->pgraph);
+ if (FAILED(hr)) {
+ TRACE("Cannot create filtergraph (hr = %x)\n", hr);
+ goto err;
+ }
+
+ hr = IGraphBuilder_QueryInterface(wma->pgraph, &IID_IMediaControl, (LPVOID*)&wma->pmctrl);
+ if (FAILED(hr)) {
+ TRACE("Cannot get IMediaControl interface (hr = %x)\n", hr);
+ goto err;
+ }
+
+ if (!((dwFlags & MCI_OPEN_ELEMENT) && (dwFlags & MCI_OPEN_ELEMENT))) {
+ TRACE("Wrong dwFlags %x\n", dwFlags);
+ goto err;
+ }
+
+ if (!lpOpenParms->lpstrElementName && !lstrlenW(lpOpenParms->lpstrElementName)) {
+ 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)) {
+ TRACE("Cannot render file (hr = %x)\n", hr);
+ goto err;
+ }
+
+ return 0;
+
+err:
+ if (wma->pgraph)
+ IGraphBuilder_Release(wma->pgraph);
+ wma->pgraph = NULL;
+ if (wma->pmctrl)
+ IMediaControl_Release(wma->pmctrl);
+ wma->pmctrl = NULL;
+
+ CoUninitialize();
+
+ return MCIERR_INTERNAL;
+}
+
+/***************************************************************************
* MCIQTZ_mciClose [internal]
*/
static DWORD MCIQTZ_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
@@ -146,6 +214,41 @@ static DWORD MCIQTZ_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
if (!wma)
return MCIERR_INVALID_DEVICE_ID;
+ if (wma->pgraph)
+ IGraphBuilder_Release(wma->pgraph);
+ wma->pgraph = NULL;
+ if (wma->pmctrl)
+ IMediaControl_Release(wma->pmctrl);
+ wma->pmctrl = NULL;
+
+ CoUninitialize();
+
+ return 0;
+}
+
+/***************************************************************************
+ * MCIQTZ_mciPlay [internal]
+ */
+static DWORD MCIQTZ_mciPlay(UINT wDevID, DWORD dwFlags, LPMCI_PLAY_PARMS lpParms)
+{
+ WINE_MCIQTZ* wma;
+ HRESULT hr;
+
+ TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
+
+ if (!lpParms)
+ return MCIERR_NULL_PARAMETER_BLOCK;
+
+ wma = MCIQTZ_mciGetOpenDev(wDevID);
+
+ hr = IMediaControl_Run(wma->pmctrl);
+ if (FAILED(hr)) {
+ TRACE("Cannot run filtergraph (hr = %x)\n", hr);
+ return MCIERR_INTERNAL;
+ }
+
+ wma->started = TRUE;
+
return 0;
}
@@ -155,6 +258,7 @@ static DWORD MCIQTZ_mciClose(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpP
static DWORD MCIQTZ_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
{
WINE_MCIQTZ* wma;
+ HRESULT hr;
TRACE("(%04x, %08X, %p)\n", wDevID, dwFlags, lpParms);
@@ -162,6 +266,17 @@ static DWORD MCIQTZ_mciStop(UINT wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
if (!wma)
return MCIERR_INVALID_DEVICE_ID;
+ if (!wma->started)
+ return 0;
+
+ hr = IMediaControl_Stop(wma->pmctrl);
+ if (FAILED(hr)) {
+ TRACE("Cannot stop filtergraph (hr = %x)\n", hr);
+ return MCIERR_INTERNAL;
+ }
+
+ wma->started = FALSE;
+
return 0;
}
@@ -195,7 +310,60 @@ LRESULT CALLBACK MCIQTZ_DriverProc(DWORD_PTR dwDevID, HDRVR hDriv, UINT wMsg,
if (dwDevID == 0xFFFFFFFF)
return 1;
- FIXME("Unsupported command [%u]\n", wMsg);
+ switch (wMsg) {
+ 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_RECORD:
+ case MCI_STOP:
+ case MCI_SET:
+ case MCI_PAUSE:
+ case MCI_RESUME:
+ case MCI_STATUS:
+ case MCI_GETDEVCAPS:
+ case MCI_INFO:
+ case MCI_SEEK:
+ case MCI_PUT:
+ case MCI_WINDOW:
+ case MCI_LOAD:
+ case MCI_SAVE:
+ case MCI_FREEZE:
+ case MCI_REALIZE:
+ case MCI_UNFREEZE:
+ case MCI_UPDATE:
+ case MCI_WHERE:
+ 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_SETAUDIO:
+ case MCI_SIGNAL:
+ case MCI_SETVIDEO:
+ case MCI_QUALITY:
+ case MCI_LIST:
+ case MCI_UNDO:
+ case MCI_CONFIGURE:
+ case MCI_RESTORE:
+ FIXME("Unimplemented command [%u]\n", wMsg);
+ break;
+ case MCI_SPIN:
+ case MCI_ESCAPE:
+ WARN("Unsupported command [%u]\n", wMsg);
+ break;
+ case MCI_OPEN:
+ case MCI_CLOSE:
+ FIXME("Shouldn't receive a MCI_OPEN or CLOSE message\n");
+ break;
+ default:
+ TRACE("Sending msg [%u] to default driver proc\n", wMsg);
+ return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
+ }
return MCIERR_UNRECOGNIZED_COMMAND;
}
diff --git a/dlls/mciqtz32/mciqtz_private.h b/dlls/mciqtz32/mciqtz_private.h
index 4134d8d..cbcece0 100644
--- a/dlls/mciqtz32/mciqtz_private.h
+++ b/dlls/mciqtz32/mciqtz_private.h
@@ -21,8 +21,15 @@
#ifndef __WINE_PRIVATE_MCIQTZ_H
#define __WINE_PRIVATE_MCIQTZ_H
+#define COBJMACROS
+
+#include "dshow.h"
+
typedef struct {
- MCIDEVICEID wDevID;
+ MCIDEVICEID wDevID;
+ IGraphBuilder* pgraph;
+ IMediaControl* pmctrl;
+ BOOL started;
} WINE_MCIQTZ;
#endif /* __WINE_PRIVATE_MCIQTZ_H */
More information about the wine-cvs
mailing list