[MPlayer-cvslog] r30866 - in trunk: Makefile loader/dshow/DS_Filter.c loader/dshow/allocator.c loader/dshow/guids.c loader/dshow/guids.h loader/dshow/interfaces.h

sesse subversion at mplayerhq.hu
Mon Mar 8 20:57:37 CET 2010


Author: sesse
Date: Mon Mar  8 20:57:37 2010
New Revision: 30866

Log:
Implement DirectShow filter graph.

DirectShow specifies that a filter (codec) can expect JoinFilterGraph
to be called, and store a reference to the graph manager. Implement a
very bare-bones graph manager (all functions are stubs, and no extra
interfaces are implemented) and give it to the codec on init.

Modified:
   trunk/Makefile
   trunk/loader/dshow/DS_Filter.c
   trunk/loader/dshow/allocator.c
   trunk/loader/dshow/guids.c
   trunk/loader/dshow/guids.h
   trunk/loader/dshow/interfaces.h

Modified: trunk/Makefile
==============================================================================
--- trunk/Makefile	Mon Mar  8 20:54:07 2010	(r30865)
+++ trunk/Makefile	Mon Mar  8 20:57:37 2010	(r30866)
@@ -322,6 +322,7 @@ SRCS_COMMON-$(WIN32DLL)              += 
                                         loader/dshow/DS_VideoDecoder.c \
                                         loader/dshow/allocator.c \
                                         loader/dshow/cmediasample.c \
+                                        loader/dshow/graph.c \
                                         loader/dshow/guids.c \
                                         loader/dshow/inputpin.c \
                                         loader/dshow/mediatype.c \

Modified: trunk/loader/dshow/DS_Filter.c
==============================================================================
--- trunk/loader/dshow/DS_Filter.c	Mon Mar  8 20:54:07 2010	(r30865)
+++ trunk/loader/dshow/DS_Filter.c	Mon Mar  8 20:57:37 2010	(r30866)
@@ -5,6 +5,7 @@
 
 #include "config.h"
 #include "DS_Filter.h"
+#include "graph.h"
 #include "loader/drv.h"
 #include "loader/com.h"
 #include <stdio.h>
@@ -125,6 +126,7 @@ DS_Filter* DS_FilterCreate(const char* d
 //    char eb[250];
     const char* em = NULL;
     MemAllocator* tempAll;
+    FilterGraph* graph;
     ALLOCATOR_PROPERTIES props,props1;
     DS_Filter* This = malloc(sizeof(DS_Filter));
     if (!This)
@@ -166,6 +168,7 @@ DS_Filter* DS_FilterCreate(const char* d
 	ULONG fetched;
         HRESULT result;
         unsigned int i;
+        static const uint16_t filter_name[] = { 'F', 'i', 'l', 't', 'e', 'r', 0 };
 
 	This->m_iHandle = LoadLibraryA(dllname);
 	if (!This->m_iHandle)
@@ -199,6 +202,10 @@ DS_Filter* DS_FilterCreate(const char* d
 	    em = "object does not provide IBaseFilter interface";
             break;
 	}
+
+	graph = FilterGraphCreate();
+	result = This->m_pFilter->vt->JoinFilterGraph(This->m_pFilter, (IFilterGraph*)graph, filter_name);
+
 	// enumerate pins
 	result = This->m_pFilter->vt->EnumPins(This->m_pFilter, &enum_pins);
 	if (result || !enum_pins)

Modified: trunk/loader/dshow/allocator.c
==============================================================================
--- trunk/loader/dshow/allocator.c	Mon Mar  8 20:54:07 2010	(r30865)
+++ trunk/loader/dshow/allocator.c	Mon Mar  8 20:57:37 2010	(r30866)
@@ -116,7 +116,7 @@ static inline avm_list_t* avm_list_find(
 
 static long MemAllocator_CreateAllocator(GUID* clsid, const GUID* iid, void** ppv)
 {
-    IMemAllocator* p;
+    IUnknown* p;
     int result;
     if (!ppv)
 	return -1;
@@ -124,9 +124,9 @@ static long MemAllocator_CreateAllocator
     if (memcmp(clsid, &CLSID_MemoryAllocator, sizeof(GUID)))
 	return -1;
 
-    p = (IMemAllocator*) MemAllocatorCreate();
-    result = p->vt->QueryInterface((IUnknown*)p, iid, ppv);
-    p->vt->Release((IUnknown*)p);
+    p = (IUnknown*) MemAllocatorCreate();
+    result = p->vt->QueryInterface(p, iid, ppv);
+    p->vt->Release(p);
 
     return result;
 }

Modified: trunk/loader/dshow/guids.c
==============================================================================
--- trunk/loader/dshow/guids.c	Mon Mar  8 20:54:07 2010	(r30865)
+++ trunk/loader/dshow/guids.c	Mon Mar  8 20:57:37 2010	(r30866)
@@ -11,6 +11,8 @@ const GUID IID_IBaseFilter={0x56a86895, 
     {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
 const GUID IID_IEnumPins={0x56a86892, 0x0ad4, 0x11ce,
     {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
+const GUID IID_IFilterGraph={0x56a8689f, 0x0ad4, 0x11ce,
+    {0xb0, 0x3a, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
 const GUID IID_IEnumMediaTypes={0x89c31040, 0x846b, 0x11ce,
     {0x97, 0xd3, 0x00, 0xaa, 0x00, 0x55, 0x59, 0x5a}};
 const GUID IID_IMemInputPin={0x56a8689d, 0x0ad4, 0x11ce,
@@ -64,6 +66,8 @@ const GUID MEDIASUBTYPE_I420={0x30323449
     {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
 const GUID MEDIASUBTYPE_IF09={0x39304649, 0x0000, 0x0010,
     {0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71}};
+const GUID CLSID_FilterGraph={0xe436ebb3, 0x524f, 0x11ce,
+    {0x9f, 0x53, 0x00, 0x20, 0xaf, 0x0b, 0xa7, 0x70}};
 const GUID CLSID_MemoryAllocator={0x1e651cc0, 0xb199, 0x11d0,
     {0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45}};
 const GUID IID_DivxHidden={0x598eba01, 0xb49a, 0x11d2,

Modified: trunk/loader/dshow/guids.h
==============================================================================
--- trunk/loader/dshow/guids.h	Mon Mar  8 20:54:07 2010	(r30865)
+++ trunk/loader/dshow/guids.h	Mon Mar  8 20:57:37 2010	(r30866)
@@ -46,6 +46,7 @@ typedef GUID IID;
 extern const GUID IID_IBaseFilter;
 extern const GUID IID_IEnumPins;
 extern const GUID IID_IEnumMediaTypes;
+extern const GUID IID_IFilterGraph;
 extern const GUID IID_IMemInputPin;
 extern const GUID IID_IMemAllocator;
 extern const GUID IID_IMediaSample;
@@ -54,6 +55,7 @@ extern const GUID IID_Iv50Hidden;
 extern const GUID CLSID_DivxDecompressorCF;
 extern const GUID IID_IDivxFilterInterface;
 extern const GUID CLSID_IV50_Decoder;
+extern const GUID CLSID_FilterGraph;
 extern const GUID CLSID_MemoryAllocator;
 extern const GUID MEDIATYPE_Video;
 // avoid a clash with MinGW-W64 libuuid

Modified: trunk/loader/dshow/interfaces.h
==============================================================================
--- trunk/loader/dshow/interfaces.h	Mon Mar  8 20:54:07 2010	(r30865)
+++ trunk/loader/dshow/interfaces.h	Mon Mar  8 20:57:37 2010	(r30866)
@@ -329,4 +329,32 @@ struct IDivxFilterInterface_vt
     HRESULT STDCALL ( *get_AspectRatio )(IDivxFilterInterface* This, int* x, IDivxFilterInterface* Thisit, int* y);
 };
 
+typedef struct IEnumFilters IEnumFilters;
+
+typedef struct IFilterGraph_vt
+{
+    INHERIT_IUNKNOWN();
+
+    HRESULT STDCALL ( *AddFilter )(IFilterGraph* This,
+                                   /* [in] */ IBaseFilter* pFilter,
+                                   /* [string][in] */ unsigned short* pName);
+    HRESULT STDCALL ( *RemoveFilter )(IFilterGraph* This,
+                                      /* [in] */ IBaseFilter* pFilter);
+    HRESULT STDCALL ( *EnumFilters )(IFilterGraph* This,
+                                     /* [out] */ IEnumFilters** ppEnum);
+    HRESULT STDCALL ( *FindFilterByName )(IFilterGraph* This,
+                                          /* [string][in] */ unsigned short* pName,
+                                          /* [out] */ IBaseFilter** ppFilter);
+    HRESULT STDCALL ( *ConnectDirect )(IFilterGraph* This,
+                                       /* [in] */ IPin* ppinOut,
+                                       /* [in] */ IPin* ppinIn,
+                                       /* [in] */ const AM_MEDIA_TYPE* pmt);
+    HRESULT STDCALL ( *Reconnect )(IFilterGraph* This,
+                                   /* [in] */ IPin* ppin);
+    HRESULT STDCALL ( *Disconnect )(IFilterGraph* This,
+                                    /* [in] */ IPin* ppin);
+    HRESULT STDCALL ( *SetDefaultSyncSource )(IFilterGraph* This);
+} IFilterGraph_vt;
+struct IFilterGraph { IFilterGraph_vt *vt; };
+
 #endif  /*MPLAYER_INTERFACES_H */


More information about the MPlayer-cvslog mailing list