Commit 6cb835f8 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

amstream: Forbid changing the multimedia stream mode.

parent fa62cde3
......@@ -39,6 +39,7 @@ struct multimedia_stream
IMediaControl* media_control;
IMediaStreamFilter *filter;
IPin* ipin;
BOOL initialized;
STREAM_TYPE type;
OAEVENT event;
};
......@@ -250,10 +251,17 @@ static HRESULT WINAPI multimedia_stream_Initialize(IAMMultiMediaStream *iface,
return E_INVALIDARG;
}
if (mmstream->initialized && type != mmstream->type)
{
WARN("Attempt to change type from %u, returning E_INVALIDARG.\n", mmstream->type);
return E_INVALIDARG;
}
if (graph && FAILED(hr = create_graph(mmstream, graph)))
return hr;
mmstream->type = type;
mmstream->initialized = TRUE;
return S_OK;
}
......
......@@ -1497,9 +1497,9 @@ static void test_initialize(void)
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_WRITE, 0, NULL);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_TRANSFORM, 0, NULL);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ret_graph = (IGraphBuilder *)0xdeadbeef;
hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &ret_graph);
......@@ -1511,7 +1511,7 @@ static void test_initialize(void)
type = 0xdeadbeef;
hr = IMediaStream_GetInformation(stream, NULL, &type);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(type == STREAMTYPE_READ, "Got type %u.\n", type);
ok(type == STREAMTYPE_READ, "Got type %u.\n", type);
IMediaStream_Release(stream);
ret_graph = NULL;
......@@ -1531,9 +1531,9 @@ static void test_initialize(void)
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_WRITE, 0, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_TRANSFORM, 0, NULL);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ret_graph = (IGraphBuilder *)0xdeadbeef;
hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &ret_graph);
......@@ -1545,7 +1545,7 @@ static void test_initialize(void)
type = 0xdeadbeef;
hr = IMediaStream_GetInformation(stream, NULL, &type);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(type == STREAMTYPE_WRITE, "Got type %u.\n", type);
ok(type == STREAMTYPE_WRITE, "Got type %u.\n", type);
IMediaStream_Release(stream);
ref = IAMMultiMediaStream_Release(mmstream);
......@@ -1559,9 +1559,9 @@ static void test_initialize(void)
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_TRANSFORM, 0, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_WRITE, 0, NULL);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ret_graph = (IGraphBuilder *)0xdeadbeef;
hr = IAMMultiMediaStream_GetFilterGraph(mmstream, &ret_graph);
......@@ -1573,7 +1573,7 @@ static void test_initialize(void)
type = 0xdeadbeef;
hr = IMediaStream_GetInformation(stream, NULL, &type);
ok(hr == S_OK, "Got hr %#x.\n", hr);
todo_wine ok(type == STREAMTYPE_TRANSFORM, "Got type %u.\n", type);
ok(type == STREAMTYPE_TRANSFORM, "Got type %u.\n", type);
IMediaStream_Release(stream);
ref = IAMMultiMediaStream_Release(mmstream);
......@@ -1651,9 +1651,9 @@ static void test_initialize(void)
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_WRITE, 0, NULL);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_TRANSFORM, 0, NULL);
todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
IMediaStreamFilter_Release(filter);
ref = IAMMultiMediaStream_Release(mmstream);
......
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