mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
dshowsrcwrapper: remove use of IGstDshowInterface
This commit is contained in:
parent
9b1bdac9cc
commit
dabb692e7c
13 changed files with 48 additions and 381 deletions
|
@ -8,7 +8,6 @@ EXTRA_DIST = \
|
|||
gstdshowfakesink.cpp \
|
||||
gstdshowfakesink.h \
|
||||
gstdshow.h \
|
||||
gstdshowinterface.h \
|
||||
gstdshowsrcwrapper.cpp \
|
||||
gstdshowvideosrc.cpp \
|
||||
gstdshowvideosrc.h
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -21,87 +21,30 @@
|
|||
|
||||
#include "gstdshowfakesink.h"
|
||||
|
||||
|
||||
CDshowFakeSink::CDshowFakeSink()
|
||||
: m_hres(S_OK), CBaseRenderer(CLSID_DshowFakeSink, "DshowFakeSink", NULL, &m_hres)
|
||||
CDshowFakeSink::CDshowFakeSink() :
|
||||
m_hres(S_OK),
|
||||
m_callback(NULL),
|
||||
m_data(NULL),
|
||||
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()
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
gpointer m_data;
|
||||
};
|
||||
|
||||
#endif /* __GST_DSHOW_FAKESINK_H__ */
|
||||
|
|
|
@ -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__ */
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1,8 +0,0 @@
|
|||
EXPORTS
|
||||
DllMain PRIVATE
|
||||
DllGetClassObject PRIVATE
|
||||
DllCanUnloadNow PRIVATE
|
||||
DllRegisterServer PRIVATE
|
||||
DllUnregisterServer PRIVATE
|
||||
|
||||
|
|
@ -49,7 +49,7 @@
|
|||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
AdditionalIncludeDirectories="C:\msys\1.0\local\include;C:\msys\1.0\local\include\libxml2;"C:\msys\1.0\local\include\glib-2.0";"C:\msys\1.0\local\lib\glib-2.0\include";"C:\msys\1.0\local\include\gstreamer-0.10";..\common;"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Multimedia\DirectShow\BaseClasses""
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;DSHOWSRCWRAPPER_EXPORTS;HAVE_CONFIG_H;COBJMACROS;_WIN32_DCOM;_CRT_SECURE_NO_DEPRECATE"
|
||||
PreprocessorDefinitions="NDEBUG;WIN32;_WINDOWS;_USRDLL;DSHOWSRCWRAPPER_EXPORTS;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
|
||||
StringPooling="true"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="true"
|
||||
|
@ -78,7 +78,7 @@
|
|||
LinkIncremental="1"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="C:\msys\1.0\local\lib;"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib";"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Multimedia\DirectShow\BaseClasses\XP32_RETAIL""
|
||||
ModuleDefinitionFile="..\..\sys\dshowsrcwrapper\libgstdshow.def"
|
||||
ModuleDefinitionFile=""
|
||||
ProgramDatabaseFile=".\Release/libgstdshowsrcwrapper.pdb"
|
||||
ImportLibrary=".\Release/libgstdshowsrcwrapper.lib"
|
||||
TargetMachine="1"
|
||||
|
@ -146,7 +146,7 @@
|
|||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
AdditionalIncludeDirectories="C:\msys\1.0\local\include;C:\msys\1.0\local\include\libxml2;"C:\msys\1.0\local\include\glib-2.0";"C:\msys\1.0\local\lib\glib-2.0\include";"C:\msys\1.0\local\include\gstreamer-0.10";..\common;"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Multimedia\DirectShow\BaseClasses""
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;DSHOWSRCWRAPPER_EXPORTS;HAVE_CONFIG_H;COBJMACROS;_WIN32_DCOM;_CRT_SECURE_NO_DEPRECATE"
|
||||
PreprocessorDefinitions="_DEBUG;WIN32;_WINDOWS;_USRDLL;DSHOWSRCWRAPPER_EXPORTS;HAVE_CONFIG_H;_CRT_SECURE_NO_DEPRECATE"
|
||||
MinimalRebuild="true"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
|
@ -177,7 +177,7 @@
|
|||
LinkIncremental="2"
|
||||
SuppressStartupBanner="true"
|
||||
AdditionalLibraryDirectories="C:\msys\1.0\local\lib;"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Lib";"C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Samples\Multimedia\DirectShow\BaseClasses\XP32_DEBUG""
|
||||
ModuleDefinitionFile="..\..\sys\dshowsrcwrapper\libgstdshow.def"
|
||||
ModuleDefinitionFile=""
|
||||
GenerateDebugInformation="true"
|
||||
ProgramDatabaseFile=".\Debug/libgstdshowsrcwrapper.pdb"
|
||||
ImportLibrary=".\Debug/libgstdshowsrcwrapper.lib"
|
||||
|
@ -239,10 +239,6 @@
|
|||
RelativePath="..\..\sys\dshowsrcwrapper\gstdshowvideosrc.cpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\sys\dshowsrcwrapper\libgstdshow.def"
|
||||
>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
|
@ -260,10 +256,6 @@
|
|||
RelativePath="..\..\sys\dshowsrcwrapper\gstdshowfakesink.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\sys\dshowsrcwrapper\gstdshowinterface.h"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\sys\dshowsrcwrapper\gstdshowvideosrc.h"
|
||||
>
|
||||
|
|
Loading…
Reference in a new issue