When present, the aperture indicates the area of the sample's buffers to display. The frame size instead includes some undesired padding. This is the case when color planes are aligned, such as with YUV output from a decoder MFT.
-- v2: evr/mixer: Respect input media type MF_MT_GEOMETRIC_APERTURE. evr/tests: Add more video mixer input media type aperture tests. evr/tests: Split check_presenter_output to a separate helper. evr/tests: Split create_d3d_sample to a separate helper. mf/tests: Check that pan scan and geometric apertures are set.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mf/tests/transform.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c index 28ac7291e0b..e43b1627789 100644 --- a/dlls/mf/tests/transform.c +++ b/dlls/mf/tests/transform.c @@ -4090,6 +4090,8 @@ static void test_h264_decoder(void) ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), ATTR_BLOB(MF_MT_MINIMUM_DISPLAY_APERTURE, &actual_aperture, 16), + ATTR_BLOB(MF_MT_GEOMETRIC_APERTURE, &actual_aperture, 16, .todo = TRUE), + ATTR_BLOB(MF_MT_PAN_SCAN_APERTURE, &actual_aperture, 16, .todo = TRUE), }, { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), @@ -4104,6 +4106,8 @@ static void test_h264_decoder(void) ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), ATTR_BLOB(MF_MT_MINIMUM_DISPLAY_APERTURE, &actual_aperture, 16), + ATTR_BLOB(MF_MT_GEOMETRIC_APERTURE, &actual_aperture, 16, .todo = TRUE), + ATTR_BLOB(MF_MT_PAN_SCAN_APERTURE, &actual_aperture, 16, .todo = TRUE), }, { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), @@ -4118,6 +4122,8 @@ static void test_h264_decoder(void) ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), ATTR_BLOB(MF_MT_MINIMUM_DISPLAY_APERTURE, &actual_aperture, 16), + ATTR_BLOB(MF_MT_GEOMETRIC_APERTURE, &actual_aperture, 16, .todo = TRUE), + ATTR_BLOB(MF_MT_PAN_SCAN_APERTURE, &actual_aperture, 16, .todo = TRUE), }, { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), @@ -4132,6 +4138,8 @@ static void test_h264_decoder(void) ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), ATTR_BLOB(MF_MT_MINIMUM_DISPLAY_APERTURE, &actual_aperture, 16), + ATTR_BLOB(MF_MT_GEOMETRIC_APERTURE, &actual_aperture, 16, .todo = TRUE), + ATTR_BLOB(MF_MT_PAN_SCAN_APERTURE, &actual_aperture, 16, .todo = TRUE), }, { ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video), @@ -4146,6 +4154,8 @@ static void test_h264_decoder(void) ATTR_UINT32(MF_MT_FIXED_SIZE_SAMPLES, 1), ATTR_UINT32(MF_MT_ALL_SAMPLES_INDEPENDENT, 1), ATTR_BLOB(MF_MT_MINIMUM_DISPLAY_APERTURE, &actual_aperture, 16), + ATTR_BLOB(MF_MT_GEOMETRIC_APERTURE, &actual_aperture, 16, .todo = TRUE), + ATTR_BLOB(MF_MT_PAN_SCAN_APERTURE, &actual_aperture, 16, .todo = TRUE), }, }; const MFT_OUTPUT_STREAM_INFO initial_output_info =
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/evr/tests/evr.c | 109 ++++++++++++++++++++++++------------------- 1 file changed, 62 insertions(+), 47 deletions(-)
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index 25fb1978443..a0aba91aa74 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -3318,6 +3318,66 @@ done: DestroyWindow(window); }
+static void create_d3d_sample(IDirect3DDeviceManager9 *manager, const GUID *subtype, IMFSample **sample) +{ + static const BITMAPINFOHEADER expect_header = + { + .biSize = sizeof(BITMAPINFOHEADER), + .biWidth = 96, .biHeight = 96, + .biPlanes = 1, .biBitCount = 32, + .biCompression = BI_RGB, + .biSizeImage = 96 * 96 * 4, + }; + DWORD data_size, frame_data_len; + D3DLOCKED_RECT d3d_rect = {0}; + IDirect3DSurface9 *surface; + const BYTE *frame_data; + LONG stride; + HRESULT hr; + + if (IsEqualGUID(subtype, &MFVideoFormat_NV12)) + { + load_resource(L"nv12frame.bmp", &frame_data, &frame_data_len); + /* skip BMP header and RGB data from the dump */ + data_size = *(DWORD *)(frame_data + 2); + frame_data_len = frame_data_len - data_size; + frame_data = frame_data + data_size; + ok(frame_data_len == 13824, "got length %lu\n", frame_data_len); + } + else + { + load_resource(L"rgb32frame.bmp", &frame_data, &frame_data_len); + /* skip BMP header from the dump */ + data_size = *(DWORD *)(frame_data + 2 + 2 * sizeof(DWORD)); + frame_data_len -= data_size; + frame_data += data_size; + ok(frame_data_len == 36864, "got length %lu\n", frame_data_len); + } + + surface = create_surface(manager, subtype->Data1, expect_header.biWidth, expect_header.biHeight); + ok(!!surface, "Failed to create input surface.\n"); + hr = IDirect3DSurface9_LockRect(surface, &d3d_rect, NULL, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + if (IsEqualGUID(subtype, &MFVideoFormat_RGB32)) + memcpy(d3d_rect.pBits, frame_data, frame_data_len); + else if (IsEqualGUID(subtype, &MFVideoFormat_NV12)) + { + hr = MFGetStrideForBitmapInfoHeader(subtype->Data1, expect_header.biWidth, &stride); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = MFCopyImage(d3d_rect.pBits, d3d_rect.Pitch, frame_data, stride, expect_header.biWidth, expect_header.biHeight); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + frame_data += stride * expect_header.biHeight; + d3d_rect.pBits = (BYTE *)d3d_rect.pBits + d3d_rect.Pitch * expect_header.biHeight; + hr = MFCopyImage(d3d_rect.pBits, d3d_rect.Pitch, frame_data, stride, expect_header.biWidth, expect_header.biHeight / 2); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + } + hr = IDirect3DSurface9_UnlockRect(surface); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = MFCreateVideoSampleFromSurface((IUnknown *)surface, sample); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IDirect3DSurface9_Release(surface); +} + static void test_presenter_orientation(const GUID *subtype) { IMFTopologyServiceLookupClient *lookup_client; @@ -3331,18 +3391,14 @@ static void test_presenter_orientation(const GUID *subtype) }; BITMAPINFOHEADER header = {.biSize = sizeof(BITMAPINFOHEADER)}; IMFVideoDisplayControl *display_control; - DWORD diff, data_size, frame_data_len; IDirect3DDeviceManager9 *manager; - D3DLOCKED_RECT d3d_rect = {0}; IMFVideoPresenter *presenter; - IDirect3DSurface9 *surface; IMFMediaType *video_type; - const BYTE *frame_data; + DWORD diff, data_size; struct test_host host; IMFTransform *mixer; LONGLONG timestamp; IMFSample *sample; - LONG stride; HWND window; BYTE *data; HRESULT hr; @@ -3393,48 +3449,7 @@ static void test_presenter_orientation(const GUID *subtype) hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_BEGINSTREAMING, 0); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
- if (IsEqualGUID(subtype, &MFVideoFormat_NV12)) - { - load_resource(L"nv12frame.bmp", &frame_data, &frame_data_len); - /* skip BMP header and RGB data from the dump */ - data_size = *(DWORD *)(frame_data + 2); - frame_data_len = frame_data_len - data_size; - frame_data = frame_data + data_size; - ok(frame_data_len == 13824, "got length %lu\n", frame_data_len); - } - else - { - load_resource(L"rgb32frame.bmp", &frame_data, &frame_data_len); - /* skip BMP header from the dump */ - data_size = *(DWORD *)(frame_data + 2 + 2 * sizeof(DWORD)); - frame_data_len -= data_size; - frame_data += data_size; - ok(frame_data_len == 36864, "got length %lu\n", frame_data_len); - } - - surface = create_surface(manager, subtype->Data1, expect_header.biWidth, expect_header.biHeight); - ok(!!surface, "Failed to create input surface.\n"); - hr = IDirect3DSurface9_LockRect(surface, &d3d_rect, NULL, 0); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - if (IsEqualGUID(subtype, &MFVideoFormat_RGB32)) - memcpy(d3d_rect.pBits, frame_data, frame_data_len); - else if (IsEqualGUID(subtype, &MFVideoFormat_NV12)) - { - hr = MFGetStrideForBitmapInfoHeader(subtype->Data1, expect_header.biWidth, &stride); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = MFCopyImage(d3d_rect.pBits, d3d_rect.Pitch, frame_data, stride, expect_header.biWidth, expect_header.biHeight); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - frame_data += stride * expect_header.biHeight; - d3d_rect.pBits = (BYTE *)d3d_rect.pBits + d3d_rect.Pitch * expect_header.biHeight; - hr = MFCopyImage(d3d_rect.pBits, d3d_rect.Pitch, frame_data, stride, expect_header.biWidth, expect_header.biHeight / 2); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - } - hr = IDirect3DSurface9_UnlockRect(surface); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = MFCreateVideoSampleFromSurface((IUnknown *)surface, &sample); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - IDirect3DSurface9_Release(surface); - + create_d3d_sample(manager, subtype, &sample); hr = IMFTransform_ProcessInput(mixer, 0, sample, 0); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_PROCESSINPUTNOTIFY, 0);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/evr/tests/evr.c | 74 +++++++++++++++++++++++++------------------- 1 file changed, 43 insertions(+), 31 deletions(-)
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index a0aba91aa74..abd507760c5 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -3378,6 +3378,46 @@ static void create_d3d_sample(IDirect3DDeviceManager9 *manager, const GUID *subt IDirect3DSurface9_Release(surface); }
+#define check_presenter_output(a, b, c, d) check_presenter_output_(__LINE__, a, b, c, d) +static DWORD check_presenter_output_(int line, IMFVideoPresenter *presenter, const BITMAPINFOHEADER *expect_header, + const WCHAR *resource, const RECT *rect) +{ + BITMAPINFOHEADER header = {.biSize = sizeof(BITMAPINFOHEADER)}; + IMFVideoDisplayControl *display_control; + DWORD diff, data_size; + LONGLONG timestamp; + BYTE *data; + HRESULT hr; + + hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control); + ok_(__FILE__, line)(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFVideoDisplayControl_GetCurrentImage(display_control, &header, &data, &data_size, ×tamp); + if (hr == MF_E_INVALIDREQUEST) + { + Sleep(500); + hr = IMFVideoDisplayControl_GetCurrentImage(display_control, &header, &data, &data_size, ×tamp); + } + ok_(__FILE__, line)(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFVideoDisplayControl_Release(display_control); + + ok_(__FILE__, line)(header.biSize == expect_header->biSize, "Unexpected biSize %#lx\n", header.biSize); + ok_(__FILE__, line)(header.biWidth == expect_header->biWidth, "Unexpected biWidth %#lx\n", header.biWidth); + ok_(__FILE__, line)(header.biHeight == expect_header->biHeight, "Unexpected biHeight %#lx\n", header.biHeight); + ok_(__FILE__, line)(header.biPlanes == expect_header->biPlanes, "Unexpected biPlanes %#x\n", header.biPlanes); + ok_(__FILE__, line)(header.biBitCount == expect_header->biBitCount, "Unexpected biBitCount %#x\n", header.biBitCount); + ok_(__FILE__, line)(header.biCompression == expect_header->biCompression, "Unexpected biCompression %#lx\n", header.biCompression); + ok_(__FILE__, line)(header.biSizeImage == expect_header->biSizeImage, "Unexpected biSizeImage %#lx\n", header.biSizeImage); + ok_(__FILE__, line)(header.biXPelsPerMeter == expect_header->biXPelsPerMeter, "Unexpected biXPelsPerMeter %#lx\n", header.biXPelsPerMeter); + ok_(__FILE__, line)(header.biYPelsPerMeter == expect_header->biYPelsPerMeter, "Unexpected biYPelsPerMeter %#lx\n", header.biYPelsPerMeter); + ok_(__FILE__, line)(header.biClrUsed == expect_header->biClrUsed, "Unexpected biClrUsed %#lx\n", header.biClrUsed); + ok_(__FILE__, line)(header.biClrImportant == expect_header->biClrImportant, "Unexpected biClrImportant %#lx\n", header.biClrImportant); + + diff = check_rgb32_data(resource, data, header.biSizeImage, rect); + CoTaskMemFree(data); + + return diff; +} + static void test_presenter_orientation(const GUID *subtype) { IMFTopologyServiceLookupClient *lookup_client; @@ -3389,19 +3429,15 @@ static void test_presenter_orientation(const GUID *subtype) .biCompression = BI_RGB, .biSizeImage = 96 * 96 * 4, }; - BITMAPINFOHEADER header = {.biSize = sizeof(BITMAPINFOHEADER)}; - IMFVideoDisplayControl *display_control; IDirect3DDeviceManager9 *manager; IMFVideoPresenter *presenter; IMFMediaType *video_type; - DWORD diff, data_size; struct test_host host; IMFTransform *mixer; - LONGLONG timestamp; IMFSample *sample; HWND window; - BYTE *data; HRESULT hr; + DWORD diff; RECT rect;
window = create_window(); @@ -3456,33 +3492,9 @@ static void test_presenter_orientation(const GUID *subtype) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); IMFSample_Release(sample);
- hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFVideoDisplayControl, (void **)&display_control); - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFVideoDisplayControl_GetCurrentImage(display_control, &header, &data, &data_size, ×tamp); - if (hr == MF_E_INVALIDREQUEST) - { - Sleep(500); - hr = IMFVideoDisplayControl_GetCurrentImage(display_control, &header, &data, &data_size, ×tamp); - } - ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - IMFVideoDisplayControl_Release(display_control); - - ok(header.biSize == expect_header.biSize, "Unexpected biSize %#lx\n", header.biSize); - ok(header.biWidth == expect_header.biWidth, "Unexpected biWidth %#lx\n", header.biWidth); - ok(header.biHeight == expect_header.biHeight, "Unexpected biHeight %#lx\n", header.biHeight); - ok(header.biPlanes == expect_header.biPlanes, "Unexpected biPlanes %#x\n", header.biPlanes); - ok(header.biBitCount == expect_header.biBitCount, "Unexpected biBitCount %#x\n", header.biBitCount); - ok(header.biCompression == expect_header.biCompression, "Unexpected biCompression %#lx\n", header.biCompression); - ok(header.biSizeImage == expect_header.biSizeImage, "Unexpected biSizeImage %#lx\n", header.biSizeImage); - ok(header.biXPelsPerMeter == expect_header.biXPelsPerMeter, "Unexpected biXPelsPerMeter %#lx\n", header.biXPelsPerMeter); - ok(header.biYPelsPerMeter == expect_header.biYPelsPerMeter, "Unexpected biYPelsPerMeter %#lx\n", header.biYPelsPerMeter); - ok(header.biClrUsed == expect_header.biClrUsed, "Unexpected biClrUsed %#lx\n", header.biClrUsed); - ok(header.biClrImportant == expect_header.biClrImportant, "Unexpected biClrImportant %#lx\n", header.biClrImportant); - - SetRect(&rect, 0, 0, header.biWidth, header.biHeight); - diff = check_rgb32_data(L"rgb32frame-flip.bmp", data, header.biSizeImage, &rect); + SetRect(&rect, 0, 0, expect_header.biWidth, expect_header.biHeight); + diff = check_presenter_output(presenter, &expect_header, L"rgb32frame-flip.bmp", &rect); ok(diff <= 5, "Unexpected %lu%% diff\n", diff); - CoTaskMemFree(data);
hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_ENDSTREAMING, 0); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/evr/tests/evr.c | 208 ++++++++++++++++++++++++++++- dlls/evr/tests/resource.rc | 10 +- dlls/evr/tests/rgb32frame-crop.bmp | Bin 0 -> 7670 bytes 3 files changed, 211 insertions(+), 7 deletions(-) create mode 100644 dlls/evr/tests/rgb32frame-crop.bmp
diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index abd507760c5..59fdfcb8fae 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -41,7 +41,7 @@ static void load_resource(const WCHAR *filename, const BYTE **data, DWORD *lengt
static DWORD compare_rgb32(const BYTE *data, DWORD *length, const RECT *rect, const BYTE *expect) { - DWORD x, y, size, diff = 0, width = (rect->right + 0xf) & ~0xf, height = (rect->bottom + 0xf) & ~0xf; + DWORD x, y, size, diff = 0, width = rect->right, height = rect->bottom;
/* skip BMP header from the dump */ size = *(DWORD *)(expect + 2 + 2 * sizeof(DWORD)); @@ -66,7 +66,7 @@ static DWORD compare_rgb32(const BYTE *data, DWORD *length, const RECT *rect, co
static void dump_rgb32(const BYTE *data, DWORD length, const RECT *rect, HANDLE output) { - DWORD width = (rect->right + 0xf) & ~0xf, height = (rect->bottom + 0xf) & ~0xf; + DWORD width = rect->right, height = rect->bottom; static const char magic[2] = "BM"; struct { @@ -3378,9 +3378,9 @@ static void create_d3d_sample(IDirect3DDeviceManager9 *manager, const GUID *subt IDirect3DSurface9_Release(surface); }
-#define check_presenter_output(a, b, c, d) check_presenter_output_(__LINE__, a, b, c, d) +#define check_presenter_output(a, b, c, d) check_presenter_output_(__LINE__, a, b, c, d, FALSE) static DWORD check_presenter_output_(int line, IMFVideoPresenter *presenter, const BITMAPINFOHEADER *expect_header, - const WCHAR *resource, const RECT *rect) + const WCHAR *resource, const RECT *rect, BOOL todo) { BITMAPINFOHEADER header = {.biSize = sizeof(BITMAPINFOHEADER)}; IMFVideoDisplayControl *display_control; @@ -3401,11 +3401,14 @@ static DWORD check_presenter_output_(int line, IMFVideoPresenter *presenter, con IMFVideoDisplayControl_Release(display_control);
ok_(__FILE__, line)(header.biSize == expect_header->biSize, "Unexpected biSize %#lx\n", header.biSize); + todo_wine_if(todo) ok_(__FILE__, line)(header.biWidth == expect_header->biWidth, "Unexpected biWidth %#lx\n", header.biWidth); + todo_wine_if(todo) ok_(__FILE__, line)(header.biHeight == expect_header->biHeight, "Unexpected biHeight %#lx\n", header.biHeight); ok_(__FILE__, line)(header.biPlanes == expect_header->biPlanes, "Unexpected biPlanes %#x\n", header.biPlanes); ok_(__FILE__, line)(header.biBitCount == expect_header->biBitCount, "Unexpected biBitCount %#x\n", header.biBitCount); ok_(__FILE__, line)(header.biCompression == expect_header->biCompression, "Unexpected biCompression %#lx\n", header.biCompression); + todo_wine_if(todo) ok_(__FILE__, line)(header.biSizeImage == expect_header->biSizeImage, "Unexpected biSizeImage %#lx\n", header.biSizeImage); ok_(__FILE__, line)(header.biXPelsPerMeter == expect_header->biXPelsPerMeter, "Unexpected biXPelsPerMeter %#lx\n", header.biXPelsPerMeter); ok_(__FILE__, line)(header.biYPelsPerMeter == expect_header->biYPelsPerMeter, "Unexpected biYPelsPerMeter %#lx\n", header.biYPelsPerMeter); @@ -3512,6 +3515,202 @@ skip_tests: DestroyWindow(window); }
+static void test_mixer_video_aperture(void) +{ + IMFTopologyServiceLookupClient *lookup_client; + static const BITMAPINFOHEADER expect_header_crop = + { + .biSize = sizeof(BITMAPINFOHEADER), + .biWidth = 34, .biHeight = 56, + .biPlanes = 1, .biBitCount = 32, + .biCompression = BI_RGB, + .biSizeImage = 34 * 56 * 4, + }; + static const BITMAPINFOHEADER expect_header = + { + .biSize = sizeof(BITMAPINFOHEADER), + .biWidth = 96, .biHeight = 96, + .biPlanes = 1, .biBitCount = 32, + .biCompression = BI_RGB, + .biSizeImage = 96 * 96 * 4, + }; + const MFVideoArea aperture = {.Area = {.cx = 34, .cy = 56}}; + IDirect3DDeviceManager9 *manager; + IMFVideoPresenter *presenter; + IMFMediaType *video_type; + struct test_host host; + IMFTransform *mixer; + IMFSample *sample; + HWND window; + HRESULT hr; + DWORD diff; + RECT rect; + + window = create_window(); + + hr = MFCreateVideoMixer(NULL, &IID_IDirect3DDevice9, &IID_IMFTransform, (void **)&mixer); + ok(hr == S_OK, "Failed to create a mixer, hr %#lx.\n", hr); + hr = MFCreateVideoPresenter(NULL, &IID_IDirect3DDevice9, &IID_IMFVideoPresenter, (void **)&presenter); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + init_test_host(&host, mixer, presenter); + hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFTopologyServiceLookupClient, (void **)&lookup_client); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTopologyServiceLookupClient_InitServicePointers(lookup_client, &host.IMFTopologyServiceLookup_iface); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFTopologyServiceLookupClient_Release(lookup_client); + + /* Configure device and media types. */ + + hr = MFGetService((IUnknown *)presenter, &MR_VIDEO_ACCELERATION_SERVICE, &IID_IDirect3DDeviceManager9, (void **)&manager); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTransform_ProcessMessage(mixer, MFT_MESSAGE_SET_D3D_MANAGER, (ULONG_PTR)manager); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IDirect3DDeviceManager9_Release(manager); + + + /* MF_MT_MINIMUM_DISPLAY_APERTURE / MF_MT_PAN_SCAN_APERTURE have no effect */ + + video_type = create_video_type(&MFVideoFormat_RGB32); + hr = IMFMediaType_SetUINT64(video_type, &MF_MT_FRAME_SIZE, (UINT64)expect_header.biWidth << 32 | expect_header.biHeight); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT32(video_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetBlob(video_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture)); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetBlob(video_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture)); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTransform_SetInputType(mixer, 0, video_type, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(video_type); + + video_type = create_video_type(&MFVideoFormat_RGB32); + hr = IMFMediaType_SetUINT64(video_type, &MF_MT_FRAME_SIZE, (UINT64)expect_header.biWidth << 32 | expect_header.biHeight); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT32(video_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTransform_SetOutputType(mixer, 0, video_type, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(video_type); + + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_INVALIDATEMEDIATYPE, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_BEGINSTREAMING, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + create_d3d_sample(manager, &MFVideoFormat_RGB32, &sample); + hr = IMFTransform_ProcessInput(mixer, 0, sample, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_PROCESSINPUTNOTIFY, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFSample_Release(sample); + + SetRect(&rect, 0, 0, expect_header.biWidth, expect_header.biHeight); + diff = check_presenter_output(presenter, &expect_header, L"rgb32frame-flip.bmp", &rect); + ok(diff <= 5, "Unexpected %lu%% diff\n", diff); + + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_ENDSTREAMING, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + + /* MF_MT_PAN_SCAN_APERTURE has an effect only when enabled */ + + video_type = create_video_type(&MFVideoFormat_RGB32); + hr = IMFMediaType_SetUINT64(video_type, &MF_MT_FRAME_SIZE, (UINT64)expect_header.biWidth << 32 | expect_header.biHeight); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT32(video_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTransform_SetOutputType(mixer, 0, video_type, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(video_type); + + video_type = create_video_type(&MFVideoFormat_RGB32); + hr = IMFMediaType_SetUINT64(video_type, &MF_MT_FRAME_SIZE, (UINT64)expect_header.biWidth << 32 | expect_header.biHeight); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT32(video_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetBlob(video_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture)); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT32(video_type, &MF_MT_PAN_SCAN_ENABLED, TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTransform_SetInputType(mixer, 0, video_type, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(video_type); + + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_INVALIDATEMEDIATYPE, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_BEGINSTREAMING, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + create_d3d_sample(manager, &MFVideoFormat_RGB32, &sample); + hr = IMFTransform_ProcessInput(mixer, 0, sample, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_PROCESSINPUTNOTIFY, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFSample_Release(sample); + + SetRect(&rect, 0, 0, expect_header_crop.biWidth, expect_header_crop.biHeight); + diff = check_presenter_output_(__LINE__, presenter, &expect_header_crop, L"rgb32frame-crop.bmp", &rect, TRUE); + todo_wine ok(diff <= 5, "Unexpected %lu%% diff\n", diff); + + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_ENDSTREAMING, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + + /* MF_MT_GEOMETRIC_APERTURE has an effect */ + + video_type = create_video_type(&MFVideoFormat_RGB32); + hr = IMFMediaType_SetUINT64(video_type, &MF_MT_FRAME_SIZE, (UINT64)expect_header.biWidth << 32 | expect_header.biHeight); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT32(video_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetBlob(video_type, &MF_MT_GEOMETRIC_APERTURE, (BYTE *)&aperture, sizeof(aperture)); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTransform_SetInputType(mixer, 0, video_type, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(video_type); + + video_type = create_video_type(&MFVideoFormat_RGB32); + hr = IMFMediaType_SetUINT64(video_type, &MF_MT_FRAME_SIZE, (UINT64)expect_header.biWidth << 32 | expect_header.biHeight); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT32(video_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, TRUE); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTransform_SetOutputType(mixer, 0, video_type, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFMediaType_Release(video_type); + + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_INVALIDATEMEDIATYPE, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_BEGINSTREAMING, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + create_d3d_sample(manager, &MFVideoFormat_RGB32, &sample); + hr = IMFTransform_ProcessInput(mixer, 0, sample, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_PROCESSINPUTNOTIFY, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFSample_Release(sample); + + SetRect(&rect, 0, 0, expect_header_crop.biWidth, expect_header_crop.biHeight); + diff = check_presenter_output_(__LINE__, presenter, &expect_header_crop, L"rgb32frame-crop.bmp", &rect, TRUE); + todo_wine ok(diff <= 5, "Unexpected %lu%% diff\n", diff); + + hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_ENDSTREAMING, 0); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + + hr = IMFVideoPresenter_QueryInterface(presenter, &IID_IMFTopologyServiceLookupClient, (void **)&lookup_client); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFTopologyServiceLookupClient_ReleaseServicePointers(lookup_client); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + IMFTopologyServiceLookupClient_Release(lookup_client); + + IMFTransform_Release(mixer); + IMFVideoPresenter_Release(presenter); + + DestroyWindow(window); +} + static void test_MFIsFormatYUV(void) { static const DWORD formats[] = @@ -3715,6 +3914,7 @@ START_TEST(evr) test_presenter_media_type(); test_presenter_orientation(&MFVideoFormat_NV12); test_presenter_orientation(&MFVideoFormat_RGB32); + test_mixer_video_aperture(); test_presenter_shutdown(); test_mixer_output_rectangle(); test_mixer_zorder(); diff --git a/dlls/evr/tests/resource.rc b/dlls/evr/tests/resource.rc index 79b62304303..7537acfe5ac 100644 --- a/dlls/evr/tests/resource.rc +++ b/dlls/evr/tests/resource.rc @@ -20,14 +20,18 @@
#include "windef.h"
-/* Generated from running the mf:transform tests on Windows */ +/* Generated from running the evr:evr tests on Windows */ /* @makedep: rgb32frame.bmp */ rgb32frame.bmp RCDATA rgb32frame.bmp
-/* Generated from running the mf:transform tests on Windows */ +/* Generated from running the evr:evr tests on Windows */ /* @makedep: rgb32frame-flip.bmp */ rgb32frame-flip.bmp RCDATA rgb32frame-flip.bmp
-/* Generated from running the mf:transform tests on Windows */ +/* Generated from running the evr:evr tests on Windows */ +/* @makedep: rgb32frame-crop.bmp */ +rgb32frame-crop.bmp RCDATA rgb32frame-crop.bmp + +/* Generated from running the evr:evr tests on Windows */ /* @makedep: nv12frame.bmp */ nv12frame.bmp RCDATA nv12frame.bmp diff --git a/dlls/evr/tests/rgb32frame-crop.bmp b/dlls/evr/tests/rgb32frame-crop.bmp new file mode 100644 index 0000000000000000000000000000000000000000..6cbaf72df609a7e439c7897e7a42ff76fa269bc6 GIT binary patch literal 7670 zcmeIzu?fOZ6oug<mQEll1VL~Dv9{MnvWJtnhc>R@8kVBHAS8t$?|KNC;H5dm349kq znsE7(x7*hXbk~M+O-tI+2n8o_@1J)!{b-S3-hmr%133*K_#-jzzzw(oH!!$?vIZ2) zTR_1p#!zsL2^0jsG4l@GfE&nZ;QTp2!K0Z%!7AQRaEcogAb9Ybci;xxKt=<{>I((4 b<_85&9?}Xfd=CXFC75^M2Hb!f7~a4iz_P>T
literal 0 HcmV?d00001
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/evr/mixer.c | 53 ++++++++++++++++++++++++++------------------ dlls/evr/presenter.c | 25 ++++++++++++--------- dlls/evr/tests/evr.c | 4 ++-- 3 files changed, 48 insertions(+), 34 deletions(-)
diff --git a/dlls/evr/mixer.c b/dlls/evr/mixer.c index 222fc538fec..2ff733261b9 100644 --- a/dlls/evr/mixer.c +++ b/dlls/evr/mixer.c @@ -45,7 +45,7 @@ struct input_stream IMFMediaType *media_type; MFVideoNormalizedRect rect; unsigned int zorder; - SIZE frame_size; + MFVideoArea aperture; IMFSample *sample; unsigned int sample_requested : 1; }; @@ -102,7 +102,6 @@ struct video_mixer COLORREF rgba; DXVA2_AYUVSample16 ayuv; } bkgnd_color; - MFVideoArea aperture; LONGLONG lower_bound; LONGLONG upper_bound; CRITICAL_SECTION cs; @@ -763,7 +762,7 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const
if (count && !(flags & MFT_SET_TYPE_TEST_ONLY)) { - UINT32 fixed_samples, interlace_mode; + UINT32 fixed_samples, interlace_mode, width = video_desc->SampleWidth, height = video_desc->SampleHeight; MFVideoArea aperture; UINT64 par;
@@ -775,12 +774,18 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const
memcpy(&subtype, &MFVideoFormat_Base, sizeof(subtype)); memset(&aperture, 0, sizeof(aperture)); - if (FAILED(IMFMediaType_GetBlob(media_type, &MF_MT_GEOMETRIC_APERTURE, (UINT8 *)&aperture, + if (SUCCEEDED(IMFMediaType_GetBlob(media_type, &MF_MT_GEOMETRIC_APERTURE, (UINT8 *)&aperture, sizeof(aperture), NULL))) { - aperture.Area.cx = video_desc->SampleWidth; - aperture.Area.cy = video_desc->SampleHeight; + width = aperture.OffsetX.value + aperture.Area.cx; + height = aperture.OffsetX.value + aperture.Area.cy; + } + else + { + aperture.Area.cx = width; + aperture.Area.cy = height; } + interlace_mode = video_mixer_get_interlace_mode_from_video_desc(video_desc); mf_get_attribute_uint64(media_type, &MF_MT_PIXEL_ASPECT_RATIO, &par, (UINT64)1 << 32 | 1); mf_get_attribute_uint32(media_type, &MF_MT_FIXED_SIZE_SAMPLES, &fixed_samples, 1); @@ -795,7 +800,7 @@ static HRESULT video_mixer_collect_output_types(struct video_mixer *mixer, const MFCreateMediaType(&rt_media_type); IMFMediaType_CopyAllItems(media_type, (IMFAttributes *)rt_media_type); IMFMediaType_SetGUID(rt_media_type, &MF_MT_SUBTYPE, &subtype); - IMFMediaType_SetUINT64(rt_media_type, &MF_MT_FRAME_SIZE, (UINT64)aperture.Area.cx << 32 | aperture.Area.cy); + IMFMediaType_SetUINT64(rt_media_type, &MF_MT_FRAME_SIZE, (UINT64)width << 32 | height); IMFMediaType_SetBlob(rt_media_type, &MF_MT_GEOMETRIC_APERTURE, (const UINT8 *)&aperture, sizeof(aperture)); IMFMediaType_SetBlob(rt_media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (const UINT8 *)&aperture, sizeof(aperture)); IMFMediaType_SetUINT32(rt_media_type, &MF_MT_INTERLACE_MODE, interlace_mode); @@ -851,6 +856,7 @@ static HRESULT WINAPI video_mixer_transform_SetInputType(IMFTransform *iface, DW DXVA2_VideoDesc video_desc; HRESULT hr = E_NOTIMPL; unsigned int count; + UINT32 size; GUID *guids;
TRACE("%p, %lu, %p, %#lx.\n", iface, id, media_type, flags); @@ -884,8 +890,15 @@ static HRESULT WINAPI video_mixer_transform_SetInputType(IMFTransform *iface, DW if (mixer->inputs[0].media_type) IMFMediaType_Release(mixer->inputs[0].media_type); mixer->inputs[0].media_type = media_type; - mixer->inputs[0].frame_size.cx = video_desc.SampleWidth; - mixer->inputs[0].frame_size.cy = video_desc.SampleHeight; + + if (FAILED(IMFMediaType_GetBlob(media_type, &MF_MT_GEOMETRIC_APERTURE, + (BYTE *)&mixer->inputs[0].aperture, sizeof(mixer->inputs[0].aperture), &size))) + { + memset(&mixer->inputs[0].aperture, 0, sizeof(mixer->inputs[0].aperture)); + mixer->inputs[0].aperture.Area.cx = video_desc.SampleWidth; + mixer->inputs[0].aperture.Area.cy = video_desc.SampleHeight; + } + IMFMediaType_AddRef(mixer->inputs[0].media_type); } CoTaskMemFree(guids); @@ -962,11 +975,6 @@ static HRESULT WINAPI video_mixer_transform_SetOutputType(IMFTransform *iface, D if (SUCCEEDED(hr = IDirectXVideoProcessorService_CreateVideoProcessor(service, &mixer->output.rt_formats[i].device, &video_desc, rt_format, MAX_MIXER_INPUT_SUBSTREAMS, &mixer->processor))) { - if (FAILED(IMFMediaType_GetBlob(type, &MF_MT_GEOMETRIC_APERTURE, (UINT8 *)&mixer->aperture, - sizeof(mixer->aperture), NULL))) - { - memset(&mixer->aperture, 0, sizeof(mixer->aperture)); - } if (mixer->output.media_type) IMFMediaType_Release(mixer->output.media_type); mixer->output.media_type = type; @@ -1297,9 +1305,9 @@ static void video_mixer_render(struct video_mixer *mixer, IDirect3DSurface9 *rt) DXVA2_VideoProcessBltParams params = { 0 }; MFVideoNormalizedRect zoom_rect; struct input_stream *stream; + MFVideoArea aperture; HRESULT hr = S_OK; unsigned int i; - RECT dst;
if (FAILED(IMFAttributes_GetBlob(mixer->attributes, &VIDEO_ZOOM_RECT, (UINT8 *)&zoom_rect, sizeof(zoom_rect), NULL))) @@ -1308,8 +1316,11 @@ static void video_mixer_render(struct video_mixer *mixer, IDirect3DSurface9 *rt) zoom_rect.right = zoom_rect.bottom = 1.0f; }
- SetRect(&dst, 0, 0, mixer->aperture.Area.cx, mixer->aperture.Area.cy); - OffsetRect(&dst, mixer->aperture.OffsetX.value, mixer->aperture.OffsetY.value); + if (FAILED(IMFMediaType_GetBlob(mixer->output.media_type, &MF_MT_GEOMETRIC_APERTURE, + (UINT8 *)&aperture, sizeof(aperture), NULL))) + aperture = mixer->inputs[0].aperture; + SetRect(¶ms.TargetRect, 0, 0, aperture.Area.cx, aperture.Area.cy); + OffsetRect(¶ms.TargetRect, aperture.OffsetX.value, aperture.OffsetY.value);
for (i = 0; i < mixer->input_count; ++i) { @@ -1326,8 +1337,9 @@ static void video_mixer_render(struct video_mixer *mixer, IDirect3DSurface9 *rt)
/* Full input frame corrected to full destination rectangle. */
- video_mixer_scale_rect(&sample->SrcRect, stream->frame_size.cx, stream->frame_size.cy, &zoom_rect); - CopyRect(&sample->DstRect, &dst); + video_mixer_scale_rect(&sample->SrcRect, stream->aperture.Area.cx, stream->aperture.Area.cy, &zoom_rect); + OffsetRect(&sample->SrcRect, stream->aperture.OffsetX.value, stream->aperture.OffsetY.value); + CopyRect(&sample->DstRect, ¶ms.TargetRect); video_mixer_correct_aspect_ratio(&sample->SrcRect, &sample->DstRect);
if (video_mixer_rect_needs_scaling(&stream->rect)) @@ -1340,9 +1352,6 @@ static void video_mixer_render(struct video_mixer *mixer, IDirect3DSurface9 *rt)
if (SUCCEEDED(hr)) { - SetRect(¶ms.TargetRect, 0, 0, mixer->aperture.Area.cx, mixer->aperture.Area.cy); - OffsetRect(¶ms.TargetRect, mixer->aperture.OffsetX.value, mixer->aperture.OffsetY.value); - params.BackgroundColor = mixer->bkgnd_color.ayuv; params.Alpha = DXVA2_Fixed32OpaqueAlpha();
diff --git a/dlls/evr/presenter.c b/dlls/evr/presenter.c index 552e24b4b97..f9500c46e7d 100644 --- a/dlls/evr/presenter.c +++ b/dlls/evr/presenter.c @@ -361,8 +361,8 @@ static HRESULT video_presenter_configure_output_type(struct video_presenter *pre static HRESULT video_presenter_invalidate_media_type(struct video_presenter *presenter) { IMFMediaType *media_type, *candidate_type; - MFVideoArea aperture = {{ 0 }}; unsigned int idx = 0; + UINT32 size; RECT rect; HRESULT hr;
@@ -374,18 +374,23 @@ static HRESULT video_presenter_invalidate_media_type(struct video_presenter *pre
video_presenter_get_native_video_size(presenter);
- rect = presenter->dst_rect; - if (rect.left == 0 && rect.right == 0 && rect.bottom == 0 && rect.top == 0) + while (SUCCEEDED(hr = IMFTransform_GetOutputAvailableType(presenter->mixer, 0, idx++, &candidate_type))) { - rect.right = presenter->native_size.cx; - rect.bottom = presenter->native_size.cy; - } + MFVideoArea aperture = {{ 0 }};
- aperture.Area.cx = rect.right - rect.left; - aperture.Area.cy = rect.bottom - rect.top; + rect = presenter->dst_rect; + if (!IsRectEmpty(&rect)) + { + aperture.Area.cx = rect.right - rect.left; + aperture.Area.cy = rect.bottom - rect.top; + } + else if (FAILED(IMFMediaType_GetBlob(candidate_type, &MF_MT_GEOMETRIC_APERTURE, (UINT8 *)&aperture, + sizeof(aperture), &size))) + { + aperture.Area.cx = presenter->native_size.cx; + aperture.Area.cy = presenter->native_size.cy; + }
- while (SUCCEEDED(hr = IMFTransform_GetOutputAvailableType(presenter->mixer, 0, idx++, &candidate_type))) - { /* FIXME: check that d3d device supports this format */
if (FAILED(hr = IMFMediaType_CopyAllItems(candidate_type, (IMFAttributes *)media_type))) diff --git a/dlls/evr/tests/evr.c b/dlls/evr/tests/evr.c index 59fdfcb8fae..a684540d977 100644 --- a/dlls/evr/tests/evr.c +++ b/dlls/evr/tests/evr.c @@ -3692,8 +3692,8 @@ static void test_mixer_video_aperture(void) IMFSample_Release(sample);
SetRect(&rect, 0, 0, expect_header_crop.biWidth, expect_header_crop.biHeight); - diff = check_presenter_output_(__LINE__, presenter, &expect_header_crop, L"rgb32frame-crop.bmp", &rect, TRUE); - todo_wine ok(diff <= 5, "Unexpected %lu%% diff\n", diff); + diff = check_presenter_output(presenter, &expect_header_crop, L"rgb32frame-crop.bmp", &rect); + ok(diff <= 5, "Unexpected %lu%% diff\n", diff);
hr = IMFVideoPresenter_ProcessMessage(presenter, MFVP_MESSAGE_ENDSTREAMING, 0); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
v2: Added tests and used MF_MT_GEOMETRIC_APERTURE instead. Left MF_MT_PAN_SCAN_APERTURE unimplemented for now although it seems to have some similar effects (and the combinations of both would probably need to be handled).
Nikolay Sivov (@nsivov) commented about dlls/evr/mixer.c:
if (mixer->inputs[0].media_type) IMFMediaType_Release(mixer->inputs[0].media_type); mixer->inputs[0].media_type = media_type;
mixer->inputs[0].frame_size.cx = video_desc.SampleWidth;
mixer->inputs[0].frame_size.cy = video_desc.SampleHeight;
if (FAILED(IMFMediaType_GetBlob(media_type, &MF_MT_GEOMETRIC_APERTURE,
(BYTE *)&mixer->inputs[0].aperture, sizeof(mixer->inputs[0].aperture), &size)))
The size argument is optional, existing code does not use it.
Nikolay Sivov (@nsivov) commented about dlls/evr/presenter.c:
{
rect.right = presenter->native_size.cx;
rect.bottom = presenter->native_size.cy;
- }
MFVideoArea aperture = {{ 0 }};
- aperture.Area.cx = rect.right - rect.left;
- aperture.Area.cy = rect.bottom - rect.top;
rect = presenter->dst_rect;
if (!IsRectEmpty(&rect))
{
aperture.Area.cx = rect.right - rect.left;
aperture.Area.cy = rect.bottom - rect.top;
}
else if (FAILED(IMFMediaType_GetBlob(candidate_type, &MF_MT_GEOMETRIC_APERTURE, (UINT8 *)&aperture,
sizeof(aperture), &size)))
Same here.