Stub CaptureGraphBuilder

Maarten Lankhorst m.b.lankhorst at gmail.com
Tue Apr 26 15:05:11 CDT 2005


Added a very stubby CaptureGraphBuilder
-------------- next part --------------
Index: Makefile.in
===================================================================
RCS file: /home/wine/wine/dlls/quartz/Makefile.in,v
retrieving revision 1.44
diff -u -p -r1.44 Makefile.in
--- Makefile.in	10 Feb 2005 17:13:18 -0000	1.44
+++ Makefile.in	26 Apr 2005 19:57:04 -0000
@@ -10,6 +10,7 @@ C_SRCS = \
 	acmwrapper.c \
 	avidec.c \
 	avisplit.c \
+	capturegraph.c \
 	control.c \
 	dsoundrender.c \
 	enumfilters.c \
Index: main.c
===================================================================
RCS file: /home/wine/wine/dlls/quartz/main.c,v
retrieving revision 1.44
diff -u -p -r1.44 main.c
--- main.c	2 Mar 2005 12:23:22 -0000	1.44
+++ main.c	26 Apr 2005 19:57:10 -0000
@@ -71,7 +71,8 @@ static const struct object_creation_info
     { &CLSID_AVIDec, AVIDec_create },
     { &CLSID_SystemClock, &QUARTZ_CreateSystemClock },
     { &CLSID_ACMWrapper, &ACMWrapper_create },
-    { &CLSID_WAVEParser, &WAVEParser_create }
+    { &CLSID_WAVEParser, &WAVEParser_create },
+    { &CLSID_CaptureGraphBuilder, &CaptureGraphBuilder_create }
 };
 
 static HRESULT WINAPI
Index: quartz_private.h
===================================================================
RCS file: /home/wine/wine/dlls/quartz/quartz_private.h,v
retrieving revision 1.22
diff -u -p -r1.22 quartz_private.h
--- quartz_private.h	10 Feb 2005 17:13:18 -0000	1.22
+++ quartz_private.h	26 Apr 2005 19:57:11 -0000
@@ -52,6 +52,7 @@ HRESULT VideoRenderer_create(IUnknown * 
 HRESULT QUARTZ_CreateSystemClock(IUnknown * pUnkOuter, LPVOID * ppv);
 HRESULT ACMWrapper_create(IUnknown * pUnkOuter, LPVOID * ppv);
 HRESULT WAVEParser_create(IUnknown * pUnkOuter, LPVOID * ppv);
+HRESULT CaptureGraphBuilder_create(IUnknown * pUnkOuter, LPVOID * ppv);
 
 HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG nMonikerCount, IEnumMoniker ** ppEnum);
 
Index: regsvr.c
===================================================================
RCS file: /home/wine/wine/dlls/quartz/regsvr.c,v
retrieving revision 1.19
diff -u -p -r1.19 regsvr.c
--- regsvr.c	10 Feb 2005 17:13:18 -0000	1.19
+++ regsvr.c	26 Apr 2005 19:57:12 -0000
@@ -922,6 +922,12 @@ static struct regsvr_coclass const cocla
 	"quartz.dll",
 	"Both"
     },
+    {   &CLSID_CaptureGraphBuilder,
+        "Capture Graph Builder",
+        NULL,
+        "quartz.dll",
+        "Both"
+    },
     { NULL }			/* list terminator */
 };
 
--- /dev/null	2005-04-24 13:16:50.030128280 +0200
+++ capturegraph.c	2005-04-26 21:53:53.000000000 +0200
@@ -0,0 +1,196 @@
+/* Capture Graph Builder, Minimal edition..
+ * Copyright 2005 Maarten Lankhorst
+ *
+ * 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., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * TODO: Implement CaptureGraphBuilder2, and make all calls from
+ * CaptureGraphBuilder forward to it..
+ */
+
+#include "config.h"
+
+#define NONAMELESSSTRUCT
+#define NONAMELESSUNION
+#include "quartz_private.h"
+
+#include "uuids.h"
+#include "mmreg.h"
+#include "vfwmsgs.h"
+#include "amvideo.h"
+#include "windef.h"
+#include "winbase.h"
+#include "dshow.h"
+#include "evcode.h"
+#include "strmif.h"
+#include "ddraw.h"
+
+#include "wine/unicode.h"
+#include "wine/debug.h"
+
+WINE_DEFAULT_DEBUG_CHANNEL(quartz);
+
+static const ICaptureGraphBuilderVtbl Builder_Vtbl;
+
+typedef struct CaptureGraphImpl
+{
+   const ICaptureGraphBuilderVtbl * lpVtbl;
+   IGraphBuilder *mygraph;
+
+   ULONG refCount;
+   CRITICAL_SECTION csFilter;
+} CaptureGraphImpl;
+
+HRESULT CaptureGraphBuilder_create(IUnknown * pUnkOuter, LPVOID * ppv)
+{
+   CaptureGraphImpl * pCapture;
+   TRACE("(%p, %p)\n", pUnkOuter, ppv);
+   *ppv = NULL;
+   if (pUnkOuter) return CLASS_E_NOAGGREGATION;
+   pCapture = CoTaskMemAlloc(sizeof(CaptureGraphImpl));
+   pCapture->lpVtbl = &Builder_Vtbl;
+   pCapture->refCount = 1;
+   pCapture->mygraph = NULL;
+   InitializeCriticalSection(&pCapture->csFilter);
+   *ppv = (LPVOID)pCapture;
+   return S_OK;
+}
+
+static HRESULT WINAPI CaptureGraphBuilder_QueryInterface(ICaptureGraphBuilder * iface, REFIID riid, LPVOID * ppv)
+{
+   struct CaptureGraphImpl *This = (CaptureGraphImpl *)iface;
+   TRACE("(%p/%p)->(%s, %p)\n", This, iface, qzdebugstr_guid(riid), ppv);
+   *ppv = NULL;
+   if (IsEqualIID(riid, &IID_IUnknown))
+      *ppv = (LPVOID)This;
+   else if (IsEqualIID(riid, &IID_ICaptureGraphBuilder))
+      *ppv = (LPVOID)This;
+
+   if (*ppv)
+   {
+       IUnknown_AddRef((IUnknown *)(*ppv));
+       return S_OK;
+   }
+
+   FIXME("No interface for %s!\n", qzdebugstr_guid(riid));
+   return E_NOINTERFACE;
+}
+
+static ULONG WINAPI CaptureGraphBuilder_AddRef(ICaptureGraphBuilder * iface)
+{
+   CaptureGraphImpl *This = (CaptureGraphImpl *)iface;
+   ULONG refCount = InterlockedIncrement(&This->refCount);
+
+   TRACE("(%p/%p)->() AddRef from %ld\n", This, iface, refCount - 1);
+   return refCount;
+}
+
+static ULONG WINAPI CaptureGraphBuilder_Release(ICaptureGraphBuilder * iface)
+{
+   CaptureGraphImpl *This = (CaptureGraphImpl *)iface;
+   ULONG refCount = InterlockedDecrement(&This->refCount);
+
+   TRACE("(%p/%p)->() Release from %ld\n", This, iface, refCount + 1);
+
+   if (!refCount) {
+      TRACE("Destroying everything..\n");
+      DeleteCriticalSection(&This->csFilter);
+      if (This->mygraph != NULL)
+        IGraphBuilder_Release((IGraphBuilder *)This->mygraph);
+      CoTaskMemFree(This);
+      return 0;
+   }
+   else return refCount;
+}
+
+static HRESULT WINAPI CaptureGraphBuilder_SetFilterGraph(ICaptureGraphBuilder * iface, IGraphBuilder *pfg)
+{
+/* The graph builder will automatically create a filter graph if you don't call this method. If you call this method after the graph builder has created its own filter graph, the call will fail. */
+   struct CaptureGraphImpl *This = (CaptureGraphImpl *)iface;
+   if (This->mygraph != NULL) return E_NOTIMPL;
+   This->mygraph = pfg;
+   IGraphBuilder_AddRef((IGraphBuilder *)This->mygraph);
+   TRACE("%p: %p\n", iface, pfg);
+   return S_OK;
+}
+
+static HRESULT WINAPI CaptureGraphBuilder_GetFilterGraph(ICaptureGraphBuilder * iface, IGraphBuilder **pfg)
+{
+   struct CaptureGraphImpl *This = (CaptureGraphImpl *)iface;
+   FIXME("%p: Make our own filtergraph if we haven't got one already - stub\n", iface);
+   if (This->mygraph == NULL) return E_NOTIMPL;
+
+   *pfg = This->mygraph;
+   IGraphBuilder_AddRef((IGraphBuilder *)This->mygraph);
+   
+   TRACE("%p: %p\n", iface, *pfg);
+   return S_OK;
+}
+
+static HRESULT WINAPI CaptureGraphBuilder_SetOutputFileName(ICaptureGraphBuilder * iface, const GUID *pType, LPCOLESTR lpstrFile,IBaseFilter **ppf, IFileSinkFilter **ppSink)
+{
+   FIXME("%p: %p, %p, %p, %p - stub\n", iface, pType, lpstrFile, *ppf, *ppSink);
+   return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CaptureGraphBuilder_FindInterface(ICaptureGraphBuilder * iface, const GUID *pCategory, IBaseFilter *pf, REFIID riid, void **ppint)
+{
+   struct CaptureGraphImpl *This = (CaptureGraphImpl *)iface;
+   FIXME("%p: %s %p %s %p - unwanted partial stub!\n", This, qzdebugstr_guid(pCategory), pf, qzdebugstr_guid(riid), *ppint);
+   return IBaseFilter_QueryInterface(pf, riid, ppint);
+   /* Looks for the specified interface on the filter, upstream and
+    * downstream from the filter, and, optionally, only on the output
+    * pin of the given category.
+    */
+}
+
+static HRESULT WINAPI CaptureGraphBuilder_RenderStream(ICaptureGraphBuilder * iface, const GUID *pCategory, IUnknown *pSource, IBaseFilter *pfCompressor, IBaseFilter *pfRenderer)
+{
+   FIXME("%p: stub\n", iface);
+   return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CaptureGraphBuilder_ControlStream(ICaptureGraphBuilder * iface, const GUID *pCategory, IBaseFilter *pFilter, REFERENCE_TIME *pstart, REFERENCE_TIME *pstop, WORD wStartCookie, WORD wStopCookie)
+{
+   FIXME("%p: stub\n", iface);
+   return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CaptureGraphBuilder_AllocCapFile(ICaptureGraphBuilder * iface, LPCOLESTR lpstr, DWORDLONG dwlSize)
+{
+   FIXME("%p: stub\n", iface);
+   return E_NOTIMPL;
+}
+
+static HRESULT WINAPI CaptureGraphBuilder_CopyCaptureFile(ICaptureGraphBuilder * iface, LPOLESTR lpwstrOld, LPOLESTR lpwstrNew, int fAllowEscAbort, IAMCopyCaptureFileProgress *pCallback)
+{
+   FIXME("%p: stub\n", iface);
+   return E_NOTIMPL;
+}
+
+static const ICaptureGraphBuilderVtbl Builder_Vtbl =
+{   
+   CaptureGraphBuilder_QueryInterface,
+   CaptureGraphBuilder_AddRef,
+   CaptureGraphBuilder_Release,
+   CaptureGraphBuilder_SetFilterGraph,
+   CaptureGraphBuilder_GetFilterGraph,
+   CaptureGraphBuilder_SetOutputFileName,
+   CaptureGraphBuilder_FindInterface,
+   CaptureGraphBuilder_RenderStream,
+   CaptureGraphBuilder_ControlStream,
+   CaptureGraphBuilder_AllocCapFile,
+   CaptureGraphBuilder_CopyCaptureFile
+};
+


More information about the wine-patches mailing list