From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/wm_asyncreader.c | 127 ++++++++++++++++++++++++++++ 1 file changed, 127 insertions(+)
diff --git a/dlls/winegstreamer/wm_asyncreader.c b/dlls/winegstreamer/wm_asyncreader.c index 84742d2f40f..089c96deddf 100644 --- a/dlls/winegstreamer/wm_asyncreader.c +++ b/dlls/winegstreamer/wm_asyncreader.c @@ -70,6 +70,7 @@ struct async_reader CRITICAL_SECTION cs;
IWMReaderCallbackAdvanced *callback_advanced; + IWMReaderAllocatorEx *allocator; IWMReaderCallback *callback; void *context;
@@ -87,6 +88,125 @@ struct async_reader QWORD user_time; };
+struct allocator +{ + IWMReaderAllocatorEx IWMReaderAllocatorEx_iface; + LONG refcount; + + IWMReaderCallbackAdvanced *callback; +}; + +static struct allocator *impl_from_IWMReaderAllocatorEx(IWMReaderAllocatorEx *iface) +{ + return CONTAINING_RECORD(iface, struct allocator, IWMReaderAllocatorEx_iface); +} + +static HRESULT WINAPI allocator_QueryInterface(IWMReaderAllocatorEx *iface, REFIID iid, void **out) +{ + struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface); + + TRACE("iface %p, iid %s, out %p.\n", iface, debugstr_guid(iid), out); + + if (IsEqualIID(iid, &IID_IUnknown) + || IsEqualIID(iid, &IID_IWMReaderAllocatorEx)) + *out = &allocator->IWMReaderAllocatorEx_iface; + else + { + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(iid)); + return E_NOINTERFACE; + } + + IUnknown_AddRef((IUnknown *)*out); + return S_OK; +} + +static ULONG WINAPI allocator_AddRef(IWMReaderAllocatorEx *iface) +{ + struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface); + ULONG refcount = InterlockedIncrement(&allocator->refcount); + TRACE("iface %p increasing refcount to %lu.\n", iface, refcount); + return refcount; +} + +static ULONG WINAPI allocator_Release(IWMReaderAllocatorEx *iface) +{ + struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface); + ULONG refcount = InterlockedDecrement(&allocator->refcount); + + TRACE("iface %p decreasing refcount to %lu.\n", iface, refcount); + + if (!refcount) + { + if (allocator->callback) + IWMReaderCallbackAdvanced_Release(allocator->callback); + free(allocator); + } + + return refcount; +} + +static HRESULT WINAPI allocator_AllocateForStreamEx(IWMReaderAllocatorEx *iface, + WORD stream_number, DWORD size, INSSBuffer **sample, DWORD flags, + QWORD pts, QWORD duration, void *context) +{ + struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface); + + TRACE("iface %p, stream_number %u, size %#lx, sample %p, flags %#lx, pts %I64d, duration %I64d, context %p.\n", + iface, stream_number, size, sample, flags, pts, duration, context); + + if (allocator->callback) + return IWMReaderCallbackAdvanced_AllocateForStream(allocator->callback, + stream_number, size, sample, context); + + return E_NOTIMPL; +} + +static HRESULT WINAPI allocator_AllocateForOutputEx(IWMReaderAllocatorEx *iface, + DWORD output, DWORD size, INSSBuffer **sample, DWORD flags, + QWORD pts, QWORD duration, void *context) +{ + struct allocator *allocator = impl_from_IWMReaderAllocatorEx(iface); + + TRACE("iface %p, output %lu, size %#lx, sample %p, flags %#lx, pts %I64d, duration %I64d, context %p.\n", + iface, output, size, sample, flags, pts, duration, context); + + if (allocator->callback) + return IWMReaderCallbackAdvanced_AllocateForOutput(allocator->callback, + output, size, sample, context); + + return E_NOTIMPL; +} + +static const IWMReaderAllocatorExVtbl allocator_vtbl = +{ + allocator_QueryInterface, + allocator_AddRef, + allocator_Release, + allocator_AllocateForStreamEx, + allocator_AllocateForOutputEx, +}; + +static HRESULT allocator_create(IWMReaderCallback *callback, IWMReaderAllocatorEx **out) +{ + struct allocator *allocator; + HRESULT hr; + + if (!(allocator = calloc(1, sizeof(*allocator)))) + return E_OUTOFMEMORY; + allocator->IWMReaderAllocatorEx_iface.lpVtbl = &allocator_vtbl; + allocator->refcount = 1; + + if (FAILED(hr = IWMReaderCallback_QueryInterface(callback, + &IID_IWMReaderCallbackAdvanced, (void **)&allocator->callback))) + { + WARN("Failed to retrieve IWMReaderCallbackAdvanced interface, hr %#lx\n", hr); + allocator->callback = NULL; + } + + *out = &allocator->IWMReaderAllocatorEx_iface; + return S_OK; +} + static REFERENCE_TIME get_current_time(const struct async_reader *reader) { LARGE_INTEGER time; @@ -306,6 +426,10 @@ static void async_reader_close(struct async_reader *reader) free(op); }
+ if (reader->allocator) + IWMReaderAllocatorEx_Release(reader->allocator); + reader->allocator = NULL; + if (reader->callback_advanced) IWMReaderCallbackAdvanced_Release(reader->callback_advanced); reader->callback_advanced = NULL; @@ -323,6 +447,9 @@ static HRESULT async_reader_open(struct async_reader *reader, IWMReaderCallback IWMReaderCallback_AddRef((reader->callback = callback)); reader->context = context;
+ if (FAILED(hr = allocator_create(reader->callback, &reader->allocator))) + goto error; + if (FAILED(hr = IWMReaderCallback_QueryInterface(callback, &IID_IWMReaderCallbackAdvanced, (void **)&reader->callback_advanced))) {
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/gst_private.h | 2 -- dlls/winegstreamer/wm_asyncreader.c | 5 ++--- dlls/winegstreamer/wm_reader.c | 21 --------------------- 3 files changed, 2 insertions(+), 26 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index fa93ce969c7..67df97d0c84 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -151,7 +151,6 @@ struct wm_stream WMT_STREAM_SELECTION selection; WORD index; bool eos; - bool allocate_output; bool allocate_stream; /* Note that we only pretend to read compressed samples, and instead output * uncompressed samples regardless of whether we are configured to read @@ -194,7 +193,6 @@ struct wm_reader *wm_reader_from_sync_reader_inner(IUnknown *inner);
HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackAdvanced *callback_advanced, WORD stream_number, INSSBuffer **ret_sample, QWORD *pts, QWORD *duration, DWORD *flags, WORD *ret_stream_number); -HRESULT wm_reader_set_allocate_for_output(struct wm_reader *reader, DWORD output, BOOL allocate); HRESULT wm_reader_set_allocate_for_stream(struct wm_reader *reader, WORD stream_number, BOOL allocate);
#endif /* __GST_PRIVATE_INCLUDED__ */ diff --git a/dlls/winegstreamer/wm_asyncreader.c b/dlls/winegstreamer/wm_asyncreader.c index 089c96deddf..fc0090f01c6 100644 --- a/dlls/winegstreamer/wm_asyncreader.c +++ b/dlls/winegstreamer/wm_asyncreader.c @@ -870,14 +870,13 @@ static HRESULT WINAPI WMReaderAdvanced_GetReceiveStreamSamples(IWMReaderAdvanced return E_NOTIMPL; }
-static HRESULT WINAPI WMReaderAdvanced_SetAllocateForOutput(IWMReaderAdvanced6 *iface, - DWORD output, BOOL allocate) +static HRESULT WINAPI WMReaderAdvanced_SetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output, BOOL allocate) { struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
TRACE("reader %p, output %lu, allocate %d.\n", reader, output, allocate);
- return wm_reader_set_allocate_for_output(reader->wm_reader, output, allocate); + return IWMSyncReader2_SetAllocateForOutput(reader->reader, output, allocate ? reader->allocator : NULL); }
static HRESULT WINAPI WMReaderAdvanced_GetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output_num, BOOL *allocate) diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index bd6d9064171..89328d1443a 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1629,9 +1629,6 @@ HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackA else if (callback_advanced && stream->read_compressed && stream->allocate_stream) hr = IWMReaderCallbackAdvanced_AllocateForStream(callback_advanced, stream->index + 1, wg_buffer.size, &sample, NULL); - else if (callback_advanced && !stream->read_compressed && stream->allocate_output) - hr = IWMReaderCallbackAdvanced_AllocateForOutput(callback_advanced, - stream->index, wg_buffer.size, &sample, NULL); /* FIXME: Should these be pooled? */ else if (!(object = calloc(1, offsetof(struct buffer, data[wg_buffer.size])))) hr = E_OUTOFMEMORY; @@ -1690,24 +1687,6 @@ HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackA } }
-HRESULT wm_reader_set_allocate_for_output(struct wm_reader *reader, DWORD output, BOOL allocate) -{ - struct wm_stream *stream; - - EnterCriticalSection(&reader->cs); - - if (!(stream = get_stream_by_output_number(reader, output))) - { - LeaveCriticalSection(&reader->cs); - return E_INVALIDARG; - } - - stream->allocate_output = !!allocate; - - LeaveCriticalSection(&reader->cs); - return S_OK; -} - HRESULT wm_reader_set_allocate_for_stream(struct wm_reader *reader, WORD stream_number, BOOL allocate) { struct wm_stream *stream;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/wm_asyncreader.c | 14 ++++++++++--- dlls/wmvcore/tests/wmvcore.c | 32 ++++++++++++----------------- 2 files changed, 24 insertions(+), 22 deletions(-)
diff --git a/dlls/winegstreamer/wm_asyncreader.c b/dlls/winegstreamer/wm_asyncreader.c index fc0090f01c6..cd4979ee256 100644 --- a/dlls/winegstreamer/wm_asyncreader.c +++ b/dlls/winegstreamer/wm_asyncreader.c @@ -879,13 +879,21 @@ static HRESULT WINAPI WMReaderAdvanced_SetAllocateForOutput(IWMReaderAdvanced6 * return IWMSyncReader2_SetAllocateForOutput(reader->reader, output, allocate ? reader->allocator : NULL); }
-static HRESULT WINAPI WMReaderAdvanced_GetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output_num, BOOL *allocate) +static HRESULT WINAPI WMReaderAdvanced_GetAllocateForOutput(IWMReaderAdvanced6 *iface, DWORD output, BOOL *allocate) { struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface); + IWMReaderAllocatorEx *allocator; + HRESULT hr;
- FIXME("reader %p, output %lu, allocate %p, stub!\n", reader, output_num, allocate); + TRACE("reader %p, output %lu, allocate %p.\n", reader, output, allocate);
- return E_NOTIMPL; + if (FAILED(hr = IWMSyncReader2_GetAllocateForOutput(reader->reader, output, &allocator))) + return hr; + + if ((*allocate = allocator != NULL)) + IWMReaderAllocatorEx_Release(allocator); + + return hr; }
static HRESULT WINAPI WMReaderAdvanced_SetAllocateForStream(IWMReaderAdvanced6 *iface, diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c index 5ba280c3222..fc4b6ac390c 100644 --- a/dlls/wmvcore/tests/wmvcore.c +++ b/dlls/wmvcore/tests/wmvcore.c @@ -2505,15 +2505,13 @@ static void test_async_reader_allocate(IWMReader *reader, callback->allocated_samples = true;
hr = IWMReaderAdvanced2_GetAllocateForOutput(advanced, 0, &allocate); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - ok(!allocate, "Got allocate %d.\n", allocate); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(!allocate, "Got allocate %d.\n", allocate); hr = IWMReaderAdvanced2_GetAllocateForOutput(advanced, 1, &allocate); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - ok(!allocate, "Got allocate %d.\n", allocate); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(!allocate, "Got allocate %d.\n", allocate); hr = IWMReaderAdvanced2_GetAllocateForOutput(advanced, 2, &allocate); - todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
hr = IWMReaderAdvanced2_GetAllocateForStream(advanced, 0, &allocate); todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); @@ -2536,13 +2534,11 @@ static void test_async_reader_allocate(IWMReader *reader, ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
hr = IWMReaderAdvanced2_GetAllocateForOutput(advanced, 0, &allocate); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - ok(allocate == TRUE, "Got allocate %d.\n", allocate); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(allocate == TRUE, "Got allocate %d.\n", allocate); hr = IWMReaderAdvanced2_GetAllocateForOutput(advanced, 1, &allocate); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - ok(allocate == TRUE, "Got allocate %d.\n", allocate); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(allocate == TRUE, "Got allocate %d.\n", allocate);
hr = IWMReaderAdvanced2_GetAllocateForStream(advanced, 1, &allocate); todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); @@ -2572,13 +2568,11 @@ static void test_async_reader_allocate(IWMReader *reader, ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
hr = IWMReaderAdvanced2_GetAllocateForOutput(advanced, 0, &allocate); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - ok(!allocate, "Got allocate %d.\n", allocate); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(!allocate, "Got allocate %d.\n", allocate); hr = IWMReaderAdvanced2_GetAllocateForOutput(advanced, 1, &allocate); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - ok(!allocate, "Got allocate %d.\n", allocate); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(!allocate, "Got allocate %d.\n", allocate);
hr = IWMReaderAdvanced2_GetAllocateForStream(advanced, 1, &allocate); todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr);
Hi,
It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated.
The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=124590
Your paranoid android.
=== debian11 (32 bit fr report) ===
wmvcore: wmvcore.c:1663: Test failed: Stream 0: Format 1: Got hr 0xc00d0041. wmvcore.c:1680: Test failed: Stream 0: Format 1: Media types didn't match.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/gst_private.h | 2 -- dlls/winegstreamer/wm_asyncreader.c | 5 ++--- dlls/winegstreamer/wm_reader.c | 21 --------------------- 3 files changed, 2 insertions(+), 26 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 67df97d0c84..033cc008cff 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -151,7 +151,6 @@ struct wm_stream WMT_STREAM_SELECTION selection; WORD index; bool eos; - bool allocate_stream; /* Note that we only pretend to read compressed samples, and instead output * uncompressed samples regardless of whether we are configured to read * compressed samples. Rather, the behaviour of the reader objects differs @@ -193,6 +192,5 @@ struct wm_reader *wm_reader_from_sync_reader_inner(IUnknown *inner);
HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackAdvanced *callback_advanced, WORD stream_number, INSSBuffer **ret_sample, QWORD *pts, QWORD *duration, DWORD *flags, WORD *ret_stream_number); -HRESULT wm_reader_set_allocate_for_stream(struct wm_reader *reader, WORD stream_number, BOOL allocate);
#endif /* __GST_PRIVATE_INCLUDED__ */ diff --git a/dlls/winegstreamer/wm_asyncreader.c b/dlls/winegstreamer/wm_asyncreader.c index cd4979ee256..4d067dbb239 100644 --- a/dlls/winegstreamer/wm_asyncreader.c +++ b/dlls/winegstreamer/wm_asyncreader.c @@ -896,14 +896,13 @@ static HRESULT WINAPI WMReaderAdvanced_GetAllocateForOutput(IWMReaderAdvanced6 * return hr; }
-static HRESULT WINAPI WMReaderAdvanced_SetAllocateForStream(IWMReaderAdvanced6 *iface, - WORD stream_number, BOOL allocate) +static HRESULT WINAPI WMReaderAdvanced_SetAllocateForStream(IWMReaderAdvanced6 *iface, WORD stream_number, BOOL allocate) { struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface);
TRACE("reader %p, stream_number %u, allocate %d.\n", reader, stream_number, allocate);
- return wm_reader_set_allocate_for_stream(reader->wm_reader, stream_number, allocate); + return IWMSyncReader2_SetAllocateForStream(reader->reader, stream_number, allocate ? reader->allocator : NULL); }
static HRESULT WINAPI WMReaderAdvanced_GetAllocateForStream(IWMReaderAdvanced6 *iface, WORD output_num, BOOL *allocate) diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 89328d1443a..0c4f89a835e 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -1626,9 +1626,6 @@ HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackA else if (stream->read_compressed && stream->stream_allocator) hr = IWMReaderAllocatorEx_AllocateForStreamEx(stream->stream_allocator, stream->index + 1, wg_buffer.size, &sample, 0, 0, 0, NULL); - else if (callback_advanced && stream->read_compressed && stream->allocate_stream) - hr = IWMReaderCallbackAdvanced_AllocateForStream(callback_advanced, - stream->index + 1, wg_buffer.size, &sample, NULL); /* FIXME: Should these be pooled? */ else if (!(object = calloc(1, offsetof(struct buffer, data[wg_buffer.size])))) hr = E_OUTOFMEMORY; @@ -1687,24 +1684,6 @@ HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackA } }
-HRESULT wm_reader_set_allocate_for_stream(struct wm_reader *reader, WORD stream_number, BOOL allocate) -{ - struct wm_stream *stream; - - EnterCriticalSection(&reader->cs); - - if (!(stream = wm_reader_get_stream_by_stream_number(reader, stream_number))) - { - LeaveCriticalSection(&reader->cs); - return E_INVALIDARG; - } - - stream->allocate_stream = !!allocate; - - LeaveCriticalSection(&reader->cs); - return S_OK; -} - static struct wm_reader *impl_from_IUnknown(IUnknown *iface) { return CONTAINING_RECORD(iface, struct wm_reader, IUnknown_inner);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/wm_asyncreader.c | 18 +++++++++++---- dlls/wmvcore/tests/wmvcore.c | 34 ++++++++++++----------------- 2 files changed, 28 insertions(+), 24 deletions(-)
diff --git a/dlls/winegstreamer/wm_asyncreader.c b/dlls/winegstreamer/wm_asyncreader.c index 4d067dbb239..9f25d726a51 100644 --- a/dlls/winegstreamer/wm_asyncreader.c +++ b/dlls/winegstreamer/wm_asyncreader.c @@ -905,11 +905,21 @@ static HRESULT WINAPI WMReaderAdvanced_SetAllocateForStream(IWMReaderAdvanced6 * return IWMSyncReader2_SetAllocateForStream(reader->reader, stream_number, allocate ? reader->allocator : NULL); }
-static HRESULT WINAPI WMReaderAdvanced_GetAllocateForStream(IWMReaderAdvanced6 *iface, WORD output_num, BOOL *allocate) +static HRESULT WINAPI WMReaderAdvanced_GetAllocateForStream(IWMReaderAdvanced6 *iface, WORD stream_number, BOOL *allocate) { - struct async_reader *This = impl_from_IWMReaderAdvanced6(iface); - FIXME("(%p)->(%d %p)\n", This, output_num, allocate); - return E_NOTIMPL; + struct async_reader *reader = impl_from_IWMReaderAdvanced6(iface); + IWMReaderAllocatorEx *allocator; + HRESULT hr; + + TRACE("reader %p, stream_number %u, allocate %p.\n", reader, stream_number, allocate); + + if (FAILED(hr = IWMSyncReader2_GetAllocateForStream(reader->reader, stream_number, &allocator))) + return hr; + + if ((*allocate = allocator != NULL)) + IWMReaderAllocatorEx_Release(allocator); + + return hr; }
static HRESULT WINAPI WMReaderAdvanced_GetStatistics(IWMReaderAdvanced6 *iface, WM_READER_STATISTICS *statistics) diff --git a/dlls/wmvcore/tests/wmvcore.c b/dlls/wmvcore/tests/wmvcore.c index fc4b6ac390c..401856eb744 100644 --- a/dlls/wmvcore/tests/wmvcore.c +++ b/dlls/wmvcore/tests/wmvcore.c @@ -2514,17 +2514,15 @@ static void test_async_reader_allocate(IWMReader *reader, ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
hr = IWMReaderAdvanced2_GetAllocateForStream(advanced, 0, &allocate); - todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); hr = IWMReaderAdvanced2_GetAllocateForStream(advanced, 1, &allocate); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - ok(!allocate, "Got allocate %d.\n", allocate); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(!allocate, "Got allocate %d.\n", allocate); hr = IWMReaderAdvanced2_GetAllocateForStream(advanced, 2, &allocate); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - ok(!allocate, "Got allocate %d.\n", allocate); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(!allocate, "Got allocate %d.\n", allocate); hr = IWMReaderAdvanced2_GetAllocateForStream(advanced, 3, &allocate); - todo_wine ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr); + ok(hr == E_INVALIDARG, "Got hr %#lx.\n", hr);
hr = IWMReaderAdvanced2_SetAllocateForOutput(advanced, 0, TRUE); ok(hr == S_OK, "Got hr %#lx.\n", hr); @@ -2541,13 +2539,11 @@ static void test_async_reader_allocate(IWMReader *reader, ok(allocate == TRUE, "Got allocate %d.\n", allocate);
hr = IWMReaderAdvanced2_GetAllocateForStream(advanced, 1, &allocate); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - ok(!allocate, "Got allocate %d.\n", allocate); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(!allocate, "Got allocate %d.\n", allocate); hr = IWMReaderAdvanced2_GetAllocateForStream(advanced, 2, &allocate); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - ok(!allocate, "Got allocate %d.\n", allocate); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(!allocate, "Got allocate %d.\n", allocate);
run_async_reader(reader, advanced, callback);
@@ -2575,13 +2571,11 @@ static void test_async_reader_allocate(IWMReader *reader, ok(!allocate, "Got allocate %d.\n", allocate);
hr = IWMReaderAdvanced2_GetAllocateForStream(advanced, 1, &allocate); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - ok(allocate == TRUE, "Got allocate %d.\n", allocate); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(allocate == TRUE, "Got allocate %d.\n", allocate); hr = IWMReaderAdvanced2_GetAllocateForStream(advanced, 2, &allocate); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - if (hr == S_OK) - ok(allocate == TRUE, "Got allocate %d.\n", allocate); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(allocate == TRUE, "Got allocate %d.\n", allocate);
run_async_reader(reader, advanced, callback);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/winegstreamer/gst_private.h | 48 -------------------------- dlls/winegstreamer/wm_asyncreader.c | 16 ++++----- dlls/winegstreamer/wm_reader.c | 53 +++++++++++++++++++++++++---- 3 files changed, 53 insertions(+), 64 deletions(-)
diff --git a/dlls/winegstreamer/gst_private.h b/dlls/winegstreamer/gst_private.h index 033cc008cff..fed5766d3a4 100644 --- a/dlls/winegstreamer/gst_private.h +++ b/dlls/winegstreamer/gst_private.h @@ -143,54 +143,6 @@ HRESULT winegstreamer_stream_handler_create(REFIID riid, void **obj); HRESULT h264_decoder_create(REFIID riid, void **ret); HRESULT video_processor_create(REFIID riid, void **ret);
-struct wm_stream -{ - struct wm_reader *reader; - struct wg_parser_stream *wg_stream; - struct wg_format format; - WMT_STREAM_SELECTION selection; - WORD index; - bool eos; - /* Note that we only pretend to read compressed samples, and instead output - * uncompressed samples regardless of whether we are configured to read - * compressed samples. Rather, the behaviour of the reader objects differs - * in nontrivial ways depending on this field. */ - bool read_compressed; - - IWMReaderAllocatorEx *output_allocator; - IWMReaderAllocatorEx *stream_allocator; -}; - -struct wm_reader -{ - IUnknown IUnknown_inner; - IWMSyncReader2 IWMSyncReader2_iface; - IWMHeaderInfo3 IWMHeaderInfo3_iface; - IWMLanguageList IWMLanguageList_iface; - IWMPacketSize2 IWMPacketSize2_iface; - IWMProfile3 IWMProfile3_iface; - IWMReaderPlaylistBurn IWMReaderPlaylistBurn_iface; - IWMReaderTimecode IWMReaderTimecode_iface; - IUnknown *outer; - LONG refcount; - - CRITICAL_SECTION cs; - QWORD start_time; - - IStream *source_stream; - HANDLE file; - HANDLE read_thread; - bool read_thread_shutdown; - struct wg_parser *wg_parser; - - struct wm_stream *streams; - WORD stream_count; -}; - HRESULT WINAPI winegstreamer_create_wm_sync_reader(IUnknown *outer, void **out); -struct wm_reader *wm_reader_from_sync_reader_inner(IUnknown *inner); - -HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackAdvanced *callback_advanced, WORD stream_number, - INSSBuffer **ret_sample, QWORD *pts, QWORD *duration, DWORD *flags, WORD *ret_stream_number);
#endif /* __GST_PRIVATE_INCLUDED__ */ diff --git a/dlls/winegstreamer/wm_asyncreader.c b/dlls/winegstreamer/wm_asyncreader.c index 9f25d726a51..409ebeae1af 100644 --- a/dlls/winegstreamer/wm_asyncreader.c +++ b/dlls/winegstreamer/wm_asyncreader.c @@ -48,7 +48,7 @@ struct sample { INSSBuffer *buffer; QWORD pts, duration; - DWORD flags; + DWORD flags, output; WORD stream; };
@@ -65,7 +65,6 @@ struct async_reader LONG refcount;
IWMSyncReader2 *reader; - struct wm_reader *wm_reader;
CRITICAL_SECTION cs;
@@ -261,9 +260,9 @@ static void async_reader_deliver_sample(struct async_reader *reader, struct samp BOOL read_compressed; HRESULT hr;
- TRACE("reader %p, stream %u, pts %s, duration %s, flags %#lx, buffer %p.\n", - reader, sample->stream, debugstr_time(sample->pts), debugstr_time(sample->duration), - sample->flags, sample->buffer); + TRACE("reader %p, output %lu, stream %u, pts %s, duration %s, flags %#lx, buffer %p.\n", + reader, sample->output, sample->stream, debugstr_time(sample->pts), + debugstr_time(sample->duration), sample->flags, sample->buffer);
if (FAILED(hr = IWMSyncReader2_GetReadStreamSamples(reader->reader, sample->stream, &read_compressed))) @@ -274,7 +273,7 @@ static void async_reader_deliver_sample(struct async_reader *reader, struct samp hr = IWMReaderCallbackAdvanced_OnStreamSample(callback_advanced, sample->stream, sample->pts, sample->duration, sample->flags, sample->buffer, reader->context); else - hr = IWMReaderCallback_OnSample(callback, sample->stream - 1, sample->pts, sample->duration, + hr = IWMReaderCallback_OnSample(callback, sample->output, sample->pts, sample->duration, sample->flags, sample->buffer, reader->context); EnterCriticalSection(&reader->callback_cs);
@@ -295,8 +294,8 @@ static void callback_thread_run(struct async_reader *reader) struct sample sample;
LeaveCriticalSection(&reader->callback_cs); - hr = wm_reader_get_stream_sample(reader->wm_reader, callback_advanced, 0, &sample.buffer, - &sample.pts, &sample.duration, &sample.flags, &sample.stream); + hr = IWMSyncReader2_GetNextSample(reader->reader, 0, &sample.buffer, &sample.pts, + &sample.duration, &sample.flags, &sample.output, &sample.stream); EnterCriticalSection(&reader->callback_cs); if (hr != S_OK) break; @@ -1909,7 +1908,6 @@ HRESULT WINAPI winegstreamer_create_wm_async_reader(IWMReader **reader) (void **)&object->reader))) goto failed; IWMReader_Release(&object->IWMReader_iface); - object->wm_reader = wm_reader_from_sync_reader_inner(object->reader_inner);
InitializeCriticalSection(&object->cs); object->cs.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": async_reader.cs"); diff --git a/dlls/winegstreamer/wm_reader.c b/dlls/winegstreamer/wm_reader.c index 0c4f89a835e..0885f3c40fe 100644 --- a/dlls/winegstreamer/wm_reader.c +++ b/dlls/winegstreamer/wm_reader.c @@ -20,6 +20,50 @@
WINE_DEFAULT_DEBUG_CHANNEL(wmvcore);
+struct wm_stream +{ + struct wm_reader *reader; + struct wg_parser_stream *wg_stream; + struct wg_format format; + WMT_STREAM_SELECTION selection; + WORD index; + bool eos; + /* Note that we only pretend to read compressed samples, and instead output + * uncompressed samples regardless of whether we are configured to read + * compressed samples. Rather, the behaviour of the reader objects differs + * in nontrivial ways depending on this field. */ + bool read_compressed; + + IWMReaderAllocatorEx *output_allocator; + IWMReaderAllocatorEx *stream_allocator; +}; + +struct wm_reader +{ + IUnknown IUnknown_inner; + IWMSyncReader2 IWMSyncReader2_iface; + IWMHeaderInfo3 IWMHeaderInfo3_iface; + IWMLanguageList IWMLanguageList_iface; + IWMPacketSize2 IWMPacketSize2_iface; + IWMProfile3 IWMProfile3_iface; + IWMReaderPlaylistBurn IWMReaderPlaylistBurn_iface; + IWMReaderTimecode IWMReaderTimecode_iface; + IUnknown *outer; + LONG refcount; + + CRITICAL_SECTION cs; + QWORD start_time; + + IStream *source_stream; + HANDLE file; + HANDLE read_thread; + bool read_thread_shutdown; + struct wg_parser *wg_parser; + + struct wm_stream *streams; + WORD stream_count; +}; + static struct wm_stream *get_stream_by_output_number(struct wm_reader *reader, DWORD output) { if (output < reader->stream_count) @@ -1567,7 +1611,7 @@ static WORD get_earliest_buffer(struct wm_reader *reader, struct wg_parser_buffe return stream_number; }
-HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, IWMReaderCallbackAdvanced *callback_advanced, WORD stream_number, +static HRESULT wm_reader_get_stream_sample(struct wm_reader *reader, WORD stream_number, INSSBuffer **ret_sample, QWORD *pts, QWORD *duration, DWORD *flags, WORD *ret_stream_number) { struct wg_parser_stream *wg_stream; @@ -1863,7 +1907,7 @@ static HRESULT WINAPI reader_GetNextSample(IWMSyncReader2 *iface,
EnterCriticalSection(&reader->cs);
- hr = wm_reader_get_stream_sample(reader, NULL, stream_number, sample, pts, duration, flags, &stream_number); + hr = wm_reader_get_stream_sample(reader, stream_number, sample, pts, duration, flags, &stream_number); if (output_number && hr == S_OK) *output_number = stream_number - 1; if (ret_stream_number && (hr == S_OK || stream_number)) @@ -2514,11 +2558,6 @@ static const IWMSyncReader2Vtbl reader_vtbl = reader_GetAllocateForStream };
-struct wm_reader *wm_reader_from_sync_reader_inner(IUnknown *iface) -{ - return impl_from_IUnknown(iface); -} - HRESULT WINAPI winegstreamer_create_wm_sync_reader(IUnknown *outer, void **out) { struct wm_reader *object;
On Fri Sep 30 06:19:40 2022 +0000, **** wrote:
Marvin replied on the mailing list:
Hi, It looks like your patch introduced the new failures shown below. Please investigate and fix them before resubmitting your patch. If they are not new, fixing them anyway would help a lot. Otherwise please ask for the known failures list to be updated. The full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=124590 Your paranoid android. === debian11 (32 bit fr report) === wmvcore: wmvcore.c:1663: Test failed: Stream 0: Format 1: Got hr 0xc00d0041. wmvcore.c:1680: Test failed: Stream 0: Format 1: Media types didn't match.
I don't think this failure is related, anything else to do?
This merge request was approved by Zebediah Figura.