Commit b66d0ed6 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

quartz/tests: Add some tests for end-of-stream notifications on the VMR9.

parent 3cad37a6
...@@ -1228,6 +1228,145 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control ...@@ -1228,6 +1228,145 @@ static void test_flushing(IPin *pin, IMemInputPin *input, IMediaControl *control
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
} }
static unsigned int check_ec_complete(IMediaEvent *eventsrc, DWORD timeout)
{
LONG_PTR param1, param2;
unsigned int ret = 0;
HRESULT hr;
LONG code;
while ((hr = IMediaEvent_GetEvent(eventsrc, &code, &param1, &param2, timeout)) == S_OK)
{
if (code == EC_COMPLETE)
{
ok(param1 == S_OK, "Got param1 %#lx.\n", param1);
ok(!param2, "Got param2 %#lx.\n", param2);
ret++;
}
IMediaEvent_FreeEventParams(eventsrc, code, param1, param2);
timeout = 0;
}
ok(hr == E_ABORT, "Got hr %#x.\n", hr);
return ret;
}
static void test_eos(IPin *pin, IMemInputPin *input, IMediaControl *control)
{
IMediaEvent *eventsrc;
OAFilterState state;
HRESULT hr;
BOOL ret;
IMediaControl_QueryInterface(control, &IID_IMediaEvent, (void **)&eventsrc);
commit_allocator(input);
hr = IMediaControl_Pause(control);
ok(hr == S_FALSE, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
hr = IPin_EndOfStream(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaControl_GetState(control, 1000, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
hr = join_thread(send_frame(input));
todo_wine ok(hr == E_UNEXPECTED, "Got hr %#x.\n", hr);
hr = IMediaControl_Run(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
todo_wine ok(ret == 1, "Expected EC_COMPLETE.\n");
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
/* We do not receive an EC_COMPLETE notification until the last sample is
* done rendering. */
commit_allocator(input);
hr = IMediaControl_Run(control);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = join_thread(send_frame(input));
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaControl_GetState(control, 1000, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
hr = IPin_EndOfStream(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
ret = check_ec_complete(eventsrc, 1600);
todo_wine ok(ret == 1, "Expected EC_COMPLETE.\n");
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
/* Test sending EOS while flushing. */
commit_allocator(input);
hr = IMediaControl_Run(control);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = join_thread(send_frame(input));
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IPin_BeginFlush(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IPin_EndOfStream(pin);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = IPin_EndFlush(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
/* Test sending EOS and then flushing or stopping. */
commit_allocator(input);
hr = IMediaControl_Run(control);
todo_wine ok(hr == S_FALSE, "Got hr %#x.\n", hr);
hr = join_thread(send_frame(input));
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMediaControl_GetState(control, 1000, &state);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IPin_EndOfStream(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
todo_wine ok(!ret, "Got unexpected EC_COMPLETE.\n");
hr = IPin_BeginFlush(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IPin_EndFlush(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = join_thread(send_frame(input));
ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IPin_EndOfStream(pin);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
hr = IMediaControl_Stop(control);
ok(hr == S_OK, "Got hr %#x.\n", hr);
ret = check_ec_complete(eventsrc, 0);
ok(!ret, "Got unexpected EC_COMPLETE.\n");
IMediaEvent_Release(eventsrc);
}
static void test_sample_time(IPin *pin, IMemInputPin *input, IMediaControl *control) static void test_sample_time(IPin *pin, IMemInputPin *input, IMediaControl *control)
{ {
OAFilterState state; OAFilterState state;
...@@ -1521,6 +1660,7 @@ static void test_connect_pin(void) ...@@ -1521,6 +1660,7 @@ static void test_connect_pin(void)
test_filter_state(input, control); test_filter_state(input, control);
test_flushing(pin, input, control); test_flushing(pin, input, control);
test_eos(pin, input, control);
test_sample_time(pin, input, control); test_sample_time(pin, input, control);
test_current_image(filter, input, control, &vih.bmiHeader); test_current_image(filter, input, control, &vih.bmiHeader);
......
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