From: Myah Caron qsniyg@protonmail.com
Signed-off-by: Myah Caron qsniyg@protonmail.com Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v5: Style tweaks (adjust trace messages to be more consistent with standard format, remove a couple newlines)
dlls/amstream/filter.c | 19 ++++- dlls/amstream/tests/amstream.c | 130 +++++++++++++++++++++++++++++++++ 2 files changed, 147 insertions(+), 2 deletions(-)
diff --git a/dlls/amstream/filter.c b/dlls/amstream/filter.c index 0a06e78180c..b99cc4cda0c 100644 --- a/dlls/amstream/filter.c +++ b/dlls/amstream/filter.c @@ -773,9 +773,24 @@ static HRESULT WINAPI filter_seeking_SetTimeFormat(IMediaSeeking *iface, const G
static HRESULT WINAPI filter_seeking_GetDuration(IMediaSeeking *iface, LONGLONG *duration) { - FIXME("iface %p, duration %p, stub!\n", iface, duration); + struct filter *filter = impl_from_IMediaSeeking(iface); + IMediaSeeking *seeking; + HRESULT hr;
- return E_NOTIMPL; + TRACE("filter %p, duration %p.\n", filter, duration); + + EnterCriticalSection(&filter->cs); + + if (!(seeking = get_seeking(filter->seekable_stream))) + { + LeaveCriticalSection(&filter->cs); + return E_NOTIMPL; + } + hr = IMediaSeeking_GetDuration(seeking, duration); + IMediaSeeking_Release(seeking); + + LeaveCriticalSection(&filter->cs); + return hr; }
static HRESULT WINAPI filter_seeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 68d2b9c18fc..5402734b3df 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -5099,6 +5099,135 @@ static void test_mediastreamfilter_set_positions(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_mediastreamfilter_get_duration(void) +{ + IAMMultiMediaStream *mmstream = create_ammultimediastream(); + static const MSPID mspid1 = {0x88888888, 1}; + static const MSPID mspid2 = {0x88888888, 2}; + static const MSPID mspid3 = {0x88888888, 3}; + struct testfilter source1, source2, source3; + IAMMediaStream *stream1, *stream2, *stream3; + IMediaStreamFilter *filter; + IPin *pin1, *pin2, *pin3; + IMediaSeeking *seeking; + IGraphBuilder *graph; + LONGLONG duration; + HRESULT hr; + ULONG ref; + + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = CoCreateInstance(&CLSID_AMAudioStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&stream1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = CoCreateInstance(&CLSID_AMAudioStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&stream2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = CoCreateInstance(&CLSID_AMAudioStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&stream3); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMediaStream_Initialize(stream1, NULL, 0, &mspid1, STREAMTYPE_READ); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMediaStream_Initialize(stream2, NULL, 0, &mspid2, STREAMTYPE_READ); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMediaStream_Initialize(stream3, NULL, 0, &mspid3, STREAMTYPE_READ); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_AddMediaStream(mmstream, (IUnknown *)stream1, &mspid1, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_AddMediaStream(mmstream, (IUnknown *)stream2, &mspid2, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_AddMediaStream(mmstream, (IUnknown *)stream3, &mspid3, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMediaStream_QueryInterface(stream1, &IID_IPin, (void **)&pin1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMediaStream_QueryInterface(stream2, &IID_IPin, (void **)&pin2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMediaStream_QueryInterface(stream3, &IID_IPin, (void **)&pin3); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_GetFilter(mmstream, &filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(graph != NULL, "Expected non-NULL graph.\n"); + testfilter_init(&source1); + testfilter_init(&source2); + testfilter_init(&source3); + source1.IMediaSeeking_iface.lpVtbl = &testsource_seeking_vtbl; + source2.IMediaSeeking_iface.lpVtbl = &testsource_seeking_vtbl; + source3.IMediaSeeking_iface.lpVtbl = &testsource_seeking_vtbl; + hr = IGraphBuilder_AddFilter(graph, &source1.filter.IBaseFilter_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IGraphBuilder_AddFilter(graph, &source2.filter.IBaseFilter_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IGraphBuilder_AddFilter(graph, &source3.filter.IBaseFilter_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IGraphBuilder_ConnectDirect(graph, &source2.source.pin.IPin_iface, pin2, &audio_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IGraphBuilder_ConnectDirect(graph, &source3.source.pin.IPin_iface, pin3, &audio_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaStreamFilter_SupportSeeking(filter, TRUE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IGraphBuilder_ConnectDirect(graph, &source1.source.pin.IPin_iface, pin1, &audio_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaStreamFilter_QueryInterface(filter, &IID_IMediaSeeking, (void **)&seeking); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + duration = 0xdeadbeefdeadbeefULL; + hr = IMediaSeeking_GetDuration(seeking, &duration); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(duration == 0x8000000000000000ULL, "Got duration %s.\n", wine_dbgstr_longlong(duration)); + + source2.get_duration_hr = E_FAIL; + duration = 0xdeadbeefdeadbeefULL; + hr = IMediaSeeking_GetDuration(seeking, &duration); + ok(hr == E_FAIL, "Got hr %#x.\n", hr); + ok(duration == 0xdeadbeefdeadbeefULL, "Got duration %s.\n", wine_dbgstr_longlong(duration)); + + source2.get_duration_hr = E_NOTIMPL; + duration = 0xdeadbeefdeadbeefULL; + hr = IMediaSeeking_GetDuration(seeking, &duration); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + ok(duration == 0xdeadbeefdeadbeefULL, "Got duration %s.\n", wine_dbgstr_longlong(duration)); + + source2.IMediaSeeking_iface.lpVtbl = NULL; + duration = 0xdeadbeefdeadbeefULL; + hr = IMediaSeeking_GetDuration(seeking, &duration); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + ok(duration == 0xdeadbeefdeadbeefULL, "Got duration %s.\n", wine_dbgstr_longlong(duration)); + + IGraphBuilder_Disconnect(graph, pin2); + IGraphBuilder_Disconnect(graph, &source2.source.pin.IPin_iface); + + source2.IMediaSeeking_iface.lpVtbl = NULL; + duration = 0xdeadbeefdeadbeefULL; + hr = IMediaSeeking_GetDuration(seeking, &duration); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + ok(duration == 0xdeadbeefdeadbeefULL, "Got duration %s.\n", wine_dbgstr_longlong(duration)); + + IGraphBuilder_Disconnect(graph, pin2); + IGraphBuilder_Disconnect(graph, &source2.source.pin.IPin_iface); + IGraphBuilder_Disconnect(graph, pin3); + IGraphBuilder_Disconnect(graph, &source3.source.pin.IPin_iface); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IGraphBuilder_Release(graph); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IMediaSeeking_Release(seeking); + ref = IMediaStreamFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IPin_Release(pin1); + ref = IAMMediaStream_Release(stream1); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IPin_Release(pin2); + ref = IAMMediaStream_Release(stream2); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IPin_Release(pin3); + ref = IAMMediaStream_Release(stream3); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_mediastreamfilter_get_current_stream_time(void) { IMediaStreamFilter *filter; @@ -5340,6 +5469,7 @@ START_TEST(amstream) test_mediastreamfilter_stop_pause_run(); test_mediastreamfilter_support_seeking(); test_mediastreamfilter_set_positions(); + test_mediastreamfilter_get_duration(); test_mediastreamfilter_get_current_stream_time();
CoUninitialize();
From: Myah Caron qsniyg@protonmail.com
Signed-off-by: Myah Caron qsniyg@protonmail.com Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v5: Style tweaks, don't mark VFW_E_NO_AUDIO_HARDWARE results as broken.
dlls/amstream/multimedia.c | 10 +++-- dlls/amstream/tests/amstream.c | 80 ++++++++++++++++++++++++++++++++++ 2 files changed, 86 insertions(+), 4 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index 200bd5c4a5e..414a903cf20 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -173,13 +173,15 @@ static HRESULT WINAPI multimedia_stream_GetTime(IAMMultiMediaStream *iface, STRE return E_NOTIMPL; }
-static HRESULT WINAPI multimedia_stream_GetDuration(IAMMultiMediaStream *iface, STREAM_TIME *pDuration) +static HRESULT WINAPI multimedia_stream_GetDuration(IAMMultiMediaStream *iface, STREAM_TIME *duration) { - struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *mmstream = impl_from_IAMMultiMediaStream(iface);
- FIXME("(%p/%p)->(%p) stub!\n", This, iface, pDuration); + TRACE("mmstream %p, duration %p.\n", mmstream, duration);
- return E_NOTIMPL; + if (!mmstream->media_seeking) + return E_NOINTERFACE; + return IMediaSeeking_GetDuration(mmstream->media_seeking, duration); }
static HRESULT WINAPI multimedia_stream_Seek(IAMMultiMediaStream *iface, STREAM_TIME seek_time) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 5402734b3df..85dcac91ad3 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -336,6 +336,85 @@ static void test_openfile(const WCHAR *test_avi_path) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_mmstream_get_duration(const WCHAR *test_avi_path) +{ + IAMMultiMediaStream *mmstream = create_ammultimediastream(); + HRESULT hr, audio_hr; + LONGLONG duration; + ULONG ref; + + duration = 0xdeadbeefdeadbeefULL; + hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); + ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr); + ok(duration == 0xdeadbeefdeadbeefULL, "Got duration %s.\n", wine_dbgstr_longlong(duration)); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, AMMSF_ADDDEFAULTRENDERER, NULL); + ok(hr == S_OK || hr == VFW_E_NO_AUDIO_HARDWARE, "Got hr %#x.\n", hr); + audio_hr = hr; + + hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, 0); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + duration = 0xdeadbeefdeadbeefULL; + hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); + if (audio_hr == S_OK) + { + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(duration == 1000000LL, "Got duration %s.\n", wine_dbgstr_longlong(duration)); + } + else + { + ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(!duration, "Got duration %s.\n", wine_dbgstr_longlong(duration)); + } + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + mmstream = create_ammultimediastream(); + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + duration = 0xdeadbeefdeadbeefULL; + hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(duration == 0, "Got duration %s.\n", wine_dbgstr_longlong(duration)); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + mmstream = create_ammultimediastream(); + + hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, 0); + todo_wine ok(hr == VFW_E_CANNOT_CONNECT, "Got hr %#x.\n", hr); + + duration = 0xdeadbeefdeadbeefULL; + hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + todo_wine ok(duration == 0, "Got duration %s.\n", wine_dbgstr_longlong(duration)); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + + mmstream = create_ammultimediastream(); + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_OpenFile(mmstream, test_avi_path, AMMSF_NORENDER); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + duration = 0xdeadbeefdeadbeefULL; + hr = IAMMultiMediaStream_GetDuration(mmstream, &duration); + todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr); + ok(duration == 0, "Got duration %s.\n", wine_dbgstr_longlong(duration)); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_renderfile(const WCHAR *test_avi_path) { IAMMultiMediaStream *pams; @@ -5432,6 +5511,7 @@ START_TEST(amstream) test_avi_path = load_resource(L"test.avi");
test_openfile(test_avi_path); + test_mmstream_get_duration(test_avi_path); test_renderfile(test_avi_path);
unload_resource(test_avi_path);
From: Myah Caron qsniyg@protonmail.com
Signed-off-by: Myah Caron qsniyg@protonmail.com Signed-off-by: Zebediah Figura z.figura12@gmail.com --- v5: Style tweaks
dlls/amstream/filter.c | 19 ++++- dlls/amstream/tests/amstream.c | 139 ++++++++++++++++++++++++++++++++- 2 files changed, 154 insertions(+), 4 deletions(-)
diff --git a/dlls/amstream/filter.c b/dlls/amstream/filter.c index b99cc4cda0c..13fd30c3a51 100644 --- a/dlls/amstream/filter.c +++ b/dlls/amstream/filter.c @@ -795,9 +795,24 @@ static HRESULT WINAPI filter_seeking_GetDuration(IMediaSeeking *iface, LONGLONG
static HRESULT WINAPI filter_seeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop) { - FIXME("iface %p, stop %p, stub!\n", iface, stop); + struct filter *filter = impl_from_IMediaSeeking(iface); + IMediaSeeking *seeking; + HRESULT hr;
- return E_NOTIMPL; + TRACE("filter %p, stop %p.\n", filter, stop); + + EnterCriticalSection(&filter->cs); + + if (!(seeking = get_seeking(filter->seekable_stream))) + { + LeaveCriticalSection(&filter->cs); + return E_NOTIMPL; + } + hr = IMediaSeeking_GetStopPosition(seeking, stop); + IMediaSeeking_Release(seeking); + + LeaveCriticalSection(&filter->cs); + return hr; }
static HRESULT WINAPI filter_seeking_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *current) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 85dcac91ad3..c5cdd7aaee4 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -814,6 +814,7 @@ struct testfilter LONGLONG current_position; LONGLONG stop_position; HRESULT get_duration_hr; + HRESULT get_stop_position_hr; HRESULT set_positions_hr; HRESULT init_stream_hr; HRESULT cleanup_stream_hr; @@ -997,8 +998,12 @@ static HRESULT WINAPI testsource_seeking_GetDuration(IMediaSeeking *iface, LONGL
static HRESULT WINAPI testsource_seeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop) { - ok(0, "Unexpected call.\n"); - return E_NOTIMPL; + struct testfilter *filter = impl_from_IMediaSeeking(iface); + + if (SUCCEEDED(filter->get_stop_position_hr)) + *stop = 0x8000000000000000ULL; + + return filter->get_stop_position_hr; }
static HRESULT WINAPI testsource_seeking_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *current) @@ -5307,6 +5312,135 @@ static void test_mediastreamfilter_get_duration(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_mediastreamfilter_get_stop_position(void) +{ + IAMMultiMediaStream *mmstream = create_ammultimediastream(); + static const MSPID mspid1 = {0x88888888, 1}; + static const MSPID mspid2 = {0x88888888, 2}; + static const MSPID mspid3 = {0x88888888, 3}; + struct testfilter source1, source2, source3; + IAMMediaStream *stream1, *stream2, *stream3; + IMediaStreamFilter *filter; + IPin *pin1, *pin2, *pin3; + IMediaSeeking *seeking; + IGraphBuilder *graph; + LONGLONG stop; + HRESULT hr; + ULONG ref; + + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = CoCreateInstance(&CLSID_AMAudioStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&stream1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = CoCreateInstance(&CLSID_AMAudioStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&stream2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = CoCreateInstance(&CLSID_AMAudioStream, NULL, CLSCTX_INPROC_SERVER, &IID_IAMMediaStream, (void **)&stream3); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMediaStream_Initialize(stream1, NULL, 0, &mspid1, STREAMTYPE_READ); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMediaStream_Initialize(stream2, NULL, 0, &mspid2, STREAMTYPE_READ); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMediaStream_Initialize(stream3, NULL, 0, &mspid3, STREAMTYPE_READ); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_AddMediaStream(mmstream, (IUnknown *)stream1, &mspid1, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_AddMediaStream(mmstream, (IUnknown *)stream2, &mspid2, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_AddMediaStream(mmstream, (IUnknown *)stream3, &mspid3, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMediaStream_QueryInterface(stream1, &IID_IPin, (void **)&pin1); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMediaStream_QueryInterface(stream2, &IID_IPin, (void **)&pin2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMediaStream_QueryInterface(stream3, &IID_IPin, (void **)&pin3); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_GetFilter(mmstream, &filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(graph != NULL, "Expected non-NULL graph.\n"); + testfilter_init(&source1); + testfilter_init(&source2); + testfilter_init(&source3); + source1.IMediaSeeking_iface.lpVtbl = &testsource_seeking_vtbl; + source2.IMediaSeeking_iface.lpVtbl = &testsource_seeking_vtbl; + source3.IMediaSeeking_iface.lpVtbl = &testsource_seeking_vtbl; + hr = IGraphBuilder_AddFilter(graph, &source1.filter.IBaseFilter_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IGraphBuilder_AddFilter(graph, &source2.filter.IBaseFilter_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IGraphBuilder_AddFilter(graph, &source3.filter.IBaseFilter_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IGraphBuilder_ConnectDirect(graph, &source2.source.pin.IPin_iface, pin2, &audio_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IGraphBuilder_ConnectDirect(graph, &source3.source.pin.IPin_iface, pin3, &audio_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaStreamFilter_SupportSeeking(filter, TRUE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IGraphBuilder_ConnectDirect(graph, &source1.source.pin.IPin_iface, pin1, &audio_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaStreamFilter_QueryInterface(filter, &IID_IMediaSeeking, (void **)&seeking); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + stop = 0xdeadbeefdeadbeefULL; + hr = IMediaSeeking_GetStopPosition(seeking, &stop); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(stop == 0x8000000000000000ULL, "Got stop position %s.\n", wine_dbgstr_longlong(stop)); + + source2.get_stop_position_hr = E_FAIL; + stop = 0xdeadbeefdeadbeefULL; + hr = IMediaSeeking_GetStopPosition(seeking, &stop); + ok(hr == E_FAIL, "Got hr %#x.\n", hr); + ok(stop == 0xdeadbeefdeadbeefULL, "Got stop position %s.\n", wine_dbgstr_longlong(stop)); + + source2.get_stop_position_hr = E_NOTIMPL; + stop = 0xdeadbeefdeadbeefULL; + hr = IMediaSeeking_GetStopPosition(seeking, &stop); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + ok(stop == 0xdeadbeefdeadbeefULL, "Got stop position %s.\n", wine_dbgstr_longlong(stop)); + + source2.IMediaSeeking_iface.lpVtbl = NULL; + stop = 0xdeadbeefdeadbeefULL; + hr = IMediaSeeking_GetStopPosition(seeking, &stop); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + ok(stop == 0xdeadbeefdeadbeefULL, "Got stop position %s.\n", wine_dbgstr_longlong(stop)); + + IGraphBuilder_Disconnect(graph, pin2); + IGraphBuilder_Disconnect(graph, &source2.source.pin.IPin_iface); + + source2.IMediaSeeking_iface.lpVtbl = NULL; + stop = 0xdeadbeefdeadbeefULL; + hr = IMediaSeeking_GetStopPosition(seeking, &stop); + ok(hr == E_NOTIMPL, "Got hr %#x.\n", hr); + ok(stop == 0xdeadbeefdeadbeefULL, "Got stop position %s.\n", wine_dbgstr_longlong(stop)); + + IGraphBuilder_Disconnect(graph, pin2); + IGraphBuilder_Disconnect(graph, &source2.source.pin.IPin_iface); + IGraphBuilder_Disconnect(graph, pin3); + IGraphBuilder_Disconnect(graph, &source3.source.pin.IPin_iface); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IGraphBuilder_Release(graph); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IMediaSeeking_Release(seeking); + ref = IMediaStreamFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IPin_Release(pin1); + ref = IAMMediaStream_Release(stream1); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IPin_Release(pin2); + ref = IAMMediaStream_Release(stream2); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IPin_Release(pin3); + ref = IAMMediaStream_Release(stream3); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static void test_mediastreamfilter_get_current_stream_time(void) { IMediaStreamFilter *filter; @@ -5550,6 +5684,7 @@ START_TEST(amstream) test_mediastreamfilter_support_seeking(); test_mediastreamfilter_set_positions(); test_mediastreamfilter_get_duration(); + test_mediastreamfilter_get_stop_position(); test_mediastreamfilter_get_current_stream_time();
CoUninitialize();