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; }