quartz/filtergraph: Store the current position and return it in IMediaSeeking::GetCurrentPosition().
Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1c0985013e
commit
539fa6922b
|
@ -210,6 +210,8 @@ typedef struct _IFilterGraphImpl {
|
||||||
|
|
||||||
HANDLE message_thread, message_thread_ret;
|
HANDLE message_thread, message_thread_ret;
|
||||||
DWORD message_thread_id;
|
DWORD message_thread_id;
|
||||||
|
|
||||||
|
LONGLONG current_pos;
|
||||||
} IFilterGraphImpl;
|
} IFilterGraphImpl;
|
||||||
|
|
||||||
struct enum_filters
|
struct enum_filters
|
||||||
|
@ -2505,27 +2507,32 @@ static HRESULT WINAPI MediaSeeking_GetStopPosition(IMediaSeeking *iface, LONGLON
|
||||||
return hr;
|
return hr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *pCurrent)
|
static HRESULT WINAPI MediaSeeking_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *current)
|
||||||
{
|
{
|
||||||
IFilterGraphImpl *This = impl_from_IMediaSeeking(iface);
|
IFilterGraphImpl *graph = impl_from_IMediaSeeking(iface);
|
||||||
LONGLONG time = 0;
|
LONGLONG ret = graph->current_pos;
|
||||||
|
|
||||||
if (!pCurrent)
|
TRACE("graph %p, current %p.\n", graph, current);
|
||||||
|
|
||||||
|
if (!current)
|
||||||
return E_POINTER;
|
return E_POINTER;
|
||||||
|
|
||||||
EnterCriticalSection(&This->cs);
|
EnterCriticalSection(&graph->cs);
|
||||||
if (This->state == State_Running && This->refClock && This->start_time >= 0)
|
|
||||||
{
|
|
||||||
IReferenceClock_GetTime(This->refClock, &time);
|
|
||||||
if (time)
|
|
||||||
time -= This->start_time;
|
|
||||||
}
|
|
||||||
if (This->pause_time > 0)
|
|
||||||
time += This->pause_time;
|
|
||||||
*pCurrent = time;
|
|
||||||
LeaveCriticalSection(&This->cs);
|
|
||||||
|
|
||||||
TRACE("Time: %u.%03u\n", (DWORD)(*pCurrent / 10000000), (DWORD)((*pCurrent / 10000)%1000));
|
if (graph->state == State_Running && graph->refClock && graph->start_time >= 0)
|
||||||
|
{
|
||||||
|
REFERENCE_TIME time;
|
||||||
|
IReferenceClock_GetTime(graph->refClock, &time);
|
||||||
|
if (time)
|
||||||
|
ret += time - graph->start_time;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (graph->pause_time > 0)
|
||||||
|
ret += graph->pause_time;
|
||||||
|
LeaveCriticalSection(&graph->cs);
|
||||||
|
|
||||||
|
TRACE("Returning %s.\n", wine_dbgstr_longlong(ret));
|
||||||
|
*current = ret;
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
@ -2586,7 +2593,8 @@ static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG *
|
||||||
if (FAILED(IBaseFilter_QueryInterface(filter->filter, &IID_IMediaSeeking, (void **)&seeking)))
|
if (FAILED(IBaseFilter_QueryInterface(filter->filter, &IID_IMediaSeeking, (void **)&seeking)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
filter_hr = IMediaSeeking_SetPositions(seeking, ¤t, current_flags, &stop, stop_flags);
|
filter_hr = IMediaSeeking_SetPositions(seeking, ¤t,
|
||||||
|
current_flags | AM_SEEKING_ReturnTime, &stop, stop_flags);
|
||||||
IMediaSeeking_Release(seeking);
|
IMediaSeeking_Release(seeking);
|
||||||
if (SUCCEEDED(filter_hr))
|
if (SUCCEEDED(filter_hr))
|
||||||
{
|
{
|
||||||
|
@ -2596,6 +2604,7 @@ static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG *
|
||||||
*current_ptr = current;
|
*current_ptr = current;
|
||||||
if (stop_ptr && (stop_flags & AM_SEEKING_ReturnTime))
|
if (stop_ptr && (stop_flags & AM_SEEKING_ReturnTime))
|
||||||
*stop_ptr = stop;
|
*stop_ptr = stop;
|
||||||
|
graph->current_pos = current;
|
||||||
}
|
}
|
||||||
else if (filter_hr != E_NOTIMPL)
|
else if (filter_hr != E_NOTIMPL)
|
||||||
{
|
{
|
||||||
|
@ -5220,7 +5229,10 @@ static HRESULT WINAPI MediaFilter_Pause(IMediaFilter *iface)
|
||||||
IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface);
|
IFilterGraph2_SetDefaultSyncSource(&graph->IFilterGraph2_iface);
|
||||||
|
|
||||||
if (graph->state == State_Running && graph->refClock && graph->start_time >= 0)
|
if (graph->state == State_Running && graph->refClock && graph->start_time >= 0)
|
||||||
|
{
|
||||||
IReferenceClock_GetTime(graph->refClock, &graph->pause_time);
|
IReferenceClock_GetTime(graph->refClock, &graph->pause_time);
|
||||||
|
graph->current_pos += graph->pause_time - graph->start_time;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
graph->pause_time = -1;
|
graph->pause_time = -1;
|
||||||
|
|
||||||
|
@ -5714,6 +5726,7 @@ static HRESULT filter_graph_common_create(IUnknown *outer, void **out, BOOL thre
|
||||||
fimpl->punkFilterMapper2 = NULL;
|
fimpl->punkFilterMapper2 = NULL;
|
||||||
fimpl->recursioncount = 0;
|
fimpl->recursioncount = 0;
|
||||||
fimpl->version = 0;
|
fimpl->version = 0;
|
||||||
|
fimpl->current_pos = 0;
|
||||||
|
|
||||||
if (threaded)
|
if (threaded)
|
||||||
{
|
{
|
||||||
|
|
|
@ -3838,12 +3838,12 @@ static void test_graph_seeking(void)
|
||||||
|
|
||||||
hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
|
hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
todo_wine ok(time == 12340000, "Got time %s.\n", wine_dbgstr_longlong(time));
|
ok(time == 12340000, "Got time %s.\n", wine_dbgstr_longlong(time));
|
||||||
|
|
||||||
current = stop = 0xdeadbeef;
|
current = stop = 0xdeadbeef;
|
||||||
hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop);
|
hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
todo_wine ok(current == 12340000, "Got time %s.\n", wine_dbgstr_longlong(current));
|
ok(current == 12340000, "Got time %s.\n", wine_dbgstr_longlong(current));
|
||||||
ok(stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(stop));
|
ok(stop == 0x321, "Got time %s.\n", wine_dbgstr_longlong(stop));
|
||||||
|
|
||||||
current = 0x123;
|
current = 0x123;
|
||||||
|
@ -3908,12 +3908,12 @@ static void test_graph_seeking(void)
|
||||||
|
|
||||||
hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
|
hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
todo_wine ok(abs(time - 1234 * 10000) < 40 * 10000,
|
ok(abs(time - 1234 * 10000) < 40 * 10000,
|
||||||
"Expected about 1234ms, got %s.\n", wine_dbgstr_longlong(time));
|
"Expected about 1234ms, got %s.\n", wine_dbgstr_longlong(time));
|
||||||
current = stop = 0xdeadbeef;
|
current = stop = 0xdeadbeef;
|
||||||
hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop);
|
hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
todo_wine ok(abs(current - 1234 * 10000) < 40 * 10000,
|
ok(abs(current - 1234 * 10000) < 40 * 10000,
|
||||||
"Expected about 1234ms, got %s.\n", wine_dbgstr_longlong(current));
|
"Expected about 1234ms, got %s.\n", wine_dbgstr_longlong(current));
|
||||||
ok(stop == 9000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
|
ok(stop == 9000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
|
||||||
|
|
||||||
|
@ -3921,12 +3921,12 @@ static void test_graph_seeking(void)
|
||||||
|
|
||||||
hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
|
hr = IMediaSeeking_GetCurrentPosition(seeking, &time);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
todo_wine ok(abs(time - 1334 * 10000) < 40 * 10000,
|
ok(abs(time - 1334 * 10000) < 40 * 10000,
|
||||||
"Expected about 1334ms, got %s.\n", wine_dbgstr_longlong(time));
|
"Expected about 1334ms, got %s.\n", wine_dbgstr_longlong(time));
|
||||||
current = stop = 0xdeadbeef;
|
current = stop = 0xdeadbeef;
|
||||||
hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop);
|
hr = IMediaSeeking_GetPositions(seeking, ¤t, &stop);
|
||||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||||
todo_wine ok(abs(current - 1334 * 10000) < 40 * 10000,
|
ok(abs(current - 1334 * 10000) < 40 * 10000,
|
||||||
"Expected about 1334ms, got %s.\n", wine_dbgstr_longlong(current));
|
"Expected about 1334ms, got %s.\n", wine_dbgstr_longlong(current));
|
||||||
ok(stop == 9000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
|
ok(stop == 9000 * 10000, "Got time %s.\n", wine_dbgstr_longlong(stop));
|
||||||
|
|
||||||
|
|
|
@ -413,9 +413,7 @@ static BOOL test_wmp(void)
|
||||||
duration = 0.0;
|
duration = 0.0;
|
||||||
hres = IWMPControls_get_currentPosition(controls, &duration);
|
hres = IWMPControls_get_currentPosition(controls, &duration);
|
||||||
ok(hres == S_OK, "IWMPControls_get_currentPosition failed: %08x\n", hres);
|
ok(hres == S_OK, "IWMPControls_get_currentPosition failed: %08x\n", hres);
|
||||||
/* builtin quartz does not handle this currently and resets to 0.0, works
|
ok(duration >= 1.05 /* save some fp errors */, "unexpected value %f\n", duration);
|
||||||
* with native quartz */
|
|
||||||
todo_wine ok(duration >= 1.05 /* save some fp errors */, "unexpected value %f\n", duration);
|
|
||||||
|
|
||||||
hres = IWMPPlayer4_get_currentMedia(player4, &media);
|
hres = IWMPPlayer4_get_currentMedia(player4, &media);
|
||||||
ok(hres == S_OK, "IWMPPlayer4_get_currentMedia failed: %08x\n", hres);
|
ok(hres == S_OK, "IWMPPlayer4_get_currentMedia failed: %08x\n", hres);
|
||||||
|
|
Loading…
Reference in New Issue