Commit 2620d649 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

winegstreamer: Defer a seek to pause time if necessary.

This fixes background music in Tomb Raider II. Signed-off-by: 's avatarZebediah Figura <zfigura@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent 7987e842
...@@ -1387,6 +1387,7 @@ static HRESULT gstdemux_init_stream(struct strmbase_filter *iface) ...@@ -1387,6 +1387,7 @@ static HRESULT gstdemux_init_stream(struct strmbase_filter *iface)
{ {
struct gstdemux *filter = impl_from_strmbase_filter(iface); struct gstdemux *filter = impl_from_strmbase_filter(iface);
HRESULT hr = VFW_E_NOT_CONNECTED, pin_hr; HRESULT hr = VFW_E_NOT_CONNECTED, pin_hr;
const SourceSeeking *seeking;
GstStateChangeReturn ret; GstStateChangeReturn ret;
unsigned int i; unsigned int i;
...@@ -1407,6 +1408,23 @@ static HRESULT gstdemux_init_stream(struct strmbase_filter *iface) ...@@ -1407,6 +1408,23 @@ static HRESULT gstdemux_init_stream(struct strmbase_filter *iface)
if (filter->no_more_pads_event) if (filter->no_more_pads_event)
WaitForSingleObject(filter->no_more_pads_event, INFINITE); 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) for (i = 0; i < filter->source_count; ++i)
{ {
if (SUCCEEDED(pin_hr = BaseOutputPinImpl_Active(&filter->sources[i]->pin))) if (SUCCEEDED(pin_hr = BaseOutputPinImpl_Active(&filter->sources[i]->pin)))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment