amstream: Have the MediaStream Filter use strmbase.

This commit is contained in:
Aric Stewart 2012-01-18 07:49:45 -06:00 committed by Alexandre Julliard
parent 58aa5471a5
commit 80c233b9dd
2 changed files with 36 additions and 47 deletions

View File

@ -1,5 +1,5 @@
MODULE = amstream.dll
IMPORTS = strmiids uuid ole32 advapi32
IMPORTS = strmiids strmbase uuid ole32 advapi32
C_SRCS = \
amstream.c \

View File

@ -24,6 +24,9 @@
#include "winbase.h"
#include "wingdi.h"
#include "dshow.h"
#include "wine/strmbase.h"
#include "amstream_private.h"
#include "amstream.h"
@ -33,18 +36,13 @@
WINE_DEFAULT_DEBUG_CHANNEL(amstream);
typedef struct {
IMediaStreamFilter IMediaStreamFilter_iface;
LONG ref;
CRITICAL_SECTION csFilter;
FILTER_STATE state;
REFERENCE_TIME rtStreamStart;
IReferenceClock * pClock;
FILTER_INFO filterInfo;
BaseFilter filter;
} IMediaStreamFilterImpl;
static inline IMediaStreamFilterImpl *impl_from_IMediaStreamFilter(IMediaStreamFilter *iface)
{
return CONTAINING_RECORD(iface, IMediaStreamFilterImpl, IMediaStreamFilter_iface);
return CONTAINING_RECORD(iface, IMediaStreamFilterImpl, filter);
}
/*** IUnknown methods ***/
@ -80,18 +78,13 @@ static HRESULT WINAPI MediaStreamFilterImpl_QueryInterface(IMediaStreamFilter *i
static ULONG WINAPI MediaStreamFilterImpl_AddRef(IMediaStreamFilter *iface)
{
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->() AddRef from %d\n", iface, refCount - 1);
return refCount;
return BaseFilterImpl_AddRef((IBaseFilter*)iface);
}
static ULONG WINAPI MediaStreamFilterImpl_Release(IMediaStreamFilter *iface)
{
IMediaStreamFilterImpl *This = impl_from_IMediaStreamFilter(iface);
ULONG refCount = InterlockedDecrement(&This->ref);
ULONG refCount = BaseFilterImpl_Release((IBaseFilter*)iface);
TRACE("(%p)->() Release from %d\n", iface, refCount + 1);
@ -105,14 +98,10 @@ static ULONG WINAPI MediaStreamFilterImpl_Release(IMediaStreamFilter *iface)
static HRESULT WINAPI MediaStreamFilterImpl_GetClassID(IMediaStreamFilter * iface, CLSID * pClsid)
{
TRACE("(%p)->(%p)\n", iface, pClsid);
*pClsid = CLSID_MediaStreamFilter;
return S_OK;
return BaseFilterImpl_GetClassID((IBaseFilter*)iface, pClsid);
}
/*** IMediaFilter methods ***/
/*** IBaseFilter methods ***/
static HRESULT WINAPI MediaStreamFilterImpl_Stop(IMediaStreamFilter * iface)
{
@ -137,32 +126,22 @@ static HRESULT WINAPI MediaStreamFilterImpl_Run(IMediaStreamFilter * iface, REFE
static HRESULT WINAPI MediaStreamFilterImpl_GetState(IMediaStreamFilter * iface, DWORD dwMilliSecsTimeout, FILTER_STATE *pState)
{
FIXME("(%p)->(%d,%p): Stub!\n", iface, dwMilliSecsTimeout, pState);
return E_NOTIMPL;
return BaseFilterImpl_GetState((IBaseFilter*)iface, dwMilliSecsTimeout, pState);
}
static HRESULT WINAPI MediaStreamFilterImpl_SetSyncSource(IMediaStreamFilter * iface, IReferenceClock *pClock)
{
TRACE("(%p)->(%p): Stub!\n", iface, pClock);
return E_NOTIMPL;
return BaseFilterImpl_SetSyncSource((IBaseFilter*)iface, pClock);
}
static HRESULT WINAPI MediaStreamFilterImpl_GetSyncSource(IMediaStreamFilter * iface, IReferenceClock **ppClock)
{
FIXME("(%p)->(%p): Stub!\n", iface, ppClock);
return E_NOTIMPL;
return BaseFilterImpl_GetSyncSource((IBaseFilter*)iface, ppClock);
}
/*** IBaseFilter methods ***/
static HRESULT WINAPI MediaStreamFilterImpl_EnumPins(IMediaStreamFilter * iface, IEnumPins **ppEnum)
{
FIXME("(%p)->(%p): Stub!\n", iface, ppEnum);
return E_NOTIMPL;
return BaseFilterImpl_EnumPins((IBaseFilter*)iface, ppEnum);
}
static HRESULT WINAPI MediaStreamFilterImpl_FindPin(IMediaStreamFilter * iface, LPCWSTR Id, IPin **ppPin)
@ -174,23 +153,17 @@ static HRESULT WINAPI MediaStreamFilterImpl_FindPin(IMediaStreamFilter * iface,
static HRESULT WINAPI MediaStreamFilterImpl_QueryFilterInfo(IMediaStreamFilter * iface, FILTER_INFO *pInfo)
{
FIXME("(%p)->(%p): Stub!\n", iface, pInfo);
return E_NOTIMPL;
return BaseFilterImpl_QueryFilterInfo((IBaseFilter*)iface, pInfo);
}
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;
return BaseFilterImpl_JoinFilterGraph((IBaseFilter*)iface, pGraph, pName);
}
static HRESULT WINAPI MediaStreamFilterImpl_QueryVendorInfo(IMediaStreamFilter * iface, LPWSTR *pVendorInfo)
{
FIXME("(%p)->(%p): Stub!\n", iface, pVendorInfo);
return E_NOTIMPL;
return BaseFilterImpl_QueryVendorInfo((IBaseFilter*)iface, pVendorInfo);
}
/*** IMediaStreamFilter methods ***/
@ -286,6 +259,23 @@ static const IMediaStreamFilterVtbl MediaStreamFilter_Vtbl =
MediaStreamFilterImpl_EndOfStream
};
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
};
HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, void **ppObj)
{
IMediaStreamFilterImpl* object;
@ -302,8 +292,7 @@ HRESULT MediaStreamFilter_create(IUnknown *pUnkOuter, void **ppObj)
return E_OUTOFMEMORY;
}
object->IMediaStreamFilter_iface.lpVtbl = &MediaStreamFilter_Vtbl;
object->ref = 1;
BaseFilter_Init(&object->filter, (IBaseFilterVtbl*)&MediaStreamFilter_Vtbl, &CLSID_MediaStreamFilter, (DWORD_PTR)(__FILE__ ": MediaStreamFilterImpl.csFilter"), &BaseFuncTable);
*ppObj = object;