Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/winegstreamer/gst_private.h | 2 ++ dlls/winegstreamer/wm_reader.c | 18 ++++++++++++++++++ 2 files changed, 20 insertions(+)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index d330716b8f9..109ce6ab28f 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -136,6 +136,8 @@ struct wm_reader LONG refcount; CRITICAL_SECTION cs;
+ QWORD start_time; + IStream *source_stream; HANDLE read_thread; bool read_thread_shutdown; diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 24fd11f652d..82f74318062 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1543,6 +1543,22 @@ HRESULT wm_reader_set_output_props(struct wm_reader *reader, DWORD output, stream->format = format; wg_parser_stream_enable(stream->wg_stream, &format);
+ /* Re-decode any buffers that might have been generated with the old format. + * + * FIXME: Seeking in-place will cause some buffers to be dropped. + * Unfortunately, we can't really store the last received PTS and seek there + * either: since seeks are inexact and we aren't guaranteed to receive + * samples in order, some buffers might be duplicated or dropped anyway. + * In order to really seamlessly allow for format changes, we need + * cooperation from each individual GStreamer stream, to be able to tell + * upstream exactly which buffers they need resent... + * + * In all likelihood this function is being called not mid-stream but rather + * while setting the stream up, before consuming any events. Accordingly + * let's just seek back to the beginning. */ + wg_parser_stream_seek(reader->streams[0].wg_stream, 1.0, reader->start_time, 0, + AM_SEEKING_AbsolutePositioning, AM_SEEKING_NoPositioning); + LeaveCriticalSection(&reader->cs); return S_OK; } @@ -1643,6 +1659,8 @@ void wm_reader_seek(struct wm_reader *reader, QWORD start, LONGLONG duration)
EnterCriticalSection(&reader->cs);
+ reader->start_time = start; + wg_parser_stream_seek(reader->streams[0].wg_stream, 1.0, start, start + duration, AM_SEEKING_AbsolutePositioning, duration ? AM_SEEKING_AbsolutePositioning : AM_SEEKING_NoPositioning);