Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/vmr9.c | 6 +++--- dlls/quartz/vmr9.c | 24 +++++++++++++----------- 2 files changed, 16 insertions(+), 14 deletions(-)
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index fc2794c5cb7..93c2e504a07 100644 --- a/dlls/quartz/tests/vmr9.c +++ b/dlls/quartz/tests/vmr9.c @@ -3808,9 +3808,9 @@ static void test_windowless_size(void)
width = height = 0xdeadbeef; hr = IVMRWindowlessControl9_GetNativeVideoSize(windowless_control, &width, &height, NULL, NULL); - todo_wine ok(hr == S_OK, "Got hr %#x.\n", hr); - todo_wine ok(width == 32, "Got width %d.\n", width); - todo_wine ok(height == 16, "Got height %d.\n", height); + ok(hr == S_OK, "Got hr %#x.\n", hr); + ok(width == 32, "Got width %d.\n", width); + ok(height == 16, "Got height %d.\n", height);
aspect_width = aspect_height = 0xdeadbeef; hr = IVMRWindowlessControl9_GetNativeVideoSize(windowless_control, &width, &height, &aspect_width, &aspect_height); diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index c7ebdc6c573..44ad2965122 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -1615,21 +1615,23 @@ static ULONG WINAPI VMR9WindowlessControl_Release(IVMRWindowlessControl9 *iface) return IUnknown_Release(This->renderer.filter.outer_unk); }
-static HRESULT WINAPI VMR9WindowlessControl_GetNativeVideoSize(IVMRWindowlessControl9 *iface, LONG *width, LONG *height, LONG *arwidth, LONG *arheight) +static HRESULT WINAPI VMR9WindowlessControl_GetNativeVideoSize(IVMRWindowlessControl9 *iface, + LONG *width, LONG *height, LONG *aspect_width, LONG *aspect_height) { - struct quartz_vmr *This = impl_from_IVMRWindowlessControl9(iface); - TRACE("(%p/%p)->(%p, %p, %p, %p)\n", iface, This, width, height, arwidth, arheight); + struct quartz_vmr *filter = impl_from_IVMRWindowlessControl9(iface);
- if (!width || !height || !arwidth || !arheight) - { - ERR("Got no pointer\n"); + TRACE("filter %p, width %p, height %p, aspect_width %p, aspect_height %p.\n", + filter, width, height, aspect_width, aspect_height); + + if (!width || !height) return E_POINTER; - }
- *width = This->bmiheader.biWidth; - *height = This->bmiheader.biHeight; - *arwidth = This->bmiheader.biWidth; - *arheight = This->bmiheader.biHeight; + *width = filter->bmiheader.biWidth; + *height = filter->bmiheader.biHeight; + if (aspect_width) + *aspect_width = filter->bmiheader.biWidth; + if (aspect_height) + *aspect_height = filter->bmiheader.biHeight;
return S_OK; }
This check is already made in allocate_surfaces().
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/vmr9.c | 6 ------ 1 file changed, 6 deletions(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 44ad2965122..2bfbd8e8210 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -2615,12 +2615,6 @@ static HRESULT WINAPI VMR9_SurfaceAllocator_InitializeDevice(IVMRSurfaceAllocato { struct default_presenter *This = impl_from_IVMRSurfaceAllocatorEx9(iface);
- if (This->pVMR9->mode != VMR9Mode_Windowed && !This->pVMR9->hWndClippingWindow) - { - ERR("No window set\n"); - return VFW_E_WRONG_STATE; - } - This->info = *allocinfo;
if (!CreateRenderingWindow(This, allocinfo, numbuffers))
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/vmr9.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 2bfbd8e8210..1236b646000 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -100,8 +100,7 @@ struct quartz_vmr DWORD cur_surface; DWORD_PTR cookie;
- /* for Windowless Mode */ - HWND hWndClippingWindow; + HWND clipping_window;
LONG VideoWidth; LONG VideoHeight; @@ -402,9 +401,9 @@ static HRESULT allocate_surfaces(struct quartz_vmr *filter, const AM_MEDIA_TYPE };
TRACE("Initializing in mode %u, our window %p, clipping window %p.\n", - filter->mode, filter->window.hwnd, filter->hWndClippingWindow); + filter->mode, filter->window.hwnd, filter->clipping_window);
- if (filter->mode == VMR9Mode_Windowless && !filter->hWndClippingWindow) + if (filter->mode == VMR9Mode_Windowless && !filter->clipping_window) return S_OK;
info.Pool = D3DPOOL_DEFAULT; @@ -1727,7 +1726,7 @@ static HRESULT WINAPI VMR9WindowlessControl_SetVideoClippingWindow(IVMRWindowles return VFW_E_WRONG_STATE; }
- filter->hWndClippingWindow = window; + filter->clipping_window = window;
LeaveCriticalSection(&filter->renderer.filter.csFilter); return S_OK; @@ -1741,7 +1740,7 @@ static HRESULT WINAPI VMR9WindowlessControl_RepaintVideo(IVMRWindowlessControl9 FIXME("(%p/%p)->(...) semi-stub\n", iface, This);
EnterCriticalSection(&This->renderer.filter.csFilter); - if (hwnd != This->hWndClippingWindow && hwnd != This->window.hwnd) + if (hwnd != This->clipping_window && hwnd != This->window.hwnd) { ERR("Not handling changing windows yet!!!\n"); LeaveCriticalSection(&This->renderer.filter.csFilter);
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/vmr9.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 1236b646000..d3e75f21ede 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -1755,7 +1755,7 @@ static HRESULT WINAPI VMR9WindowlessControl_RepaintVideo(IVMRWindowlessControl9 }
/* Windowless extension */ - hr = IDirect3DDevice9_Present(This->allocator_d3d9_dev, NULL, NULL, This->window.hwnd, NULL); + hr = IDirect3DDevice9_Present(This->allocator_d3d9_dev, NULL, NULL, NULL, NULL); LeaveCriticalSection(&This->renderer.filter.csFilter);
return hr; @@ -2451,7 +2451,7 @@ static HRESULT WINAPI VMR9_ImagePresenter_PresentImage(IVMRImagePresenter9 *ifac if (render && SUCCEEDED(hr)) { hr = IDirect3DDevice9_Present(This->d3d9_dev, &This->pVMR9->window.src, - &This->pVMR9->window.dst, This->pVMR9->window.hwnd, NULL); + &This->pVMR9->window.dst, NULL, NULL); if (FAILED(hr)) FIXME("Presenting image: %08x\n", hr); } @@ -2562,17 +2562,23 @@ static BOOL CreateRenderingWindow(struct default_presenter *This, VMR9Allocation { D3DPRESENT_PARAMETERS d3dpp; DWORD d3d9_adapter; + HWND window; HRESULT hr;
TRACE("(%p)->()\n", This);
+ if (This->pVMR9->mode == VMR9Mode_Windowed) + window = This->pVMR9->window.hwnd; + else + window = This->pVMR9->clipping_window; + /* Obtain a monitor and d3d9 device */ - d3d9_adapter = d3d9_adapter_from_hwnd(This->d3d9_ptr, This->pVMR9->window.hwnd, &This->hMon); + d3d9_adapter = d3d9_adapter_from_hwnd(This->d3d9_ptr, window, &This->hMon);
/* Now try to create the d3d9 device */ ZeroMemory(&d3dpp, sizeof(d3dpp)); d3dpp.Windowed = TRUE; - d3dpp.hDeviceWindow = This->pVMR9->window.hwnd; + d3dpp.hDeviceWindow = window; d3dpp.SwapEffect = D3DSWAPEFFECT_COPY; d3dpp.BackBufferWidth = info->dwWidth; d3dpp.BackBufferHeight = info->dwHeight;
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/tests/vmr9.c | 8 ++++---- dlls/quartz/vmr9.c | 34 ++++++++++++---------------------- 2 files changed, 16 insertions(+), 26 deletions(-)
diff --git a/dlls/quartz/tests/vmr9.c b/dlls/quartz/tests/vmr9.c index 93c2e504a07..05c952bcd8e 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); diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index d3e75f21ede..32af06e5fac 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)
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=71577
Your paranoid android.
=== debiant (32 bit report) ===
quartz: vmr9.c:3857: Test succeeded inside todo block: Got dest rect (40,60)-(120,160).
=== debiant (32 bit French report) ===
quartz: vmr9.c:3857: Test succeeded inside todo block: Got dest rect (40,60)-(120,160).
=== debiant (32 bit Japanese:Japan report) ===
quartz: vmr9.c:3857: Test succeeded inside todo block: Got dest rect (40,60)-(120,160).
=== debiant (32 bit Chinese:China report) ===
quartz: vmr9.c:3857: Test succeeded inside todo block: Got dest rect (40,60)-(120,160).
=== debiant (32 bit WoW report) ===
quartz: vmr9.c:3857: Test succeeded inside todo block: Got dest rect (40,60)-(120,160).
=== debiant (64 bit WoW report) ===
quartz: vmr9.c:3857: Test succeeded inside todo block: Got dest rect (40,60)-(120,160).
Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/quartz/vmr9.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/dlls/quartz/vmr9.c b/dlls/quartz/vmr9.c index 32af06e5fac..5ff63467338 100644 --- a/dlls/quartz/vmr9.c +++ b/dlls/quartz/vmr9.c @@ -2551,7 +2551,9 @@ static UINT d3d9_adapter_from_hwnd(IDirect3D9 *d3d9, HWND hwnd, HMONITOR *mon_ou static BOOL CreateRenderingWindow(struct default_presenter *This, VMR9AllocationInfo *info, DWORD *numbuffers) { D3DPRESENT_PARAMETERS d3dpp; + IDirect3DDevice9 *device; DWORD d3d9_adapter; + D3DCAPS9 caps; HWND window; HRESULT hr;
@@ -2573,12 +2575,23 @@ static BOOL CreateRenderingWindow(struct default_presenter *This, VMR9Allocation d3dpp.BackBufferWidth = info->dwWidth; d3dpp.BackBufferHeight = info->dwHeight;
- hr = IDirect3D9_CreateDevice(This->d3d9_ptr, d3d9_adapter, D3DDEVTYPE_HAL, NULL, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &This->d3d9_dev); + hr = IDirect3D9_CreateDevice(This->d3d9_ptr, d3d9_adapter, D3DDEVTYPE_HAL, + NULL, D3DCREATE_MIXED_VERTEXPROCESSING, &d3dpp, &device); if (FAILED(hr)) { ERR("Could not create device: %08x\n", hr); return FALSE; } + + IDirect3DDevice9_GetDeviceCaps(device, &caps); + if (!(caps.DevCaps2 & D3DDEVCAPS2_CAN_STRETCHRECT_FROM_TEXTURES)) + { + WARN("Device does not support blitting from textures.\n"); + IDirect3DDevice9_Release(device); + return FALSE; + } + + This->d3d9_dev = device; IVMRSurfaceAllocatorNotify9_SetD3DDevice(This->SurfaceAllocatorNotify, This->d3d9_dev, This->hMon);
if (!(This->d3d9_surfaces = calloc(*numbuffers, sizeof(IDirect3DSurface9 *))))
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=71578
Your paranoid android.
=== debiant (32 bit report) ===
quartz: vmr9.c:3857: Test succeeded inside todo block: Got dest rect (40,60)-(120,160).
=== debiant (32 bit Chinese:China report) ===
quartz: vmr9.c:3857: Test succeeded inside todo block: Got dest rect (40,60)-(120,160).
=== debiant (32 bit WoW report) ===
quartz: vmr9.c:3857: Test succeeded inside todo block: Got dest rect (40,60)-(120,160).
=== debiant (64 bit WoW report) ===
quartz: vmr9.c:3857: Test succeeded inside todo block: Got dest rect (40,60)-(120,160).