From: Rémi Bernon <rbernon(a)codeweavers.com>
---
dlls/mf/tests/resource.rc | 4 ++
dlls/mf/tests/rgb32frame-crop.bmp | Bin 0 -> 27606 bytes
dlls/mf/tests/transform.c | 93 +++++++++++++++++++++++++++---
3 files changed, 89 insertions(+), 8 deletions(-)
create mode 100644 dlls/mf/tests/rgb32frame-crop.bmp
diff --git a/dlls/mf/tests/resource.rc b/dlls/mf/tests/resource.rc
index ab1fb7ecbb0..357a083bc66 100644
--- a/dlls/mf/tests/resource.rc
+++ b/dlls/mf/tests/resource.rc
@@ -105,6 +105,10 @@ rgb32frame.bmp RCDATA rgb32frame.bmp
/* @makedep: rgb32frame-flip.bmp */
rgb32frame-flip.bmp RCDATA rgb32frame-flip.bmp
+/* Generated from running the tests on Windows */
+/* @makedep: rgb32frame-crop.bmp */
+rgb32frame-crop.bmp RCDATA rgb32frame-crop.bmp
+
/* Generated from running the tests on Windows */
/* @makedep: rgb32frame-grabber.bmp */
rgb32frame-grabber.bmp RCDATA rgb32frame-grabber.bmp
diff --git a/dlls/mf/tests/rgb32frame-crop.bmp b/dlls/mf/tests/rgb32frame-crop.bmp
new file mode 100644
index 0000000000000000000000000000000000000000..34a28ad44732f38d4165bdc00de313db7c2f390a
GIT binary patch
literal 27606
zcmeI&!3}~y5J1tP6OUG40p7hByRa#%vK-cdFbyys_V7q%2_Yn#pLc<9e|+DuAGchu
zInSI|&JvegBR<Fd{o+_g#4s8#zyJdbFu(u<3^2d|0}L?GGZ3+6LUX=BeV)+pe8a7s
zj=g^6Pe&cg!VG5~d7Qyv?SV%g%fbw29(kO>VeNs(e|lW=y~b$300Rs#zyJdbFu(u<
z3^2ez&%iQb7!4R;fB^;=V1NMz7+`<_1{mlW$iD%G(SQL47+`<_1{h#~0R|XgfPtQY
v-qY&q#{dHiFu(u<3^2d|0}L?0z-GXqfC36Apnw7jD4>7>3Mim}0{sF%iRi;|
literal 0
HcmV?d00001
diff --git a/dlls/mf/tests/transform.c b/dlls/mf/tests/transform.c
index 247ee1d7faf..7edf247acce 100644
--- a/dlls/mf/tests/transform.c
+++ b/dlls/mf/tests/transform.c
@@ -7314,6 +7314,15 @@ static void test_video_processor(void)
ATTR_BLOB(MF_MT_MINIMUM_DISPLAY_APERTURE, &actual_aperture, 16),
{0},
};
+ const struct attribute_desc rgb32_with_aperture_positive_stride[] =
+ {
+ ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video, .required = TRUE),
+ ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32, .required = TRUE),
+ ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height, .required = TRUE),
+ ATTR_BLOB(MF_MT_MINIMUM_DISPLAY_APERTURE, &actual_aperture, 16),
+ ATTR_UINT32(MF_MT_DEFAULT_STRIDE, actual_width * 4),
+ {0},
+ };
const struct attribute_desc nv12_default_stride[] =
{
ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video, .required = TRUE),
@@ -7376,17 +7385,19 @@ static void test_video_processor(void)
};
const struct attribute_desc nv12_with_aperture[] =
{
- ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video),
- ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12),
- ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height),
+ ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video, .required = TRUE),
+ ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_NV12, .required = TRUE),
+ ATTR_RATIO(MF_MT_FRAME_SIZE, actual_width, actual_height, .required = TRUE),
ATTR_BLOB(MF_MT_MINIMUM_DISPLAY_APERTURE, &actual_aperture, 16),
+ ATTR_BLOB(MF_MT_GEOMETRIC_APERTURE, &actual_aperture, 16),
+ ATTR_BLOB(MF_MT_PAN_SCAN_APERTURE, &actual_aperture, 16),
{0},
};
const struct attribute_desc rgb32_no_aperture[] =
{
- ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video),
- ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32),
- ATTR_RATIO(MF_MT_FRAME_SIZE, 82, 84),
+ ATTR_GUID(MF_MT_MAJOR_TYPE, MFMediaType_Video, .required = TRUE),
+ ATTR_GUID(MF_MT_SUBTYPE, MFVideoFormat_RGB32, .required = TRUE),
+ ATTR_RATIO(MF_MT_FRAME_SIZE, 82, 84, .required = TRUE),
{0},
};
const MFT_OUTPUT_STREAM_INFO initial_output_info = {0};
@@ -7412,6 +7423,19 @@ static void test_video_processor(void)
.buffer_count = 1, .buffers = &rgb32_buffer_desc,
};
+ const struct buffer_desc rgb32_crop_buffer_desc =
+ {
+ .length = actual_aperture.Area.cx * actual_aperture.Area.cy * 4,
+ .compare = compare_rgb32, .compare_rect = {.right = actual_aperture.Area.cx,
.bottom = actual_aperture.Area.cy},
+ .dump = dump_rgb32, .size = actual_aperture.Area,
+ };
+ const struct sample_desc rgb32_crop_sample_desc =
+ {
+ .attributes = output_sample_attributes,
+ .sample_time = 0, .sample_duration = 10000000,
+ .buffer_count = 1, .buffers = &rgb32_crop_buffer_desc,
+ };
+
const struct buffer_desc rgb555_buffer_desc =
{
.length = actual_width * actual_height * 2,
@@ -7525,6 +7549,26 @@ static void test_video_processor(void)
.output_type_desc = rgb555_positive_stride, .output_bitmap =
L"rgb555frame-flip.bmp",
.output_sample_desc = &rgb555_sample_desc, .delta = 4, /* Windows returns
0, Wine needs 4 */
},
+ {
+ .input_type_desc = nv12_with_aperture, .input_bitmap =
L"nv12frame.bmp",
+ .output_type_desc = rgb32_no_aperture, .output_bitmap =
L"rgb32frame-crop.bmp",
+ .output_sample_desc = &rgb32_crop_sample_desc,
+ },
+ {
+ .input_type_desc = rgb32_no_aperture, .input_bitmap =
L"rgb32frame-crop.bmp",
+ .output_type_desc = rgb32_with_aperture, .output_bitmap =
L"rgb32frame-flip.bmp",
+ .output_sample_desc = &rgb32_sample_desc,
+ },
+ {
+ .input_type_desc = rgb32_with_aperture, .input_bitmap =
L"rgb32frame-flip.bmp",
+ .output_type_desc = rgb32_no_aperture, .output_bitmap =
L"rgb32frame-crop.bmp",
+ .output_sample_desc = &rgb32_crop_sample_desc,
+ },
+ {
+ .input_type_desc = rgb32_with_aperture_positive_stride, .input_bitmap =
L"rgb32frame.bmp",
+ .output_type_desc = rgb32_no_aperture, .output_bitmap =
L"rgb32frame-crop.bmp",
+ .output_sample_desc = &rgb32_crop_sample_desc, .delta = 3, /* Windows
returns 3 */
+ },
};
MFT_REGISTER_TYPE_INFO output_type = {MFMediaType_Video, MFVideoFormat_NV12};
@@ -7847,6 +7891,23 @@ static void test_video_processor(void)
check_mft_set_input_type(transform, test->input_type_desc);
check_mft_get_input_current_type(transform, test->input_type_desc);
+ if (i >= 15)
+ {
+ IMFMediaType *media_type;
+ HRESULT hr;
+
+ hr = MFCreateMediaType(&media_type);
+ ok(hr == S_OK, "MFCreateMediaType returned hr %#lx.\n", hr);
+ init_media_type(media_type, test->output_type_desc, -1);
+ hr = IMFTransform_SetOutputType(transform, 0, media_type, 0);
+ todo_wine
+ ok(hr == S_OK, "SetOutputType returned %#lx.\n", hr);
+ IMFMediaType_Release(media_type);
+
+ if (hr != S_OK)
+ goto skip_test;
+ }
+
check_mft_set_output_type_required(transform, test->output_type_desc);
check_mft_set_output_type(transform, test->output_type_desc, S_OK);
check_mft_get_output_current_type(transform, test->output_type_desc);
@@ -7861,13 +7922,18 @@ static void test_video_processor(void)
output_info.cbSize = actual_width * actual_height * 2;
check_mft_get_output_stream_info(transform, S_OK, &output_info);
}
+ else if (test->output_sample_desc == &rgb32_crop_sample_desc)
+ {
+ output_info.cbSize = actual_aperture.Area.cx * actual_aperture.Area.cy * 4;
+ check_mft_get_output_stream_info(transform, S_OK, &output_info);
+ }
else
{
output_info.cbSize = actual_width * actual_height * 4;
check_mft_get_output_stream_info(transform, S_OK, &output_info);
}
- if (test->input_type_desc == nv12_default_stride)
+ if (test->input_type_desc == nv12_default_stride || test->input_type_desc
== nv12_with_aperture)
{
input_info.cbSize = actual_width * actual_height * 3 / 2;
check_mft_get_input_stream_info(transform, S_OK, &input_info);
@@ -7877,6 +7943,11 @@ static void test_video_processor(void)
input_info.cbSize = actual_width * actual_height * 2;
check_mft_get_input_stream_info(transform, S_OK, &input_info);
}
+ else if (test->input_type_desc == rgb32_no_aperture)
+ {
+ input_info.cbSize = 82 * 84 * 4;
+ check_mft_get_input_stream_info(transform, S_OK, &input_info);
+ }
else
{
input_info.cbSize = actual_width * actual_height * 4;
@@ -7884,7 +7955,7 @@ static void test_video_processor(void)
}
load_resource(test->input_bitmap, &input_data, &input_data_len);
- if (test->input_type_desc == nv12_default_stride)
+ if (test->input_type_desc == nv12_default_stride || test->input_type_desc
== nv12_with_aperture)
{
/* skip BMP header and RGB data from the dump */
length = *(DWORD *)(input_data + 2);
@@ -7948,6 +8019,12 @@ static void test_video_processor(void)
ret = IMFSample_Release(output_sample);
ok(ret == 0, "Release returned %lu\n", ret);
winetest_pop_context();
+
+skip_test:
+ hr = IMFTransform_SetInputType(transform, 0, NULL, 0);
+ ok(hr == S_OK, "got %#lx\n", hr);
+ hr = IMFTransform_SetOutputType(transform, 0, NULL, 0);
+ ok(hr == S_OK, "got %#lx\n", hr);
}
ret = IMFTransform_Release(transform);
--
GitLab
https://gitlab.winehq.org/wine/wine/-/merge_requests/5536