diff options
author | Julien Isorce <julien.isorce@gmail.com> | 2009-07-27 14:52:57 +0200 |
---|---|---|
committer | Julien Isorce <julien.isorce@gmail.com> | 2009-07-27 14:52:57 +0200 |
commit | dabb692e7cec9eaef0703a2cabefc65cb12738ff (patch) | |
tree | ea221bf3b53f52af54617a7c0b1023639f831774 /sys | |
parent | 9b1bdac9cc60e274ddc10b2948d9f7d70f2b6e49 (diff) | |
download | gst-plugins-bad-dabb692e7cec9eaef0703a2cabefc65cb12738ff.tar.gz gst-plugins-bad-dabb692e7cec9eaef0703a2cabefc65cb12738ff.tar.bz2 gst-plugins-bad-dabb692e7cec9eaef0703a2cabefc65cb12738ff.zip |
dshowsrcwrapper: remove use of IGstDshowInterface
Diffstat (limited to 'sys')
-rwxr-xr-x | sys/dshowsrcwrapper/Makefile.am | 1 | ||||
-rwxr-xr-x | sys/dshowsrcwrapper/gstdshow.cpp | 38 | ||||
-rwxr-xr-x | sys/dshowsrcwrapper/gstdshow.h | 2 | ||||
-rwxr-xr-x | sys/dshowsrcwrapper/gstdshowaudiosrc.cpp | 34 | ||||
-rwxr-xr-x | sys/dshowsrcwrapper/gstdshowaudiosrc.h | 4 | ||||
-rwxr-xr-x | sys/dshowsrcwrapper/gstdshowfakesink.cpp | 71 | ||||
-rwxr-xr-x | sys/dshowsrcwrapper/gstdshowfakesink.h | 32 | ||||
-rwxr-xr-x | sys/dshowsrcwrapper/gstdshowinterface.h | 163 | ||||
-rwxr-xr-x | sys/dshowsrcwrapper/gstdshowsrcwrapper.cpp | 19 | ||||
-rwxr-xr-x | sys/dshowsrcwrapper/gstdshowvideosrc.cpp | 37 | ||||
-rwxr-xr-x | sys/dshowsrcwrapper/gstdshowvideosrc.h | 4 | ||||
-rwxr-xr-x | sys/dshowsrcwrapper/libgstdshow.def | 8 |
12 files changed, 44 insertions, 369 deletions
diff --git a/sys/dshowsrcwrapper/Makefile.am b/sys/dshowsrcwrapper/Makefile.am index 74bf83ed..de78c531 100755 --- a/sys/dshowsrcwrapper/Makefile.am +++ b/sys/dshowsrcwrapper/Makefile.am @@ -8,7 +8,6 @@ EXTRA_DIST = \ gstdshowfakesink.cpp \ gstdshowfakesink.h \ gstdshow.h \ - gstdshowinterface.h \ gstdshowsrcwrapper.cpp \ gstdshowvideosrc.cpp \ gstdshowvideosrc.h diff --git a/sys/dshowsrcwrapper/gstdshow.cpp b/sys/dshowsrcwrapper/gstdshow.cpp index ed27d631..4b090346 100755 --- a/sys/dshowsrcwrapper/gstdshow.cpp +++ b/sys/dshowsrcwrapper/gstdshow.cpp @@ -22,44 +22,6 @@ #include "gstdshow.h" #include "gstdshowfakesink.h" -CFactoryTemplate g_Templates[]= -{ - { - L"DSHOW fake sink filter" - , &CLSID_DshowFakeSink - , CDshowFakeSink::CreateInstance - , NULL - , NULL - } -}; - -int g_cTemplates = sizeof(g_Templates)/sizeof(g_Templates[0]); -static HINSTANCE g_hModule = NULL; - -extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE, ULONG, LPVOID); -BOOL APIENTRY DllMain(HANDLE hModule, DWORD dwReason, LPVOID lpReserved) -{ - if (!g_hModule) - g_hModule = (HINSTANCE)hModule; - - return DllEntryPoint((HINSTANCE)(hModule), dwReason, lpReserved); -} - -STDAPI DllRegisterServer() -{ - return AMovieDllRegisterServer2 (TRUE); -} - -STDAPI DllUnregisterServer() -{ - return AMovieDllRegisterServer2 (FALSE); -} - -HRESULT gst_dshow_register_fakefilters () -{ - return DllRegisterServer(); -} - void gst_dshow_free_mediatype (AM_MEDIA_TYPE *pmt) { diff --git a/sys/dshowsrcwrapper/gstdshow.h b/sys/dshowsrcwrapper/gstdshow.h index ec360b32..e71ca789 100755 --- a/sys/dshowsrcwrapper/gstdshow.h +++ b/sys/dshowsrcwrapper/gstdshow.h @@ -43,7 +43,7 @@ extern "C" { #endif /* register fake filters as COM object and as Direct Show filters in the registry */ -HRESULT gst_dshow_register_fakefilters (); +//HRESULT gst_dshow_register_fakefilters (); /* free memory of the input pin mediatype */ void gst_dshow_free_pin_mediatype (gpointer pt); diff --git a/sys/dshowsrcwrapper/gstdshowaudiosrc.cpp b/sys/dshowsrcwrapper/gstdshowaudiosrc.cpp index c213aae5..a0e2d78c 100755 --- a/sys/dshowsrcwrapper/gstdshowaudiosrc.cpp +++ b/sys/dshowsrcwrapper/gstdshowaudiosrc.cpp @@ -95,7 +95,7 @@ static void gst_dshowaudiosrc_reset (GstAudioSrc * asrc); static GstCaps *gst_dshowaudiosrc_getcaps_from_streamcaps (GstDshowAudioSrc * src, IPin * pin, IAMStreamConfig * streamcaps); static gboolean gst_dshowaudiosrc_push_buffer (byte * buffer, long size, - byte * src_object, UINT64 start, UINT64 stop); + gpointer src_object, UINT64 start, UINT64 stop); static void gst_dshowaudiosrc_init_interfaces (GType type) @@ -540,13 +540,8 @@ gst_dshowaudiosrc_open (GstAudioSrc * asrc) goto error; } - hres = CoCreateInstance (CLSID_DshowFakeSink, NULL, CLSCTX_INPROC, - IID_IBaseFilter, (LPVOID *) & src->dshow_fakesink); - if (hres != S_OK || !src->dshow_fakesink) { - GST_CAT_ERROR (dshowaudiosrc_debug, - "Can't create an instance of the directshow fakesink (error=%d)", hres); - goto error; - } + src->dshow_fakesink = new CDshowFakeSink; + src->dshow_fakesink->AddRef(); hres = src->filter_graph->AddFilter(src->audio_cap_filter, L"capture"); if (hres != S_OK) { @@ -587,7 +582,6 @@ static gboolean gst_dshowaudiosrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec) { HRESULT hres; - IGstDshowInterface *srcinterface = NULL; IPin *input_pin = NULL; GstDshowAudioSrc *src = GST_DSHOWAUDIOSRC (asrc); @@ -613,20 +607,9 @@ gst_dshowaudiosrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec) if (type) { pin_mediatype = (GstCapturePinMediaType *) type->data; - hres = src->dshow_fakesink->QueryInterface(IID_IGstDshowInterface, (LPVOID *) &srcinterface); - if (hres != S_OK || !srcinterface) { - GST_CAT_ERROR (dshowaudiosrc_debug, - "Can't get IGstDshowInterface interface from our dshow fakesink filter (error=%d)", - hres); - goto error; - } - - srcinterface->gst_set_media_type(pin_mediatype->mediatype); - srcinterface->gst_set_buffer_callback( - (push_buffer_func) gst_dshowaudiosrc_push_buffer, (byte *) src); - - if (srcinterface) - srcinterface->Release(); + src->dshow_fakesink->gst_set_media_type (pin_mediatype->mediatype); + src->dshow_fakesink->gst_set_buffer_callback( + (push_buffer_func) gst_dshowaudiosrc_push_buffer, src); gst_dshow_get_pin_from_filter (src->dshow_fakesink, PINDIR_INPUT, &input_pin); @@ -656,9 +639,6 @@ gst_dshowaudiosrc_prepare (GstAudioSrc * asrc, GstRingBufferSpec * spec) return TRUE; error: - if (srcinterface) - srcinterface->Release(); - return FALSE; } @@ -844,7 +824,7 @@ gst_dshowaudiosrc_getcaps_from_streamcaps (GstDshowAudioSrc * src, IPin * pin, } static gboolean -gst_dshowaudiosrc_push_buffer (byte * buffer, long size, byte * src_object, +gst_dshowaudiosrc_push_buffer (byte * buffer, long size, gpointer src_object, UINT64 start, UINT64 stop) { GstDshowAudioSrc *src = GST_DSHOWAUDIOSRC (src_object); diff --git a/sys/dshowsrcwrapper/gstdshowaudiosrc.h b/sys/dshowsrcwrapper/gstdshowaudiosrc.h index b8147011..d5cfe6e0 100755 --- a/sys/dshowsrcwrapper/gstdshowaudiosrc.h +++ b/sys/dshowsrcwrapper/gstdshowaudiosrc.h @@ -28,7 +28,7 @@ #include <gst/interfaces/propertyprobe.h> #include "gstdshow.h" -#include "gstdshowinterface.h" +#include "gstdshowfakesink.h" G_BEGIN_DECLS #define GST_TYPE_DSHOWAUDIOSRC (gst_dshowaudiosrc_get_type()) @@ -59,7 +59,7 @@ struct _GstDshowAudioSrc IBaseFilter *audio_cap_filter; /* dshow fakesink filter */ - IBaseFilter *dshow_fakesink; + CDshowFakeSink *dshow_fakesink; /* graph manager interfaces */ IMediaFilter *media_filter; diff --git a/sys/dshowsrcwrapper/gstdshowfakesink.cpp b/sys/dshowsrcwrapper/gstdshowfakesink.cpp index afc0a5ef..6c0c74dc 100755 --- a/sys/dshowsrcwrapper/gstdshowfakesink.cpp +++ b/sys/dshowsrcwrapper/gstdshowfakesink.cpp @@ -21,87 +21,30 @@ #include "gstdshowfakesink.h" - -CDshowFakeSink::CDshowFakeSink() - : m_hres(S_OK), CBaseRenderer(CLSID_DshowFakeSink, "DshowFakeSink", NULL, &m_hres) -{ - m_callback = NULL; -} - -CDshowFakeSink::~CDshowFakeSink() -{ - -} - -//Object creation. -CUnknown* WINAPI CDshowFakeSink::CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr) -{ - CDshowFakeSink *pNewObject = new CDshowFakeSink(); - g_print ("CDshowFakeSink::CreateInstance\n"); - if (pNewObject == NULL) { - *pHr = E_OUTOFMEMORY; - } - return pNewObject; -} - -STDMETHODIMP CDshowFakeSink::QueryInterface(REFIID riid, void **ppvObject) -{ - if (riid == IID_IGstDshowInterface) { - *ppvObject = (IGstDshowInterface*) this; - AddRef(); - return S_OK; - } - else - return CBaseRenderer::QueryInterface (riid, ppvObject); -} - -ULONG STDMETHODCALLTYPE CDshowFakeSink::AddRef() -{ - return CBaseRenderer::AddRef(); -} - -ULONG STDMETHODCALLTYPE CDshowFakeSink::Release() +CDshowFakeSink::CDshowFakeSink() : + m_hres(S_OK), + m_callback(NULL), + m_data(NULL), + CBaseRenderer(CLSID_DshowFakeSink, "DshowFakeSink", NULL, &m_hres) { - return CBaseRenderer::Release(); } - STDMETHODIMP CDshowFakeSink::gst_set_media_type (AM_MEDIA_TYPE *pmt) { m_MediaType.Set (*pmt); return S_OK; } -STDMETHODIMP CDshowFakeSink::gst_set_buffer_callback (push_buffer_func push, byte *data) +STDMETHODIMP CDshowFakeSink::gst_set_buffer_callback (push_buffer_func push, gpointer data) { m_callback = push; m_data = data; return S_OK; } -STDMETHODIMP CDshowFakeSink::gst_push_buffer (byte *buffer, __int64 start, __int64 stop, unsigned int size, bool discount) -{ - return E_NOTIMPL; -} - -STDMETHODIMP CDshowFakeSink::gst_flush () -{ - return E_NOTIMPL; -} - -STDMETHODIMP CDshowFakeSink::gst_set_sample_size(unsigned int size) -{ - return E_NOTIMPL; -} - HRESULT CDshowFakeSink::CheckMediaType(const CMediaType *pmt) { - VIDEOINFOHEADER *p1; - VIDEOINFOHEADER *p2; - if(pmt != NULL) - { - p1 = (VIDEOINFOHEADER *)pmt->Format(); - p2 = (VIDEOINFOHEADER *)m_MediaType.Format(); + if (pmt != NULL) { if (*pmt == m_MediaType) return S_OK; } diff --git a/sys/dshowsrcwrapper/gstdshowfakesink.h b/sys/dshowsrcwrapper/gstdshowfakesink.h index 7f419b27..51291c69 100755 --- a/sys/dshowsrcwrapper/gstdshowfakesink.h +++ b/sys/dshowsrcwrapper/gstdshowfakesink.h @@ -19,32 +19,34 @@ * Boston, MA 02111-1307, USA. */ -#include "gstdshowinterface.h" +#ifndef __GST_DHOW_FAKESINK_H__ +#define __GST_DHOW_FAKESINK_H__ -class CDshowFakeSink : public CBaseRenderer, - public IGstDshowInterface +#include "gstdshow.h" + +//{6A780808-9725-4d0b-8695-A4DD8D210773} +static const GUID CLSID_DshowFakeSink = + { 0x6a780808, 0x9725, 0x4d0b, { 0x86, 0x95, 0xa4, 0xdd, 0x8d, 0x21, 0x7, 0x73 } }; + +typedef bool (*push_buffer_func) (byte *buffer, long size, gpointer src_object, UINT64 start, UINT64 stop); + +class CDshowFakeSink : public CBaseRenderer { public: CDshowFakeSink (); - virtual ~CDshowFakeSink (); - - static CUnknown * WINAPI CreateInstance (LPUNKNOWN pUnk, HRESULT *pHr); + virtual ~CDshowFakeSink () {} virtual HRESULT CheckMediaType (const CMediaType *pmt); virtual HRESULT DoRenderSample (IMediaSample *pMediaSample); - STDMETHOD (QueryInterface)(REFIID riid, void **ppvObject); - ULONG STDMETHODCALLTYPE AddRef(); - ULONG STDMETHODCALLTYPE Release(); STDMETHOD (gst_set_media_type) (AM_MEDIA_TYPE *pmt); - STDMETHOD (gst_set_buffer_callback) (push_buffer_func push, byte *data); - STDMETHOD (gst_push_buffer) (byte *buffer, __int64 start, __int64 stop, unsigned int size, bool discount); - STDMETHOD (gst_flush) (); - STDMETHOD (gst_set_sample_size) (unsigned int size); + STDMETHOD (gst_set_buffer_callback) (push_buffer_func push, gpointer data); protected: HRESULT m_hres; CMediaType m_MediaType; push_buffer_func m_callback; - byte *m_data; -};
\ No newline at end of file + gpointer m_data; +}; + +#endif /* __GST_DSHOW_FAKESINK_H__ */ diff --git a/sys/dshowsrcwrapper/gstdshowinterface.h b/sys/dshowsrcwrapper/gstdshowinterface.h deleted file mode 100755 index 68328b95..00000000 --- a/sys/dshowsrcwrapper/gstdshowinterface.h +++ /dev/null @@ -1,163 +0,0 @@ -/* GStreamer - * Copyright (C) 2007 Sebastien Moutte <sebastien@moutte.net> - * - * gstdshowinterface.h: - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 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 - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library 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. - */ - -#ifndef __GST_DHOW_INTERFACE_H__ -#define __GST_DHOW_INTERFACE_H__ - -#include "gstdshow.h" - -#ifdef __cplusplus -typedef bool (*push_buffer_func) (byte *buffer, long size, byte *src_object, UINT64 start, UINT64 stop); -#endif - -/* verify that the <rpcndr.h> version is high enough to compile this file*/ -#ifndef __REQUIRED_RPCNDR_H_VERSION__ -#define __REQUIRED_RPCNDR_H_VERSION__ 440 -#endif - -#include "rpc.h" -#include "rpcndr.h" - -#ifndef __RPCNDR_H_VERSION__ -#error this stub requires an updated version of <rpcndr.h> -#endif // __RPCNDR_H_VERSION__ - -#ifndef COM_NO_WINDOWS_H -#include "windows.h" -#include "ole2.h" -#endif /*COM_NO_WINDOWS_H*/ - -//{6A780808-9725-4d0b-8695-A4DD8D210773} -static const GUID CLSID_DshowFakeSink - = { 0x6a780808, 0x9725, 0x4d0b, { 0x86, 0x95, 0xa4, 0xdd, 0x8d, 0x21, 0x7, 0x73 } }; - -// {FC36764C-6CD4-4C73-900F-3F40BF3F191A} -static const GUID IID_IGstDshowInterface = - { 0xfc36764c, 0x6cd4, 0x4c73, { 0x90, 0xf, 0x3f, 0x40, 0xbf, 0x3f, 0x19, 0x1a } }; - -#define CLSID_DSHOWFAKESINK_STRING "{6A780808-9725-4d0b-8695-A4DD8D210773}" - -typedef interface IGstDshowInterface IGstDshowInterface; - -/* header files for imported files */ -#include "oaidl.h" -#include "ocidl.h" - -void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t); -void __RPC_USER MIDL_user_free( void __RPC_FAR * ); - -#ifndef __IGstDshowInterface_INTERFACE_DEFINED__ -#define __IGstDshowInterface_INTERFACE_DEFINED__ - -#if defined(__cplusplus) && !defined(CINTERFACE) - - MIDL_INTERFACE("542C0A24-8BD1-46cb-AA57-3E46D006D2F3") - IGstDshowInterface : public IUnknown - { - public: - virtual HRESULT STDMETHODCALLTYPE gst_set_media_type( - AM_MEDIA_TYPE __RPC_FAR *pmt) = 0; - - virtual HRESULT STDMETHODCALLTYPE gst_set_buffer_callback( - push_buffer_func push, byte *data) = 0; - - virtual HRESULT STDMETHODCALLTYPE gst_push_buffer( - byte *buffer, __int64 start, __int64 stop, unsigned int size, bool discount) = 0; - - virtual HRESULT STDMETHODCALLTYPE gst_flush() = 0; - - virtual HRESULT STDMETHODCALLTYPE gst_set_sample_size(unsigned int size) = 0; - }; - -#else /* C style interface */ - - typedef struct IGstDshowInterfaceVtbl - { - BEGIN_INTERFACE - - HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )( - IGstDshowInterface __RPC_FAR * This, - REFIID riid, - void __RPC_FAR *__RPC_FAR *ppvObject); - - ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )( - IGstDshowInterface __RPC_FAR * This); - - ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )( - IGstDshowInterface __RPC_FAR * This); - - HRESULT (STDMETHODCALLTYPE *gst_set_media_type )( - IGstDshowInterface __RPC_FAR * This, - AM_MEDIA_TYPE *pmt); - - HRESULT (STDMETHODCALLTYPE *gst_set_buffer_callback) ( - IGstDshowInterface __RPC_FAR * This, - byte * push, byte *data); - - HRESULT (STDMETHODCALLTYPE *gst_push_buffer) ( - IGstDshowInterface __RPC_FAR * This, - byte *buffer, __int64 start, __int64 stop, - unsigned int size, boolean discount); - - HRESULT (STDMETHODCALLTYPE *gst_flush) ( - IGstDshowInterface __RPC_FAR * This); - - HRESULT (STDMETHODCALLTYPE *gst_set_sample_size) ( - IGstDshowInterface __RPC_FAR * This, - unsigned int size); - - END_INTERFACE - } IGstDshowInterfaceVtbl; - - interface IGstDshowInterface - { - CONST_VTBL struct IGstDshowInterfaceVtbl __RPC_FAR *lpVtbl; - }; - -#define IGstDshowInterface_QueryInterface(This,riid,ppvObject) \ - (This)->lpVtbl -> QueryInterface(This,riid,ppvObject) - -#define IGstDshowInterface_AddRef(This) \ - (This)->lpVtbl -> AddRef(This) - -#define IGstDshowInterface_Release(This) \ - (This)->lpVtbl -> Release(This) - -#define IGstDshowInterface_gst_set_media_type(This, mediatype) \ - (This)->lpVtbl -> gst_set_media_type(This, mediatype) - -#define IGstDshowInterface_gst_set_buffer_callback(This, push, data) \ - (This)->lpVtbl -> gst_set_buffer_callback(This, push, data) - -#define IGstDshowInterface_gst_push_buffer(This, buffer, start, stop, size, discount) \ - (This)->lpVtbl -> gst_push_buffer(This, buffer, start, stop, size, discount) - -#define IGstDshowInterface_gst_flush(This) \ - (This)->lpVtbl -> gst_flush(This) - -#define IGstDshowInterface_gst_set_sample_size(This, size) \ - (This)->lpVtbl -> gst_set_sample_size(This, size) - -#endif /* C style interface */ - -#endif /* __IGstDshowInterface_INTERFACE_DEFINED__ */ - -#endif /* __GST_DSHOW_INTERFACE_H__ */
\ No newline at end of file diff --git a/sys/dshowsrcwrapper/gstdshowsrcwrapper.cpp b/sys/dshowsrcwrapper/gstdshowsrcwrapper.cpp index 1e9a8aa2..9acfc344 100755 --- a/sys/dshowsrcwrapper/gstdshowsrcwrapper.cpp +++ b/sys/dshowsrcwrapper/gstdshowsrcwrapper.cpp @@ -26,28 +26,11 @@ #include "gstdshowaudiosrc.h" #include "gstdshowvideosrc.h" -const GUID CLSID_GstreamerSrcFilter - = - { 0x6a780808, 0x9725, 0x4d0b, {0x86, 0x95, 0xa4, 0xdd, 0x8d, 0x21, 0x7, - 0x73} }; - -const GUID IID_IGstSrcInterface = - { 0x542c0a24, 0x8bd1, 0x46cb, {0xaa, 0x57, 0x3e, 0x46, 0xd0, 0x6, 0xd2, - 0xf3} }; - static gboolean plugin_init (GstPlugin * plugin) { - /* register fake filters */ - HRESULT hr = gst_dshow_register_fakefilters (); - if (FAILED (hr)) { - g_warning ("failed to register directshow fakesink filter: 0x%x\n", hr); - return FALSE; - } - if (!gst_element_register (plugin, "dshowaudiosrc", - GST_RANK_NONE, - GST_TYPE_DSHOWAUDIOSRC) || + GST_RANK_NONE, GST_TYPE_DSHOWAUDIOSRC) || !gst_element_register (plugin, "dshowvideosrc", GST_RANK_NONE, GST_TYPE_DSHOWVIDEOSRC)) return FALSE; diff --git a/sys/dshowsrcwrapper/gstdshowvideosrc.cpp b/sys/dshowsrcwrapper/gstdshowvideosrc.cpp index 67e70d96..14654f60 100755 --- a/sys/dshowsrcwrapper/gstdshowvideosrc.cpp +++ b/sys/dshowsrcwrapper/gstdshowvideosrc.cpp @@ -111,7 +111,7 @@ static GstFlowReturn gst_dshowvideosrc_create (GstPushSrc * psrc, static GstCaps *gst_dshowvideosrc_getcaps_from_streamcaps (GstDshowVideoSrc * src, IPin * pin, IAMStreamConfig * streamcaps); static gboolean gst_dshowvideosrc_push_buffer (byte * buffer, long size, - byte * src_object, UINT64 start, UINT64 stop); + gpointer src_object, UINT64 start, UINT64 stop); static void gst_dshowvideosrc_init_interfaces (GType type) @@ -614,14 +614,8 @@ gst_dshowvideosrc_start (GstBaseSrc * bsrc) goto error; } - hres = CoCreateInstance (CLSID_DshowFakeSink, NULL, CLSCTX_INPROC, - IID_IBaseFilter, (LPVOID *) & src->dshow_fakesink); - if (hres != S_OK || !src->dshow_fakesink) { - GST_CAT_ERROR (dshowvideosrc_debug, - "Can't create an instance of our dshow fakesink filter (error=0x%x)", - hres); - goto error; - } + src->dshow_fakesink = new CDshowFakeSink; + src->dshow_fakesink->AddRef(); hres = src->filter_graph->AddFilter(src->video_cap_filter, L"capture"); if (hres != S_OK) { @@ -661,7 +655,6 @@ static gboolean gst_dshowvideosrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps) { HRESULT hres; - IGstDshowInterface *srcinterface = NULL; IPin *input_pin = NULL; GstDshowVideoSrc *src = GST_DSHOWVIDEOSRC (bsrc); GstStructure *s = gst_caps_get_structure (caps, 0); @@ -689,22 +682,9 @@ gst_dshowvideosrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps) if (type) { pin_mediatype = (GstCapturePinMediaType *) type->data; - hres = src->dshow_fakesink->QueryInterface( - IID_IGstDshowInterface, (LPVOID *) &srcinterface); - - if (hres != S_OK || !srcinterface) { - GST_CAT_ERROR (dshowvideosrc_debug, - "Can't get IGstDshowInterface interface from our dshow fakesink filter (error=%d)", - hres); - goto error; - } - - srcinterface->gst_set_media_type(pin_mediatype->mediatype); - srcinterface->gst_set_buffer_callback( - (push_buffer_func) gst_dshowvideosrc_push_buffer, (byte *) src); - - if (srcinterface) - srcinterface->Release(); + src->dshow_fakesink->gst_set_media_type (pin_mediatype->mediatype); + src->dshow_fakesink->gst_set_buffer_callback( + (push_buffer_func) gst_dshowvideosrc_push_buffer, src); gst_dshow_get_pin_from_filter (src->dshow_fakesink, PINDIR_INPUT, &input_pin); @@ -746,9 +726,6 @@ gst_dshowvideosrc_set_caps (GstBaseSrc * bsrc, GstCaps * caps) return TRUE; error: - if (srcinterface) - srcinterface->Release(); - return FALSE; } @@ -992,7 +969,7 @@ gst_dshowvideosrc_getcaps_from_streamcaps (GstDshowVideoSrc * src, IPin * pin, } static gboolean -gst_dshowvideosrc_push_buffer (byte * buffer, long size, byte * src_object, +gst_dshowvideosrc_push_buffer (byte * buffer, long size, gpointer src_object, UINT64 start, UINT64 stop) { GstDshowVideoSrc *src = GST_DSHOWVIDEOSRC (src_object); diff --git a/sys/dshowsrcwrapper/gstdshowvideosrc.h b/sys/dshowsrcwrapper/gstdshowvideosrc.h index b7bfbb19..bf94e61f 100755 --- a/sys/dshowsrcwrapper/gstdshowvideosrc.h +++ b/sys/dshowsrcwrapper/gstdshowvideosrc.h @@ -28,7 +28,7 @@ #include <gst/interfaces/propertyprobe.h> #include "gstdshow.h" -#include "gstdshowinterface.h" +#include "gstdshowfakesink.h" // 30323449-0000-0010-8000-00AA00389B71 MEDIASUBTYPE_I420 DEFINE_GUID(MEDIASUBTYPE_I420, 0x30323449, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xAA, 0x00, 0x38, 0x9B, 0x71); @@ -62,7 +62,7 @@ struct _GstDshowVideoSrc IBaseFilter *video_cap_filter; /* dshow sink filter */ - IBaseFilter *dshow_fakesink; + CDshowFakeSink *dshow_fakesink; /* graph manager interfaces */ IMediaFilter *media_filter; diff --git a/sys/dshowsrcwrapper/libgstdshow.def b/sys/dshowsrcwrapper/libgstdshow.def deleted file mode 100755 index ee8586c9..00000000 --- a/sys/dshowsrcwrapper/libgstdshow.def +++ /dev/null @@ -1,8 +0,0 @@ -EXPORTS - DllMain PRIVATE - DllGetClassObject PRIVATE - DllCanUnloadNow PRIVATE - DllRegisterServer PRIVATE - DllUnregisterServer PRIVATE - - |