2008-12-14 19:08:17 +01:00
|
|
|
/*
|
|
|
|
* Implementation of MediaStream Filter
|
|
|
|
*
|
|
|
|
* Copyright 2008 Christian Costa
|
|
|
|
*
|
|
|
|
* 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"
|
2012-01-18 14:49:45 +01:00
|
|
|
#include "dshow.h"
|
|
|
|
|
|
|
|
#include "wine/strmbase.h"
|
2008-12-14 19:08:17 +01:00
|
|
|
|
|
|
|
#include "amstream_private.h"
|
|
|
|
#include "amstream.h"
|
|
|
|
|
|
|
|
#include "ddstream.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
|
|
|
|
|
|
|
|
typedef struct {
|
2012-01-18 14:49:45 +01:00
|
|
|
BaseFilter filter;
|
|
|
|
|
2008-12-14 19:08:17 +01:00
|
|
|
} IMediaStreamFilterImpl;
|
|
|
|
|
2011-08-11 00:13:17 +02:00
|
|
|
static inline IMediaStreamFilterImpl *impl_from_IMediaStreamFilter(IMediaStreamFilter *iface)
|
|
|
|
{
|
2012-01-18 14:49:45 +01:00
|
|
|
return CONTAINING_RECORD(iface, IMediaStreamFilterImpl, filter);
|
2011-08-11 00:13:17 +02:00
|
|
|
}
|
|
|
|
|
2008-12-14 19:08:17 +01:00
|
|
|
/*** IUnknown methods ***/
|
|
|
|
|
2011-08-11 00:13:17 +02:00
|
|
|
static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter *iface, REFIID riid,
|
|
|
|
void **ppv)
|
2008-12-14 19:08:17 +01:00
|
|
|
{
|
2011-08-11 00:13:17 +02:00
|
|
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
2008-12-14 19:08:17 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
|
|
|
|
|
|
|
|
*ppv = NULL;
|
|
|
|
|
|
|
|
if (IsEqualIID(riid, &IID_IUnknown))
|
2009-01-08 00:38:16 +01:00
|
|
|
*ppv = This;
|
2008-12-14 19:08:17 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_IPersist))
|
2009-01-08 00:38:16 +01:00
|
|
|
*ppv = This;
|
2008-12-14 19:08:17 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_IMediaFilter))
|
2009-01-08 00:38:16 +01:00
|
|
|
*ppv = This;
|
2008-12-14 19:08:17 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_IBaseFilter))
|
2009-01-08 00:38:16 +01:00
|
|
|
*ppv = This;
|
2008-12-14 19:08:17 +01:00
|
|
|
else if (IsEqualIID(riid, &IID_IMediaStreamFilter))
|
2009-01-08 00:38:16 +01:00
|
|
|
*ppv = This;
|
2008-12-14 19:08:17 +01:00
|
|
|
|
|
|
|
if (*ppv)
|
|
|
|
{
|
|
|
|
IUnknown_AddRef((IUnknown *)(*ppv));
|
|
|
|
return S_OK;
|
|
|
|
}
|
|
|
|
|
|
|
|
return E_NOINTERFACE;
|
|
|
|
}
|
|
|
|
|
2011-08-11 00:13:17 +02:00
|
|
|
static ULONG WINAPI MediaStreamFilterImpl_AddRef(IMediaStreamFilter *iface)
|
2008-12-14 19:08:17 +01:00
|
|
|
{
|
2012-01-18 14:49:45 +01:00
|
|
|
return BaseFilterImpl_AddRef((IBaseFilter*)iface);
|
2008-12-14 19:08:17 +01:00
|
|
|
}
|
|
|
|
|
2011-08-11 00:13:17 +02:00
|
|
|
static ULONG WINAPI MediaStreamFilterImpl_Release(IMediaStreamFilter *iface)
|
2008-12-14 19:08:17 +01:00
|
|
|
{
|
2011-08-11 00:13:17 +02:00
|
|
|
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
|
2012-01-18 14:49:45 +01:00
|
|
|
ULONG refCount = BaseFilterImpl_Release((IBaseFilter*)iface);
|
2008-12-14 19:08:17 +01:00
|
|
|
|
|
|
|
TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
|
|
|
|
|
|
|
|
if (!refCount)
|
|
|
|
HeapFree(GetProcessHeap(), 0, This);
|
|
|
|
|
|
|
|
return refCount;
|
|
|
|
}
|
|
|
|
|
|
|
|
/*** IPersist methods ***/
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaStreamFilterImpl_GetClassID(IMediaStreamFilter * iface, CLSID * pClsid)
|
|
|
|
{
|
2012-01-18 14:49:45 +01:00
|
|
|
return BaseFilterImpl_GetClassID((IBaseFilter*)iface, pClsid);
|
2008-12-14 19:08:17 +01:00
|
|
|
}
|
|
|
|
|
2012-01-18 14:49:45 +01:00
|
|
|
/*** IBaseFilter methods ***/
|
2008-12-14 19:08:17 +01:00
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2012-01-18 14:49:45 +01:00
|
|
|
return BaseFilterImpl_GetState((IBaseFilter*)iface, dwMilliSecsTimeout, pState);
|
2008-12-14 19:08:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaStreamFilterImpl_SetSyncSource(IMediaStreamFilter * iface, IReferenceClock *pClock)
|
|
|
|
{
|
2012-01-18 14:49:45 +01:00
|
|
|
return BaseFilterImpl_SetSyncSource((IBaseFilter*)iface, pClock);
|
2008-12-14 19:08:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaStreamFilterImpl_GetSyncSource(IMediaStreamFilter * iface, IReferenceClock **ppClock)
|
|
|
|
{
|
2012-01-18 14:49:45 +01:00
|
|
|
return BaseFilterImpl_GetSyncSource((IBaseFilter*)iface, ppClock);
|
2008-12-14 19:08:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaStreamFilterImpl_EnumPins(IMediaStreamFilter * iface, IEnumPins **ppEnum)
|
|
|
|
{
|
2012-01-18 14:49:45 +01:00
|
|
|
return BaseFilterImpl_EnumPins((IBaseFilter*)iface, ppEnum);
|
2008-12-14 19:08:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
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)
|
|
|
|
{
|
2012-01-18 14:49:45 +01:00
|
|
|
return BaseFilterImpl_QueryFilterInfo((IBaseFilter*)iface, pInfo);
|
2008-12-14 19:08:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaStreamFilterImpl_JoinFilterGraph(IMediaStreamFilter * iface, IFilterGraph *pGraph, LPCWSTR pName)
|
|
|
|
{
|
2012-01-18 14:49:45 +01:00
|
|
|
return BaseFilterImpl_JoinFilterGraph((IBaseFilter*)iface, pGraph, pName);
|
2008-12-14 19:08:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
static HRESULT WINAPI MediaStreamFilterImpl_QueryVendorInfo(IMediaStreamFilter * iface, LPWSTR *pVendorInfo)
|
|
|
|
{
|
2012-01-18 14:49:45 +01:00
|
|
|
return BaseFilterImpl_QueryVendorInfo((IBaseFilter*)iface, pVendorInfo);
|
2008-12-14 19:08:17 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/*** 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;
|
|
|
|
}
|
|
|
|
|
2009-03-12 23:04:35 +01:00
|
|
|
static HRESULT WINAPI MediaStreamFilterImpl_EnumMediaStreams(IMediaStreamFilter* iface, LONG Index, IMediaStream **ppMediaStream)
|
2008-12-14 19:08:17 +01:00
|
|
|
{
|
2009-03-12 23:04:35 +01:00
|
|
|
FIXME("(%p)->(%d,%p): Stub!\n", iface, Index, ppMediaStream);
|
2008-12-14 19:08:17 +01:00
|
|
|
|
|
|
|
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
|
|
|
|
};
|
2011-08-11 00:14:30 +02:00
|
|
|
|
2012-01-18 14:49:45 +01:00
|
|
|
static IPin* WINAPI MediaStreamFilterImpl_GetPin(BaseFilter *iface, int pos)
|
|
|
|
{
|
|
|
|
/* No pins */
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
static LONG WINAPI MediaStreamFilterImpl_GetPinCount(BaseFilter *iface)
|
|
|
|
{
|
|
|
|
/* No pins */
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static const BaseFilterFuncTable BaseFuncTable = {
|
|
|
|
MediaStreamFilterImpl_GetPin,
|
|
|
|
MediaStreamFilterImpl_GetPinCount
|
|
|
|
};
|
|
|
|
|
2011-08-11 00:14:30 +02:00
|
|
|
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, void **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;
|
|
|
|
}
|
|
|
|
|
2012-01-18 14:49:45 +01:00
|
|
|
BaseFilter_Init(&object->filter, (IBaseFilterVtbl*)&MediaStreamFilter_Vtbl, &CLSID_MediaStreamFilter, (DWORD_PTR)(__FILE__ ": MediaStreamFilterImpl.csFilter"), &BaseFuncTable);
|
2011-08-11 00:14:30 +02:00
|
|
|
|
|
|
|
*ppObj = object;
|
|
|
|
|
|
|
|
return S_OK;
|
|
|
|
}
|