amstream: Return S_OK from AMMultiMediaStream::SetState when IMediaControl::Run succeeds.
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
0e6f24db19
commit
6395c83d2a
|
@ -153,7 +153,11 @@ static HRESULT WINAPI multimedia_stream_SetState(IAMMultiMediaStream *iface, STR
|
|||
TRACE("(%p/%p)->(%u)\n", This, iface, new_state);
|
||||
|
||||
if (new_state == STREAMSTATE_RUN)
|
||||
{
|
||||
hr = IMediaControl_Run(This->media_control);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = S_OK;
|
||||
}
|
||||
else if (new_state == STREAMSTATE_STOP)
|
||||
hr = IMediaControl_Stop(This->media_control);
|
||||
|
||||
|
|
|
@ -710,6 +710,8 @@ struct testfilter
|
|||
LONGLONG stop_position;
|
||||
HRESULT get_duration_hr;
|
||||
HRESULT set_positions_hr;
|
||||
HRESULT init_stream_hr;
|
||||
HRESULT cleanup_stream_hr;
|
||||
};
|
||||
|
||||
static inline struct testfilter *impl_from_BaseFilter(struct strmbase_filter *iface)
|
||||
|
@ -736,16 +738,20 @@ static HRESULT testfilter_init_stream(struct strmbase_filter *iface)
|
|||
{
|
||||
struct testfilter *filter = impl_from_BaseFilter(iface);
|
||||
|
||||
BaseOutputPinImpl_Active(&filter->source);
|
||||
return S_OK;
|
||||
if (SUCCEEDED(filter->init_stream_hr))
|
||||
BaseOutputPinImpl_Active(&filter->source);
|
||||
|
||||
return filter->init_stream_hr;
|
||||
}
|
||||
|
||||
static HRESULT testfilter_cleanup_stream(struct strmbase_filter *iface)
|
||||
{
|
||||
struct testfilter *filter = impl_from_BaseFilter(iface);
|
||||
|
||||
BaseOutputPinImpl_Inactive(&filter->source);
|
||||
return S_OK;
|
||||
if (SUCCEEDED(filter->cleanup_stream_hr))
|
||||
BaseOutputPinImpl_Inactive(&filter->source);
|
||||
|
||||
return filter->cleanup_stream_hr;
|
||||
}
|
||||
|
||||
static const struct strmbase_filter_ops testfilter_ops =
|
||||
|
@ -2062,6 +2068,62 @@ static void test_initialize(void)
|
|||
IUnknown_Release(graph_inner_unk);
|
||||
}
|
||||
|
||||
static void test_set_state(void)
|
||||
{
|
||||
IAMMultiMediaStream *mmstream = create_ammultimediastream();
|
||||
struct testfilter source;
|
||||
IGraphBuilder *graph;
|
||||
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, NULL);
|
||||
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(&source);
|
||||
|
||||
hr = IGraphBuilder_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
source.init_stream_hr = E_FAIL;
|
||||
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN);
|
||||
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
|
||||
source.init_stream_hr = S_OK;
|
||||
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
source.init_stream_hr = S_FALSE;
|
||||
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
source.init_stream_hr = S_OK;
|
||||
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
source.cleanup_stream_hr = E_FAIL;
|
||||
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP);
|
||||
ok(hr == E_FAIL, "Got hr %#x.\n", hr);
|
||||
source.cleanup_stream_hr = S_OK;
|
||||
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
|
||||
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN);
|
||||
ok(hr == S_OK, "Got hr %#x.\n", hr);
|
||||
source.cleanup_stream_hr = S_FALSE;
|
||||
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP);
|
||||
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
|
||||
source.cleanup_stream_hr = S_OK;
|
||||
|
||||
ref = IAMMultiMediaStream_Release(mmstream);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
ref = IGraphBuilder_Release(graph);
|
||||
ok(!ref, "Got outstanding refcount %d.\n", ref);
|
||||
}
|
||||
|
||||
static void test_enum_media_types(void)
|
||||
{
|
||||
IAMMultiMediaStream *mmstream = create_ammultimediastream();
|
||||
|
@ -5116,6 +5178,7 @@ START_TEST(amstream)
|
|||
test_find_pin();
|
||||
test_pin_info();
|
||||
test_initialize();
|
||||
test_set_state();
|
||||
test_enum_media_types();
|
||||
test_media_types();
|
||||
test_IDirectDrawStreamSample();
|
||||
|
|
Loading…
Reference in New Issue