Signed-off-by: Zebediah Figura zfigura@codeweavers.com --- dlls/winegstreamer/gst_private.h | 1 + dlls/winegstreamer/wm_reader.c | 15 +++++++++++++++ dlls/winegstreamer/wm_syncreader.c | 9 ++++++--- dlls/wmvcore/tests/wmvcore.c | 17 +++++++---------- 4 files changed, 29 insertions(+), 13 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index a9c361366b3..d330716b8f9 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -166,6 +166,7 @@ HRESULT wm_reader_get_stream_sample(struct wm_stream *stream, INSSBuffer **sample, QWORD *pts, QWORD *duration, DWORD *flags); void wm_reader_init(struct wm_reader *reader, const struct wm_reader_ops *ops); HRESULT wm_reader_open_stream(struct wm_reader *reader, IStream *stream); +void wm_reader_seek(struct wm_reader *reader, QWORD start, LONGLONG duration); HRESULT wm_reader_set_output_props(struct wm_reader *reader, DWORD output, IWMOutputMediaProps *props);
diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index e708ed4bfa6..24fd11f652d 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1637,6 +1637,21 @@ HRESULT wm_reader_get_stream_sample(struct wm_stream *stream, } }
+void wm_reader_seek(struct wm_reader *reader, QWORD start, LONGLONG duration) +{ + WORD i; + + EnterCriticalSection(&reader->cs); + + wg_parser_stream_seek(reader->streams[0].wg_stream, 1.0, start, start + duration, + AM_SEEKING_AbsolutePositioning, duration ? AM_SEEKING_AbsolutePositioning : AM_SEEKING_NoPositioning); + + for (i = 0; i < reader->stream_count; ++i) + reader->streams[i].eos = false; + + LeaveCriticalSection(&reader->cs); +} + void wm_reader_init(struct wm_reader *reader, const struct wm_reader_ops *ops) { reader->IWMHeaderInfo3_iface.lpVtbl = &header_info_vtbl; diff --git a/dlls/winegstreamer/wm_syncreader.c b/dlls/winegstreamer/wm_syncreader.c index 063be2a94ab..1f5827cf244 100644 --- a/dlls/winegstreamer/wm_syncreader.c +++ b/dlls/winegstreamer/wm_syncreader.c @@ -259,9 +259,12 @@ static HRESULT WINAPI WMSyncReader_SetOutputSetting(IWMSyncReader2 *iface, DWORD
static HRESULT WINAPI WMSyncReader_SetRange(IWMSyncReader2 *iface, QWORD start, LONGLONG duration) { - struct sync_reader *This = impl_from_IWMSyncReader2(iface); - FIXME("(%p)->(%s %s): stub!\n", This, wine_dbgstr_longlong(start), wine_dbgstr_longlong(duration)); - return E_NOTIMPL; + struct sync_reader *reader = impl_from_IWMSyncReader2(iface); + + TRACE("reader %p, start %I64u, duration %I64d.\n", reader, start, duration); + + wm_reader_seek(&reader->reader, start, duration); + return S_OK; }
static HRESULT WINAPI WMSyncReader_SetRangeByFrame(IWMSyncReader2 *iface, WORD stream_num, QWORD frame_num, diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c index 48d585e73c0..6e196234208 100644 --- a/dlls/wmvcore/tests/wmvcore.c +++ b/dlls/wmvcore/tests/wmvcore.c @@ -542,25 +542,22 @@ static void test_sync_reader_streaming(void) ok(hr == NS_E_NO_MORE_SAMPLES, "Got hr %#x.\n", hr);
hr = IWMSyncReader_SetRange(reader, 0, 0); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IWMSyncReader_GetNextSample(reader, stream_numbers[0], &sample, &pts, &duration, &flags, NULL, NULL); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - if (hr == S_OK) - INSSBuffer_Release(sample); + ok(hr == S_OK, "Got hr %#x.\n", hr); + INSSBuffer_Release(sample);
hr = IWMSyncReader_GetNextSample(reader, 0, &sample, &pts, &duration, &flags, NULL, NULL); ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IWMSyncReader_GetNextSample(reader, 0, &sample, &pts, &duration, &flags, &output_number, NULL); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - if (hr == S_OK) - INSSBuffer_Release(sample); + ok(hr == S_OK, "Got hr %#x.\n", hr); + INSSBuffer_Release(sample);
hr = IWMSyncReader_GetNextSample(reader, 0, &sample, &pts, &duration, &flags, NULL, &stream_number); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - if (hr == S_OK) - INSSBuffer_Release(sample); + ok(hr == S_OK, "Got hr %#x.\n", hr); + INSSBuffer_Release(sample);
for (;;) {