Module: wine Branch: master Commit: 1c0985013e4cf6aacd384bc69806aa1c557dd806 URL: https://source.winehq.org/git/wine.git/?a=commit;h=1c0985013e4cf6aacd384bc69...
Author: Zebediah Figura z.figura12@gmail.com Date: Mon Oct 21 16:54:47 2019 -0500
quartz/filtergraph: Iterate filters directly in IMediaSeeking::SetPositions().
Signed-off-by: Zebediah Figura z.figura12@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/quartz/filtergraph.c | 103 ++++++++++++++++++++-------------------- dlls/quartz/tests/filtergraph.c | 4 +- 2 files changed, 54 insertions(+), 53 deletions(-)
diff --git a/dlls/quartz/filtergraph.c b/dlls/quartz/filtergraph.c index 96c9ae31f0..966f427b15 100644 --- a/dlls/quartz/filtergraph.c +++ b/dlls/quartz/filtergraph.c @@ -2552,64 +2552,65 @@ static HRESULT WINAPI MediaSeeking_ConvertTimeFormat(IMediaSeeking *iface, LONGL return S_OK; }
-struct pos_args { - LONGLONG* current, *stop; - DWORD curflags, stopflags; -}; - -static HRESULT WINAPI found_setposition(IFilterGraphImpl *This, IMediaSeeking *seek, DWORD_PTR pargs) +static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG *current_ptr, + DWORD current_flags, LONGLONG *stop_ptr, DWORD stop_flags) { - struct pos_args *args = (void*)pargs; - LONGLONG current = args->current ? *args->current : 0, stop = args->stop ? *args->stop : 0; - HRESULT hr; + IFilterGraphImpl *graph = impl_from_IMediaSeeking(iface); + HRESULT hr = E_NOTIMPL, filter_hr; + IMediaSeeking *seeking; + struct filter *filter; + FILTER_STATE state; + + TRACE("graph %p, current %s, current_flags %#x, stop %s, stop_flags %#x.\n", graph, + current_ptr ? wine_dbgstr_longlong(*current_ptr) : "<null>", current_flags, + stop_ptr ? wine_dbgstr_longlong(*stop_ptr): "<null>", stop_flags); + + if ((current_flags & 0x7) != AM_SEEKING_AbsolutePositioning + && (current_flags & 0x7) != AM_SEEKING_NoPositioning) + FIXME("Unhandled current_flags %#x.\n", current_flags & 0x7);
- if (SUCCEEDED(hr = IMediaSeeking_SetPositions(seek, ¤t, - args->curflags, &stop, args->stopflags))) + if ((stop_flags & 0x7) != AM_SEEKING_NoPositioning + && (stop_flags & 0x7) != AM_SEEKING_AbsolutePositioning) + FIXME("Unhandled stop_flags %#x.\n", stop_flags & 0x7); + + EnterCriticalSection(&graph->cs); + + state = graph->state; + if (state == State_Running && !(current_flags & AM_SEEKING_NoFlush)) + IMediaControl_Pause(&graph->IMediaControl_iface); + + LIST_FOR_EACH_ENTRY(filter, &graph->filters, struct filter, entry) { - if (args->current && (args->curflags & AM_SEEKING_ReturnTime)) - *args->current = current; - if (args->stop && (args->stopflags & AM_SEEKING_ReturnTime)) - *args->stop = stop; - } - return hr; -} + LONGLONG current = current_ptr ? *current_ptr : 0, stop = stop_ptr ? *stop_ptr : 0;
-static HRESULT WINAPI MediaSeeking_SetPositions(IMediaSeeking *iface, LONGLONG *pCurrent, - DWORD dwCurrentFlags, LONGLONG *pStop, DWORD dwStopFlags) -{ - IFilterGraphImpl *This = impl_from_IMediaSeeking(iface); - HRESULT hr = S_OK; - FILTER_STATE state; - struct pos_args args; + if (FAILED(IBaseFilter_QueryInterface(filter->filter, &IID_IMediaSeeking, (void **)&seeking))) + continue;
- TRACE("(%p/%p)->(%p, %08x, %p, %08x)\n", This, iface, pCurrent, dwCurrentFlags, pStop, dwStopFlags); + filter_hr = IMediaSeeking_SetPositions(seeking, ¤t, current_flags, &stop, stop_flags); + IMediaSeeking_Release(seeking); + if (SUCCEEDED(filter_hr)) + { + hr = S_OK;
- EnterCriticalSection(&This->cs); - 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 && - (dwCurrentFlags & 0x7) != AM_SEEKING_NoPositioning) - FIXME("Adjust method %x not handled yet!\n", dwCurrentFlags & 0x7); - - if ((dwStopFlags & 0x7) != AM_SEEKING_NoPositioning - && (dwStopFlags & 0x7) != AM_SEEKING_AbsolutePositioning) - FIXME("Stop position not handled yet!\n"); - - if (state == State_Running && !(dwCurrentFlags & AM_SEEKING_NoFlush)) - IMediaControl_Pause(&This->IMediaControl_iface); - args.current = pCurrent; - args.stop = pStop; - args.curflags = dwCurrentFlags; - args.stopflags = dwStopFlags; - hr = all_renderers_seek(This, found_setposition, (DWORD_PTR)&args); - - if ((dwCurrentFlags & 0x7) != AM_SEEKING_NoPositioning) - This->pause_time = This->start_time = -1; - if (state == State_Running && !(dwCurrentFlags & AM_SEEKING_NoFlush)) - IMediaControl_Run(&This->IMediaControl_iface); - LeaveCriticalSection(&This->cs); + if (current_ptr && (current_flags & AM_SEEKING_ReturnTime)) + *current_ptr = current; + if (stop_ptr && (stop_flags & AM_SEEKING_ReturnTime)) + *stop_ptr = stop; + } + else if (filter_hr != E_NOTIMPL) + { + LeaveCriticalSection(&graph->cs); + return filter_hr; + } + } + + if ((current_flags & 0x7) != AM_SEEKING_NoPositioning) + graph->pause_time = graph->start_time = -1;
+ if (state == State_Running && !(current_flags & AM_SEEKING_NoFlush)) + IMediaControl_Run(&graph->IMediaControl_iface); + + LeaveCriticalSection(&graph->cs); return hr; }
diff --git a/dlls/quartz/tests/filtergraph.c b/dlls/quartz/tests/filtergraph.c index a768b737fb..bffbc82b98 100644 --- a/dlls/quartz/tests/filtergraph.c +++ b/dlls/quartz/tests/filtergraph.c @@ -3818,12 +3818,12 @@ static void test_graph_seeking(void) filter1.seek_hr = filter2.seek_hr = 0xbeef; hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning, &stop, AM_SEEKING_AbsolutePositioning); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
filter1.seek_hr = E_NOTIMPL; hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning, &stop, AM_SEEKING_AbsolutePositioning); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
filter1.seek_hr = 0xdeadbeef; hr = IMediaSeeking_SetPositions(seeking, ¤t, AM_SEEKING_AbsolutePositioning,