From 48e213b4d8ccd718a0fe3f9b5f6a8577a5d6f3d4 Mon Sep 17 00:00:00 2001 From: Christian Costa Date: Sun, 14 Dec 2008 19:08:17 +0100 Subject: [PATCH] amstream: Add stubbed implementation of MediaStreamFilter. --- dlls/amstream/Makefile.in | 1 + dlls/amstream/amstream_private.h | 1 + dlls/amstream/main.c | 1 + dlls/amstream/mediastreamfilter.c | 313 ++++++++++++++++++++++++++++++ include/amstream.idl | 1 + 5 files changed, 317 insertions(+) create mode 100644 dlls/amstream/mediastreamfilter.c diff --git a/dlls/amstream/Makefile.in b/dlls/amstream/Makefile.in index 63d4093bde1..c74c14d9da2 100644 --- a/dlls/amstream/Makefile.in +++ b/dlls/amstream/Makefile.in @@ -9,6 +9,7 @@ C_SRCS = \ amstream.c \ main.c \ mediastream.c \ + mediastreamfilter.c \ regsvr.c RC_SRCS = version.rc diff --git a/dlls/amstream/amstream_private.h b/dlls/amstream/amstream_private.h index d5efa6ce84e..b10b632b6df 100644 --- a/dlls/amstream/amstream_private.h +++ b/dlls/amstream/amstream_private.h @@ -35,6 +35,7 @@ #include "mmstream.h" HRESULT AM_create(IUnknown *pUnkOuter, LPVOID *ppObj); +HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj); HRESULT MediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, STREAM_TYPE StreamType, IMediaStream** ppMediaStream); HRESULT DirectDrawMediaStream_create(IMultiMediaStream* Parent, const MSPID* pPurposeId, STREAM_TYPE StreamType, IMediaStream** ppMediaStream); diff --git a/dlls/amstream/main.c b/dlls/amstream/main.c index 7bebe901fbe..8af5619b13d 100644 --- a/dlls/amstream/main.c +++ b/dlls/amstream/main.c @@ -75,6 +75,7 @@ static const struct object_creation_info object_creation[] = { { &CLSID_AMMultiMediaStream, AM_create }, { &CLSID_AMDirectDrawStream, AM_create }, + { &CLSID_MediaStreamFilter, MediaStreamFilter_create } }; static HRESULT WINAPI diff --git a/dlls/amstream/mediastreamfilter.c b/dlls/amstream/mediastreamfilter.c new file mode 100644 index 00000000000..7f57e607113 --- /dev/null +++ b/dlls/amstream/mediastreamfilter.c @@ -0,0 +1,313 @@ +/* + * Implementation of MediaStream Filter + * + * Copyright 2008 Christian Costa + * + * This file contains the (internal) driver registration functions, + * driver enumeration APIs and DirectDraw creation functions. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "wine/debug.h" + +#define COBJMACROS + +#include "winbase.h" +#include "wingdi.h" + +#include "amstream_private.h" +#include "amstream.h" + +#include "ddstream.h" + +WINE_DEFAULT_DEBUG_CHANNEL(amstream); + +typedef struct { + IMediaStreamFilter lpVtbl; + LONG ref; + CRITICAL_SECTION csFilter; + FILTER_STATE state; + REFERENCE_TIME rtStreamStart; + IReferenceClock * pClock; + FILTER_INFO filterInfo; +} IMediaStreamFilterImpl; + +static const struct IMediaStreamFilterVtbl MediaStreamFilter_Vtbl; + +HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, LPVOID *ppObj) +{ + IMediaStreamFilterImpl* object; + + TRACE("(%p,%p)\n", pUnkOuter, ppObj); + + if( pUnkOuter ) + return CLASS_E_NOAGGREGATION; + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IMediaStreamFilterImpl)); + if (!object) + { + ERR("Out of memory\n"); + return E_OUTOFMEMORY; + } + + object->lpVtbl.lpVtbl = &MediaStreamFilter_Vtbl; + object->ref = 1; + + *ppObj = object; + + return S_OK; +} + +/*** IUnknown methods ***/ + +static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter * iface, REFIID riid, LPVOID * ppv) +{ + IMediaStreamFilterImpl *This = (IMediaStreamFilterImpl *)iface; + + TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); + + *ppv = NULL; + + if (IsEqualIID(riid, &IID_IUnknown)) + *ppv = (LPVOID)This; + else if (IsEqualIID(riid, &IID_IPersist)) + *ppv = (LPVOID)This; + else if (IsEqualIID(riid, &IID_IMediaFilter)) + *ppv = (LPVOID)This; + else if (IsEqualIID(riid, &IID_IBaseFilter)) + *ppv = (LPVOID)This; + else if (IsEqualIID(riid, &IID_IMediaStreamFilter)) + *ppv = (LPVOID)This; + + if (*ppv) + { + IUnknown_AddRef((IUnknown *)(*ppv)); + return S_OK; + } + + return E_NOINTERFACE; +} + +static ULONG WINAPI MediaStreamFilterImpl_AddRef(IMediaStreamFilter * iface) +{ + IMediaStreamFilterImpl *This = (IMediaStreamFilterImpl *)iface; + ULONG refCount = InterlockedIncrement(&This->ref); + + TRACE("(%p)->() AddRef from %d\n", iface, refCount - 1); + + return refCount; +} + +static ULONG WINAPI MediaStreamFilterImpl_Release(IMediaStreamFilter * iface) +{ + IMediaStreamFilterImpl *This = (IMediaStreamFilterImpl *)iface; + ULONG refCount = InterlockedDecrement(&This->ref); + + TRACE("(%p)->() Release from %d\n", iface, refCount + 1); + + if (!refCount) + { + This->lpVtbl.lpVtbl = NULL; + HeapFree(GetProcessHeap(), 0, This); + } + + return refCount; +} + +/*** IPersist methods ***/ + +static HRESULT WINAPI MediaStreamFilterImpl_GetClassID(IMediaStreamFilter * iface, CLSID * pClsid) +{ + TRACE("(%p)->(%p)\n", iface, pClsid); + + *pClsid = CLSID_MediaStreamFilter; + + return S_OK; +} + +/*** IMediaFilter methods ***/ + +static HRESULT WINAPI MediaStreamFilterImpl_Stop(IMediaStreamFilter * iface) +{ + FIXME("(%p)->(): Stub!\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_Pause(IMediaStreamFilter * iface) +{ + FIXME("(%p)->(): Stub!\n", iface); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_Run(IMediaStreamFilter * iface, REFERENCE_TIME tStart) +{ + FIXME("(%p)->(%s): Stub!\n", iface, wine_dbgstr_longlong(tStart)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_GetState(IMediaStreamFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState) +{ + FIXME("(%p)->(%d,%p): Stub!\n", iface, dwMilliSecsTimeout, pState); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_SetSyncSource(IMediaStreamFilter * iface, IReferenceClock *pClock) +{ + TRACE("(%p)->(%p): Stub!\n", iface, pClock); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_GetSyncSource(IMediaStreamFilter * iface, IReferenceClock **ppClock) +{ + FIXME("(%p)->(%p): Stub!\n", iface, ppClock); + + return E_NOTIMPL; +} + +/*** IBaseFilter methods ***/ + +static HRESULT WINAPI MediaStreamFilterImpl_EnumPins(IMediaStreamFilter * iface, IEnumPins **ppEnum) +{ + FIXME("(%p)->(%p): Stub!\n", iface, ppEnum); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_FindPin(IMediaStreamFilter * iface, LPCWSTR Id, IPin **ppPin) +{ + FIXME("(%p)->(%s,%p): Stub!\n", iface, debugstr_w(Id), ppPin); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_QueryFilterInfo(IMediaStreamFilter * iface, FILTER_INFO *pInfo) +{ + FIXME("(%p)->(%p): Stub!\n", iface, pInfo); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_JoinFilterGraph(IMediaStreamFilter * iface, IFilterGraph *pGraph, LPCWSTR pName) +{ + FIXME("(%p)->(%p, %s): Stub!\n", iface, pGraph, debugstr_w(pName)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_QueryVendorInfo(IMediaStreamFilter * iface, LPWSTR *pVendorInfo) +{ + FIXME("(%p)->(%p): Stub!\n", iface, pVendorInfo); + + return E_NOTIMPL; +} + +/*** IMediaStreamFilter methods ***/ + +static HRESULT WINAPI MediaStreamFilterImpl_AddMediaStream(IMediaStreamFilter* iface, IAMMediaStream *pAMMediaStream) +{ + FIXME("(%p)->(%p): Stub!\n", iface, pAMMediaStream); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_GetMediaStream(IMediaStreamFilter* iface, REFMSPID idPurpose, IMediaStream **ppMediaStream) +{ + FIXME("(%p)->(%s,%p): Stub!\n", iface, debugstr_guid(idPurpose), ppMediaStream); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_EnumMediaStreams(IMediaStreamFilter* iface, long Index, IMediaStream **ppMediaStream) +{ + FIXME("(%p)->(%ld,%p): Stub!\n", iface, Index, ppMediaStream); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_SupportSeeking(IMediaStreamFilter* iface, BOOL bRenderer) +{ + FIXME("(%p)->(%d): Stub!\n", iface, bRenderer); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_ReferenceTimeToStreamTime(IMediaStreamFilter* iface, REFERENCE_TIME *pTime) +{ + FIXME("(%p)->(%p): Stub!\n", iface, pTime); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_GetCurrentStreamTime(IMediaStreamFilter* iface, REFERENCE_TIME *pCurrentStreamTime) +{ + FIXME("(%p)->(%p): Stub!\n", iface, pCurrentStreamTime); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_WaitUntil(IMediaStreamFilter* iface, REFERENCE_TIME WaitStreamTime) +{ + FIXME("(%p)->(%s): Stub!\n", iface, wine_dbgstr_longlong(WaitStreamTime)); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_Flush(IMediaStreamFilter* iface, BOOL bCancelEOS) +{ + FIXME("(%p)->(%d): Stub!\n", iface, bCancelEOS); + + return E_NOTIMPL; +} + +static HRESULT WINAPI MediaStreamFilterImpl_EndOfStream(IMediaStreamFilter* iface) +{ + FIXME("(%p)->(): Stub!\n", iface); + + return E_NOTIMPL; +} + +static const IMediaStreamFilterVtbl MediaStreamFilter_Vtbl = +{ + MediaStreamFilterImpl_QueryInterface, + MediaStreamFilterImpl_AddRef, + MediaStreamFilterImpl_Release, + MediaStreamFilterImpl_GetClassID, + MediaStreamFilterImpl_Stop, + MediaStreamFilterImpl_Pause, + MediaStreamFilterImpl_Run, + MediaStreamFilterImpl_GetState, + MediaStreamFilterImpl_SetSyncSource, + MediaStreamFilterImpl_GetSyncSource, + MediaStreamFilterImpl_EnumPins, + MediaStreamFilterImpl_FindPin, + MediaStreamFilterImpl_QueryFilterInfo, + MediaStreamFilterImpl_JoinFilterGraph, + MediaStreamFilterImpl_QueryVendorInfo, + MediaStreamFilterImpl_AddMediaStream, + MediaStreamFilterImpl_GetMediaStream, + MediaStreamFilterImpl_EnumMediaStreams, + MediaStreamFilterImpl_SupportSeeking, + MediaStreamFilterImpl_ReferenceTimeToStreamTime, + MediaStreamFilterImpl_GetCurrentStreamTime, + MediaStreamFilterImpl_WaitUntil, + MediaStreamFilterImpl_Flush, + MediaStreamFilterImpl_EndOfStream +}; diff --git a/include/amstream.idl b/include/amstream.idl index d1cdd4c7e00..2f32d44001f 100644 --- a/include/amstream.idl +++ b/include/amstream.idl @@ -315,3 +315,4 @@ cpp_quote("DEFINE_GUID(CLSID_AMDirectDrawStream, 0x49c47ce4, 0x9ba4, 0x11d0, 0x cpp_quote("DEFINE_GUID(CLSID_AMAudioStream, 0x8496e040, 0xaf4c, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);") cpp_quote("DEFINE_GUID(CLSID_AMAudioData, 0xf2468580, 0xaf8a, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);") cpp_quote("DEFINE_GUID(CLSID_AMMediaTypeStream, 0xcf0f2f7c, 0xf7bf, 0x11d0, 0x90, 0x0d, 0x00, 0xc0, 0x4f, 0xd9, 0x18, 0x9d);") +cpp_quote("DEFINE_GUID(CLSID_MediaStreamFilter, 0x49c47ce0, 0x9ba4, 0x11d0, 0x82, 0x12, 0x00, 0xc0, 0x4f, 0xc3, 0x2c, 0x45);")