amstream: Support the event parameter in IDirectDrawStreamSample::Update.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50628
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:
Anton Baskanov 2021-04-21 12:53:34 +07:00 committed by Alexandre Julliard
parent 3088ce35cb
commit b8a646f499
2 changed files with 12 additions and 17 deletions

View File

@ -77,6 +77,7 @@ struct ddraw_sample
STREAM_TIME end_time; STREAM_TIME end_time;
BOOL continuous_update; BOOL continuous_update;
CONDITION_VARIABLE update_cv; CONDITION_VARIABLE update_cv;
HANDLE external_event;
struct list entry; struct list entry;
HRESULT update_hr; HRESULT update_hr;
@ -91,6 +92,8 @@ static void remove_queued_update(struct ddraw_sample *sample)
sample->busy = FALSE; sample->busy = FALSE;
list_remove(&sample->entry); list_remove(&sample->entry);
WakeConditionVariable(&sample->update_cv); WakeConditionVariable(&sample->update_cv);
if (sample->external_event)
SetEvent(sample->external_event);
} }
static void flush_update_queue(struct ddraw_stream *stream, HRESULT update_hr) static void flush_update_queue(struct ddraw_stream *stream, HRESULT update_hr)
@ -1596,12 +1599,6 @@ static HRESULT WINAPI ddraw_sample_Update(IDirectDrawStreamSample *iface,
return E_NOTIMPL; return E_NOTIMPL;
} }
if (event)
{
FIXME("Event parameter support is not implemented!\n");
return E_NOTIMPL;
}
EnterCriticalSection(&sample->parent->cs); EnterCriticalSection(&sample->parent->cs);
if (sample->parent->state != State_Running) if (sample->parent->state != State_Running)
@ -1625,10 +1622,11 @@ static HRESULT WINAPI ddraw_sample_Update(IDirectDrawStreamSample *iface,
sample->update_hr = MS_S_NOUPDATE; sample->update_hr = MS_S_NOUPDATE;
sample->busy = TRUE; sample->busy = TRUE;
sample->external_event = event;
list_add_tail(&sample->parent->update_queue, &sample->entry); list_add_tail(&sample->parent->update_queue, &sample->entry);
WakeConditionVariable(&sample->parent->update_queued_cv); WakeConditionVariable(&sample->parent->update_queued_cv);
if (flags & SSUPDATE_ASYNC) if ((flags & SSUPDATE_ASYNC) || event)
{ {
LeaveCriticalSection(&sample->parent->cs); LeaveCriticalSection(&sample->parent->cs);
return MS_S_PENDING; return MS_S_PENDING;

View File

@ -8512,20 +8512,17 @@ static void test_ddrawstreamsample_update(void)
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IDirectDrawStreamSample_Update(stream_sample, 0, event, NULL, 0); hr = IDirectDrawStreamSample_Update(stream_sample, 0, event, NULL, 0);
todo_wine ok(hr == MS_S_PENDING, "Got hr %#x.\n", hr); ok(hr == MS_S_PENDING, "Got hr %#x.\n", hr);
ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n"); ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n");
if (hr == MS_S_PENDING) media_sample = ammediastream_allocate_sample(&source, test_data, sizeof(test_data));
{ hr = IMemInputPin_Receive(source.source.pMemInputPin, media_sample);
media_sample = ammediastream_allocate_sample(&source, test_data, sizeof(test_data)); ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IMemInputPin_Receive(source.source.pMemInputPin, media_sample); ref = IMediaSample_Release(media_sample);
ok(hr == S_OK, "Got hr %#x.\n", hr); ok(!ref, "Got outstanding refcount %d.\n", ref);
ref = IMediaSample_Release(media_sample);
ok(!ref, "Got outstanding refcount %d.\n", ref);
}
todo_wine ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n"); ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n");
hr = IDirectDrawStreamSample_Update(stream_sample, SSUPDATE_ASYNC, NULL, NULL, 0); hr = IDirectDrawStreamSample_Update(stream_sample, SSUPDATE_ASYNC, NULL, NULL, 0);
ok(hr == MS_S_PENDING, "Got hr %#x.\n", hr); ok(hr == MS_S_PENDING, "Got hr %#x.\n", hr);