winegstreamer: Don't fail seeking methods if we couldn't query duration.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48315
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-02-27 20:40:36 -06:00 committed by Alexandre Julliard
parent 18bdaaaa26
commit 7987e84229
1 changed files with 9 additions and 19 deletions

View File

@ -1601,7 +1601,8 @@ static BOOL gstdecoder_init_gst(struct gstdemux *filter)
WaitForSingleObject(filter->no_more_pads_event, INFINITE); WaitForSingleObject(filter->no_more_pads_event, INFINITE);
gst_pad_query_duration(filter->sources[0]->their_src, GST_FORMAT_TIME, &duration); if (!gst_pad_query_duration(filter->sources[0]->their_src, GST_FORMAT_TIME, &duration))
ERR("Failed to query duration.\n");
for (i = 0; i < filter->source_count; ++i) for (i = 0; i < filter->source_count; ++i)
{ {
struct gstdemux_source *pin = filter->sources[i]; struct gstdemux_source *pin = filter->sources[i];
@ -1609,8 +1610,6 @@ static BOOL gstdecoder_init_gst(struct gstdemux *filter)
pin->seek.llDuration = pin->seek.llStop = duration / 100; pin->seek.llDuration = pin->seek.llStop = duration / 100;
pin->seek.llCurrent = 0; pin->seek.llCurrent = 0;
if (!pin->seek.llDuration)
pin->seek.dwCapabilities = 0;
if (WaitForMultipleObjects(2, events, FALSE, INFINITE)) if (WaitForMultipleObjects(2, events, FALSE, INFINITE))
return FALSE; return FALSE;
} }
@ -1845,10 +1844,7 @@ static HRESULT WINAPI GST_Seeking_GetCurrentPosition(IMediaSeeking *iface, REFER
{ {
*pos = This->seek.llCurrent; *pos = This->seek.llCurrent;
TRACE("Cached value\n"); TRACE("Cached value\n");
if (This->seek.llDuration)
return S_OK; return S_OK;
else
return E_NOTIMPL;
} }
if (!gst_pad_query_position(This->their_src, GST_FORMAT_TIME, pos)) { if (!gst_pad_query_position(This->their_src, GST_FORMAT_TIME, pos)) {
@ -1889,9 +1885,6 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface,
mark_wine_thread(); mark_wine_thread();
if (!This->seek.llDuration)
return E_NOTIMPL;
hr = SourceSeekingImpl_SetPositions(iface, pCur, curflags, pStop, stopflags); hr = SourceSeekingImpl_SetPositions(iface, pCur, curflags, pStop, stopflags);
if (This->pin.pin.filter->state == State_Stopped) if (This->pin.pin.filter->state == State_Stopped)
return hr; return hr;
@ -2377,11 +2370,10 @@ static BOOL wave_parser_init_gst(struct gstdemux *filter)
return FALSE; return FALSE;
} }
gst_pad_query_duration(pin->their_src, GST_FORMAT_TIME, &duration); if (!gst_pad_query_duration(pin->their_src, GST_FORMAT_TIME, &duration))
ERR("Failed to query duration.\n");
pin->seek.llDuration = pin->seek.llStop = duration / 100; pin->seek.llDuration = pin->seek.llStop = duration / 100;
pin->seek.llCurrent = 0; pin->seek.llCurrent = 0;
if (!pin->seek.llDuration)
pin->seek.dwCapabilities = 0;
events[0] = pin->caps_event; events[0] = pin->caps_event;
events[1] = filter->error_event; events[1] = filter->error_event;
@ -2496,7 +2488,8 @@ static BOOL avi_splitter_init_gst(struct gstdemux *filter)
WaitForSingleObject(filter->no_more_pads_event, INFINITE); WaitForSingleObject(filter->no_more_pads_event, INFINITE);
gst_pad_query_duration(filter->sources[0]->their_src, GST_FORMAT_TIME, &duration); if (!gst_pad_query_duration(filter->sources[0]->their_src, GST_FORMAT_TIME, &duration))
ERR("Failed to query duration.\n");
for (i = 0; i < filter->source_count; ++i) for (i = 0; i < filter->source_count; ++i)
{ {
struct gstdemux_source *pin = filter->sources[i]; struct gstdemux_source *pin = filter->sources[i];
@ -2504,8 +2497,6 @@ static BOOL avi_splitter_init_gst(struct gstdemux *filter)
pin->seek.llDuration = pin->seek.llStop = duration / 100; pin->seek.llDuration = pin->seek.llStop = duration / 100;
pin->seek.llCurrent = 0; pin->seek.llCurrent = 0;
if (!pin->seek.llDuration)
pin->seek.dwCapabilities = 0;
if (WaitForMultipleObjects(2, events, FALSE, INFINITE)) if (WaitForMultipleObjects(2, events, FALSE, INFINITE))
return FALSE; return FALSE;
} }
@ -2633,11 +2624,10 @@ static BOOL mpeg_splitter_init_gst(struct gstdemux *filter)
if (WaitForMultipleObjects(2, events, FALSE, INFINITE)) if (WaitForMultipleObjects(2, events, FALSE, INFINITE))
return FALSE; return FALSE;
gst_pad_query_duration(pin->their_src, GST_FORMAT_TIME, &duration); if (!gst_pad_query_duration(pin->their_src, GST_FORMAT_TIME, &duration))
ERR("Failed to query duration.\n");
pin->seek.llDuration = pin->seek.llStop = duration / 100; pin->seek.llDuration = pin->seek.llStop = duration / 100;
pin->seek.llCurrent = 0; pin->seek.llCurrent = 0;
if (!pin->seek.llDuration)
pin->seek.dwCapabilities = 0;
events[0] = pin->caps_event; events[0] = pin->caps_event;
if (WaitForMultipleObjects(2, events, FALSE, INFINITE)) if (WaitForMultipleObjects(2, events, FALSE, INFINITE))