quartz: Remove position from filtergraph.

This commit is contained in:
Maarten Lankhorst 2010-11-05 23:19:08 +01:00 committed by Alexandre Julliard
parent 2e0e6677c6
commit 4f8584ac27
1 changed files with 27 additions and 32 deletions

View File

@ -203,7 +203,6 @@ typedef struct _IFilterGraphImpl {
GUID timeformatseek;
REFERENCE_TIME start_time;
REFERENCE_TIME pause_time;
LONGLONG position;
LONGLONG stop_position;
LONG recursioncount;
} IFilterGraphImpl;
@ -1956,7 +1955,7 @@ static HRESULT WINAPI MediaControl_Run(IMediaControl *iface) {
else
This->start_time += now - This->pause_time;
}
else This->position = This->start_time = 0;
else This->start_time = 0;
SendFilterMessage(iface, SendRun, 0);
This->state = State_Running;
@ -1990,13 +1989,6 @@ static HRESULT WINAPI MediaControl_Stop(IMediaControl *iface) {
if (This->state == State_Stopped) return S_OK;
EnterCriticalSection(&This->cs);
if (This->state == State_Running && This->refClock)
{
LONGLONG time = This->start_time;
IReferenceClock_GetTime(This->refClock, &time);
This->position += time - This->start_time;
}
if (This->state == State_Running) SendFilterMessage(iface, SendPause, 0);
SendFilterMessage(iface, SendStop, 0);
This->state = State_Stopped;
@ -2319,10 +2311,8 @@ static HRESULT WINAPI FoundDuration(IFilterGraphImpl *This, IMediaSeeking *seek,
if (FAILED(hr))
return hr;
/* FIXME: Minimum or maximum duration? Assuming minimum */
if (duration > 0 && *pdur < duration)
if (*pdur < duration)
*pdur = duration;
return hr;
}
@ -2337,7 +2327,7 @@ static HRESULT WINAPI MediaSeeking_GetDuration(IMediaSeeking *iface,
return E_POINTER;
EnterCriticalSection(&This->cs);
*pDuration = -1;
*pDuration = 0;
hr = all_renderers_seek(This, FoundDuration, (DWORD_PTR)pDuration);
LeaveCriticalSection(&This->cs);
@ -2361,37 +2351,45 @@ static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface,
hr = IMediaSeeking_GetDuration(iface, pStop);
else
*pStop = This->stop_position;
LeaveCriticalSection(&This->cs);
return hr;
}
static HRESULT WINAPI FoundCurrentPosition(IFilterGraphImpl *This, IMediaSeeking *seek, DWORD_PTR pposition)
{
HRESULT hr;
LONGLONG pos = 0, *ppos = (LONGLONG*)pposition;
hr = IMediaSeeking_GetCurrentPosition(seek, &pos);
if (FAILED(hr))
return hr;
if (*ppos < 0 || pos < *ppos)
*ppos = pos;
return hr;
}
static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface,
LONGLONG *pCurrent) {
ICOM_THIS_MULTI(IFilterGraphImpl, IMediaSeeking_vtbl, iface);
LONGLONG time = 0;
HRESULT hr;
if (!pCurrent)
return E_POINTER;
EnterCriticalSection(&This->cs);
if (This->state == State_Running && This->refClock)
{
IReferenceClock_GetTime(This->refClock, &time);
if (time)
time += This->position - This->start_time;
if (time < This->position)
time = This->position;
*pCurrent = time;
*pCurrent = -1;
hr = all_renderers_seek(This, FoundCurrentPosition, (DWORD_PTR)pCurrent);
if (hr == E_NOTIMPL) {
*pCurrent = 0;
hr = S_OK;
}
else
*pCurrent = This->position;
LeaveCriticalSection(&This->cs);
TRACE("Time: %u.%03u\n", (DWORD)(*pCurrent / 10000000), (DWORD)((*pCurrent / 10000)%1000));
return S_OK;
return hr;
}
static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface,
@ -2435,11 +2433,8 @@ static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface,
state = This->state;
TRACE("State: %s\n", state == State_Running ? "Running" : (state == State_Paused ? "Paused" : (state == State_Stopped ? "Stopped" : "UNKNOWN")));
if ((dwCurrentFlags & 0x7) == AM_SEEKING_AbsolutePositioning)
{
This->position = *pCurrent;
}
else if ((dwCurrentFlags & 0x7) != AM_SEEKING_NoPositioning)
if ((dwCurrentFlags & 0x7) != AM_SEEKING_AbsolutePositioning &&
(dwCurrentFlags & 0x7) != AM_SEEKING_NoPositioning)
FIXME("Adjust method %x not handled yet!\n", dwCurrentFlags & 0x7);
if ((dwStopFlags & 0x7) == AM_SEEKING_AbsolutePositioning)
@ -5477,7 +5472,7 @@ HRESULT FilterGraph_create(IUnknown *pUnkOuter, LPVOID *ppObj)
fimpl->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": IFilterGraphImpl.cs");
fimpl->nItfCacheEntries = 0;
memcpy(&fimpl->timeformatseek, &TIME_FORMAT_MEDIA_TIME, sizeof(GUID));
fimpl->start_time = fimpl->position = 0;
fimpl->start_time = fimpl->pause_time = 0;
fimpl->stop_position = -1;
fimpl->punkFilterMapper2 = NULL;
fimpl->recursioncount = 0;