From dc1a1ae450f1119b1f5714ed99b6049343676293 Mon Sep 17 00:00:00 2001 From: Zebediah Figura Date: Mon, 8 Nov 2021 15:24:29 -0600 Subject: [PATCH] winegstreamer: Implement INSSBuffer::GetBuffer(). Signed-off-by: Zebediah Figura Signed-off-by: Alexandre Julliard --- dlls/winegstreamer/wm_reader.c | 8 ++++++-- dlls/wmvcore/tests/wmvcore.c | 18 ++++++++++++++++-- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 12d1f04c270..2de0610165d 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -243,8 +243,12 @@ static HRESULT WINAPI buffer_GetMaxLength(INSSBuffer *iface, DWORD *size) static HRESULT WINAPI buffer_GetBuffer(INSSBuffer *iface, BYTE **data) { - FIXME("iface %p, data %p, stub!\n", iface, data); - return E_NOTIMPL; + struct buffer *buffer = impl_from_INSSBuffer(iface); + + TRACE("buffer %p, data %p.\n", buffer, data); + + *data = buffer->data; + return S_OK; } static HRESULT WINAPI buffer_GetBufferAndLength(INSSBuffer *iface, BYTE **data, DWORD *size) diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c index 0e7c6380c92..685dd92e27e 100644 --- a/dlls/wmvcore/tests/wmvcore.c +++ b/dlls/wmvcore/tests/wmvcore.c @@ -602,9 +602,9 @@ static void test_sync_reader_streaming(void) IWMProfile *profile; QWORD pts, duration; INSSBuffer *sample; + BYTE *data, *data2; HANDLE file; HRESULT hr; - BYTE *data; BOOL ret; file = CreateFileW(filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0); @@ -677,6 +677,11 @@ static void test_sync_reader_streaming(void) { hr = INSSBuffer_GetBufferAndLength(sample, &data, &size); ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = INSSBuffer_GetBuffer(sample, &data2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(data2 == data, "Data pointers didn't match.\n"); + ref = INSSBuffer_Release(sample); ok(!ref, "Got outstanding refcount %d.\n", ref); @@ -737,6 +742,11 @@ static void test_sync_reader_streaming(void) { hr = INSSBuffer_GetBufferAndLength(sample, &data, &size); ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = INSSBuffer_GetBuffer(sample, &data2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(data2 == data, "Data pointers didn't match.\n"); + ref = INSSBuffer_Release(sample); ok(!ref, "Got outstanding refcount %d.\n", ref); } @@ -1183,9 +1193,9 @@ static HRESULT WINAPI callback_OnSample(IWMReaderCallback *iface, DWORD output, QWORD time, QWORD duration, DWORD flags, INSSBuffer *sample, void *context) { struct callback *callback = impl_from_IWMReaderCallback(iface); + BYTE *data, *data2; HRESULT hr; DWORD size; - BYTE *data; if (winetest_debug > 1) trace("%u: %04x: IWMReaderCallback::OnSample(output %u, time %I64u, duration %I64u, flags %#x)\n", @@ -1196,6 +1206,10 @@ static HRESULT WINAPI callback_OnSample(IWMReaderCallback *iface, DWORD output, hr = INSSBuffer_GetBufferAndLength(sample, &data, &size); ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = INSSBuffer_GetBuffer(sample, &data2); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(data2 == data, "Data pointers didn't match.\n"); + ok(callback->got_started > 0, "Got %u WMT_STARTED callbacks.\n", callback->got_started); ok(!callback->got_eof, "Got %u WMT_EOF callbacks.\n", callback->got_eof); ++callback->got_sample;