Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/amstream/tests/amstream.c | 82 ++++++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+)
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 182fb06a082..56dc8003719 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -2961,6 +2961,87 @@ static void test_media_types(void) ok(!ref, "Got outstanding refcount %d.\n", ref); }
+static void test_get_end_of_stream_event_handle(void) +{ + IAMMultiMediaStream *mmstream = create_ammultimediastream(); + IMediaStreamFilter *filter; + struct testfilter source; + IGraphBuilder *graph; + IMediaStream *stream; + HANDLE event; + HRESULT hr; + ULONG ref; + IPin *pin; + + hr = IAMMultiMediaStream_Initialize(mmstream, STREAMTYPE_READ, 0, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IAMMultiMediaStream_GetFilter(mmstream, &filter); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(!!filter, "Expected non-null filter.\n"); + hr = IAMMultiMediaStream_AddMediaStream(mmstream, NULL, &MSPID_PrimaryVideo, 0, &stream); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IMediaStream_QueryInterface(stream, &IID_IPin, (void **)&pin); + 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, "Expected non-NULL graph.\n"); + testfilter_init(&source); + source.IMediaSeeking_iface.lpVtbl = &testsource_seeking_vtbl; + hr = IGraphBuilder_AddFilter(graph, &source.filter.IBaseFilter_iface, NULL); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IAMMultiMediaStream_GetEndOfStreamEventHandle(mmstream, NULL); + todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + + event = INVALID_HANDLE_VALUE; + hr = IAMMultiMediaStream_GetEndOfStreamEventHandle(mmstream, &event); + todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IGraphBuilder_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &rgb32_mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IMediaStreamFilter_SupportSeeking(filter, TRUE); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n"); + + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n"); + + hr = IPin_EndOfStream(pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + todo_wine ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n"); + + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + todo_wine ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n"); + + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ok(WaitForSingleObject(event, 0) == WAIT_TIMEOUT, "Event should not be signaled.\n"); + + hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + IGraphBuilder_Disconnect(graph, pin); + IGraphBuilder_Disconnect(graph, &source.source.pin.IPin_iface); + + ref = IAMMultiMediaStream_Release(mmstream); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IGraphBuilder_Release(graph); + ok(!ref, "Got outstanding refcount %d.\n", ref); + ref = IMediaStreamFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IPin_Release(pin); + ref = IMediaStream_Release(stream); + ok(!ref, "Got outstanding refcount %d.\n", ref); +} + static IUnknown *create_audio_data(void) { IUnknown *audio_data = NULL; @@ -9301,6 +9382,7 @@ START_TEST(amstream) test_set_state(); test_enum_media_types(); test_media_types(); + test_get_end_of_stream_event_handle();
test_avi_path = load_resource(L"test.avi");
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=34746 Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/amstream/multimedia.c | 13 +++++++++---- dlls/amstream/tests/amstream.c | 8 ++++---- 2 files changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/amstream/multimedia.c b/dlls/amstream/multimedia.c index b34634d89d2..6bac95a243b 100644 --- a/dlls/amstream/multimedia.c +++ b/dlls/amstream/multimedia.c @@ -207,13 +207,18 @@ static HRESULT WINAPI multimedia_stream_Seek(IAMMultiMediaStream *iface, STREAM_ return IMediaSeeking_SetPositions(This->media_seeking, &seek_time, AM_SEEKING_AbsolutePositioning, NULL, AM_SEEKING_NoPositioning); }
-static HRESULT WINAPI multimedia_stream_GetEndOfStream(IAMMultiMediaStream *iface, HANDLE *phEOS) +static HRESULT WINAPI multimedia_stream_GetEndOfStream(IAMMultiMediaStream *iface, HANDLE *eos) { - struct multimedia_stream *This = impl_from_IAMMultiMediaStream(iface); + struct multimedia_stream *mmstream = impl_from_IAMMultiMediaStream(iface);
- FIXME("(%p/%p)->(%p) stub!\n", This, iface, phEOS); + TRACE("mmstream %p, eos %p.\n", mmstream, eos);
- return E_NOTIMPL; + if (!eos) + return E_POINTER; + + *eos = (HANDLE)mmstream->event; + + return S_OK; }
static HRESULT create_graph(struct multimedia_stream *mmstream, IGraphBuilder *graph) diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 56dc8003719..5226a072364 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -2991,11 +2991,11 @@ static void test_get_end_of_stream_event_handle(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IAMMultiMediaStream_GetEndOfStreamEventHandle(mmstream, NULL); - todo_wine ok(hr == E_POINTER, "Got hr %#x.\n", hr); + ok(hr == E_POINTER, "Got hr %#x.\n", hr);
event = INVALID_HANDLE_VALUE; hr = IAMMultiMediaStream_GetEndOfStreamEventHandle(mmstream, &event); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IGraphBuilder_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &rgb32_mt); ok(hr == S_OK, "Got hr %#x.\n", hr); @@ -3013,12 +3013,12 @@ static void test_get_end_of_stream_event_handle(void) hr = IPin_EndOfStream(pin); ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n"); + ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n");
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_STOP); ok(hr == S_OK, "Got hr %#x.\n", hr);
- todo_wine ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n"); + ok(WaitForSingleObject(event, 0) == 0, "Event should be signaled.\n");
hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN); ok(hr == S_OK, "Got hr %#x.\n", hr);
Signed-off-by: Zebediah Figura z.figura12@gmail.com
Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/amstream/tests/amstream.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+)
diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index 5226a072364..ceb72c720ab 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -8511,6 +8511,22 @@ static void test_ddrawstreamsample_update(void) hr = IAMMultiMediaStream_SetState(mmstream, STREAMSTATE_RUN); ok(hr == S_OK, "Got hr %#x.\n", hr);
+ hr = IDirectDrawStreamSample_Update(stream_sample, 0, event, NULL, 0); + todo_wine ok(hr == MS_S_PENDING, "Got hr %#x.\n", hr); + + 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); + ok(hr == S_OK, "Got hr %#x.\n", hr); + 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"); + hr = IDirectDrawStreamSample_Update(stream_sample, SSUPDATE_ASYNC, NULL, NULL, 0); ok(hr == MS_S_PENDING, "Got hr %#x.\n", hr); EXPECT_REF(stream_sample, 1);
Signed-off-by: Zebediah Figura z.figura12@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=50628 Signed-off-by: Anton Baskanov baskanov@gmail.com --- dlls/amstream/ddrawstream.c | 12 +++++------- dlls/amstream/tests/amstream.c | 17 +++++++---------- 2 files changed, 12 insertions(+), 17 deletions(-)
diff --git a/dlls/amstream/ddrawstream.c b/dlls/amstream/ddrawstream.c index b1ef12cb524..150e622ad33 100644 --- a/dlls/amstream/ddrawstream.c +++ b/dlls/amstream/ddrawstream.c @@ -77,6 +77,7 @@ struct ddraw_sample STREAM_TIME end_time; BOOL continuous_update; CONDITION_VARIABLE update_cv; + HANDLE external_event;
struct list entry; HRESULT update_hr; @@ -91,6 +92,8 @@ static void remove_queued_update(struct ddraw_sample *sample) sample->busy = FALSE; list_remove(&sample->entry); WakeConditionVariable(&sample->update_cv); + if (sample->external_event) + SetEvent(sample->external_event); }
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; }
- if (event) - { - FIXME("Event parameter support is not implemented!\n"); - return E_NOTIMPL; - } - EnterCriticalSection(&sample->parent->cs);
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->busy = TRUE; + sample->external_event = event; list_add_tail(&sample->parent->update_queue, &sample->entry); WakeConditionVariable(&sample->parent->update_queued_cv);
- if (flags & SSUPDATE_ASYNC) + if ((flags & SSUPDATE_ASYNC) || event) { LeaveCriticalSection(&sample->parent->cs); return MS_S_PENDING; diff --git a/dlls/amstream/tests/amstream.c b/dlls/amstream/tests/amstream.c index ceb72c720ab..db2d6e977ca 100644 --- a/dlls/amstream/tests/amstream.c +++ b/dlls/amstream/tests/amstream.c @@ -8512,20 +8512,17 @@ static void test_ddrawstreamsample_update(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
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");
- if (hr == MS_S_PENDING) - { - media_sample = ammediastream_allocate_sample(&source, test_data, sizeof(test_data)); - hr = IMemInputPin_Receive(source.source.pMemInputPin, media_sample); - ok(hr == S_OK, "Got hr %#x.\n", hr); - ref = IMediaSample_Release(media_sample); - ok(!ref, "Got outstanding refcount %d.\n", ref); - } + media_sample = ammediastream_allocate_sample(&source, test_data, sizeof(test_data)); + hr = IMemInputPin_Receive(source.source.pMemInputPin, media_sample); + ok(hr == S_OK, "Got hr %#x.\n", hr); + 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); ok(hr == MS_S_PENDING, "Got hr %#x.\n", hr);
Signed-off-by: Zebediah Figura z.figura12@gmail.com