Commit 77134d80 authored by Anton Baskanov's avatar Anton Baskanov Committed by Alexandre Julliard

amstream: Implement MediaStreamFilter::SupportSeeking().

parent ae1ca702
......@@ -163,6 +163,7 @@ static const IEnumPinsVtbl enum_pins_vtbl =
struct filter
{
IMediaStreamFilter IMediaStreamFilter_iface;
IMediaSeeking IMediaSeeking_iface;
LONG refcount;
CRITICAL_SECTION cs;
......@@ -171,6 +172,7 @@ struct filter
IFilterGraph *graph;
ULONG nb_streams;
IAMMediaStream **streams;
IAMMediaStream *seekable_stream;
FILTER_STATE state;
};
......@@ -179,26 +181,27 @@ static inline struct filter *impl_from_IMediaStreamFilter(IMediaStreamFilter *if
return CONTAINING_RECORD(iface, struct filter, IMediaStreamFilter_iface);
}
static HRESULT WINAPI filter_QueryInterface(IMediaStreamFilter *iface, REFIID riid, void **ret_iface)
static HRESULT WINAPI filter_QueryInterface(IMediaStreamFilter *iface, REFIID iid, void **out)
{
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ret_iface);
struct filter *filter = impl_from_IMediaStreamFilter(iface);
*ret_iface = NULL;
TRACE("filter %p, iid %s, out %p.\n", filter, debugstr_guid(iid), out);
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IPersist) ||
IsEqualIID(riid, &IID_IMediaFilter) ||
IsEqualIID(riid, &IID_IBaseFilter) ||
IsEqualIID(riid, &IID_IMediaStreamFilter))
*ret_iface = iface;
*out = NULL;
if (*ret_iface)
{
IMediaStreamFilter_AddRef(*ret_iface);
return S_OK;
}
if (IsEqualGUID(iid, &IID_IUnknown)
|| IsEqualGUID(iid, &IID_IPersist)
|| IsEqualGUID(iid, &IID_IMediaFilter)
|| IsEqualGUID(iid, &IID_IBaseFilter)
|| IsEqualGUID(iid, &IID_IMediaStreamFilter))
*out = iface;
else if (IsEqualGUID(iid, &IID_IMediaSeeking) && filter->seekable_stream)
*out = &filter->IMediaSeeking_iface;
else
return E_NOINTERFACE;
return E_NOINTERFACE;
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
}
static ULONG WINAPI filter_AddRef(IMediaStreamFilter *iface)
......@@ -538,11 +541,70 @@ static HRESULT WINAPI filter_EnumMediaStreams(IMediaStreamFilter *iface, LONG in
return S_OK;
}
static HRESULT WINAPI filter_SupportSeeking(IMediaStreamFilter *iface, BOOL bRenderer)
static IMediaSeeking *get_seeking(IAMMediaStream *stream)
{
FIXME("(%p)->(%d): Stub!\n", iface, bRenderer);
IMediaSeeking *seeking;
IPin *pin, *peer;
HRESULT hr;
return E_NOTIMPL;
if (FAILED(IAMMediaStream_QueryInterface(stream, &IID_IPin, (void **)&pin)))
{
WARN("Stream %p does not support IPin.\n", stream);
return NULL;
}
hr = IPin_ConnectedTo(pin, &peer);
IPin_Release(pin);
if (FAILED(hr))
return NULL;
hr = IPin_QueryInterface(peer, &IID_IMediaSeeking, (void **)&seeking);
IPin_Release(peer);
if (FAILED(hr))
return NULL;
return seeking;
}
static HRESULT WINAPI filter_SupportSeeking(IMediaStreamFilter *iface, BOOL renderer)
{
struct filter *filter = impl_from_IMediaStreamFilter(iface);
unsigned int i;
TRACE("filter %p, renderer %d\n", iface, renderer);
if (!renderer)
FIXME("Non-renderer filter support is not yet implemented.\n");
EnterCriticalSection(&filter->cs);
if (filter->seekable_stream)
{
LeaveCriticalSection(&filter->cs);
return HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED);
}
for (i = 0; i < filter->nb_streams; ++i)
{
IMediaSeeking *seeking = get_seeking(filter->streams[i]);
LONGLONG duration;
if (!seeking)
continue;
if (SUCCEEDED(IMediaSeeking_GetDuration(seeking, &duration)))
{
filter->seekable_stream = filter->streams[i];
IMediaSeeking_Release(seeking);
LeaveCriticalSection(&filter->cs);
return S_OK;
}
IMediaSeeking_Release(seeking);
}
LeaveCriticalSection(&filter->cs);
return E_NOINTERFACE;
}
static HRESULT WINAPI filter_ReferenceTimeToStreamTime(IMediaStreamFilter *iface, REFERENCE_TIME *pTime)
......@@ -608,6 +670,177 @@ static const IMediaStreamFilterVtbl filter_vtbl =
filter_EndOfStream
};
static inline struct filter *impl_from_IMediaSeeking(IMediaSeeking *iface)
{
return CONTAINING_RECORD(iface, struct filter, IMediaSeeking_iface);
}
static HRESULT WINAPI filter_seeking_QueryInterface(IMediaSeeking *iface, REFIID iid, void **out)
{
struct filter *filter = impl_from_IMediaSeeking(iface);
return IMediaStreamFilter_QueryInterface(&filter->IMediaStreamFilter_iface, iid, out);
}
static ULONG WINAPI filter_seeking_AddRef(IMediaSeeking *iface)
{
struct filter *filter = impl_from_IMediaSeeking(iface);
return IMediaStreamFilter_AddRef(&filter->IMediaStreamFilter_iface);
}
static ULONG WINAPI filter_seeking_Release(IMediaSeeking *iface)
{
struct filter *filter = impl_from_IMediaSeeking(iface);
return IMediaStreamFilter_Release(&filter->IMediaStreamFilter_iface);
}
static HRESULT WINAPI filter_seeking_GetCapabilities(IMediaSeeking *iface, DWORD *capabilities)
{
FIXME("iface %p, capabilities %p, stub!\n", iface, capabilities);
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_CheckCapabilities(IMediaSeeking *iface, DWORD *capabilities)
{
FIXME("iface %p, capabilities %p, stub!\n", iface, capabilities);
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_IsFormatSupported(IMediaSeeking *iface, const GUID *format)
{
FIXME("iface %p, format %s, stub!\n", iface, debugstr_guid(format));
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_QueryPreferredFormat(IMediaSeeking *iface, GUID *format)
{
FIXME("iface %p, format %p, stub!\n", iface, format);
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_GetTimeFormat(IMediaSeeking *iface, GUID *format)
{
FIXME("iface %p, format %p, stub!\n", iface, format);
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_IsUsingTimeFormat(IMediaSeeking *iface, const GUID *format)
{
FIXME("iface %p, format %s, stub!\n", iface, debugstr_guid(format));
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_SetTimeFormat(IMediaSeeking *iface, const GUID *format)
{
FIXME("iface %p, format %s, stub!\n", iface, debugstr_guid(format));
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_GetDuration(IMediaSeeking *iface, LONGLONG *duration)
{
FIXME("iface %p, duration %p, stub!\n", iface, duration);
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop)
{
FIXME("iface %p, stop %p, stub!\n", iface, stop);
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *current)
{
FIXME("iface %p, current %p, stub!\n", iface, current);
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_ConvertTimeFormat(IMediaSeeking *iface, LONGLONG *target,
const GUID *target_format, LONGLONG source, const GUID *source_format)
{
FIXME("iface %p, target %p, target_format %s, source 0x%s, source_format %s, stub!\n", iface, target, debugstr_guid(target_format),
wine_dbgstr_longlong(source), debugstr_guid(source_format));
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_SetPositions(IMediaSeeking *iface, LONGLONG *current_ptr, DWORD current_flags,
LONGLONG *stop_ptr, DWORD stop_flags)
{
FIXME("iface %p, current %s, current_flags %#x, stop %s, stop_flags %#x, stub!\n", iface,
current_ptr ? wine_dbgstr_longlong(*current_ptr) : "<null>", current_flags,
stop_ptr ? wine_dbgstr_longlong(*stop_ptr): "<null>", stop_flags);
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_GetPositions(IMediaSeeking *iface, LONGLONG *current, LONGLONG *stop)
{
FIXME("iface %p, current %p, stop %p, stub!\n", iface, current, stop);
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_GetAvailable(IMediaSeeking *iface, LONGLONG *earliest, LONGLONG *latest)
{
FIXME("iface %p, earliest %p, latest %p, stub!\n", iface, earliest, latest);
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_SetRate(IMediaSeeking *iface, double rate)
{
FIXME("iface %p, rate %f, stub!\n", iface, rate);
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_GetRate(IMediaSeeking *iface, double *rate)
{
FIXME("iface %p, rate %p, stub!\n", iface, rate);
return E_NOTIMPL;
}
static HRESULT WINAPI filter_seeking_GetPreroll(IMediaSeeking *iface, LONGLONG *preroll)
{
FIXME("iface %p, preroll %p, stub!\n", iface, preroll);
return E_NOTIMPL;
}
static const IMediaSeekingVtbl filter_seeking_vtbl =
{
filter_seeking_QueryInterface,
filter_seeking_AddRef,
filter_seeking_Release,
filter_seeking_GetCapabilities,
filter_seeking_CheckCapabilities,
filter_seeking_IsFormatSupported,
filter_seeking_QueryPreferredFormat,
filter_seeking_GetTimeFormat,
filter_seeking_IsUsingTimeFormat,
filter_seeking_SetTimeFormat,
filter_seeking_GetDuration,
filter_seeking_GetStopPosition,
filter_seeking_GetCurrentPosition,
filter_seeking_ConvertTimeFormat,
filter_seeking_SetPositions,
filter_seeking_GetPositions,
filter_seeking_GetAvailable,
filter_seeking_SetRate,
filter_seeking_GetRate,
filter_seeking_GetPreroll,
};
HRESULT filter_create(IUnknown *outer, void **out)
{
struct filter *object;
......@@ -621,6 +854,7 @@ HRESULT filter_create(IUnknown *outer, void **out)
return E_OUTOFMEMORY;
object->IMediaStreamFilter_iface.lpVtbl = &filter_vtbl;
object->IMediaSeeking_iface.lpVtbl = &filter_seeking_vtbl;
object->refcount = 1;
InitializeCriticalSection(&object->cs);
object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": MediaStreamFilter.cs");
......
......@@ -2348,6 +2348,8 @@ struct testfilter
{
struct strmbase_filter filter;
struct strmbase_source source;
IMediaSeeking IMediaSeeking_iface;
HRESULT get_duration_hr;
};
static inline struct testfilter *impl_from_BaseFilter(struct strmbase_filter *iface)
......@@ -2394,6 +2396,25 @@ static const struct strmbase_filter_ops testfilter_ops =
.filter_cleanup_stream = testfilter_cleanup_stream,
};
static inline struct testfilter *impl_from_base_pin(struct strmbase_pin *iface)
{
return CONTAINING_RECORD(iface, struct testfilter, source.pin);
}
static HRESULT testsource_query_interface(struct strmbase_pin *iface, REFIID iid, void **out)
{
struct testfilter *filter = impl_from_base_pin(iface);
if (IsEqualGUID(iid, &IID_IMediaSeeking) && filter->IMediaSeeking_iface.lpVtbl)
*out = &filter->IMediaSeeking_iface;
else
return E_NOINTERFACE;
IUnknown_AddRef((IUnknown *)*out);
return S_OK;
}
static HRESULT WINAPI testsource_DecideBufferSize(struct strmbase_source *iface,
IMemAllocator *alloc, ALLOCATOR_PROPERTIES *requested)
{
......@@ -2413,6 +2434,7 @@ static HRESULT WINAPI testsource_DecideBufferSize(struct strmbase_source *iface,
static const struct strmbase_source_ops testsource_ops =
{
.base.pin_query_interface = testsource_query_interface,
.pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection,
.pfnDecideBufferSize = testsource_DecideBufferSize,
.pfnDecideAllocator = BaseOutputPinImpl_DecideAllocator,
......@@ -2421,10 +2443,166 @@ static const struct strmbase_source_ops testsource_ops =
static void testfilter_init(struct testfilter *filter)
{
static const GUID clsid = {0xabacab};
memset(filter, 0, sizeof(*filter));
strmbase_filter_init(&filter->filter, NULL, &clsid, &testfilter_ops);
strmbase_source_init(&filter->source, &filter->filter, L"", &testsource_ops);
}
static inline struct testfilter *impl_from_IMediaSeeking(IMediaSeeking *iface)
{
return CONTAINING_RECORD(iface, struct testfilter, IMediaSeeking_iface);
}
static HRESULT WINAPI testsource_seeking_QueryInterface(IMediaSeeking *iface, REFIID iid, void **out)
{
struct testfilter *filter = impl_from_IMediaSeeking(iface);
return IBaseFilter_QueryInterface(&filter->filter.IBaseFilter_iface, iid, out);
}
static ULONG WINAPI testsource_seeking_AddRef(IMediaSeeking *iface)
{
struct testfilter *filter = impl_from_IMediaSeeking(iface);
return IBaseFilter_AddRef(&filter->filter.IBaseFilter_iface);
}
static ULONG WINAPI testsource_seeking_Release(IMediaSeeking *iface)
{
struct testfilter *filter = impl_from_IMediaSeeking(iface);
return IBaseFilter_Release(&filter->filter.IBaseFilter_iface);
}
static HRESULT WINAPI testsource_seeking_GetCapabilities(IMediaSeeking *iface, DWORD *capabilities)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_CheckCapabilities(IMediaSeeking *iface, DWORD *capabilities)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_IsFormatSupported(IMediaSeeking *iface, const GUID *format)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_QueryPreferredFormat(IMediaSeeking *iface, GUID *format)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_GetTimeFormat(IMediaSeeking *iface, GUID *format)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_IsUsingTimeFormat(IMediaSeeking *iface, const GUID *format)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_SetTimeFormat(IMediaSeeking *iface, const GUID *format)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_GetDuration(IMediaSeeking *iface, LONGLONG *duration)
{
struct testfilter *filter = impl_from_IMediaSeeking(iface);
if (SUCCEEDED(filter->get_duration_hr))
*duration = 0x8000000000000000ULL;
return filter->get_duration_hr;
}
static HRESULT WINAPI testsource_seeking_GetStopPosition(IMediaSeeking *iface, LONGLONG *stop)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_GetCurrentPosition(IMediaSeeking *iface, LONGLONG *current)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_ConvertTimeFormat(IMediaSeeking *iface, LONGLONG *target,
const GUID *target_format, LONGLONG source, const GUID *source_format)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_SetPositions(IMediaSeeking *iface, LONGLONG *current_ptr, DWORD current_flags,
LONGLONG *stop_ptr, DWORD stop_flags)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_GetPositions(IMediaSeeking *iface, LONGLONG *current, LONGLONG *stop)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_GetAvailable(IMediaSeeking *iface, LONGLONG *earliest, LONGLONG *latest)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_SetRate(IMediaSeeking *iface, double rate)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_GetRate(IMediaSeeking *iface, double *rate)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static HRESULT WINAPI testsource_seeking_GetPreroll(IMediaSeeking *iface, LONGLONG *preroll)
{
ok(0, "Unexpected call.\n");
return E_NOTIMPL;
}
static const IMediaSeekingVtbl testsource_seeking_vtbl =
{
testsource_seeking_QueryInterface,
testsource_seeking_AddRef,
testsource_seeking_Release,
testsource_seeking_GetCapabilities,
testsource_seeking_CheckCapabilities,
testsource_seeking_IsFormatSupported,
testsource_seeking_QueryPreferredFormat,
testsource_seeking_GetTimeFormat,
testsource_seeking_IsUsingTimeFormat,
testsource_seeking_SetTimeFormat,
testsource_seeking_GetDuration,
testsource_seeking_GetStopPosition,
testsource_seeking_GetCurrentPosition,
testsource_seeking_ConvertTimeFormat,
testsource_seeking_SetPositions,
testsource_seeking_GetPositions,
testsource_seeking_GetAvailable,
testsource_seeking_SetRate,
testsource_seeking_GetRate,
testsource_seeking_GetPreroll,
};
static void test_audiostream_get_format(void)
{
static const WAVEFORMATEX pin_format =
......@@ -3903,6 +4081,143 @@ void test_mediastreamfilter_stop_pause_run(void)
check_mediastreamfilter_state(State_Running, mediastreamfilter_run, mediastreamfilter_stop);
}
static void test_mediastreamfilter_support_seeking(void)
{
static const WAVEFORMATEX format =
{
.wFormatTag = WAVE_FORMAT_PCM,
.nChannels = 1,
.nSamplesPerSec = 11025,
.wBitsPerSample = 16,
.nBlockAlign = 2,
.nAvgBytesPerSec = 2 * 11025,
};
const AM_MEDIA_TYPE mt =
{
.majortype = MEDIATYPE_Audio,
.subtype = MEDIASUBTYPE_PCM,
.formattype = FORMAT_WaveFormatEx,
.cbFormat = sizeof(WAVEFORMATEX),
.pbFormat = (BYTE *)&format,
};
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;
ULONG ref, seeking_ref;
IGraphBuilder *graph;
HRESULT hr;
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);
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 = IMediaStreamFilter_SupportSeeking(filter, TRUE);
ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
hr = IGraphBuilder_ConnectDirect(graph, &source1.source.pin.IPin_iface, pin1, &mt);
ok(hr == S_OK, "Got hr %#x.\n", hr);
source2.get_duration_hr = E_FAIL;
hr = IMediaStreamFilter_SupportSeeking(filter, TRUE);
ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
hr = IGraphBuilder_ConnectDirect(graph, &source2.source.pin.IPin_iface, pin2, &mt);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaStreamFilter_SupportSeeking(filter, TRUE);
ok(hr == E_NOINTERFACE, "Got hr %#x.\n", hr);
hr = IGraphBuilder_ConnectDirect(graph, &source3.source.pin.IPin_iface, pin3, &mt);
ok(hr == S_OK, "Got hr %#x.\n", hr);
check_interface(filter, &IID_IMediaSeeking, FALSE);
seeking_ref = get_refcount(&source3.IMediaSeeking_iface);
hr = IMediaStreamFilter_SupportSeeking(filter, TRUE);
ok(hr == S_OK, "Got hr %#x.\n", hr);
check_interface(filter, &IID_IMediaSeeking, TRUE);
ref = get_refcount(&source3.IMediaSeeking_iface);
ok(ref == seeking_ref, "Expected outstanding refcount %d, got %d.\n", seeking_ref, ref);
hr = IMediaStreamFilter_SupportSeeking(filter, TRUE);
ok(hr == HRESULT_FROM_WIN32(ERROR_ALREADY_INITIALIZED), "Got hr %#x.\n", hr);
IGraphBuilder_Disconnect(graph, pin1);
IGraphBuilder_Disconnect(graph, &source1.source.pin.IPin_iface);
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);
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);
}
START_TEST(amstream)
{
HANDLE file;
......@@ -3954,6 +4269,7 @@ START_TEST(amstream)
test_mediastreamfilter_get_state();
test_mediastreamfilter_stop_pause_run();
test_mediastreamfilter_support_seeking();
CoUninitialize();
}
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