typedef HRESULT (*SeekFunc)( IMediaSeeking *to, LPVOID arg );
-static HRESULT ForwardCmdSeek( IBaseFilter* from, SeekFunc fnSeek, LPVOID arg )
+static HRESULT ForwardCmdSeek( PCRITICAL_SECTION crit_sect, IBaseFilter* from, SeekFunc fnSeek, LPVOID arg )
{
HRESULT hr = S_OK;
HRESULT hr_return = S_OK;
if (!hr_local)
{
foundend = TRUE;
+ LeaveCriticalSection( crit_sect );
hr_local = fnSeek( seek , arg );
+ EnterCriticalSection( crit_sect );
if (hr_local != E_NOTIMPL)
allnotimpl = FALSE;
hr = hr_return;
out:
- FIXME("Returning: %08x\n", hr);
+ TRACE("Returning: %08x\n", hr);
return hr;
}
if (!pCapabilities)
return E_POINTER;
- hr = ForwardCmdSeek(This->pUserData, fwd_checkcaps, pCapabilities);
+ EnterCriticalSection(This->crst);
+ hr = ForwardCmdSeek(This->crst, This->pUserData, fwd_checkcaps, pCapabilities);
+ LeaveCriticalSection(This->crst);
if (FAILED(hr) && hr != E_NOTIMPL)
return hr;
MediaSeekingImpl *This = (MediaSeekingImpl *)iface;
TRACE("(%s)\n", qzdebugstr_guid(pFormat));
- ForwardCmdSeek(This->pUserData, fwd_settimeformat, (LPVOID)pFormat);
+ 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);
}
EnterCriticalSection(This->crst);
*pDuration = This->llDuration;
- ForwardCmdSeek(This->pUserData, fwd_getduration, pDuration);
+ ForwardCmdSeek(This->crst, This->pUserData, fwd_getduration, pDuration);
LeaveCriticalSection(This->crst);
return S_OK;
EnterCriticalSection(This->crst);
*pStop = This->llStop;
- ForwardCmdSeek(This->pUserData, fwd_getstopposition, pStop);
+ ForwardCmdSeek(This->crst, This->pUserData, fwd_getstopposition, pStop);
LeaveCriticalSection(This->crst);
return S_OK;
EnterCriticalSection(This->crst);
*pCurrent = This->llCurrent;
- ForwardCmdSeek(This->pUserData, fwd_getcurposition, pCurrent);
+ ForwardCmdSeek(This->crst, This->pUserData, fwd_getcurposition, pCurrent);
LeaveCriticalSection(This->crst);
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);
+}
+
+
HRESULT WINAPI MediaSeekingImpl_SetPositions(IMediaSeeking * iface, LONGLONG * pCurrent, DWORD dwCurrentFlags, LONGLONG * pStop, DWORD dwStopFlags)
{
MediaSeekingImpl *This = (MediaSeekingImpl *)iface;
BOOL bChangeCurrent = FALSE, bChangeStop = FALSE;
LONGLONG llNewCurrent, llNewStop;
+ struct pos_args args;
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);
llNewCurrent = Adjust(This->llCurrent, pCurrent, dwCurrentFlags);
if (llNewStop != This->llStop)
bChangeStop = TRUE;
+ TRACE("Old: %u, New: %u\n", (DWORD)(This->llCurrent/10000000), (DWORD)(llNewCurrent/10000000));
+
This->llCurrent = llNewCurrent;
This->llStop = llNewStop;
if (dwStopFlags & AM_SEEKING_ReturnTime)
*pStop = llNewStop;
+ ForwardCmdSeek(This->crst, This->pUserData, fwd_setposition, &args);
+ LeaveCriticalSection(This->crst);
+
if (bChangeCurrent)
This->fnChangeCurrent(This->pUserData);
if (bChangeStop)
This->fnChangeStop(This->pUserData);
- LeaveCriticalSection(This->crst);
-
return S_OK;
}
This->dRate = dRate;
if (bChangeRate)
hr = This->fnChangeRate(This->pUserData);
- ForwardCmdSeek(This->pUserData, fwd_setrate, &dRate);
+ ForwardCmdSeek(This->crst, This->pUserData, fwd_setrate, &dRate);
LeaveCriticalSection(This->crst);
return hr;