From dabb692e7cec9eaef0703a2cabefc65cb12738ff Mon Sep 17 00:00:00 2001 From: Julien Isorce Date: Mon, 27 Jul 2009 14:52:57 +0200 Subject: dshowsrcwrapper: remove use of IGstDshowInterface --- sys/dshowsrcwrapper/gstdshowaudiosrc.cpp | 34 +++++++------------------------- 1 file changed, 7 insertions(+), 27 deletions(-) (limited to 'sys/dshowsrcwrapper/gstdshowaudiosrc.cpp') 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); -- cgit v1.2.1