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

Signed-off-by: Zebediah Figura <z.figura12@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zebediah Figura 2020-05-12 12:06:57 -05:00 committed by Alexandre Julliard
parent 3c0b0cc834
commit fa32c8e36d
2 changed files with 17 additions and 27 deletions

View File

@ -1734,8 +1734,8 @@ static void test_overlay(void)
hwnd = (HWND)0xdeadbeef; hwnd = (HWND)0xdeadbeef;
hr = IOverlay_GetWindowHandle(overlay, &hwnd); hr = IOverlay_GetWindowHandle(overlay, &hwnd);
todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr); ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
todo_wine ok(hwnd == (HWND)0xdeadbeef, "Got invalid window %p.\n", hwnd); ok(hwnd == (HWND)0xdeadbeef, "Got window %p.\n", hwnd);
IOverlay_Release(overlay); IOverlay_Release(overlay);
IPin_Release(pin); IPin_Release(pin);
@ -1750,8 +1750,8 @@ static void test_overlay(void)
hwnd = (HWND)0xdeadbeef; hwnd = (HWND)0xdeadbeef;
hr = IOverlay_GetWindowHandle(overlay, &hwnd); hr = IOverlay_GetWindowHandle(overlay, &hwnd);
todo_wine ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr); ok(hr == VFW_E_WRONG_STATE, "Got hr %#x.\n", hr);
todo_wine ok(hwnd == (HWND)0xdeadbeef, "Got invalid window %p.\n", hwnd); ok(hwnd == (HWND)0xdeadbeef, "Got window %p.\n", hwnd);
IOverlay_Release(overlay); IOverlay_Release(overlay);
IPin_Release(pin); IPin_Release(pin);
@ -3854,7 +3854,7 @@ static void test_windowless_size(void)
SetRect(&expect, 4, 6, 16, 12); SetRect(&expect, 4, 6, 16, 12);
ok(EqualRect(&src, &expect), "Got source rect %s.\n", wine_dbgstr_rect(&src)); ok(EqualRect(&src, &expect), "Got source rect %s.\n", wine_dbgstr_rect(&src));
SetRect(&expect, 40, 60, 120, 160); 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); GetWindowRect(window, &src);
SetRect(&expect, 0, 0, 640, 480); SetRect(&expect, 0, 0, 640, 480);

View File

@ -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) static void vmr_start_stream(struct strmbase_renderer *iface)
{ {
struct quartz_vmr *This = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface); struct quartz_vmr *filter = impl_from_IBaseFilter(&iface->filter.IBaseFilter_iface);
TRACE("(%p)\n", This); IVMRImagePresenter9_StartPresenting(filter->presenter, filter->cookie);
if (filter->window.hwnd)
IVMRImagePresenter9_StartPresenting(This->presenter, This->cookie); ShowWindow(filter->window.hwnd, SW_SHOW);
ShowWindow(This->window.hwnd, SW_SHOW); SetEvent(filter->run_event);
SetEvent(This->run_event);
} }
static void vmr_stop_stream(struct strmbase_renderer *iface) static void vmr_stop_stream(struct strmbase_renderer *iface)
@ -1354,6 +1353,9 @@ static HRESULT WINAPI VMR9FilterConfig_SetRenderingMode(IVMRFilterConfig9 *iface
return E_INVALIDARG; return E_INVALIDARG;
} }
if (mode != VMR9Mode_Windowed)
video_window_cleanup(&This->window);
This->mode = mode; This->mode = mode;
LeaveCriticalSection(&This->renderer.filter.csFilter); LeaveCriticalSection(&This->renderer.filter.csFilter);
return hr; return hr;
@ -1459,13 +1461,7 @@ static HRESULT WINAPI VMR7WindowlessControl_SetVideoPosition(IVMRWindowlessContr
if (source) if (source)
This->window.src = *source; This->window.src = *source;
if (dest) if (dest)
{
This->window.dst = *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); LeaveCriticalSection(&This->renderer.filter.csFilter);
@ -1662,13 +1658,7 @@ static HRESULT WINAPI VMR9WindowlessControl_SetVideoPosition(IVMRWindowlessContr
if (source) if (source)
This->window.src = *source; This->window.src = *source;
if (dest) if (dest)
{
This->window.dst = *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); LeaveCriticalSection(&This->renderer.filter.csFilter);
@ -1740,7 +1730,7 @@ static HRESULT WINAPI VMR9WindowlessControl_RepaintVideo(IVMRWindowlessControl9
FIXME("(%p/%p)->(...) semi-stub\n", iface, This); FIXME("(%p/%p)->(...) semi-stub\n", iface, This);
EnterCriticalSection(&This->renderer.filter.csFilter); 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"); ERR("Not handling changing windows yet!!!\n");
LeaveCriticalSection(&This->renderer.filter.csFilter); 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); TRACE("filter %p, window %p.\n", filter, window);
if (!filter->window.hwnd)
return VFW_E_WRONG_STATE;
*window = filter->window.hwnd; *window = filter->window.hwnd;
return S_OK; return S_OK;
} }
@ -2424,12 +2417,9 @@ static HRESULT WINAPI VMR9_ImagePresenter_PresentImage(IVMRImagePresenter9 *ifac
{ {
struct default_presenter *This = impl_from_IVMRImagePresenter9(iface); struct default_presenter *This = impl_from_IVMRImagePresenter9(iface);
HRESULT hr; HRESULT hr;
RECT output;
BOOL render = FALSE; BOOL render = FALSE;
TRACE("(%p/%p/%p)->(...) stub\n", iface, This, This->pVMR9); 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) */ /* This might happen if we don't have active focus (eg on a different virtual desktop) */
if (!This->d3d9_dev) if (!This->d3d9_dev)