Commit 86bc6a28 authored by Anton Baskanov's avatar Anton Baskanov Committed by Alexandre Julliard

amstream: Implement AMAudioStream::SetState.

parent eaad2380
......@@ -184,6 +184,7 @@ struct audio_stream
IMemAllocator *allocator;
AM_MEDIA_TYPE mt;
WAVEFORMATEX format;
FILTER_STATE state;
};
static inline struct audio_stream *impl_from_IAMMediaStream(IAMMediaStream *iface)
......@@ -340,11 +341,17 @@ static HRESULT WINAPI audio_IAMMediaStream_Initialize(IAMMediaStream *iface, IUn
static HRESULT WINAPI audio_IAMMediaStream_SetState(IAMMediaStream *iface, FILTER_STATE state)
{
struct audio_stream *This = impl_from_IAMMediaStream(iface);
struct audio_stream *stream = impl_from_IAMMediaStream(iface);
FIXME("(%p/%p)->(%u) stub!\n", This, iface, state);
TRACE("stream %p, state %u.\n", stream, state);
return S_FALSE;
EnterCriticalSection(&stream->cs);
stream->state = state;
LeaveCriticalSection(&stream->cs);
return S_OK;
}
static HRESULT WINAPI audio_IAMMediaStream_JoinAMMultiMediaStream(IAMMediaStream *iface,
......
......@@ -2780,6 +2780,40 @@ static void test_audiostream_receive_connection(void)
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
static void test_audiostream_set_state(void)
{
IAMMultiMediaStream *mmstream = create_ammultimediastream();
IAMMediaStream *am_stream;
IMediaStream *stream;
HRESULT hr;
ULONG ref;
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryAudio, 0, &stream);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaStream_QueryInterface(stream, &IID_IAMMediaStream, (void **)&am_stream);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMediaStream_SetState(am_stream, 4);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMediaStream_SetState(am_stream, State_Running);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMediaStream_SetState(am_stream, State_Paused);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMediaStream_SetState(am_stream, State_Stopped);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ref = IAMMultiMediaStream_Release(mmstream);
ok(!ref, "Got outstanding refcount %d.\n", ref);
IAMMediaStream_Release(am_stream);
ref = IMediaStream_Release(stream);
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
void test_mediastreamfilter_get_state(void)
{
IAMMultiMediaStream *mmstream = create_ammultimediastream();
......@@ -2951,6 +2985,7 @@ START_TEST(amstream)
test_audiostream_get_format();
test_audiostream_set_format();
test_audiostream_receive_connection();
test_audiostream_set_state();
test_mediastreamfilter_get_state();
test_mediastreamfilter_stop_pause_run();
......
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