diff options
author | Sébastien Moutte <sebastien@moutte.net> | 2007-05-23 22:44:12 +0000 |
---|---|---|
committer | Sébastien Moutte <sebastien@moutte.net> | 2007-05-23 22:44:12 +0000 |
commit | 0a0c13670a4e4e08d1f21ebf5ca03e810491e991 (patch) | |
tree | 61c1b4433965e68da0bf7c8a97ef8ab21187d978 /gst-libs/gst/dshow/gstdshowfakesink.cpp | |
parent | 7935a424b1932e83c18cd1a34a82f3ca4121bca6 (diff) | |
download | gst-plugins-bad-0a0c13670a4e4e08d1f21ebf5ca03e810491e991.tar.gz gst-plugins-bad-0a0c13670a4e4e08d1f21ebf5ca03e810491e991.tar.bz2 gst-plugins-bad-0a0c13670a4e4e08d1f21ebf5ca03e810491e991.zip |
docs/plugins/gst-plugins-bad-plugins.args: Remove directsoundsink property doc as this sink use the mixer interface now.
Original commit message from CVS:
* docs/plugins/gst-plugins-bad-plugins.args:
Remove directsoundsink property doc as this sink use the mixer
interface now.
* docs/plugins/gst-plugins-bad-plugins.interfaces:
Add interfaces implemented by Windows sinks.
* sys/directsound/gstdirectsoundsink.c:
* sys/directsound/gstdirectsoundsink.h:
Remove directsoundsink property and implement the mixer interface.
* win32/vs6/gst_plugins_bad.dsw:
* win32/vs6/libgstdirectsound.dsp:
Update project files.
* gst-libs/gst/dshow/gstdshow.cpp:
* gst-libs/gst/dshow/gstdshow.h:
* gst-libs/gst/dshow/gstdshowfakesink.cpp:
* gst-libs/gst/dshow/gstdshowfakesink.h:
* gst-libs/gst/dshow/gstdshowfakesrc.cpp:
* gst-libs/gst/dshow/gstdshowfakesrc.h:
* gst-libs/gst/dshow/gstdshowinterface.cpp:
* gst-libs/gst/dshow/gstdshowinterface.h:
* win32/common/libgstdshow.def:
* win32/vs6/libgstdshow.dsp:
Add a new gst library which allow to create internal Direct Show
graph (pipelines) to wrap Windows sources, decoders or encoders.
It includes a DirectShow fake source and sink and utility functions.
* sys/dshowsrcwrapper/gstdshowaudiosrc.c:
* sys/dshowsrcwrapper/gstdshowaudiosrc.h:
* sys/dshowsrcwrapper/gstdshowsrcwrapper.c:
* sys/dshowsrcwrapper/gstdshowsrcwrapper.h:
* sys/dshowsrcwrapper/gstdshowvideosrc.c:
* sys/dshowsrcwrapper/gstdshowvideosrc.h:
* win32/vs6/libdshowsrcwrapper.dsp:
Add a new plugin to wrap DirectShow sources on Windows.
It gets data from any webcam, dv cam, micro. We could add
tv tunner card later.
Diffstat (limited to 'gst-libs/gst/dshow/gstdshowfakesink.cpp')
-rw-r--r-- | gst-libs/gst/dshow/gstdshowfakesink.cpp | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/gst-libs/gst/dshow/gstdshowfakesink.cpp b/gst-libs/gst/dshow/gstdshowfakesink.cpp new file mode 100644 index 00000000..58b23718 --- /dev/null +++ b/gst-libs/gst/dshow/gstdshowfakesink.cpp @@ -0,0 +1,125 @@ +/* GStreamer + * Copyright (C) 2007 Sebastien Moutte <sebastien@moutte.net> + * + * gstdshowfakesink.cpp: + * + * 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. + */ + +#include "gstdshowfakesink.h" + + +CDshowFakeSink::CDshowFakeSink():CBaseRenderer(CLSID_DshowFakeSink, "DshowFakeSink", NULL, NULL) +{ + m_callback = NULL; +} + +CDshowFakeSink::~CDshowFakeSink() +{ + +} + +//Object creation. +CUnknown* WINAPI CDshowFakeSink::CreateInstance(LPUNKNOWN pUnk, HRESULT *pHr) +{ + CDshowFakeSink *pNewObject = new CDshowFakeSink(); + 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) +{ + 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 == m_MediaType) + return S_OK; + } + + return S_FALSE; +} + +HRESULT CDshowFakeSink::DoRenderSample(IMediaSample *pMediaSample) +{ + if(pMediaSample && m_callback) + { + BYTE *pBuffer = NULL; + LONGLONG lStart = 0, lStop = 0; + pMediaSample->GetPointer(&pBuffer); + long size = pMediaSample->GetActualDataLength(); + pMediaSample->GetTime(&lStart, &lStop); + lStart*=100; + lStop*=100; + m_callback(pBuffer, size, m_data, lStart, lStop); + } + + return S_OK; +} |