Commit cde7d63b authored by Hidenori Takeshima's avatar Hidenori Takeshima Committed by Alexandre Julliard

Implemented ISeekingPassThru.

parent 7bed696a
......@@ -40,6 +40,9 @@ C_SRCS = \
main.c \
memalloc.c \
monprop.c \
ptimpl.c \
ptmpos.c \
ptmseek.c \
regsvr.c \
sample.c \
seekpass.c \
......
/*
* A pass-through class.
*
* hidenori@a2.ctktv.ne.jp
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "ptimpl.h"
static
HRESULT CPassThruImpl_GetConnected( CPassThruImpl* pImpl, IPin** ppPin )
{
return IPin_ConnectedTo( pImpl->pPin, ppPin );
}
HRESULT CPassThruImpl_QueryPosPass(
CPassThruImpl* pImpl, IMediaPosition** ppPosition )
{
IPin* pPin;
HRESULT hr;
hr = CPassThruImpl_GetConnected( pImpl, &pPin );
if ( FAILED(hr) )
return hr;
hr = IPin_QueryInterface(pPin,&IID_IMediaPosition,(void**)ppPosition);
IPin_Release(pPin);
return hr;
}
HRESULT CPassThruImpl_QuerySeekPass(
CPassThruImpl* pImpl, IMediaSeeking** ppSeeking )
{
IPin* pPin;
HRESULT hr;
hr = CPassThruImpl_GetConnected( pImpl, &pPin );
if ( FAILED(hr) )
return hr;
hr = IPin_QueryInterface(pPin,&IID_IMediaSeeking,(void**)ppSeeking);
IPin_Release(pPin);
return hr;
}
#ifndef WINE_DSHOW_PTIMPL_H
#define WINE_DSHOW_PTIMPL_H
/*
* A pass-through class.
*
* hidenori@a2.ctktv.ne.jp
*/
typedef struct CPassThruImpl
{
struct { ICOM_VFIELD(IMediaPosition); } mpos;
struct { ICOM_VFIELD(IMediaSeeking); } mseek;
IUnknown* punk;
IPin* pPin;
} CPassThruImpl;
#define CPassThruImpl_THIS(iface,member) CPassThruImpl* This = ((CPassThruImpl*)(((char*)iface)-offsetof(CPassThruImpl,member)))
HRESULT CPassThruImpl_InitIMediaPosition( CPassThruImpl* pImpl );
void CPassThruImpl_UninitIMediaPosition( CPassThruImpl* pImpl );
HRESULT CPassThruImpl_InitIMediaSeeking( CPassThruImpl* pImpl );
void CPassThruImpl_UninitIMediaSeeking( CPassThruImpl* pImpl );
HRESULT CPassThruImpl_QueryPosPass(
CPassThruImpl* pImpl, IMediaPosition** ppPosition );
HRESULT CPassThruImpl_QuerySeekPass(
CPassThruImpl* pImpl, IMediaSeeking** ppSeeking );
#endif /* WINE_DSHOW_PTIMPL_H */
/*
* A pass-through class for IMediaPosition.
*
* hidenori@a2.ctktv.ne.jp
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "ptimpl.h"
#define QUERYPOSPASS \
IMediaPosition* pPos; \
HRESULT hr; \
hr = CPassThruImpl_QueryPosPass( This, &pPos ); \
if ( FAILED(hr) ) return hr;
static HRESULT WINAPI
IMediaPosition_fnQueryInterface(IMediaPosition* iface,REFIID riid,void** ppobj)
{
CPassThruImpl_THIS(iface,mpos);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->punk,riid,ppobj);
}
static ULONG WINAPI
IMediaPosition_fnAddRef(IMediaPosition* iface)
{
CPassThruImpl_THIS(iface,mpos);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->punk);
}
static ULONG WINAPI
IMediaPosition_fnRelease(IMediaPosition* iface)
{
CPassThruImpl_THIS(iface,mpos);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->punk);
}
static HRESULT WINAPI
IMediaPosition_fnGetTypeInfoCount(IMediaPosition* iface,UINT* pcTypeInfo)
{
CPassThruImpl_THIS(iface,mpos);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaPosition_fnGetTypeInfo(IMediaPosition* iface,UINT iTypeInfo, LCID lcid, ITypeInfo** ppobj)
{
CPassThruImpl_THIS(iface,mpos);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaPosition_fnGetIDsOfNames(IMediaPosition* iface,REFIID riid, LPOLESTR* ppwszName, UINT cNames, LCID lcid, DISPID* pDispId)
{
CPassThruImpl_THIS(iface,mpos);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaPosition_fnInvoke(IMediaPosition* iface,DISPID DispId, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS* pDispParams, VARIANT* pVarRes, EXCEPINFO* pExcepInfo, UINT* puArgErr)
{
CPassThruImpl_THIS(iface,mpos);
FIXME("(%p)->() stub!\n",This);
return E_NOTIMPL;
}
static HRESULT WINAPI
IMediaPosition_fnget_Duration(IMediaPosition* iface,REFTIME* prefTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
return IMediaPosition_get_Duration(pPos,prefTime);
}
static HRESULT WINAPI
IMediaPosition_fnput_CurrentPosition(IMediaPosition* iface,REFTIME refTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
return IMediaPosition_put_CurrentPosition(pPos,refTime);
}
static HRESULT WINAPI
IMediaPosition_fnget_CurrentPosition(IMediaPosition* iface,REFTIME* prefTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
return IMediaPosition_get_CurrentPosition(pPos,prefTime);
}
static HRESULT WINAPI
IMediaPosition_fnget_StopTime(IMediaPosition* iface,REFTIME* prefTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
return IMediaPosition_get_StopTime(pPos,prefTime);
}
static HRESULT WINAPI
IMediaPosition_fnput_StopTime(IMediaPosition* iface,REFTIME refTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
return IMediaPosition_put_StopTime(pPos,refTime);
}
static HRESULT WINAPI
IMediaPosition_fnget_PrerollTime(IMediaPosition* iface,REFTIME* prefTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
return IMediaPosition_get_PrerollTime(pPos,prefTime);
}
static HRESULT WINAPI
IMediaPosition_fnput_PrerollTime(IMediaPosition* iface,REFTIME refTime)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
return IMediaPosition_put_PrerollTime(pPos,refTime);
}
static HRESULT WINAPI
IMediaPosition_fnput_Rate(IMediaPosition* iface,double dblRate)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
return IMediaPosition_put_Rate(pPos,dblRate);
}
static HRESULT WINAPI
IMediaPosition_fnget_Rate(IMediaPosition* iface,double* pdblRate)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
return IMediaPosition_get_Rate(pPos,pdblRate);
}
static HRESULT WINAPI
IMediaPosition_fnCanSeekForward(IMediaPosition* iface,LONG* pCanSeek)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
return IMediaPosition_CanSeekForward(pPos,pCanSeek);
}
static HRESULT WINAPI
IMediaPosition_fnCanSeekBackward(IMediaPosition* iface,LONG* pCanSeek)
{
CPassThruImpl_THIS(iface,mpos);
QUERYPOSPASS
TRACE("(%p)->()\n",This);
return IMediaPosition_CanSeekBackward(pPos,pCanSeek);
}
static ICOM_VTABLE(IMediaPosition) impos =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMediaPosition_fnQueryInterface,
IMediaPosition_fnAddRef,
IMediaPosition_fnRelease,
/* IDispatch fields */
IMediaPosition_fnGetTypeInfoCount,
IMediaPosition_fnGetTypeInfo,
IMediaPosition_fnGetIDsOfNames,
IMediaPosition_fnInvoke,
/* IMediaPosition fields */
IMediaPosition_fnget_Duration,
IMediaPosition_fnput_CurrentPosition,
IMediaPosition_fnget_CurrentPosition,
IMediaPosition_fnget_StopTime,
IMediaPosition_fnput_StopTime,
IMediaPosition_fnget_PrerollTime,
IMediaPosition_fnput_PrerollTime,
IMediaPosition_fnput_Rate,
IMediaPosition_fnget_Rate,
IMediaPosition_fnCanSeekForward,
IMediaPosition_fnCanSeekBackward,
};
HRESULT CPassThruImpl_InitIMediaPosition( CPassThruImpl* pImpl )
{
TRACE("(%p)\n",pImpl);
ICOM_VTBL(&pImpl->mpos) = &impos;
return NOERROR;
}
void CPassThruImpl_UninitIMediaPosition( CPassThruImpl* pImpl )
{
TRACE("(%p)\n",pImpl);
}
/*
* A pass-through class for IMediaSeeking.
*
* hidenori@a2.ctktv.ne.jp
*/
#include "config.h"
#include "windef.h"
#include "winbase.h"
#include "wingdi.h"
#include "winuser.h"
#include "winerror.h"
#include "wine/obj_base.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "debugtools.h"
DEFAULT_DEBUG_CHANNEL(quartz);
#include "quartz_private.h"
#include "ptimpl.h"
#define QUERYSEEKPASS \
IMediaSeeking* pSeek; \
HRESULT hr; \
hr = CPassThruImpl_QuerySeekPass( This, &pSeek ); \
if ( FAILED(hr) ) return hr;
static HRESULT WINAPI
IMediaSeeking_fnQueryInterface(IMediaSeeking* iface,REFIID riid,void** ppobj)
{
CPassThruImpl_THIS(iface,mseek);
TRACE("(%p)->()\n",This);
return IUnknown_QueryInterface(This->punk,riid,ppobj);
}
static ULONG WINAPI
IMediaSeeking_fnAddRef(IMediaSeeking* iface)
{
CPassThruImpl_THIS(iface,mseek);
TRACE("(%p)->()\n",This);
return IUnknown_AddRef(This->punk);
}
static ULONG WINAPI
IMediaSeeking_fnRelease(IMediaSeeking* iface)
{
CPassThruImpl_THIS(iface,mseek);
TRACE("(%p)->()\n",This);
return IUnknown_Release(This->punk);
}
static HRESULT WINAPI
IMediaSeeking_fnGetCapabilities(IMediaSeeking* iface,DWORD* pdwCaps)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_GetCapabilities(pSeek,pdwCaps);
}
static HRESULT WINAPI
IMediaSeeking_fnCheckCapabilities(IMediaSeeking* iface,DWORD* pdwCaps)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_CheckCapabilities(pSeek,pdwCaps);
}
static HRESULT WINAPI
IMediaSeeking_fnIsFormatSupported(IMediaSeeking* iface,const GUID* pidFormat)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_IsFormatSupported(pSeek,pidFormat);
}
static HRESULT WINAPI
IMediaSeeking_fnQueryPreferredFormat(IMediaSeeking* iface,GUID* pidFormat)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_QueryPreferredFormat(pSeek,pidFormat);
}
static HRESULT WINAPI
IMediaSeeking_fnGetTimeFormat(IMediaSeeking* iface,GUID* pidFormat)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_GetTimeFormat(pSeek,pidFormat);
}
static HRESULT WINAPI
IMediaSeeking_fnIsUsingTimeFormat(IMediaSeeking* iface,const GUID* pidFormat)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_IsUsingTimeFormat(pSeek,pidFormat);
}
static HRESULT WINAPI
IMediaSeeking_fnSetTimeFormat(IMediaSeeking* iface,const GUID* pidFormat)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_SetTimeFormat(pSeek,pidFormat);
}
static HRESULT WINAPI
IMediaSeeking_fnGetDuration(IMediaSeeking* iface,LONGLONG* pllDuration)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_GetDuration(pSeek,pllDuration);
}
static HRESULT WINAPI
IMediaSeeking_fnGetStopPosition(IMediaSeeking* iface,LONGLONG* pllPos)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_GetStopPosition(pSeek,pllPos);
}
static HRESULT WINAPI
IMediaSeeking_fnGetCurrentPosition(IMediaSeeking* iface,LONGLONG* pllPos)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_GetCurrentPosition(pSeek,pllPos);
}
static HRESULT WINAPI
IMediaSeeking_fnConvertTimeFormat(IMediaSeeking* iface,LONGLONG* pllOut,const GUID* pidFmtOut,LONGLONG llIn,const GUID* pidFmtIn)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_ConvertTimeFormat(pSeek,pllOut,pidFmtOut,llIn,pidFmtIn);
}
static HRESULT WINAPI
IMediaSeeking_fnSetPositions(IMediaSeeking* iface,LONGLONG* pllCur,DWORD dwCurFlags,LONGLONG* pllStop,DWORD dwStopFlags)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_SetPositions(pSeek,pllCur,dwCurFlags,pllStop,dwStopFlags);
}
static HRESULT WINAPI
IMediaSeeking_fnGetPositions(IMediaSeeking* iface,LONGLONG* pllCur,LONGLONG* pllStop)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_GetPositions(pSeek,pllCur,pllStop);
}
static HRESULT WINAPI
IMediaSeeking_fnGetAvailable(IMediaSeeking* iface,LONGLONG* pllFirst,LONGLONG* pllLast)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_GetAvailable(pSeek,pllFirst,pllLast);
}
static HRESULT WINAPI
IMediaSeeking_fnSetRate(IMediaSeeking* iface,double dblRate)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_SetRate(pSeek,dblRate);
}
static HRESULT WINAPI
IMediaSeeking_fnGetRate(IMediaSeeking* iface,double* pdblRate)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_GetRate(pSeek,pdblRate);
}
static HRESULT WINAPI
IMediaSeeking_fnGetPreroll(IMediaSeeking* iface,LONGLONG* pllPreroll)
{
CPassThruImpl_THIS(iface,mseek);
QUERYSEEKPASS
TRACE("(%p)->()\n",This);
return IMediaSeeking_GetPreroll(pSeek,pllPreroll);
}
static ICOM_VTABLE(IMediaSeeking) imseek =
{
ICOM_MSVTABLE_COMPAT_DummyRTTIVALUE
/* IUnknown fields */
IMediaSeeking_fnQueryInterface,
IMediaSeeking_fnAddRef,
IMediaSeeking_fnRelease,
/* IMediaSeeking fields */
IMediaSeeking_fnGetCapabilities,
IMediaSeeking_fnCheckCapabilities,
IMediaSeeking_fnIsFormatSupported,
IMediaSeeking_fnQueryPreferredFormat,
IMediaSeeking_fnGetTimeFormat,
IMediaSeeking_fnIsUsingTimeFormat,
IMediaSeeking_fnSetTimeFormat,
IMediaSeeking_fnGetDuration,
IMediaSeeking_fnGetStopPosition,
IMediaSeeking_fnGetCurrentPosition,
IMediaSeeking_fnConvertTimeFormat,
IMediaSeeking_fnSetPositions,
IMediaSeeking_fnGetPositions,
IMediaSeeking_fnGetAvailable,
IMediaSeeking_fnSetRate,
IMediaSeeking_fnGetRate,
IMediaSeeking_fnGetPreroll,
};
HRESULT CPassThruImpl_InitIMediaSeeking( CPassThruImpl* pImpl )
{
TRACE("(%p)\n",pImpl);
ICOM_VTBL(&pImpl->mseek) = &imseek;
return NOERROR;
}
void CPassThruImpl_UninitIMediaSeeking( CPassThruImpl* pImpl )
{
TRACE("(%p)\n",pImpl);
}
......@@ -13,6 +13,7 @@
#include "winerror.h"
#include "wine/obj_base.h"
#include "strmif.h"
#include "control.h"
#include "uuids.h"
#include "debugtools.h"
......@@ -58,9 +59,21 @@ ISeekingPassThru_fnInit(ISeekingPassThru* iface,BOOL bRendering,IPin* pPin)
{
CSeekingPassThru_THIS(iface,seekpass);
FIXME("(%p)->(%d,%p) stub!\n",This,bRendering,pPin);
FIXME("(%p)->(%d,%p) not tested!\n",This,bRendering,pPin);
return E_NOTIMPL;
if ( pPin == NULL )
return E_POINTER;
/* Why 'bRendering' is given as an argument?? */
EnterCriticalSection( &This->cs );
if ( This->passthru.pPin != NULL )
IPin_Release( This->passthru.pPin );
This->passthru.pPin = pPin; IPin_AddRef( pPin );
LeaveCriticalSection( &This->cs );
return NOERROR;
}
......@@ -80,6 +93,9 @@ HRESULT CSeekingPassThru_InitISeekingPassThru(CSeekingPassThru* This)
{
TRACE("(%p)\n",This);
ICOM_VTBL(&This->seekpass) = &iseekingpassthru;
This->passthru.punk = This->unk.punkControl;
This->passthru.pPin = NULL;
InitializeCriticalSection( &This->cs );
return NOERROR;
}
......@@ -88,6 +104,12 @@ static
void CSeekingPassThru_UninitISeekingPassThru(CSeekingPassThru* This)
{
TRACE("(%p)\n",This);
if ( This->passthru.pPin != NULL )
{
IPin_Release( This->passthru.pPin );
This->passthru.pPin = NULL;
}
DeleteCriticalSection( &This->cs );
}
......@@ -95,6 +117,8 @@ void CSeekingPassThru_UninitISeekingPassThru(CSeekingPassThru* This)
static QUARTZ_IFEntry IFEntries[] =
{
{ &IID_ISeekingPassThru, offsetof(CSeekingPassThru,seekpass)-offsetof(CSeekingPassThru,unk) },
{ &IID_IMediaPosition, offsetof(CSeekingPassThru,passthru.mpos)-offsetof(CSeekingPassThru,unk) },
{ &IID_IMediaSeeking, offsetof(CSeekingPassThru,passthru.mseek)-offsetof(CSeekingPassThru,unk) },
};
......
......@@ -12,6 +12,7 @@
*/
#include "iunk.h"
#include "ptimpl.h"
typedef struct QUARTZ_ISeekingPassThruImpl
{
......@@ -25,6 +26,8 @@ typedef struct CSeekingPassThru
QUARTZ_ISeekingPassThruImpl seekpass;
/* ISeekingPassThru fields. */
CRITICAL_SECTION cs;
CPassThruImpl passthru;
} CSeekingPassThru;
#define CSeekingPassThru_THIS(iface,member) CSeekingPassThru* This = ((CSeekingPassThru*)(((char*)iface)-offsetof(CSeekingPassThru,member)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment