[PATCH 5/6] mfreadwrite/tests: Check media type attributes after reading a sample.
Rémi Bernon
rbernon at codeweavers.com
Mon Nov 8 08:08:19 CST 2021
Signed-off-by: Rémi Bernon <rbernon at codeweavers.com>
---
dlls/mfreadwrite/tests/mfplat.c | 157 +++++++++++++++++++++++++++++++-
1 file changed, 155 insertions(+), 2 deletions(-)
diff --git a/dlls/mfreadwrite/tests/mfplat.c b/dlls/mfreadwrite/tests/mfplat.c
index 051c7206e96..9d2e17de4f1 100644
--- a/dlls/mfreadwrite/tests/mfplat.c
+++ b/dlls/mfreadwrite/tests/mfplat.c
@@ -1523,6 +1523,134 @@ static void test_media_types(void)
},
};
+ static const UINT32 actual_40x36_aperture[] = {0, 0, 40, 36};
+ static const struct media_type_desc video_48x48_h264_nv12_desc =
+ {
+ .items =
+ {
+ {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Video}},
+ {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFVideoFormat_NV12}},
+ {.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}},
+ {.key = &MF_MT_COMPRESSED, .value = {.vt = VT_UI4, .ulVal = 0}},
+ {.key = &MF_MT_FIXED_SIZE_SAMPLES, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE},
+ {.key = &MF_MT_SAMPLE_SIZE, .value = {.vt = VT_UI4, .ulVal = 48 * 48 * 3 / 2}, .todo_missing = TRUE},
+ {.key = &MF_MT_AVG_BIT_ERROR_RATE, .value = {.vt = VT_UI4, .ulVal = 0}, .todo_missing = TRUE},
+ {.key = &MF_MT_AVG_BITRATE, .value = {.vt = VT_UI4, .ulVal = 78904}, .todo_missing = TRUE},
+ {.key = &MF_MT_DEFAULT_STRIDE, .value = {.vt = VT_UI4, .ulVal = 48}, .todo_missing = TRUE},
+ {.key = &MF_MT_FRAME_RATE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (30ull << 32) | 1ull}}},
+ {.key = &MF_MT_FRAME_SIZE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (48ull << 32) | 48ull}}, .todo_value = TRUE},
+ {.key = &MF_MT_INTERLACE_MODE, .value = {.vt = VT_UI4, .ulVal = MFVideoInterlace_MixedInterlaceOrProgressive}, .todo_missing = TRUE},
+ {.key = &MF_MT_PIXEL_ASPECT_RATIO, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (1ull << 32) | 1ull}}, .todo_missing = TRUE},
+ {.key = &MF_MT_VIDEO_ROTATION, .value = {.vt = VT_UI4, .ulVal = 0}, .optional = TRUE /* <= win7 */},
+ {.key = &MF_MT_YUV_MATRIX, .value = {.vt = VT_UI4, .ulVal = MFVideoTransferMatrix_BT601}, .todo_missing = TRUE},
+ {.key = &MF_MT_TRANSFER_FUNCTION, .value = {.vt = VT_UI4, .ulVal = MFVideoTransFunc_709}, .todo_missing = TRUE},
+ {.key = &MF_MT_VIDEO_NOMINAL_RANGE, .value = {.vt = VT_UI4, .ulVal = MFNominalRange_Wide}, .todo_missing = TRUE},
+ {.key = &MF_MT_VIDEO_PRIMARIES, .value = {.vt = VT_UI4, .ulVal = MFVideoPrimaries_SMPTE170M}, .todo_missing = TRUE},
+ {
+ .key = &MF_MT_GEOMETRIC_APERTURE,
+ .value =
+ {
+ .vt = VT_VECTOR|VT_UI1,
+ .caub =
+ {
+ .pElems = (BYTE *)actual_40x36_aperture,
+ .cElems = sizeof(actual_40x36_aperture),
+ }
+ },
+ .todo_missing = TRUE,
+ },
+ {
+ .key = &MF_MT_PAN_SCAN_APERTURE,
+ .value =
+ {
+ .vt = VT_VECTOR|VT_UI1,
+ .caub =
+ {
+ .pElems = (BYTE *)actual_40x36_aperture,
+ .cElems = sizeof(actual_40x36_aperture),
+ }
+ },
+ .todo_missing = TRUE,
+ },
+ {
+ .key = &MF_MT_MINIMUM_DISPLAY_APERTURE,
+ .value =
+ {
+ .vt = VT_VECTOR|VT_UI1,
+ .caub =
+ {
+ .pElems = (BYTE *)actual_40x36_aperture,
+ .cElems = sizeof(actual_40x36_aperture),
+ }
+ },
+ .todo_missing = TRUE,
+ },
+ },
+ };
+ static const struct media_type_desc video_48x48_h264_i420_desc =
+ {
+ .items =
+ {
+ {.key = &MF_MT_MAJOR_TYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFMediaType_Video}},
+ {.key = &MF_MT_SUBTYPE, .value = {.vt = VT_CLSID, .puuid = (GUID *)&MFVideoFormat_I420}},
+ {.key = &MF_MT_ALL_SAMPLES_INDEPENDENT, .value = {.vt = VT_UI4, .ulVal = 1}},
+ {.key = &MF_MT_COMPRESSED, .value = {.vt = VT_UI4, .ulVal = 0}},
+ {.key = &MF_MT_FIXED_SIZE_SAMPLES, .value = {.vt = VT_UI4, .ulVal = 1}, .todo_missing = TRUE},
+ {.key = &MF_MT_SAMPLE_SIZE, .value = {.vt = VT_UI4, .ulVal = 48 * 48 * 3 / 2}, .todo_missing = TRUE},
+ {.key = &MF_MT_AVG_BIT_ERROR_RATE, .value = {.vt = VT_UI4, .ulVal = 0}, .todo_missing = TRUE},
+ {.key = &MF_MT_AVG_BITRATE, .value = {.vt = VT_UI4, .ulVal = 78904}, .todo_missing = TRUE},
+ {.key = &MF_MT_DEFAULT_STRIDE, .value = {.vt = VT_UI4, .ulVal = 48}, .todo_missing = TRUE},
+ {.key = &MF_MT_FRAME_RATE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (30ull << 32) | 1ull}}},
+ {.key = &MF_MT_FRAME_SIZE, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (48ull << 32) | 48ull}}, .todo_value = TRUE},
+ {.key = &MF_MT_INTERLACE_MODE, .value = {.vt = VT_UI4, .ulVal = MFVideoInterlace_MixedInterlaceOrProgressive}, .todo_missing = TRUE},
+ {.key = &MF_MT_PIXEL_ASPECT_RATIO, .value = {.vt = VT_UI8, .uhVal = {.QuadPart = (1ull << 32) | 1ull}}, .todo_missing = TRUE},
+ {.key = &MF_MT_VIDEO_ROTATION, .value = {.vt = VT_UI4, .ulVal = 0}, .optional = TRUE /* <= win7 */},
+ {.key = &MF_MT_YUV_MATRIX, .value = {.vt = VT_UI4, .ulVal = MFVideoTransferMatrix_BT601}, .todo_missing = TRUE},
+ {.key = &MF_MT_TRANSFER_FUNCTION, .value = {.vt = VT_UI4, .ulVal = MFVideoTransFunc_709}, .todo_missing = TRUE},
+ {.key = &MF_MT_VIDEO_NOMINAL_RANGE, .value = {.vt = VT_UI4, .ulVal = MFNominalRange_Wide}, .todo_missing = TRUE},
+ {.key = &MF_MT_VIDEO_PRIMARIES, .value = {.vt = VT_UI4, .ulVal = MFVideoPrimaries_SMPTE170M}, .todo_missing = TRUE},
+ {
+ .key = &MF_MT_GEOMETRIC_APERTURE,
+ .value =
+ {
+ .vt = VT_VECTOR|VT_UI1,
+ .caub =
+ {
+ .pElems = (BYTE *)actual_40x36_aperture,
+ .cElems = sizeof(actual_40x36_aperture),
+ }
+ },
+ .todo_missing = TRUE,
+ },
+ {
+ .key = &MF_MT_PAN_SCAN_APERTURE,
+ .value =
+ {
+ .vt = VT_VECTOR|VT_UI1,
+ .caub =
+ {
+ .pElems = (BYTE *)actual_40x36_aperture,
+ .cElems = sizeof(actual_40x36_aperture),
+ }
+ },
+ .todo_missing = TRUE,
+ },
+ {
+ .key = &MF_MT_MINIMUM_DISPLAY_APERTURE,
+ .value =
+ {
+ .vt = VT_VECTOR|VT_UI1,
+ .caub =
+ {
+ .pElems = (BYTE *)actual_40x36_aperture,
+ .cElems = sizeof(actual_40x36_aperture),
+ }
+ },
+ .todo_missing = TRUE,
+ },
+ },
+ };
+
struct test_audio_format
{
GUID subtype;
@@ -1535,6 +1663,7 @@ static void test_media_types(void)
{
GUID subtype;
const struct media_type_desc *current;
+ const struct media_type_desc *actual;
};
struct test_media_type
@@ -1557,8 +1686,8 @@ static void test_media_types(void)
struct test_video_format test_h264_formats[] =
{
- {.subtype = MFVideoFormat_NV12, .current = &video_40x36_h264_nv12_desc},
- {.subtype = MFVideoFormat_I420, .current = &video_40x36_h264_i420_desc},
+ {.subtype = MFVideoFormat_NV12, .current = &video_40x36_h264_nv12_desc, .actual = &video_48x48_h264_nv12_desc},
+ {.subtype = MFVideoFormat_I420, .current = &video_40x36_h264_i420_desc, .actual = &video_48x48_h264_i420_desc},
};
struct test_media_type tests[] =
@@ -1588,6 +1717,8 @@ static void test_media_types(void)
IMFMediaType *media_type;
IMFSourceReader *reader;
IMFByteStream *stream;
+ IMFSample *sample;
+ DWORD flags;
HRESULT hr;
int i, j;
@@ -1658,6 +1789,17 @@ static void test_media_types(void)
winetest_pop_context();
IMFMediaType_Release(media_type);
+ hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, 0, NULL, &flags, NULL, &sample);
+ ok(hr == S_OK, "Failed to read sample, hr %#x\n", hr);
+ IMFSample_Release(sample);
+
+ hr = IMFSourceReader_GetCurrentMediaType(reader, MF_SOURCE_READER_FIRST_AUDIO_STREAM, &media_type);
+ ok(hr == S_OK, "Failed to get current mediatype, hr %#x.\n", hr);
+ winetest_push_context("actual audio %u", j);
+ check_media_type_items(media_type, audio_format.current);
+ winetest_pop_context();
+ IMFMediaType_Release(media_type);
+
IMFSourceReader_Release(reader);
IMFByteStream_Release(stream);
}
@@ -1707,6 +1849,17 @@ static void test_media_types(void)
winetest_pop_context();
IMFMediaType_Release(media_type);
+ hr = IMFSourceReader_ReadSample(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, 0, NULL, &flags, NULL, &sample);
+ ok(hr == S_OK, "Failed to read sample, hr %#x\n", hr);
+ IMFSample_Release(sample);
+
+ hr = IMFSourceReader_GetCurrentMediaType(reader, MF_SOURCE_READER_FIRST_VIDEO_STREAM, &media_type);
+ ok(hr == S_OK, "Failed to get current mediatype, hr %#x.\n", hr);
+ winetest_push_context("actual video %u", j);
+ check_media_type_items(media_type, video_format.actual);
+ winetest_pop_context();
+ IMFMediaType_Release(media_type);
+
IMFSourceReader_Release(reader);
IMFByteStream_Release(stream);
}
--
2.33.1
More information about the wine-devel
mailing list