Zebediah Figura : quartz/vmr9: Destroy the window when set to windowless or renderless mode.

Alexandre Julliard julliard at winehq.org
Tue May 12 16:59:27 CDT 2020


Module: wine
Branch: master
Commit: fa32c8e36d1fc9ed54fcfdb40b7bc60b3fcc94d7
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=fa32c8e36d1fc9ed54fcfdb40b7bc60b3fcc94d7

Author: Zebediah Figura <z.figura12 at gmail.com>
Date:   Tue May 12 12:06:57 2020 -0500

quartz/vmr9: Destroy the window when set to windowless or renderless mode.

Signed-off-by: Zebediah Figura <z.figura12 at gmail.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/quartz/tests/vmr9.c | 10 +++++-----
 dlls/quartz/vmr9.c       | 34 ++++++++++++----------------------
 2 files changed, 17 insertions(+), 27 deletions(-)

diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c
index 93c2e504a0..6fe2a9bab1 100644
--- a/dlls/quartz/tests/vmr9.c
+++ b/dlls/quartz/tests/vmr9.c
@@ -1734,8 +1734,8 @@ static void test_overlay(void)
 
     hwnd = (HWND)0xdeadbeef;
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
-    todo_wine ok(hwnd == (HWND)0xdeadbeef, "Got invalid window %p.\n", hwnd);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hwnd == (HWND)0xdeadbeef, "Got window %p.\n", hwnd);
 
     IOverlay_Release(overlay);
     IPin_Release(pin);
@@ -1750,8 +1750,8 @@ static void test_overlay(void)
 
     hwnd = (HWND)0xdeadbeef;
     hr = IOverlay_GetWindowHandle(overlay, &hwnd);
-    todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
-    todo_wine ok(hwnd == (HWND)0xdeadbeef, "Got invalid window %p.\n", hwnd);
+    ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
+    ok(hwnd == (HWND)0xdeadbeef, "Got window %p.\n", hwnd);
 
     IOverlay_Release(overlay);
     IPin_Release(pin);
@@ -3854,7 +3854,7 @@ static void test_windowless_size(void)
     SetRect(&expect, 4, 6, 16, 12);
     ok(EqualRect(&src, &expect), "Got source rect %s.\n", wine_dbgstr_rect(&src));
     SetRect(&expect, 40, 60, 120, 160);
-    todo_wine ok(EqualRect(&dst, &expect), "Got dest rect %s.\n", wine_dbgstr_rect(&dst));
+    ok(EqualRect(&dst, &expect), "Got dest rect %s.\n", wine_dbgstr_rect(&dst));
 
     GetWindowRect(window, &src);
     SetRect(&expect, 0, 0, 640, 480);
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c
index d3e75f21ed..32af06e5fa 100644
--- a/dlls/quartz/vmr9.c
+++ b/dlls/quartz/vmr9.c
@@ -458,13 +458,12 @@ static HRESULT allocate_surfaces(struct quartz_vmr *filter, const AM_MEDIA_TYPE
 
 static void vmr_start_stream(struct strmbase_renderer *iface)
 {
-    struct quartz_vmr *This = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface);
-
-    TRACE("(%p)\n", This);
+    struct quartz_vmr *filter = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface);
 
-    IVMRImagePresenter9_StartPresenting(This->presenter, This->cookie);
-    ShowWindow(This->window.hwnd, SW_SHOW);
-    SetEvent(This->run_event);
+    IVMRImagePresenter9_StartPresenting(filter->presenter, filter->cookie);
+    if (filter->window.hwnd)
+        ShowWindow(filter->window.hwnd, SW_SHOW);
+    SetEvent(filter->run_event);
 }
 
 static void vmr_stop_stream(struct strmbase_renderer *iface)
@@ -1354,6 +1353,9 @@ static HRESULT WINAPI VMR9FilterConfig_SetRenderingMode(IVMRFilterConfig9 *iface
         return E_INVALIDARG;
     }
 
+    if (mode != VMR9Mode_Windowed)
+        video_window_cleanup(&This->window);
+
     This->mode = mode;
     LeaveCriticalSection(&This->renderer.filter.csFilter);
     return hr;
@@ -1459,13 +1461,7 @@ static HRESULT WINAPI VMR7WindowlessControl_SetVideoPosition(IVMRWindowlessContr
     if (source)
         This->window.src = *source;
     if (dest)
-    {
         This->window.dst = *dest;
-        FIXME("Output rectangle: %s.\n", wine_dbgstr_rect(dest));
-        SetWindowPos(This->window.hwnd, NULL,
-                dest->left, dest->top, dest->right - dest->left, dest->bottom-dest->top,
-                SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOOWNERZORDER | SWP_NOREDRAW);
-    }
 
     LeaveCriticalSection(&This->renderer.filter.csFilter);
 
@@ -1662,13 +1658,7 @@ static HRESULT WINAPI VMR9WindowlessControl_SetVideoPosition(IVMRWindowlessContr
     if (source)
         This->window.src = *source;
     if (dest)
-    {
         This->window.dst = *dest;
-        FIXME("Output rectangle: %s.\n", wine_dbgstr_rect(dest));
-        SetWindowPos(This->window.hwnd, NULL,
-                dest->left, dest->top, dest->right - dest->left, dest->bottom - dest->top,
-                SWP_NOACTIVATE | SWP_NOCOPYBITS | SWP_NOOWNERZORDER | SWP_NOREDRAW);
-    }
 
     LeaveCriticalSection(&This->renderer.filter.csFilter);
 
@@ -1740,7 +1730,7 @@ static HRESULT WINAPI VMR9WindowlessControl_RepaintVideo(IVMRWindowlessControl9
     FIXME("(%p/%p)->(...) semi-stub\n", iface, This);
 
     EnterCriticalSection(&This->renderer.filter.csFilter);
-    if (hwnd != This->clipping_window && hwnd != This->window.hwnd)
+    if (hwnd != This->clipping_window)
     {
         ERR("Not handling changing windows yet!!!\n");
         LeaveCriticalSection(&This->renderer.filter.csFilter);
@@ -2214,6 +2204,9 @@ static HRESULT WINAPI overlay_GetWindowHandle(IOverlay *iface, HWND *window)
 
     TRACE("filter %p, window %p.\n", filter, window);
 
+    if (!filter->window.hwnd)
+        return VFW_E_WRONG_STATE;
+
     *window = filter->window.hwnd;
     return S_OK;
 }
@@ -2424,12 +2417,9 @@ static HRESULT WINAPI VMR9_ImagePresenter_PresentImage(IVMRImagePresenter9 *ifac
 {
     struct default_presenter *This = impl_from_IVMRImagePresenter9(iface);
     HRESULT hr;
-    RECT output;
     BOOL render = FALSE;
 
     TRACE("(%p/%p/%p)->(...) stub\n", iface, This, This->pVMR9);
-    GetWindowRect(This->pVMR9->window.hwnd, &output);
-    TRACE("Output rectangle: %s\n", wine_dbgstr_rect(&output));
 
     /* This might happen if we don't have active focus (eg on a different virtual desktop) */
     if (!This->d3d9_dev)




More information about the wine-cvs mailing list