summaryrefslogtreecommitdiffstats
path: root/loader
diff options
context:
space:
mode:
authorcehoyos <cehoyos@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-03-09 12:00:30 +0000
committercehoyos <cehoyos@b3059339-0415-0410-9bf9-f77b7e298cf2>2010-03-09 12:00:30 +0000
commitb35edca8bfdab76c6251104c474cf15f05391da4 (patch)
tree7eca7959cf423ebf63ddfe942fdbb7d1baa68a86 /loader
parent26dbd2fc7c402141cdff72c3e064233dd78253d4 (diff)
downloadmpv-b35edca8bfdab76c6251104c474cf15f05391da4.tar.bz2
mpv-b35edca8bfdab76c6251104c474cf15f05391da4.tar.xz
Commit files by Steinar Gunderson, forgotten in r30866.
Fixes compilation on x86-32. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30870 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'loader')
-rw-r--r--loader/dshow/graph.c146
-rw-r--r--loader/dshow/graph.h38
2 files changed, 184 insertions, 0 deletions
diff --git a/loader/dshow/graph.c b/loader/dshow/graph.c
new file mode 100644
index 0000000000..783ccac7f4
--- /dev/null
+++ b/loader/dshow/graph.c
@@ -0,0 +1,146 @@
+/*
+ * Implemention of FilterGraph. Based on allocator.c.
+ *
+ * Modified for use with MPlayer, detailed changelog at
+ * http://svn.mplayerhq.hu/mplayer/trunk/
+ */
+
+#include "config.h"
+#include "loader/com.h"
+#include "loader/dshow/graph.h"
+#include "loader/wine/winerror.h"
+#include <stdio.h>
+#include <stdlib.h>
+
+// How many FilterGraph objects exist.
+// Used for knowing when to register and unregister the class in COM.
+static int GraphKeeper = 0;
+
+static long FilterGraph_CreateGraph(GUID* clsid, const GUID* iid, void** ppv)
+{
+ IUnknown* p;
+ int result;
+ if (!ppv)
+ return -1;
+ *ppv = 0;
+ if (memcmp(clsid, &CLSID_FilterGraph, sizeof(*clsid)))
+ return -1;
+
+ p = (IUnknown*) FilterGraphCreate();
+ result = p->vt->QueryInterface(p, iid, ppv);
+ p->vt->Release(p);
+
+ return result;
+}
+
+static void FilterGraph_Destroy(FilterGraph* This)
+{
+ Debug printf("FilterGraph_Destroy(%p) called (%d, %d)\n", This, This->refcount, GraphKeeper);
+#ifdef WIN32_LOADER
+ if (--GraphKeeper == 0)
+ UnregisterComClass(&CLSID_FilterGraph, FilterGraph_CreateGraph);
+#endif
+ free(This->vt);
+ free(This);
+}
+
+HRESULT STDCALL FilterGraph_AddFilter(FilterGraph* This,
+ IBaseFilter* pFilter,
+ unsigned short* pName)
+{
+ Debug printf("FilterGraph_AddFilter(%p) called\n", This);
+ return E_NOTIMPL;
+}
+
+HRESULT STDCALL FilterGraph_RemoveFilter(FilterGraph* This, IBaseFilter* pFilter)
+{
+ Debug printf("FilterGraph_RemoveFilter(%p) called\n", This);
+ return E_NOTIMPL;
+}
+
+HRESULT STDCALL FilterGraph_EnumFilters(FilterGraph* This, IEnumFilters** ppEnum)
+{
+ Debug printf("FilterGraph_EnumFilters(%p) called\n", This);
+ return E_NOTIMPL;
+}
+
+HRESULT STDCALL FilterGraph_FindFilterByName(FilterGraph* This,
+ unsigned short* pName,
+ IBaseFilter** ppFilter)
+{
+ Debug printf("FilterGraph_FindFilterByName(%p) called\n", This);
+ return E_NOTIMPL;
+}
+
+HRESULT STDCALL FilterGraph_ConnectDirect(FilterGraph* This,
+ IPin* ppinOut,
+ IPin* ppinIn,
+ const AM_MEDIA_TYPE* pmt)
+{
+ Debug printf("FilterGraph_ConnectDirect(%p) called\n", This);
+ return E_NOTIMPL;
+}
+
+HRESULT STDCALL FilterGraph_Reconnect(FilterGraph* This, IPin* ppin)
+{
+ Debug printf("FilterGraph_Reconnect(%p) called\n", This);
+ return E_NOTIMPL;
+}
+
+HRESULT STDCALL FilterGraph_Disconnect(FilterGraph* This, IPin* ppin)
+{
+ Debug printf("FilterGraph_Disconnect(%p) called\n", This);
+ return E_NOTIMPL;
+}
+
+HRESULT STDCALL FilterGraph_SetDefaultSyncSource(FilterGraph* This)
+{
+ Debug printf("FilterGraph_SetDefaultSyncSource(%p) called\n", This);
+ return E_NOTIMPL;
+}
+
+IMPLEMENT_IUNKNOWN(FilterGraph)
+
+FilterGraph* FilterGraphCreate()
+{
+ FilterGraph* This = calloc(1, sizeof(*This));
+
+ if (!This)
+ return NULL;
+
+ Debug printf("FilterGraphCreate() called -> %p\n", This);
+
+ This->refcount = 1;
+
+ This->vt = calloc(1, sizeof(*This->vt));
+
+ if (!This->vt)
+ {
+ free(This);
+ return NULL;
+ }
+
+ This->vt->QueryInterface = FilterGraph_QueryInterface;
+ This->vt->AddRef = FilterGraph_AddRef;
+ This->vt->Release = FilterGraph_Release;
+
+ This->vt->AddFilter = FilterGraph_AddFilter;
+ This->vt->RemoveFilter = FilterGraph_RemoveFilter;
+ This->vt->EnumFilters = FilterGraph_EnumFilters;
+ This->vt->FindFilterByName = FilterGraph_FindFilterByName;
+ This->vt->ConnectDirect = FilterGraph_ConnectDirect;
+ This->vt->Reconnect = FilterGraph_Reconnect;
+ This->vt->Disconnect = FilterGraph_Disconnect;
+ This->vt->SetDefaultSyncSource = FilterGraph_SetDefaultSyncSource;
+
+ This->interfaces[0]=IID_IUnknown;
+ This->interfaces[1]=IID_IFilterGraph;
+
+#ifdef WIN32_LOADER
+ if (GraphKeeper++ == 0)
+ RegisterComClass(&CLSID_FilterGraph, FilterGraph_CreateGraph);
+#endif
+
+ return This;
+}
+
diff --git a/loader/dshow/graph.h b/loader/dshow/graph.h
new file mode 100644
index 0000000000..62423960a0
--- /dev/null
+++ b/loader/dshow/graph.h
@@ -0,0 +1,38 @@
+#ifndef MPLAYER_GRAPH_H
+#define MPLAYER_GRAPH_H
+
+#include "interfaces.h"
+#include "cmediasample.h"
+
+typedef struct FilterGraph FilterGraph;
+
+struct FilterGraph
+{
+ IFilterGraph_vt* vt;
+ DECLARE_IUNKNOWN();
+ GUID interfaces[2];
+
+ HRESULT STDCALL ( *AddFilter )(FilterGraph* This,
+ /* [in] */ IBaseFilter* pFilter,
+ /* [string][in] */ unsigned short* pName);
+ HRESULT STDCALL ( *RemoveFilter )(FilterGraph* This,
+ /* [in] */ IBaseFilter* pFilter);
+ HRESULT STDCALL ( *EnumFilters )(FilterGraph* This,
+ /* [out] */ IEnumFilters** ppEnum);
+ HRESULT STDCALL ( *FindFilterByName )(FilterGraph* This,
+ /* [string][in] */ unsigned short* pName,
+ /* [out] */ IBaseFilter** ppFilter);
+ HRESULT STDCALL ( *ConnectDirect )(FilterGraph* This,
+ /* [in] */ IPin* ppinOut,
+ /* [in] */ IPin* ppinIn,
+ /* [in] */ const AM_MEDIA_TYPE* pmt);
+ HRESULT STDCALL ( *Reconnect )(FilterGraph* This,
+ /* [in] */ IPin* ppin);
+ HRESULT STDCALL ( *Disconnect )(FilterGraph* This,
+ /* [in] */ IPin* ppin);
+ HRESULT STDCALL ( *SetDefaultSyncSource )(FilterGraph* This);
+};
+
+FilterGraph* FilterGraphCreate(void);
+
+#endif /* MPLAYER_GRAPH_H */