This check is not equivalent to the existence of "their_src" for the MPEG-1 splitter, since that always exposes a source audio pin.
Fixes: 40a4c782b7f77534535dfa7bb2a97049026fef47 Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/winegstreamer/gstdemux.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 488c9bd8a13..d469f2dbbff 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1841,7 +1841,8 @@ static HRESULT WINAPI GST_Seeking_GetCurrentPosition(IMediaSeeking *iface, REFER
mark_wine_thread();
- if (!This->their_src) { + if (This->pin.pin.filter->state == State_Stopped) + { *pos = This->seek.llCurrent; TRACE("Cached value\n"); if (This->seek.llDuration) @@ -1892,7 +1893,7 @@ static HRESULT WINAPI GST_Seeking_SetPositions(IMediaSeeking *iface, return E_NOTIMPL;
hr = SourceSeekingImpl_SetPositions(iface, pCur, curflags, pStop, stopflags); - if (!This->their_src) + if (This->pin.pin.filter->state == State_Stopped) return hr;
curtype = type_from_flags(curflags);
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48315 Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/winegstreamer/gstdemux.c | 28 +++++++++------------------- 1 file changed, 9 insertions(+), 19 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index d469f2dbbff..2fb158d5628 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1601,7 +1601,8 @@ static BOOL gstdecoder_init_gst(struct gstdemux *filter)
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) { 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.llCurrent = 0; - if (!pin->seek.llDuration) - pin->seek.dwCapabilities = 0; if (WaitForMultipleObjects(2, events, FALSE, INFINITE)) return FALSE; } @@ -1845,10 +1844,7 @@ static HRESULT WINAPI GST_Seeking_GetCurrentPosition(IMediaSeeking *iface, REFER { *pos = This->seek.llCurrent; TRACE("Cached value\n"); - if (This->seek.llDuration) - return S_OK; - else - return E_NOTIMPL; + return S_OK; }
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();
- if (!This->seek.llDuration) - return E_NOTIMPL; - hr = SourceSeekingImpl_SetPositions(iface, pCur, curflags, pStop, stopflags); if (This->pin.pin.filter->state == State_Stopped) return hr; @@ -2377,11 +2370,10 @@ static BOOL wave_parser_init_gst(struct gstdemux *filter) 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.llCurrent = 0; - if (!pin->seek.llDuration) - pin->seek.dwCapabilities = 0;
events[0] = pin->caps_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);
- 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) { 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.llCurrent = 0; - if (!pin->seek.llDuration) - pin->seek.dwCapabilities = 0; if (WaitForMultipleObjects(2, events, FALSE, INFINITE)) return FALSE; } @@ -2633,11 +2624,10 @@ static BOOL mpeg_splitter_init_gst(struct gstdemux *filter) if (WaitForMultipleObjects(2, events, FALSE, INFINITE)) 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.llCurrent = 0; - if (!pin->seek.llDuration) - pin->seek.dwCapabilities = 0;
events[0] = pin->caps_event; if (WaitForMultipleObjects(2, events, FALSE, INFINITE))
This fixes background music in Tomb Raider II.
Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/winegstreamer/gstdemux.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 2fb158d5628..8b5eb928cec 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -1387,6 +1387,7 @@ static HRESULT gstdemux_init_stream(struct strmbase_filter *iface) { struct gstdemux *filter = impl_from_strmbase_filter(iface); HRESULT hr = VFW_E_NOT_CONNECTED, pin_hr; + const SourceSeeking *seeking; GstStateChangeReturn ret; unsigned int i;
@@ -1407,6 +1408,23 @@ static HRESULT gstdemux_init_stream(struct strmbase_filter *iface) if (filter->no_more_pads_event) WaitForSingleObject(filter->no_more_pads_event, INFINITE);
+ seeking = &filter->sources[0]->seek; + + /* GStreamer can't seek while stopped, and it resets position to the + * beginning of the stream every time it is stopped. */ + if (seeking->llCurrent) + { + GstSeekType stop_type = GST_SEEK_TYPE_NONE; + + if (seeking->llStop && seeking->llStop != seeking->llDuration) + stop_type = GST_SEEK_TYPE_SET; + + gst_pad_push_event(filter->sources[0]->my_sink, gst_event_new_seek( + seeking->dRate, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, + GST_SEEK_TYPE_SET, seeking->llCurrent * 100, + stop_type, seeking->llStop * 100)); + } + for (i = 0; i < filter->source_count; ++i) { if (SUCCEEDED(pin_hr = BaseOutputPinImpl_Active(&filter->sources[i]->pin)))
Fixes: 6745afd81d38e26b8890bd97163eb1e4494c6cb1 Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/winegstreamer/gstdemux.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 8b5eb928cec..30f3a590006 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -2070,7 +2070,9 @@ static HRESULT WINAPI GSTOutPin_DecideBufferSize(struct strmbase_source *iface, VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pin->pin.pin.mt.pbFormat; buffer_size = format->bmiHeader.biSizeImage; } - else if (IsEqualGUID(&pin->pin.pin.mt.formattype, &FORMAT_WaveFormatEx)) + else if (IsEqualGUID(&pin->pin.pin.mt.formattype, &FORMAT_WaveFormatEx) + && (IsEqualGUID(&pin->pin.pin.mt.subtype, &MEDIASUBTYPE_PCM) + || IsEqualGUID(&pin->pin.pin.mt.subtype, &MEDIASUBTYPE_IEEE_FLOAT))) { WAVEFORMATEX *format = (WAVEFORMATEX *)pin->pin.pin.mt.pbFormat; buffer_size = format->nAvgBytesPerSec;