amstream: Implement MediaStreamFilter::GetState.
Signed-off-by: Anton Baskanov <baskanov@gmail.com> Signed-off-by: Zebediah Figura <zfigura@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
7ff63efa01
commit
ef2249e4b6
|
@ -171,6 +171,7 @@ struct filter
|
|||
IFilterGraph *graph;
|
||||
ULONG nb_streams;
|
||||
IAMMediaStream **streams;
|
||||
FILTER_STATE state;
|
||||
};
|
||||
|
||||
static inline struct filter *impl_from_IMediaStreamFilter(IMediaStreamFilter *iface)
|
||||
|
@ -264,9 +265,19 @@ static HRESULT WINAPI filter_Run(IMediaStreamFilter *iface, REFERENCE_TIME start
|
|||
|
||||
static HRESULT WINAPI filter_GetState(IMediaStreamFilter *iface, DWORD timeout, FILTER_STATE *state)
|
||||
{
|
||||
FIXME("iface %p, timeout %u, state %p, stub!\n", iface, timeout, state);
|
||||
struct filter *filter = impl_from_IMediaStreamFilter(iface);
|
||||
|
||||
TRACE("iface %p, timeout %u, state %p.\n", iface, timeout, state);
|
||||
|
||||
if (!state)
|
||||
return E_POINTER;
|
||||
|
||||
EnterCriticalSection(&filter->cs);
|
||||
|
||||
*state = filter->state;
|
||||
|
||||
LeaveCriticalSection(&filter->cs);
|
||||
|
||||
*state = State_Stopped;
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -2737,6 +2737,37 @@ static void test_audiostream_receive_connection(void)
|
|||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
}
|
||||
|
||||
void test_mediastreamfilter_get_state(void)
|
||||
{
|
||||
IAMMultiMediaStream *mmstream = create_ammultimediastream();
|
||||
IMediaStreamFilter *filter;
|
||||
FILTER_STATE state;
|
||||
HRESULT hr;
|
||||
ULONG ref;
|
||||
|
||||
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
hr = IAMMultiMediaStream_GetFilter(mmstream, &filter);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
ok(!!filter, "Expected non-null filter.\n");
|
||||
|
||||
/* Crashes on native. */
|
||||
if (0)
|
||||
{
|
||||
hr = IMediaStreamFilter_GetState(filter, 0, NULL);
|
||||
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
|
||||
}
|
||||
|
||||
state = 0xcc;
|
||||
hr = IMediaStreamFilter_GetState(filter, 0, &state);
|
||||
ok(state == State_Stopped, "Got state %#x.\n", state);
|
||||
|
||||
ref = IAMMultiMediaStream_Release(mmstream);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
ref = IMediaStreamFilter_Release(filter);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
}
|
||||
|
||||
START_TEST(amstream)
|
||||
{
|
||||
HANDLE file;
|
||||
|
@ -2774,5 +2805,7 @@ START_TEST(amstream)
|
|||
test_audiostream_set_format();
|
||||
test_audiostream_receive_connection();
|
||||
|
||||
test_mediastreamfilter_get_state();
|
||||
|
||||
CoUninitialize();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue