mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-02 08:33:37 +00:00
amstream: Implement AMMultiMediaStream::GetState.
Signed-off-by: Anton Baskanov <baskanov@gmail.com> Signed-off-by: Zebediah Figura <z.figura12@gmail.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
16874608d6
commit
23cbd7f591
|
@ -42,6 +42,7 @@ struct multimedia_stream
|
|||
BOOL initialized;
|
||||
STREAM_TYPE type;
|
||||
OAEVENT event;
|
||||
STREAM_STATE state;
|
||||
};
|
||||
|
||||
static inline struct multimedia_stream *impl_from_IAMMultiMediaStream(IAMMultiMediaStream *iface)
|
||||
|
@ -136,13 +137,15 @@ static HRESULT WINAPI multimedia_stream_EnumMediaStreams(IAMMultiMediaStream *if
|
|||
return IMediaStreamFilter_EnumMediaStreams(mmstream->filter, index, stream);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI multimedia_stream_GetState(IAMMultiMediaStream *iface, STREAM_STATE *pCurrentState)
|
||||
static HRESULT WINAPI multimedia_stream_GetState(IAMMultiMediaStream *iface, STREAM_STATE *state)
|
||||
{
|
||||
struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface);
|
||||
struct multimedia_stream *mmstream = impl_from_IAMMultiMediaStream(iface);
|
||||
|
||||
FIXME("(%p/%p)->(%p) stub!\n", This, iface, pCurrentState);
|
||||
TRACE("mmstream %p, state %p.\n", mmstream, state);
|
||||
|
||||
return E_NOTIMPL;
|
||||
*state = mmstream->state;
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI multimedia_stream_SetState(IAMMultiMediaStream *iface, STREAM_STATE new_state)
|
||||
|
@ -165,6 +168,9 @@ static HRESULT WINAPI multimedia_stream_SetState(IAMMultiMediaStream *iface, STR
|
|||
else if (new_state == STREAMSTATE_STOP)
|
||||
hr = IMediaControl_Stop(This->media_control);
|
||||
|
||||
if (SUCCEEDED(hr))
|
||||
This->state = new_state;
|
||||
|
||||
return hr;
|
||||
}
|
||||
|
||||
|
|
|
@ -2409,8 +2409,10 @@ static DWORD CALLBACK mmstream_set_state(void *param)
|
|||
static void test_set_state(void)
|
||||
{
|
||||
IAMMultiMediaStream *mmstream = create_ammultimediastream();
|
||||
IMediaControl *media_control;
|
||||
struct testfilter source;
|
||||
IGraphBuilder *graph;
|
||||
STREAM_STATE state;
|
||||
HANDLE thread;
|
||||
HRESULT hr;
|
||||
ULONG ref;
|
||||
|
@ -2422,6 +2424,8 @@ static void test_set_state(void)
|
|||
hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &graph);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
ok(graph != NULL, "Expected non-NULL graph.\n");
|
||||
hr = IGraphBuilder_QueryInterface(graph, &IID_IMediaControl, (void **)&media_control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
testfilter_init(&source);
|
||||
|
||||
hr = IGraphBuilder_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL);
|
||||
|
@ -2500,8 +2504,57 @@ static void test_set_state(void)
|
|||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
source.wait_state_hr = S_OK;
|
||||
|
||||
/* Crashes on native. */
|
||||
if (0)
|
||||
{
|
||||
hr = IAMMultiMediaStream_GetState(mmstream, NULL);
|
||||
ok(hr == E_POINTER, "Got hr %#x.\n", hr);
|
||||
}
|
||||
|
||||
state = 0xdeadbeef;
|
||||
hr = IAMMultiMediaStream_GetState(mmstream, &state);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
ok(state == STREAMSTATE_STOP, "Got state %#x.\n", state);
|
||||
|
||||
hr = IMediaControl_Run(media_control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
hr = IAMMultiMediaStream_GetState(mmstream, &state);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
ok(state == STREAMSTATE_STOP, "Got state %#x.\n", state);
|
||||
|
||||
hr = IMediaControl_Stop(media_control);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
hr = IAMMultiMediaStream_GetState(mmstream, &state);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
ok(state == STREAMSTATE_RUN, "Got state %#x.\n", state);
|
||||
|
||||
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
hr = IAMMultiMediaStream_GetState(mmstream, &state);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
ok(state == STREAMSTATE_STOP, "Got state %#x.\n", state);
|
||||
|
||||
source.init_stream_hr = E_FAIL;
|
||||
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN);
|
||||
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
|
||||
|
||||
state = 0xdeadbeef;
|
||||
hr = IAMMultiMediaStream_GetState(mmstream, &state);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
ok(state == STREAMSTATE_STOP, "Got state %#x.\n", state);
|
||||
|
||||
ref = IAMMultiMediaStream_Release(mmstream);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
IMediaControl_Release(media_control);
|
||||
ref = IGraphBuilder_Release(graph);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue