Signed-off-by: Zebediah Figura z.figura12@gmail.com --- Thanks to Henri Verbeet.
dlls/quartz/vmr9.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 928e98f6056..58a7e2b1218 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -627,7 +627,10 @@ static HRESULT WINAPI VMR9_GetStaticImage(BaseControlVideo *iface, LONG *size, L IDirect3DSurface9 *rt = NULL, *surface = NULL; D3DLOCKED_RECT locked_rect; IDirect3DDevice9 *device; + unsigned int row_size; BITMAPINFOHEADER bih; + LONG i, size_left; + char *dst; HRESULT hr;
TRACE("filter %p, size %d, image %p.\n", filter, *size, image); @@ -661,7 +664,20 @@ static HRESULT WINAPI VMR9_GetStaticImage(BaseControlVideo *iface, LONG *size, L if (FAILED(hr = IDirect3DSurface9_LockRect(surface, &locked_rect, NULL, D3DLOCK_READONLY))) goto out;
- memcpy(image, &bih, min(*size, sizeof(BITMAPINFOHEADER))); + size_left = *size; + memcpy(image, &bih, min(size_left, sizeof(BITMAPINFOHEADER))); + size_left -= sizeof(BITMAPINFOHEADER); + + dst = (char *)image + sizeof(BITMAPINFOHEADER); + row_size = bih.biWidth * bih.biBitCount / 8; + + for (i = 0; i < bih.biHeight && size_left > 0; ++i) + { + memcpy(dst, (char *)locked_rect.pBits + (i * locked_rect.Pitch), min(row_size, size_left)); + dst += row_size; + size_left -= row_size; + } + if (*size > sizeof(BITMAPINFOHEADER)) memcpy((char *)image + sizeof(BITMAPINFOHEADER), locked_rect.pBits, min(*size - sizeof(BITMAPINFOHEADER), bih.biSizeImage));
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gst_cbs.c | 9 ---- dlls/winegstreamer/gst_cbs.h | 5 --- dlls/winegstreamer/gstdemux.c | 81 ++++++++++------------------------- 3 files changed, 23 insertions(+), 72 deletions(-)
diff --git a/dlls/winegstreamer/gst_cbs.c b/dlls/winegstreamer/gst_cbs.c index e7a4b41d55f..679d87c52f5 100644 --- a/dlls/winegstreamer/gst_cbs.c +++ b/dlls/winegstreamer/gst_cbs.c @@ -227,15 +227,6 @@ void unknown_type_wrapper(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer call_cb(&cbdata); }
-void release_sample_wrapper(gpointer data) -{ - struct cb_data cbdata = { RELEASE_SAMPLE }; - - cbdata.u.release_sample_data.data = data; - - call_cb(&cbdata); -} - gboolean query_sink_wrapper(GstPad *pad, GstObject *parent, GstQuery *query) { struct cb_data cbdata = { QUERY_SINK }; diff --git a/dlls/winegstreamer/gst_cbs.h b/dlls/winegstreamer/gst_cbs.h index 46f8add57c4..a425671da76 100644 --- a/dlls/winegstreamer/gst_cbs.h +++ b/dlls/winegstreamer/gst_cbs.h @@ -42,7 +42,6 @@ enum CB_TYPE { REMOVED_DECODED_PAD, AUTOPLUG_BLACKLIST, UNKNOWN_TYPE, - RELEASE_SAMPLE, QUERY_SINK };
@@ -122,9 +121,6 @@ struct cb_data { GstCaps *caps; gpointer user; } unknown_type_data; - struct release_sample_data { - gpointer data; - } release_sample_data; struct query_sink_data { GstPad *pad; GstObject *parent; @@ -159,7 +155,6 @@ GstFlowReturn got_data_wrapper(GstPad *pad, GstObject *parent, GstBuffer *buf) D void removed_decoded_pad_wrapper(GstElement *bin, GstPad *pad, gpointer user) DECLSPEC_HIDDEN; GstAutoplugSelectResult autoplug_blacklist_wrapper(GstElement *bin, GstPad *pad, GstCaps *caps, GstElementFactory *fact, gpointer user) DECLSPEC_HIDDEN; void unknown_type_wrapper(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer user) DECLSPEC_HIDDEN; -void release_sample_wrapper(gpointer data) DECLSPEC_HIDDEN; void Gstreamer_transform_pad_added_wrapper(GstElement *filter, GstPad *pad, gpointer user) DECLSPEC_HIDDEN; gboolean query_sink_wrapper(GstPad *pad, GstObject *parent, GstQuery *query) DECLSPEC_HIDDEN;
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index 0b5fee30273..b62f44b6a13 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -97,8 +97,6 @@ static inline struct gstdemux *impl_from_strmbase_filter(struct strmbase_filter return CONTAINING_RECORD(iface, struct gstdemux, filter); }
-static const char *media_quark_string = "media-sample"; - static const WCHAR wcsInputPinName[] = {'i','n','p','u','t',' ','p','i','n',0}; static const IMediaSeekingVtbl GST_Seeking_Vtbl; static const IQualityControlVtbl GSTOutPin_QualityControl_Vtbl; @@ -744,21 +742,20 @@ static gboolean event_sink(GstPad *pad, GstObject *parent, GstEvent *event) } }
-static void release_sample(void *data) -{ - ULONG ret; - ret = IMediaSample_Release((IMediaSample *)data); - TRACE("Releasing %p returns %u\n", data, ret); -} - static DWORD CALLBACK push_data(LPVOID iface) { LONGLONG maxlen, curlen; struct gstdemux *This = iface; - IMediaSample *buf; - DWORD_PTR user; + GstMapInfo mapping; + GstBuffer *buffer; HRESULT hr;
+ if (!(buffer = gst_buffer_new_allocate(NULL, 16384, NULL))) + { + ERR("Failed to allocate memory.\n"); + return 0; + } + IBaseFilter_AddRef(&This->filter.IBaseFilter_iface);
if (!This->stop) @@ -768,51 +765,30 @@ static DWORD CALLBACK push_data(LPVOID iface)
TRACE("Starting..\n"); for (;;) { - REFERENCE_TIME tStart, tStop; ULONG len; - GstBuffer *gstbuf; - gsize bufsize; - BYTE *data; int ret;
- hr = IMemAllocator_GetBuffer(This->alloc, &buf, NULL, NULL, 0); - if (FAILED(hr)) - break; - if (This->nextofs >= maxlen) break; - len = IMediaSample_GetSize(buf); - if (This->nextofs + len > maxlen) - len = maxlen - This->nextofs; - - tStart = MEDIATIME_FROM_BYTES(This->nextofs); - tStop = tStart + MEDIATIME_FROM_BYTES(len); - IMediaSample_SetTime(buf, &tStart, &tStop); + len = min(16384, maxlen - This->nextofs);
- hr = IAsyncReader_Request(This->reader, buf, 0); - if (FAILED(hr)) { - IMediaSample_Release(buf); + if (!gst_buffer_map_range(buffer, -1, len, &mapping, GST_MAP_WRITE)) + { + ERR("Failed to map buffer.\n"); break; } - This->nextofs += len; - hr = IAsyncReader_WaitForNext(This->reader, -1, &buf, &user); - if (FAILED(hr) || !buf) { - if (buf) - IMediaSample_Release(buf); + hr = IAsyncReader_SyncRead(This->reader, This->nextofs, len, mapping.data); + gst_buffer_unmap(buffer, &mapping); + if (hr != S_OK) + { + ERR("Failed to read data, hr %#x.\n", hr); break; }
- IMediaSample_GetPointer(buf, &data); - bufsize = IMediaSample_GetActualDataLength(buf); - gstbuf = gst_buffer_new_wrapped_full(0, data, bufsize, 0, bufsize, buf, release_sample_wrapper); - IMediaSample_AddRef(buf); - gst_mini_object_set_qdata(GST_MINI_OBJECT(gstbuf), g_quark_from_static_string(media_quark_string), buf, release_sample_wrapper); - if (!gstbuf) { - IMediaSample_Release(buf); - break; - } - gstbuf->duration = gstbuf->pts = -1; - ret = gst_pad_push(This->my_src, gstbuf); + This->nextofs += len; + + buffer->duration = buffer->pts = -1; + ret = gst_pad_push(This->my_src, buffer); if (ret >= 0) hr = S_OK; else @@ -825,14 +801,9 @@ static DWORD CALLBACK push_data(LPVOID iface) break; }
- gst_pad_push_event(This->my_src, gst_event_new_eos()); + gst_buffer_unref(buffer);
- TRACE("Almost stopping.. %08x\n", hr); - do { - IAsyncReader_WaitForNext(This->reader, 0, &buf, &user); - if (buf) - IMediaSample_Release(buf); - } while (buf); + gst_pad_push_event(This->my_src, gst_event_new_eos());
TRACE("Stopping.. %08x\n", hr);
@@ -2332,12 +2303,6 @@ void CALLBACK perform_cb(TP_CALLBACK_INSTANCE *instance, void *user) unknown_type(data->bin, data->pad, data->caps, data->user); break; } - case RELEASE_SAMPLE: - { - struct release_sample_data *data = &cbdata->u.release_sample_data; - release_sample(data->data); - break; - } case QUERY_SINK: { struct query_sink_data *data = &cbdata->u.query_sink_data;
In particular, pass the correct buffer size for the format we have chosen.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48570 Fixes: f5a1e2bd87754a2822f2eb0e84291d787936d115 Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/winegstreamer/gstdemux.c | 91 ++++++++--------------------------- 1 file changed, 19 insertions(+), 72 deletions(-)
diff --git a/dlls/winegstreamer/gstdemux.c b/dlls/winegstreamer/gstdemux.c index b62f44b6a13..1337cd0a81c 100644 --- a/dlls/winegstreamer/gstdemux.c +++ b/dlls/winegstreamer/gstdemux.c @@ -57,7 +57,6 @@ struct gstdemux
struct strmbase_sink sink; IAsyncReader *reader; - IMemAllocator *alloc;
struct gstdemux_source **sources; unsigned int source_count; @@ -70,7 +69,6 @@ struct gstdemux GstPad *my_src, *their_sink; GstBus *bus; guint64 start, nextofs, nextpullofs, stop; - ALLOCATOR_PROPERTIES props; HANDLE no_more_pads_event, duration_event, error_event;
HANDLE push_thread; @@ -486,11 +484,6 @@ static gboolean setcaps_sink(GstPad *pad, GstCaps *caps) if (!amt_from_gst_caps(caps, &pin->mt)) return FALSE;
- if (IsEqualGUID(&pin->mt.formattype, &FORMAT_VideoInfo)) - { - VIDEOINFOHEADER *vih = (VIDEOINFOHEADER *)pin->mt.pbFormat; - filter->props.cbBuffer = max(filter->props.cbBuffer, vih->bmiHeader.biSizeImage); - } SetEvent(pin->caps_event); return TRUE; } @@ -1295,7 +1288,7 @@ static void unknown_type(GstElement *bin, GstPad *pad, GstCaps *caps, gpointer u g_free(strcaps); }
-static HRESULT GST_Connect(struct gstdemux *This, IPin *pConnectPin, ALLOCATOR_PROPERTIES *props) +static HRESULT GST_Connect(struct gstdemux *This, IPin *pConnectPin) { LONGLONG avail; GstStaticPadTemplate src_template = GST_STATIC_PAD_TEMPLATE( @@ -1304,7 +1297,6 @@ static HRESULT GST_Connect(struct gstdemux *This, IPin *pConnectPin, ALLOCATOR_P GST_PAD_ALWAYS, GST_STATIC_CAPS_ANY);
- This->props = *props; IAsyncReader_Length(This->reader, &This->filesize, &avail);
if (!This->bus) { @@ -1329,7 +1321,6 @@ static HRESULT GST_Connect(struct gstdemux *This, IPin *pConnectPin, ALLOCATOR_P return E_FAIL; This->initial = FALSE;
- *props = This->props; This->nextofs = This->nextpullofs = 0; return S_OK; } @@ -1378,9 +1369,6 @@ static void gstdemux_destroy(struct strmbase_filter *iface) assert(hr == S_OK); }
- if (filter->alloc) - IMemAllocator_Release(filter->alloc); - filter->alloc = NULL; if (filter->reader) IAsyncReader_Release(filter->reader); filter->reader = NULL; @@ -1529,46 +1517,16 @@ static HRESULT sink_query_accept(struct strmbase_pin *iface, const AM_MEDIA_TYPE static HRESULT gstdemux_sink_connect(struct strmbase_sink *iface, IPin *peer, const AM_MEDIA_TYPE *pmt) { struct gstdemux *filter = impl_from_strmbase_sink(iface); - IMemAllocator *allocator = NULL; - ALLOCATOR_PROPERTIES props; HRESULT hr = S_OK;
mark_wine_thread();
- props.cBuffers = 8; - props.cbBuffer = 16384; - props.cbAlign = 1; - props.cbPrefix = 0; - filter->reader = NULL; - filter->alloc = NULL; if (FAILED(hr = IPin_QueryInterface(peer, &IID_IAsyncReader, (void **)&filter->reader))) return hr;
- if (FAILED(hr = GST_Connect(filter, peer, &props))) - goto err; - - /* Some applications depend on IAsyncReader::RequestAllocator() passing a - * non-NULL preferred allocator. */ - hr = CoCreateInstance(&CLSID_MemoryAllocator, NULL, CLSCTX_INPROC, - &IID_IMemAllocator, (void **)&allocator); - if (FAILED(hr)) - goto err; - hr = IAsyncReader_RequestAllocator(filter->reader, allocator, &props, &filter->alloc); - IMemAllocator_Release(allocator); - if (FAILED(hr)) - { - WARN("Failed to get allocator, hr %#x.\n", hr); - goto err; - } - - if (FAILED(hr = IMemAllocator_Commit(filter->alloc))) - { - WARN("Failed to commit allocator, hr %#x.\n", hr); - IMemAllocator_Release(filter->alloc); - filter->alloc = NULL; + if (FAILED(hr = GST_Connect(filter, peer))) goto err; - }
return S_OK; err: @@ -1584,7 +1542,6 @@ static void gstdemux_sink_disconnect(struct strmbase_sink *iface)
mark_wine_thread();
- IMemAllocator_Decommit(filter->alloc); GST_RemoveOutputPins(filter); }
@@ -2083,37 +2040,27 @@ static HRESULT source_get_media_type(struct strmbase_pin *iface, unsigned int in }
static HRESULT WINAPI GSTOutPin_DecideBufferSize(struct strmbase_source *iface, - IMemAllocator *pAlloc, ALLOCATOR_PROPERTIES *ppropInputRequest) + IMemAllocator *allocator, ALLOCATOR_PROPERTIES *props) { - struct gstdemux_source *This = impl_source_from_IPin(&iface->pin.IPin_iface); - TRACE("(%p)->(%p, %p)\n", This, pAlloc, ppropInputRequest); - /* Unused */ - return S_OK; -} - -static HRESULT WINAPI GSTOutPin_DecideAllocator(struct strmbase_source *base, - IMemInputPin *pPin, IMemAllocator **pAlloc) -{ - struct gstdemux_source *pin = impl_source_from_IPin(&base->pin.IPin_iface); - struct gstdemux *filter = impl_from_strmbase_filter(pin->pin.pin.filter); - HRESULT hr; - - TRACE("pin %p, peer %p, allocator %p.\n", pin, pPin, pAlloc); + struct gstdemux_source *pin = impl_source_from_IPin(&iface->pin.IPin_iface); + unsigned int buffer_size = 16384; + ALLOCATOR_PROPERTIES ret_props;
- *pAlloc = NULL; - if (filter->alloc) + if (IsEqualGUID(&pin->pin.pin.mt.formattype, &FORMAT_VideoInfo)) { - hr = IMemInputPin_NotifyAllocator(pPin, filter->alloc, FALSE); - if (SUCCEEDED(hr)) - { - *pAlloc = filter->alloc; - IMemAllocator_AddRef(*pAlloc); - } + VIDEOINFOHEADER *format = (VIDEOINFOHEADER *)pin->pin.pin.mt.pbFormat; + buffer_size = format->bmiHeader.biSizeImage; + } + else if (IsEqualGUID(&pin->pin.pin.mt.formattype, &FORMAT_WaveFormatEx)) + { + WAVEFORMATEX *format = (WAVEFORMATEX *)pin->pin.pin.mt.pbFormat; + buffer_size = format->nAvgBytesPerSec; } - else - hr = VFW_E_NO_ALLOCATOR;
- return hr; + props->cBuffers = max(props->cBuffers, 1); + props->cbBuffer = max(props->cbBuffer, buffer_size); + props->cbAlign = max(props->cbAlign, 1); + return IMemAllocator_SetProperties(allocator, props, &ret_props); }
static void free_source_pin(struct gstdemux_source *pin) @@ -2155,8 +2102,8 @@ static const struct strmbase_source_ops source_ops = .base.pin_query_accept = source_query_accept, .base.pin_get_media_type = source_get_media_type, .pfnAttemptConnection = BaseOutputPinImpl_AttemptConnection, + .pfnDecideAllocator = BaseOutputPinImpl_DecideAllocator, .pfnDecideBufferSize = GSTOutPin_DecideBufferSize, - .pfnDecideAllocator = GSTOutPin_DecideAllocator, };
static struct gstdemux_source *create_pin(struct gstdemux *filter, const WCHAR *name)
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qcap/tests/smartteefilter.c | 16 +++------------- dlls/qedit/tests/samplegrabber.c | 22 +++++++--------------- dlls/quartz/tests/avisplit.c | 15 +++++---------- dlls/quartz/tests/filesource.c | 2 +- dlls/quartz/tests/mpegsplit.c | 10 +++------- dlls/strmbase/pin.c | 9 ++++++++- 6 files changed, 27 insertions(+), 47 deletions(-)
diff --git a/dlls/qcap/tests/smartteefilter.c b/dlls/qcap/tests/smartteefilter.c index c4fa3a69549..4602d137386 100644 --- a/dlls/qcap/tests/smartteefilter.c +++ b/dlls/qcap/tests/smartteefilter.c @@ -2831,29 +2831,19 @@ static void test_source_connection(AM_MEDIA_TYPE req_mt, IFilterGraph2 *graph,
req_mt.formattype = FORMAT_WaveFormatEx; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface); - } + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt = sink_mt; req_mt.formattype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &req_mt); ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(compare_media_types(&testsink->sink.pin.mt, &sink_mt), "Media types didn't match.\n"); + ok(compare_media_types(&testsink->sink.pin.mt, &sink_mt), "Media types didn't match.\n"); IFilterGraph2_Disconnect(graph, source); IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface);
req_mt.subtype = MEDIASUBTYPE_RGB32; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink->sink.pin.IPin_iface); - } + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.subtype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink->sink.pin.IPin_iface, &req_mt); diff --git a/dlls/qedit/tests/samplegrabber.c b/dlls/qedit/tests/samplegrabber.c index 04842211414..b3f325dd051 100644 --- a/dlls/qedit/tests/samplegrabber.c +++ b/dlls/qedit/tests/samplegrabber.c @@ -939,29 +939,21 @@ static void test_connect_pin(void)
req_mt.formattype = FORMAT_None; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface); - } + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.majortype = MEDIATYPE_Video; req_mt.subtype = MEDIASUBTYPE_RGB8; req_mt.formattype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - ok(compare_media_types(&testsink.sink.pin.mt, &testsource.source_mt), "Media types didn't match.\n"); - ok(compare_media_types(&testsource.source.pin.mt, &testsink.sink.pin.mt), "Media types didn't match.\n"); - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface); - } + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(compare_media_types(&testsink.sink.pin.mt, &testsource.source_mt), "Media types didn't match.\n"); + ok(compare_media_types(&testsource.source.pin.mt, &testsink.sink.pin.mt), "Media types didn't match.\n"); + IFilterGraph2_Disconnect(graph, source); + IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
req_mt.subtype = MEDIASUBTYPE_RGB32; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.subtype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); diff --git a/dlls/quartz/tests/avisplit.c b/dlls/quartz/tests/avisplit.c index fa10f54a7c4..240938fdc04 100644 --- a/dlls/quartz/tests/avisplit.c +++ b/dlls/quartz/tests/avisplit.c @@ -1073,6 +1073,7 @@ static void test_connect_pin(void) { .majortype = MEDIATYPE_Stream, .subtype = MEDIASUBTYPE_Avi, + .formattype = FORMAT_None, .lSampleSize = 888, }; IBaseFilter *filter = create_avi_splitter(), *reader; @@ -1235,26 +1236,20 @@ static void test_connect_pin(void)
req_mt.formattype = FORMAT_None; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface); - } + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.majortype = MEDIATYPE_Video; req_mt.subtype = MEDIASUBTYPE_I420; req_mt.formattype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - if (hr == S_OK) - ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n"); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(compare_media_types(&testsink.sink.pin.mt, source_mt), "Media types didn't match.\n"); IFilterGraph2_Disconnect(graph, source); IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface);
req_mt.subtype = MEDIASUBTYPE_RGB32; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.subtype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c index 6fe19bf2c9c..067d7d463c0 100644 --- a/dlls/quartz/tests/filesource.c +++ b/dlls/quartz/tests/filesource.c @@ -1398,7 +1398,7 @@ static void test_connect_pin(void) req_mt.formattype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(compare_media_types(&testsink.pin.pin.mt, source_mt), "Media types didn't match.\n"); + ok(compare_media_types(&testsink.pin.pin.mt, source_mt), "Media types didn't match.\n"); IFilterGraph2_Disconnect(graph, source); IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface);
diff --git a/dlls/quartz/tests/mpegsplit.c b/dlls/quartz/tests/mpegsplit.c index 4d7ef7d5823..ff86dd5acc3 100644 --- a/dlls/quartz/tests/mpegsplit.c +++ b/dlls/quartz/tests/mpegsplit.c @@ -1310,6 +1310,7 @@ static void test_connect_pin(void) { .majortype = MEDIATYPE_Stream, .subtype = MEDIASUBTYPE_MPEG1Audio, + .formattype = FORMAT_WaveFormatEx, .lSampleSize = 888, }; IBaseFilter *filter = create_mpeg_splitter(), *reader; @@ -1471,12 +1472,7 @@ static void test_connect_pin(void)
req_mt.formattype = FORMAT_None; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface); - } + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.majortype = MEDIATYPE_Audio; req_mt.subtype = MEDIASUBTYPE_MPEG1AudioPayload; @@ -1490,7 +1486,7 @@ static void test_connect_pin(void)
req_mt.subtype = MEDIASUBTYPE_PCM; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.subtype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c index 305310fbc4d..19485abb5c5 100644 --- a/dlls/strmbase/pin.c +++ b/dlls/strmbase/pin.c @@ -437,6 +437,11 @@ static BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b) && !IsEqualGUID(&b->subtype, &GUID_NULL)) return FALSE;
+ if (!IsEqualGUID(&a->formattype, &b->formattype) + && !IsEqualGUID(&a->formattype, &GUID_NULL) + && !IsEqualGUID(&b->formattype, &GUID_NULL)) + return FALSE; + return TRUE; }
@@ -477,7 +482,9 @@ static HRESULT WINAPI source_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYP return VFW_E_NOT_STOPPED; }
- if (mt && !IsEqualGUID(&mt->majortype, &GUID_NULL) && !IsEqualGUID(&mt->subtype, &GUID_NULL)) + if (mt && !IsEqualGUID(&mt->majortype, &GUID_NULL) + && !IsEqualGUID(&mt->subtype, &GUID_NULL) + && !IsEqualGUID(&mt->formattype, &GUID_NULL)) { hr = pin->pFuncsTable->pfnAttemptConnection(pin, peer, mt); LeaveCriticalSection(&pin->pin.filter->csFilter);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=64979
Your paranoid android.
=== w2008s64 (32 bit report) ===
=== w2008s64 (64 bit report) ===
Report validation errors: qcap:smartteefilter is missing some skip messages
=== w2008s64 (32 bit report) ===
Report validation errors: qedit:samplegrabber is missing some skip messages
=== w2008s64 (64 bit report) ===
Report validation errors: qedit:samplegrabber is missing some skip messages
=== debian10 (32 bit report) ===
quartz: videorenderer.c:1211: Test failed: Got hr 0x80040207. vmr7.c:1416: Test failed: Got hr 0x80040207. vmr9.c:1410: Test failed: Got hr 0x80040207.
=== debian10 (32 bit Chinese:China report) ===
quartz: videorenderer.c:1211: Test failed: Got hr 0x80040207. vmr7.c:1416: Test failed: Got hr 0x80040207. vmr9.c:1410: Test failed: Got hr 0x80040207.
=== debian10 (32 bit WoW report) ===
quartz: videorenderer.c:1211: Test failed: Got hr 0x80040207. vmr7.c:1416: Test failed: Got hr 0x80040207. vmr9.c:1410: Test failed: Got hr 0x80040207.
=== debian10 (64 bit WoW report) ===
quartz: videorenderer.c:1211: Test failed: Got hr 0x80040207. vmr7.c:1416: Test failed: Got hr 0x80040207. vmr9.c:1410: Test failed: Got hr 0x80040207.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/avisplit.c | 7 +------ dlls/quartz/tests/mpegsplit.c | 7 +------ dlls/strmbase/pin.c | 4 +++- 3 files changed, 5 insertions(+), 13 deletions(-)
diff --git a/dlls/quartz/tests/avisplit.c b/dlls/quartz/tests/avisplit.c index 240938fdc04..002966d276c 100644 --- a/dlls/quartz/tests/avisplit.c +++ b/dlls/quartz/tests/avisplit.c @@ -1200,12 +1200,7 @@ static void test_connect_pin(void) ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); req_mt.subtype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface); - } + ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); req_mt.subtype = MEDIASUBTYPE_I420;
/* Connection with wildcards. */ diff --git a/dlls/quartz/tests/mpegsplit.c b/dlls/quartz/tests/mpegsplit.c index ff86dd5acc3..c8b368e4b68 100644 --- a/dlls/quartz/tests/mpegsplit.c +++ b/dlls/quartz/tests/mpegsplit.c @@ -1435,12 +1435,7 @@ static void test_connect_pin(void) ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); req_mt.subtype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface); - } + ok(hr == VFW_E_TYPE_NOT_ACCEPTED, "Got hr %#x.\n", hr); req_mt.subtype = MEDIASUBTYPE_MPEG1AudioPayload;
/* Connection with wildcards. */ diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c index 19485abb5c5..844619b8fd9 100644 --- a/dlls/strmbase/pin.c +++ b/dlls/strmbase/pin.c @@ -482,8 +482,10 @@ static HRESULT WINAPI source_Connect(IPin *iface, IPin *peer, const AM_MEDIA_TYP return VFW_E_NOT_STOPPED; }
+ /* We don't check the subtype here. The rationale (as given by the DirectX + * documentation) is that the format type is supposed to provide at least + * as much information as the subtype. */ if (mt && !IsEqualGUID(&mt->majortype, &GUID_NULL) - && !IsEqualGUID(&mt->subtype, &GUID_NULL) && !IsEqualGUID(&mt->formattype, &GUID_NULL)) { hr = pin->pFuncsTable->pfnAttemptConnection(pin, peer, mt);
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=64980
Your paranoid android.
=== debian10 (32 bit report) ===
quartz: videorenderer.c:1211: Test failed: Got hr 0x80040207. vmr7.c:1416: Test failed: Got hr 0x80040207. vmr9.c:1410: Test failed: Got hr 0x80040207.
=== debian10 (32 bit Chinese:China report) ===
quartz: videorenderer.c:1211: Test failed: Got hr 0x80040207. vmr7.c:1416: Test failed: Got hr 0x80040207. vmr9.c:1410: Test failed: Got hr 0x80040207.
=== debian10 (32 bit WoW report) ===
quartz: videorenderer.c:1211: Test failed: Got hr 0x80040207. vmr7.c:1416: Test failed: Got hr 0x80040207. vmr9.c:1410: Test failed: Got hr 0x80040207.
=== debian10 (64 bit WoW report) ===
quartz: videorenderer.c:1211: Test failed: Got hr 0x80040207. vmr7.c:1416: Test failed: Got hr 0x80040207. vmr9.c:1410: Test failed: Got hr 0x80040207.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/qedit/tests/samplegrabber.c | 21 +++------------------ dlls/quartz/tests/filesource.c | 21 +++------------------ dlls/strmbase/pin.c | 19 ++++++++----------- 3 files changed, 14 insertions(+), 47 deletions(-)
diff --git a/dlls/qedit/tests/samplegrabber.c b/dlls/qedit/tests/samplegrabber.c index b3f325dd051..06db9d740e6 100644 --- a/dlls/qedit/tests/samplegrabber.c +++ b/dlls/qedit/tests/samplegrabber.c @@ -978,32 +978,17 @@ static void test_connect_pin(void)
req_mt.majortype = MEDIATYPE_Video; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface); - } + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); req_mt.majortype = GUID_NULL;
req_mt.subtype = MEDIASUBTYPE_RGB8; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface); - } + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); req_mt.subtype = GUID_NULL;
req_mt.formattype = FORMAT_None; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.sink.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink.sink.pin.IPin_iface); - } + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); req_mt.formattype = GUID_NULL;
testsink.sink_mt = &req_mt; diff --git a/dlls/quartz/tests/filesource.c b/dlls/quartz/tests/filesource.c index 067d7d463c0..846b92ac60b 100644 --- a/dlls/quartz/tests/filesource.c +++ b/dlls/quartz/tests/filesource.c @@ -1405,12 +1405,7 @@ static void test_connect_pin(void) req_mt.formattype = FORMAT_None; req_mt.majortype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); - } + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.formattype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); @@ -1421,12 +1416,7 @@ static void test_connect_pin(void)
req_mt.subtype = MEDIASUBTYPE_RGB8; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); - } + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.subtype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); @@ -1438,12 +1428,7 @@ static void test_connect_pin(void) req_mt.majortype = MEDIATYPE_Stream; req_mt.subtype = MEDIASUBTYPE_RGB8; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); - todo_wine ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr); - if (hr == S_OK) - { - IFilterGraph2_Disconnect(graph, source); - IFilterGraph2_Disconnect(graph, &testsink.pin.pin.IPin_iface); - } + ok(hr == VFW_E_NO_ACCEPTABLE_TYPES, "Got hr %#x.\n", hr);
req_mt.subtype = GUID_NULL; hr = IFilterGraph2_ConnectDirect(graph, source, &testsink.pin.pin.IPin_iface, &req_mt); diff --git a/dlls/strmbase/pin.c b/dlls/strmbase/pin.c index 844619b8fd9..17cb5d34b30 100644 --- a/dlls/strmbase/pin.c +++ b/dlls/strmbase/pin.c @@ -422,24 +422,21 @@ static inline struct strmbase_source *impl_source_from_IPin( IPin *iface ) return CONTAINING_RECORD(iface, struct strmbase_source, pin.IPin_iface); }
-static BOOL compare_media_types(const AM_MEDIA_TYPE *a, const AM_MEDIA_TYPE *b) +static BOOL compare_media_types(const AM_MEDIA_TYPE *req_mt, const AM_MEDIA_TYPE *pin_mt) { - if (!a) + if (!req_mt) return TRUE;
- if (!IsEqualGUID(&a->majortype, &b->majortype) - && !IsEqualGUID(&a->majortype, &GUID_NULL) - && !IsEqualGUID(&b->majortype, &GUID_NULL)) + if (!IsEqualGUID(&req_mt->majortype, &pin_mt->majortype) + && !IsEqualGUID(&req_mt->majortype, &GUID_NULL)) return FALSE;
- if (!IsEqualGUID(&a->subtype, &b->subtype) - && !IsEqualGUID(&a->subtype, &GUID_NULL) - && !IsEqualGUID(&b->subtype, &GUID_NULL)) + if (!IsEqualGUID(&req_mt->subtype, &pin_mt->subtype) + && !IsEqualGUID(&req_mt->subtype, &GUID_NULL)) return FALSE;
- if (!IsEqualGUID(&a->formattype, &b->formattype) - && !IsEqualGUID(&a->formattype, &GUID_NULL) - && !IsEqualGUID(&b->formattype, &GUID_NULL)) + if (!IsEqualGUID(&req_mt->formattype, &pin_mt->formattype) + && !IsEqualGUID(&req_mt->formattype, &GUID_NULL)) return FALSE;
return TRUE;
Hi,
While running your changed tests, I think I found new failures. Being a bot and all I'm not very good at pattern recognition, so I might be wrong, but could you please double-check?
Full results can be found at: https://testbot.winehq.org/JobDetails.pl?Key=64981
Your paranoid android.
=== w2008s64 (32 bit report) ===
Report validation errors: qedit:samplegrabber is missing some skip messages
=== w2008s64 (64 bit report) ===
Report validation errors: qedit:samplegrabber is missing some skip messages
=== debian10 (32 bit report) ===
quartz: videorenderer.c:1211: Test failed: Got hr 0x80040207. vmr7.c:1416: Test failed: Got hr 0x80040207. vmr9.c:1410: Test failed: Got hr 0x80040207.
=== debian10 (32 bit Chinese:China report) ===
quartz: videorenderer.c:1211: Test failed: Got hr 0x80040207. vmr7.c:1416: Test failed: Got hr 0x80040207. vmr9.c:1410: Test failed: Got hr 0x80040207.
=== debian10 (32 bit WoW report) ===
quartz: videorenderer.c:1211: Test failed: Got hr 0x80040207. vmr7.c:1416: Test failed: Got hr 0x80040207. vmr9.c:1410: Test failed: Got hr 0x80040207.
=== debian10 (64 bit WoW report) ===
quartz: videorenderer.c:1211: Test failed: Got hr 0x80040207. vmr7.c:1416: Test failed: Got hr 0x80040207. vmr9.c:1410: Test failed: Got hr 0x80040207.