From: Elizabeth Figura zfigura@codeweavers.com
--- dlls/quartz/tests/vmr7.c | 64 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+)
diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index d35f4d5c01c..23bcbdce790 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -3850,6 +3850,69 @@ static void test_default_presenter_allocate(void) DestroyWindow(window); }
+static void test_default_presenter_window(void) +{ + IDirectDrawSurface7 *frontbuffer; + IVMRSurfaceAllocator *allocator; + IVMRWindowlessControl *control; + VMRALLOCATIONINFO info; + LONG width, height; + DWORD count; + HRESULT hr; + LONG ref; + + BITMAPINFOHEADER bitmap_header = + { + .biSize = sizeof(BITMAPINFOHEADER), + .biWidth = 320, + .biHeight = 240, + .biCompression = BI_RGB, + .biBitCount = 32, + .biPlanes = 1, + }; + + hr = CoCreateInstance(&CLSID_AllocPresenter, NULL, CLSCTX_INPROC_SERVER, + &IID_IVMRSurfaceAllocator, (void **)&allocator); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + count = 2; + info.dwFlags = AMAP_DIRECTED_FLIP | AMAP_ALLOW_SYSMEM; + info.dwMinBuffers = count; + info.dwMaxBuffers = count; + info.dwInterlaceFlags = 0; + info.szNativeSize.cx = 420; + info.szAspectRatio.cx = 400; + info.szNativeSize.cy = 180; + info.szAspectRatio.cy = 200; + info.lpHdr = &bitmap_header; + info.lpPixFmt = NULL; + + hr = IVMRSurfaceAllocator_AllocateSurface(allocator, 0, &info, &count, &frontbuffer); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + hr = IVMRSurfaceAllocator_QueryInterface(allocator, &IID_IVMRWindowlessControl, (void **)&control); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + width = height = 0xdeadbeef; + hr = IVMRWindowlessControl_GetNativeVideoSize(control, &width, &height, NULL, NULL); + todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine ok(width == 420, "Got width %ld.\n", width); + todo_wine ok(height == 180, "Got height %ld.\n", height); + + width = height = 0xdeadbeef; + hr = IVMRWindowlessControl_GetNativeVideoSize(control, NULL, NULL, &width, &height); + todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); + todo_wine ok(width == 400, "Got width %ld.\n", width); + todo_wine ok(height == 200, "Got height %ld.\n", height); + + hr = IVMRSurfaceAllocator_FreeSurface(allocator, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + + IVMRWindowlessControl_Release(control); + ref = IVMRSurfaceAllocator_Release(allocator); + ok(!ref, "Got outstanding refcount %ld.\n", ref); +} + START_TEST(vmr7) { CoInitialize(NULL); @@ -3870,6 +3933,7 @@ START_TEST(vmr7) test_windowless_size(); test_unconnected_eos(); test_default_presenter_allocate(); + test_default_presenter_window(); test_renderless_formats();
CoUninitialize();
From: Elizabeth Figura zfigura@codeweavers.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54935 --- dlls/quartz/tests/vmr7.c | 12 ++++++------ dlls/quartz/vmr7_presenter.c | 25 +++++++++++++++++++++++-- 2 files changed, 29 insertions(+), 8 deletions(-)
diff --git a/dlls/quartz/tests/vmr7.c b/dlls/quartz/tests/vmr7.c index 23bcbdce790..ff15ad9c81d 100644 --- a/dlls/quartz/tests/vmr7.c +++ b/dlls/quartz/tests/vmr7.c @@ -3895,15 +3895,15 @@ static void test_default_presenter_window(void)
width = height = 0xdeadbeef; hr = IVMRWindowlessControl_GetNativeVideoSize(control, &width, &height, NULL, NULL); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(width == 420, "Got width %ld.\n", width); - todo_wine ok(height == 180, "Got height %ld.\n", height); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(width == 420, "Got width %ld.\n", width); + ok(height == 180, "Got height %ld.\n", height);
width = height = 0xdeadbeef; hr = IVMRWindowlessControl_GetNativeVideoSize(control, NULL, NULL, &width, &height); - todo_wine ok(hr == S_OK, "Got hr %#lx.\n", hr); - todo_wine ok(width == 400, "Got width %ld.\n", width); - todo_wine ok(height == 200, "Got height %ld.\n", height); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + ok(width == 400, "Got width %ld.\n", width); + ok(height == 200, "Got height %ld.\n", height);
hr = IVMRSurfaceAllocator_FreeSurface(allocator, 0); ok(hr == S_OK, "Got hr %#lx.\n", hr); diff --git a/dlls/quartz/vmr7_presenter.c b/dlls/quartz/vmr7_presenter.c index 406c9ead52a..c244c86236a 100644 --- a/dlls/quartz/vmr7_presenter.c +++ b/dlls/quartz/vmr7_presenter.c @@ -35,6 +35,8 @@ struct vmr7_presenter IDirectDrawSurface7 *frontbuffer; IDirectDrawSurface7 *primary; HWND window; + + SIZE native_size, aspect_ratio; };
static struct vmr7_presenter *impl_from_IVMRImagePresenter(IVMRImagePresenter *iface) @@ -213,6 +215,10 @@ static HRESULT WINAPI surface_allocator_AllocateSurface(IVMRSurfaceAllocator *if } *surface = presenter->frontbuffer; ++*count; + + presenter->native_size = info->szNativeSize; + presenter->aspect_ratio = info->szAspectRatio; + return S_OK; }
@@ -286,9 +292,24 @@ static ULONG WINAPI windowless_control_Release(IVMRWindowlessControl *iface) static HRESULT WINAPI windowless_control_GetNativeVideoSize(IVMRWindowlessControl *iface, LONG *width, LONG *height, LONG *aspect_width, LONG *aspect_height) { - FIXME("iface %p, width %p, height %p, aspect_width %p, aspect_height %p.\n", + struct vmr7_presenter *presenter = impl_from_IVMRWindowlessControl(iface); + + TRACE("iface %p, width %p, height %p, aspect_width %p, aspect_height %p.\n", iface, width, height, aspect_width, aspect_height); - return E_NOTIMPL; + + if (width) + *width = presenter->native_size.cx; + if (height) + *height = presenter->native_size.cy; + if (aspect_width) + *aspect_width = presenter->aspect_ratio.cx; + if (aspect_height) + *aspect_height = presenter->aspect_ratio.cy; + + TRACE("Returning size (%ld, %ld), aspect ratio (%ld, %ld).\n", + presenter->native_size.cx, presenter->native_size.cy, + presenter->aspect_ratio.cx, presenter->aspect_ratio.cy); + return S_OK; }
static HRESULT WINAPI windowless_control_GetMinIdealVideoSize(