Commit b6c52325 authored by Maarten Lankhorst's avatar Maarten Lankhorst Committed by Alexandre Julliard

quartz: Remove forwarding from base class.

parent 4fe2be86
...@@ -224,81 +224,6 @@ HRESULT SeekingPassThru_create(IUnknown *pUnkOuter, LPVOID *ppObj) ...@@ -224,81 +224,6 @@ HRESULT SeekingPassThru_create(IUnknown *pUnkOuter, LPVOID *ppObj)
return S_OK; return S_OK;
} }
typedef HRESULT (*SeekFunc)( IMediaSeeking *to, LPVOID arg );
static HRESULT ForwardCmdSeek( PCRITICAL_SECTION crit_sect, IBaseFilter* from, SeekFunc fnSeek, LPVOID arg )
{
HRESULT hr = S_OK;
HRESULT hr_return = S_OK;
IEnumPins *enumpins = NULL;
BOOL foundend = FALSE, allnotimpl = TRUE;
hr = IBaseFilter_EnumPins( from, &enumpins );
if (FAILED(hr))
goto out;
hr = IEnumPins_Reset( enumpins );
while (hr == S_OK) {
IPin *pin = NULL;
hr = IEnumPins_Next( enumpins, 1, &pin, NULL );
if (hr == VFW_E_ENUM_OUT_OF_SYNC)
{
hr = IEnumPins_Reset( enumpins );
continue;
}
if (pin)
{
PIN_DIRECTION dir;
IPin_QueryDirection( pin, &dir );
if (dir == PINDIR_INPUT)
{
IPin *connected = NULL;
IPin_ConnectedTo( pin, &connected );
if (connected)
{
HRESULT hr_local;
IMediaSeeking *seek = NULL;
hr_local = IPin_QueryInterface( connected, &IID_IMediaSeeking, (void**)&seek );
if (hr_local == S_OK)
{
foundend = TRUE;
if (crit_sect)
{
LeaveCriticalSection( crit_sect );
hr_local = fnSeek( seek , arg );
EnterCriticalSection( crit_sect );
}
else
hr_local = fnSeek( seek , arg );
if (hr_local != E_NOTIMPL)
allnotimpl = FALSE;
hr_return = updatehres( hr_return, hr_local );
IMediaSeeking_Release( seek );
}
IPin_Release(connected);
}
}
IPin_Release( pin );
}
}
IEnumPins_Release( enumpins );
if (foundend && allnotimpl)
hr = E_NOTIMPL;
else
hr = hr_return;
out:
TRACE("Returning: %08x\n", hr);
return hr;
}
HRESULT MediaSeekingImpl_Init(IBaseFilter *pUserData, CHANGEPROC fnChangeStop, CHANGEPROC fnChangeCurrent, CHANGEPROC fnChangeRate, MediaSeekingImpl * pSeeking, PCRITICAL_SECTION crit_sect) HRESULT MediaSeekingImpl_Init(IBaseFilter *pUserData, CHANGEPROC fnChangeStop, CHANGEPROC fnChangeCurrent, CHANGEPROC fnChangeRate, MediaSeekingImpl * pSeeking, PCRITICAL_SECTION crit_sect)
{ {
assert(fnChangeStop && fnChangeCurrent && fnChangeRate); assert(fnChangeStop && fnChangeCurrent && fnChangeRate);
...@@ -319,93 +244,9 @@ HRESULT MediaSeekingImpl_Init(IBaseFilter *pUserData, CHANGEPROC fnChangeStop, C ...@@ -319,93 +244,9 @@ HRESULT MediaSeekingImpl_Init(IBaseFilter *pUserData, CHANGEPROC fnChangeStop, C
pSeeking->dRate = 1.0; pSeeking->dRate = 1.0;
pSeeking->timeformat = TIME_FORMAT_MEDIA_TIME; pSeeking->timeformat = TIME_FORMAT_MEDIA_TIME;
pSeeking->crst = crit_sect; pSeeking->crst = crit_sect;
return S_OK; return S_OK;
} }
struct pos_args {
LONGLONG* current, *stop;
DWORD curflags, stopflags;
};
static HRESULT fwd_setposition(IMediaSeeking *seek, LPVOID pargs)
{
struct pos_args *args = (void*)pargs;
return IMediaSeeking_SetPositions(seek, args->current, args->curflags, args->stop, args->stopflags);
}
static HRESULT fwd_checkcaps(IMediaSeeking *iface, LPVOID pcaps)
{
DWORD *caps = pcaps;
return IMediaSeeking_CheckCapabilities(iface, caps);
}
static HRESULT fwd_settimeformat(IMediaSeeking *iface, LPVOID pformat)
{
const GUID *format = pformat;
return IMediaSeeking_SetTimeFormat(iface, format);
}
static HRESULT fwd_getduration(IMediaSeeking *iface, LPVOID pdur)
{
LONGLONG *duration = pdur;
LONGLONG mydur = *duration;
HRESULT hr;
hr = IMediaSeeking_GetDuration(iface, &mydur);
if (FAILED(hr))
return hr;
if ((mydur < *duration) || (*duration < 0 && mydur > 0))
*duration = mydur;
return hr;
}
static HRESULT fwd_getstopposition(IMediaSeeking *iface, LPVOID pdur)
{
LONGLONG *duration = pdur;
LONGLONG mydur = *duration;
HRESULT hr;
hr = IMediaSeeking_GetStopPosition(iface, &mydur);
if (FAILED(hr))
return hr;
if ((mydur < *duration) || (*duration < 0 && mydur > 0))
*duration = mydur;
return hr;
}
static HRESULT fwd_getcurposition(IMediaSeeking *iface, LPVOID pdur)
{
LONGLONG *duration = pdur;
LONGLONG mydur = *duration;
HRESULT hr;
hr = IMediaSeeking_GetCurrentPosition(iface, &mydur);
if (FAILED(hr))
return hr;
if ((mydur < *duration) || (*duration < 0 && mydur > 0))
*duration = mydur;
return hr;
}
static HRESULT fwd_setrate(IMediaSeeking *iface, LPVOID prate)
{
double *rate = prate;
HRESULT hr;
hr = IMediaSeeking_SetRate(iface, *rate);
if (FAILED(hr))
return hr;
return hr;
}
HRESULT WINAPI MediaSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD * pCapabilities) HRESULT WINAPI MediaSeekingImpl_GetCapabilities(IMediaSeeking * iface, DWORD * pCapabilities)
{ {
MediaSeekingImpl *This = (MediaSeekingImpl *)iface; MediaSeekingImpl *This = (MediaSeekingImpl *)iface;
...@@ -428,12 +269,6 @@ HRESULT WINAPI MediaSeekingImpl_CheckCapabilities(IMediaSeeking * iface, DWORD * ...@@ -428,12 +269,6 @@ HRESULT WINAPI MediaSeekingImpl_CheckCapabilities(IMediaSeeking * iface, DWORD *
if (!pCapabilities) if (!pCapabilities)
return E_POINTER; return E_POINTER;
EnterCriticalSection(This->crst);
hr = ForwardCmdSeek(This->crst, This->pUserData, fwd_checkcaps, pCapabilities);
LeaveCriticalSection(This->crst);
if (FAILED(hr) && hr != E_NOTIMPL)
return hr;
dwCommonCaps = *pCapabilities & This->dwCapabilities; dwCommonCaps = *pCapabilities & This->dwCapabilities;
if (!dwCommonCaps) if (!dwCommonCaps)
...@@ -441,7 +276,6 @@ HRESULT WINAPI MediaSeekingImpl_CheckCapabilities(IMediaSeeking * iface, DWORD * ...@@ -441,7 +276,6 @@ HRESULT WINAPI MediaSeekingImpl_CheckCapabilities(IMediaSeeking * iface, DWORD *
else else
hr = (*pCapabilities == dwCommonCaps) ? S_OK : S_FALSE; hr = (*pCapabilities == dwCommonCaps) ? S_OK : S_FALSE;
*pCapabilities = dwCommonCaps; *pCapabilities = dwCommonCaps;
return hr; return hr;
} }
...@@ -487,17 +321,11 @@ HRESULT WINAPI MediaSeekingImpl_IsUsingTimeFormat(IMediaSeeking * iface, const G ...@@ -487,17 +321,11 @@ HRESULT WINAPI MediaSeekingImpl_IsUsingTimeFormat(IMediaSeeking * iface, const G
return hr; return hr;
} }
HRESULT WINAPI MediaSeekingImpl_SetTimeFormat(IMediaSeeking * iface, const GUID * pFormat) HRESULT WINAPI MediaSeekingImpl_SetTimeFormat(IMediaSeeking * iface, const GUID * pFormat)
{ {
MediaSeekingImpl *This = (MediaSeekingImpl *)iface; MediaSeekingImpl *This = (MediaSeekingImpl *)iface;
TRACE("(%s)\n", qzdebugstr_guid(pFormat)); TRACE("%p %s\n", This, qzdebugstr_guid(pFormat));
return (IsEqualIID(pFormat, &TIME_FORMAT_MEDIA_TIME) ? S_OK : E_INVALIDARG);
EnterCriticalSection(This->crst);
ForwardCmdSeek(This->crst, This->pUserData, fwd_settimeformat, (LPVOID)pFormat);
LeaveCriticalSection(This->crst);
return (IsEqualIID(pFormat, &TIME_FORMAT_MEDIA_TIME) ? S_OK : S_FALSE);
} }
...@@ -509,7 +337,6 @@ HRESULT WINAPI MediaSeekingImpl_GetDuration(IMediaSeeking * iface, LONGLONG * pD ...@@ -509,7 +337,6 @@ HRESULT WINAPI MediaSeekingImpl_GetDuration(IMediaSeeking * iface, LONGLONG * pD
EnterCriticalSection(This->crst); EnterCriticalSection(This->crst);
*pDuration = This->llDuration; *pDuration = This->llDuration;
ForwardCmdSeek(This->crst, This->pUserData, fwd_getduration, pDuration);
LeaveCriticalSection(This->crst); LeaveCriticalSection(This->crst);
return S_OK; return S_OK;
...@@ -523,7 +350,6 @@ HRESULT WINAPI MediaSeekingImpl_GetStopPosition(IMediaSeeking * iface, LONGLONG ...@@ -523,7 +350,6 @@ HRESULT WINAPI MediaSeekingImpl_GetStopPosition(IMediaSeeking * iface, LONGLONG
EnterCriticalSection(This->crst); EnterCriticalSection(This->crst);
*pStop = This->llStop; *pStop = This->llStop;
ForwardCmdSeek(This->crst, This->pUserData, fwd_getstopposition, pStop);
LeaveCriticalSection(This->crst); LeaveCriticalSection(This->crst);
return S_OK; return S_OK;
...@@ -538,7 +364,6 @@ HRESULT WINAPI MediaSeekingImpl_GetCurrentPosition(IMediaSeeking * iface, LONGLO ...@@ -538,7 +364,6 @@ HRESULT WINAPI MediaSeekingImpl_GetCurrentPosition(IMediaSeeking * iface, LONGLO
EnterCriticalSection(This->crst); EnterCriticalSection(This->crst);
*pCurrent = This->llCurrent; *pCurrent = This->llCurrent;
ForwardCmdSeek(This->crst, This->pUserData, fwd_getcurposition, pCurrent);
LeaveCriticalSection(This->crst); LeaveCriticalSection(This->crst);
return S_OK; return S_OK;
...@@ -577,15 +402,8 @@ HRESULT WINAPI MediaSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * p ...@@ -577,15 +402,8 @@ HRESULT WINAPI MediaSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * p
MediaSeekingImpl *This = (MediaSeekingImpl *)iface; MediaSeekingImpl *This = (MediaSeekingImpl *)iface;
BOOL bChangeCurrent = FALSE, bChangeStop = FALSE; BOOL bChangeCurrent = FALSE, bChangeStop = FALSE;
LONGLONG llNewCurrent, llNewStop; LONGLONG llNewCurrent, llNewStop;
struct pos_args args;
TRACE("(%p, %x, %p, %x)\n", pCurrent, dwCurrentFlags, pStop, dwStopFlags); TRACE("(%p, %x, %p, %x)\n", pCurrent, dwCurrentFlags, pStop, dwStopFlags);
args.current = pCurrent;
args.stop = pStop;
args.curflags = dwCurrentFlags;
args.stopflags = dwStopFlags;
EnterCriticalSection(This->crst); EnterCriticalSection(This->crst);
llNewCurrent = Adjust(This->llCurrent, pCurrent, dwCurrentFlags); llNewCurrent = Adjust(This->llCurrent, pCurrent, dwCurrentFlags);
...@@ -605,8 +423,6 @@ HRESULT WINAPI MediaSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * p ...@@ -605,8 +423,6 @@ HRESULT WINAPI MediaSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * p
*pCurrent = llNewCurrent; *pCurrent = llNewCurrent;
if (pStop && (dwStopFlags & AM_SEEKING_ReturnTime)) if (pStop && (dwStopFlags & AM_SEEKING_ReturnTime))
*pStop = llNewStop; *pStop = llNewStop;
ForwardCmdSeek(This->crst, This->pUserData, fwd_setposition, &args);
LeaveCriticalSection(This->crst); LeaveCriticalSection(This->crst);
if (bChangeCurrent) if (bChangeCurrent)
...@@ -663,7 +479,6 @@ HRESULT WINAPI MediaSeekingImpl_SetRate(IMediaSeeking * iface, double dRate) ...@@ -663,7 +479,6 @@ HRESULT WINAPI MediaSeekingImpl_SetRate(IMediaSeeking * iface, double dRate)
This->dRate = dRate; This->dRate = dRate;
if (bChangeRate) if (bChangeRate)
hr = This->fnChangeRate(This->pUserData); hr = This->fnChangeRate(This->pUserData);
ForwardCmdSeek(This->crst, This->pUserData, fwd_setrate, &dRate);
LeaveCriticalSection(This->crst); LeaveCriticalSection(This->crst);
return hr; return hr;
......
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