Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/vmr9.c | 63 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+)
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index cb04d0b4aa5..a098416bb2c 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -3191,6 +3191,68 @@ static void test_mixing_mode(void) DestroyWindow(window); }
+static void test_clipping_window(void) +{ + VIDEOINFOHEADER vih = + { + .bmiHeader.biSize = sizeof(BITMAPINFOHEADER), + .bmiHeader.biWidth = 32, + .bmiHeader.biHeight = 16, + .bmiHeader.biBitCount = 32, + }; + AM_MEDIA_TYPE mt = + { + .majortype = MEDIATYPE_Video, + .subtype = MEDIASUBTYPE_RGB32, + .formattype = FORMAT_VideoInfo, + .cbFormat = sizeof(vih), + .pbFormat = (BYTE *)&vih, + }; + IBaseFilter *filter = create_vmr9(VMR9Mode_Windowless); + IVMRWindowlessControl9 *windowless_control; + IFilterGraph2 *graph = create_graph(); + struct testfilter source; + HWND window; + HRESULT hr; + ULONG ref; + IPin *pin; + + IBaseFilter_QueryInterface(filter, &IID_IVMRWindowlessControl9, (void **)&windowless_control); + IBaseFilter_FindPin(filter, L"VMR Input0", &pin); + testfilter_init(&source); + IFilterGraph2_AddFilter(graph, &source.filter.IBaseFilter_iface, L"source"); + IFilterGraph2_AddFilter(graph, filter, L"vmr9"); + window = CreateWindowA("static", "quartz_test", WS_OVERLAPPEDWINDOW, 0, 0, 640, 480, 0, 0, 0, 0); + ok(!!window, "Failed to create a window.\n"); + + hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, NULL); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, (HWND)0xdeadbeef); + todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + + hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &mt); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, window); + todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr); + + hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface); + ok(hr == S_OK, "Got hr %#x.\n", hr); + hr = IFilterGraph2_Disconnect(graph, pin); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, window); + ok(hr == S_OK, "Got hr %#x.\n", hr); + + ref = IFilterGraph2_Release(graph); + ok(!ref, "Got outstanding refcount %d.\n", ref); + IPin_Release(pin); + IVMRWindowlessControl9_Release(windowless_control); + ref = IBaseFilter_Release(filter); + ok(!ref, "Got outstanding refcount %d.\n", ref); + DestroyWindow(window); +} + START_TEST(vmr9) { IBaseFilter *filter; @@ -3221,6 +3283,7 @@ START_TEST(vmr9) test_allocate_surface_helper(); test_renderless_formats(); test_mixing_mode(); + test_clipping_window();
CoUninitialize(); }
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/vmr9.c | 4 ++-- dlls/quartz/vmr9.c | 8 ++++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index a098416bb2c..0bd37fe7f13 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -3226,9 +3226,9 @@ static void test_clipping_window(void) ok(!!window, "Failed to create a window.\n");
hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, NULL); - todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, (HWND)0xdeadbeef); - todo_wine ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr); + ok(hr == E_INVALIDARG, "Got hr %#x.\n", hr);
hr = IFilterGraph2_ConnectDirect(graph, &source.source.pin.IPin_iface, pin, &mt); ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index f611a3a7cf0..06e545eedfc 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -1852,12 +1852,16 @@ static HRESULT WINAPI VMR9WindowlessControl_SetVideoClippingWindow(IVMRWindowles
TRACE("(%p/%p)->(%p)\n", iface, This, hwnd);
+ if (!IsWindow(hwnd)) + { + WARN("Invalid window %p, returning E_INVALIDARG.\n", hwnd); + return E_INVALIDARG; + } + EnterCriticalSection(&This->renderer.filter.csFilter); This->hWndClippingWindow = hwnd; if (This->renderer.sink.pin.peer) VMR9_maybe_init(This, FALSE, &This->renderer.sink.pin.mt); - if (!hwnd) - IVMRSurfaceAllocatorEx9_TerminateDevice(This->allocator, This->cookie); LeaveCriticalSection(&This->renderer.filter.csFilter); return S_OK; }
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=71035
Your paranoid android.
=== debiant (build log) ===
error: patch failed: dlls/quartz/tests/vmr9.c:3221 error: patch failed: dlls/quartz/tests/vmr9.c:3226 Task: Patch failed to apply
=== debiant (build log) ===
error: patch failed: dlls/quartz/tests/vmr9.c:3221 error: patch failed: dlls/quartz/tests/vmr9.c:3226 Task: Patch failed to apply
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/vmr9.c | 2 +- dlls/quartz/vmr9.c | 27 +++++++++++++++++---------- 2 files changed, 18 insertions(+), 11 deletions(-)
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index 0bd37fe7f13..54e9b53afb1 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -3234,7 +3234,7 @@ static void test_clipping_window(void) ok(hr == S_OK, "Got hr %#x.\n", hr);
hr = IVMRWindowlessControl9_SetVideoClippingWindow(windowless_control, window); - todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr); + ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
hr = IFilterGraph2_Disconnect(graph, &source.source.pin.IPin_iface); ok(hr == S_OK, "Got hr %#x.\n", hr); diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 06e545eedfc..52cc80eca45 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -1846,23 +1846,30 @@ static HRESULT WINAPI VMR9WindowlessControl_SetAspectRatioMode(IVMRWindowlessCon return E_NOTIMPL; }
-static HRESULT WINAPI VMR9WindowlessControl_SetVideoClippingWindow(IVMRWindowlessControl9 *iface, HWND hwnd) +static HRESULT WINAPI VMR9WindowlessControl_SetVideoClippingWindow(IVMRWindowlessControl9 *iface, HWND window) { - struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); + struct quartz_vmr *filter = impl_from_IVMRWindowlessControl9(iface);
- TRACE("(%p/%p)->(%p)\n", iface, This, hwnd); + TRACE("filter %p, window %p.\n", filter, window);
- if (!IsWindow(hwnd)) + if (!IsWindow(window)) { - WARN("Invalid window %p, returning E_INVALIDARG.\n", hwnd); + WARN("Invalid window %p, returning E_INVALIDARG.\n", window); return E_INVALIDARG; }
- EnterCriticalSection(&This->renderer.filter.csFilter); - This->hWndClippingWindow = hwnd; - if (This->renderer.sink.pin.peer) - VMR9_maybe_init(This, FALSE, &This->renderer.sink.pin.mt); - LeaveCriticalSection(&This->renderer.filter.csFilter); + EnterCriticalSection(&filter->renderer.filter.csFilter); + + if (filter->renderer.sink.pin.peer) + { + LeaveCriticalSection(&filter->renderer.filter.csFilter); + WARN("Attempt to set the clipping window while connected; returning VFW_E_WRONG_STATE.\n"); + return VFW_E_WRONG_STATE; + } + + filter->hWndClippingWindow = window; + + LeaveCriticalSection(&filter->renderer.filter.csFilter); return S_OK; }
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=71036
Your paranoid android.
=== debiant (build log) ===
error: patch failed: dlls/quartz/tests/vmr9.c:3221 error: patch failed: dlls/quartz/tests/vmr9.c:3226 error: patch failed: dlls/quartz/tests/vmr9.c:3234 Task: Patch failed to apply
=== debiant (build log) ===
error: patch failed: dlls/quartz/tests/vmr9.c:3221 error: patch failed: dlls/quartz/tests/vmr9.c:3226 error: patch failed: dlls/quartz/tests/vmr9.c:3234 Task: Patch failed to apply
We have already connected if we got here, and we can only have failed to allocate surfaces if we had no clipping window, which cannot have changed in the meantime.
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/vmr9.c | 2 -- 1 file changed, 2 deletions(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 52cc80eca45..113cb7cea40 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -484,8 +484,6 @@ static void vmr_start_stream(struct strmbase_renderer *iface)
TRACE("(%p)\n", This);
- if (This->renderer.sink.pin.peer) - VMR9_maybe_init(This, TRUE, &This->renderer.sink.pin.mt); IVMRImagePresenter9_StartPresenting(This->presenter, This->cookie); SetWindowPos(This->baseControlWindow.hwnd, NULL, This->source_rect.left,
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=71037
Your paranoid android.
=== debiant (build log) ===
error: patch failed: dlls/quartz/tests/vmr9.c:3221 error: patch failed: dlls/quartz/tests/vmr9.c:3226 error: patch failed: dlls/quartz/tests/vmr9.c:3234 Task: Patch failed to apply
=== debiant (build log) ===
error: patch failed: dlls/quartz/tests/vmr9.c:3221 error: patch failed: dlls/quartz/tests/vmr9.c:3226 error: patch failed: dlls/quartz/tests/vmr9.c:3234 Task: Patch failed to apply
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/vmr9.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 113cb7cea40..93fc3417e7f 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -387,7 +387,7 @@ static HRESULT initialize_device(struct quartz_vmr *filter, VMR9AllocationInfo * return hr; }
-static HRESULT VMR9_maybe_init(struct quartz_vmr *filter, BOOL force, const AM_MEDIA_TYPE *mt) +static HRESULT allocate_surfaces(struct quartz_vmr *filter, const AM_MEDIA_TYPE *mt) { VMR9AllocationInfo info = {}; HRESULT hr = E_FAIL; @@ -418,11 +418,9 @@ static HRESULT VMR9_maybe_init(struct quartz_vmr *filter, BOOL force, const AM_M
TRACE("Initializing in mode %u, our window %p, clipping window %p.\n", filter->mode, filter->baseControlWindow.hwnd, filter->hWndClippingWindow); - if (filter->num_surfaces) - return S_OK;
if (filter->mode == VMR9Mode_Windowless && !filter->hWndClippingWindow) - return (force ? VFW_E_RUNTIME_ERROR : S_OK); + return S_OK;
info.dwWidth = filter->source_rect.right; info.dwHeight = filter->source_rect.bottom; @@ -542,7 +540,7 @@ static HRESULT vmr_connect(struct strmbase_renderer *iface, const AM_MEDIA_TYPE
if (filter->mode || SUCCEEDED(hr = IVMRFilterConfig9_SetRenderingMode(&filter->IVMRFilterConfig9_iface, VMR9Mode_Windowed))) - hr = VMR9_maybe_init(filter, FALSE, mt); + hr = allocate_surfaces(filter, mt);
return hr; }
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=71038
Your paranoid android.
=== debiant (build log) ===
error: patch failed: dlls/quartz/tests/vmr9.c:3221 error: patch failed: dlls/quartz/tests/vmr9.c:3226 error: patch failed: dlls/quartz/tests/vmr9.c:3234 Task: Patch failed to apply
=== debiant (build log) ===
error: patch failed: dlls/quartz/tests/vmr9.c:3221 error: patch failed: dlls/quartz/tests/vmr9.c:3226 error: patch failed: dlls/quartz/tests/vmr9.c:3234 Task: Patch failed to apply
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=71034
Your paranoid android.
=== debiant (build log) ===
error: patch failed: dlls/quartz/tests/vmr9.c:3221 Task: Patch failed to apply
=== debiant (build log) ===
error: patch failed: dlls/quartz/tests/vmr9.c:3221 Task: Patch failed to apply