-- v2: mfplat/mediatype: Implement some VIDEOINFOHEADER2 dwInterlaceFlags conversion. mfplat/mediatype: Implement VIDEOINFOHEADER2 dwControlFlags conversion. mfplat/mediatype: Implement MF_MT_FRAME_RATE from VIDEOINFOHEADER2. mfplat: Support flexible frame time in MFAverageTimePerFrameToFrameRate. mfplat/tests: Add more MFAverageTimePerFrameToFrameRate tests. mfplat/mediatype: Set rcSource and rcTarget if stride differs from width. mfplat/mediatype: Map rcSource to MF_MT_(PAN_SCAN|MINIMUM_DISPLAY)_APERTURE. mfplat/mediatype: Set MF_MT_SAMPLE_SIZE from bmiHeader.biSizeImage. mfplat/mediatype: Support FORMAT_VideoInfo2 in MFInitMediaTypeFromAMMediaType. mfplat/tests: Test aperture to VIDEOINFOHEADER fields mapping.
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfplat/tests/mfplat.c | 262 ++++++++++++++++++++++++++++++++++++- 1 file changed, 255 insertions(+), 7 deletions(-)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 634dd87ae09..3320e3287eb 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -7564,10 +7564,11 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void) video_info = (VIDEOINFOHEADER *)am_type.pbFormat; ok(video_info->bmiHeader.biWidth == 123, "got %lu\n", video_info->bmiHeader.biWidth); ok(video_info->bmiHeader.biHeight == 456, "got %lu\n", video_info->bmiHeader.biHeight); - ok(video_info->bmiHeader.biSizeImage == 224352, "got %lu\n", video_info->bmiHeader.biSizeImage); + ok(video_info->bmiHeader.biSizeImage == 123 * 456 * 4, "got %lu\n", video_info->bmiHeader.biSizeImage); CoTaskMemFree(am_type.pbFormat); IMFMediaType_DeleteAllItems(media_type);
+ /* MF_MT_MINIMUM_DISPLAY_APERTURE has no effect */ hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFVideoFormat_RGB32); @@ -7576,7 +7577,7 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_SetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture)); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaType_SetUINT32(media_type, &MF_MT_SAMPLE_SIZE, 123456); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_SAMPLE_SIZE, 12345678); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = MFInitAMMediaTypeFromMFMediaType(media_type, GUID_NULL, &am_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); @@ -7591,7 +7592,102 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void) ok(video_info->rcTarget.bottom == 0, "got %lu\n", video_info->rcTarget.bottom); ok(video_info->bmiHeader.biWidth == 123, "got %lu\n", video_info->bmiHeader.biWidth); ok(video_info->bmiHeader.biHeight == 456, "got %lu\n", video_info->bmiHeader.biHeight); - ok(video_info->bmiHeader.biSizeImage == 224352, "got %lu\n", video_info->bmiHeader.biSizeImage); + ok(video_info->bmiHeader.biSizeImage == 123 * 456 * 4, "got %lu\n", video_info->bmiHeader.biSizeImage); + CoTaskMemFree(am_type.pbFormat); + IMFMediaType_DeleteAllItems(media_type); + + /* MF_MT_DEFAULT_STRIDE / MF_MT_FRAME_SIZE mismatch is translated into rcSource / rcTarget */ + hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFVideoFormat_RGB32); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, (UINT64)123 << 32 | 456); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, -246 * 4); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_SAMPLE_SIZE, 12345678); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture)); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetBlob(media_type, &MF_MT_GEOMETRIC_APERTURE, (BYTE *)&aperture, sizeof(aperture)); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetBlob(media_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture)); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_PAN_SCAN_ENABLED, 1); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = MFInitAMMediaTypeFromMFMediaType(media_type, GUID_NULL, &am_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + video_info = (VIDEOINFOHEADER *)am_type.pbFormat; + ok(video_info->rcSource.left == 0, "got %lu\n", video_info->rcSource.left); + todo_wine + ok(video_info->rcSource.right == 123, "got %lu\n", video_info->rcSource.right); + ok(video_info->rcSource.top == 0, "got %lu\n", video_info->rcSource.top); + todo_wine + ok(video_info->rcSource.bottom == 456, "got %lu\n", video_info->rcSource.bottom); + ok(video_info->rcTarget.left == 0, "got %lu\n", video_info->rcTarget.left); + todo_wine + ok(video_info->rcTarget.right == 123, "got %lu\n", video_info->rcTarget.right); + ok(video_info->rcTarget.top == 0, "got %lu\n", video_info->rcTarget.top); + todo_wine + ok(video_info->rcTarget.bottom == 456, "got %lu\n", video_info->rcTarget.bottom); + ok(video_info->bmiHeader.biWidth == 246, "got %lu\n", video_info->bmiHeader.biWidth); + ok(video_info->bmiHeader.biHeight == 456, "got %ld\n", video_info->bmiHeader.biHeight); + ok(video_info->bmiHeader.biSizeImage == 246 * 456 * 4, "got %lu\n", video_info->bmiHeader.biSizeImage); + CoTaskMemFree(am_type.pbFormat); + + /* positive stride only changes biHeight */ + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, 246 * 4); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = MFInitAMMediaTypeFromMFMediaType(media_type, GUID_NULL, &am_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + video_info = (VIDEOINFOHEADER *)am_type.pbFormat; + ok(video_info->rcSource.left == 0, "got %lu\n", video_info->rcSource.left); + todo_wine + ok(video_info->rcSource.right == 123, "got %lu\n", video_info->rcSource.right); + ok(video_info->rcSource.top == 0, "got %lu\n", video_info->rcSource.top); + todo_wine + ok(video_info->rcSource.bottom == 456, "got %lu\n", video_info->rcSource.bottom); + ok(video_info->rcTarget.left == 0, "got %lu\n", video_info->rcTarget.left); + todo_wine + ok(video_info->rcTarget.right == 123, "got %lu\n", video_info->rcTarget.right); + ok(video_info->rcTarget.top == 0, "got %lu\n", video_info->rcTarget.top); + todo_wine + ok(video_info->rcTarget.bottom == 456, "got %lu\n", video_info->rcTarget.bottom); + ok(video_info->bmiHeader.biWidth == 246, "got %lu\n", video_info->bmiHeader.biWidth); + ok(video_info->bmiHeader.biHeight == -456, "got %ld\n", video_info->bmiHeader.biHeight); + ok(video_info->bmiHeader.biSizeImage == 246 * 456 * 4, "got %lu\n", video_info->bmiHeader.biSizeImage); + CoTaskMemFree(am_type.pbFormat); + IMFMediaType_DeleteAllItems(media_type); + + /* same thing happens with other formats */ + hr = IMFMediaType_SetGUID(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetGUID(media_type, &MF_MT_SUBTYPE, &MFVideoFormat_NV12); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, (UINT64)123 << 32 | 456); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, 246); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_SAMPLE_SIZE, 12345678); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = MFInitAMMediaTypeFromMFMediaType(media_type, GUID_NULL, &am_type); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + video_info = (VIDEOINFOHEADER *)am_type.pbFormat; + ok(video_info->rcSource.left == 0, "got %lu\n", video_info->rcSource.left); + todo_wine + ok(video_info->rcSource.right == 123, "got %lu\n", video_info->rcSource.right); + ok(video_info->rcSource.top == 0, "got %lu\n", video_info->rcSource.top); + todo_wine + ok(video_info->rcSource.bottom == 456, "got %lu\n", video_info->rcSource.bottom); + ok(video_info->rcTarget.left == 0, "got %lu\n", video_info->rcTarget.left); + todo_wine + ok(video_info->rcTarget.right == 123, "got %lu\n", video_info->rcTarget.right); + ok(video_info->rcTarget.top == 0, "got %lu\n", video_info->rcTarget.top); + todo_wine + ok(video_info->rcTarget.bottom == 456, "got %lu\n", video_info->rcTarget.bottom); + ok(video_info->bmiHeader.biWidth == 246, "got %lu\n", video_info->bmiHeader.biWidth); + ok(video_info->bmiHeader.biHeight == 456, "got %ld\n", video_info->bmiHeader.biHeight); + ok(video_info->bmiHeader.biSizeImage == 246 * 456 * 3 / 2, "got %lu\n", video_info->bmiHeader.biSizeImage); CoTaskMemFree(am_type.pbFormat); IMFMediaType_DeleteAllItems(media_type);
@@ -7601,14 +7697,14 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, (UINT64)123 << 32 | 456); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaType_SetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, -984); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, -246 * 4); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = MFInitAMMediaTypeFromMFMediaType(media_type, GUID_NULL, &am_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); video_info = (VIDEOINFOHEADER *)am_type.pbFormat; ok(video_info->bmiHeader.biWidth == 246, "got %lu\n", video_info->bmiHeader.biWidth); ok(video_info->bmiHeader.biHeight == 456, "got %ld\n", video_info->bmiHeader.biHeight); - ok(video_info->bmiHeader.biSizeImage == 448704, "got %lu\n", video_info->bmiHeader.biSizeImage); + ok(video_info->bmiHeader.biSizeImage == 246 * 456 * 4, "got %lu\n", video_info->bmiHeader.biSizeImage); CoTaskMemFree(am_type.pbFormat); IMFMediaType_DeleteAllItems(media_type);
@@ -7618,14 +7714,14 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_SetUINT64(media_type, &MF_MT_FRAME_SIZE, (UINT64)123 << 32 | 456); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - hr = IMFMediaType_SetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, 984); + hr = IMFMediaType_SetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, 246 * 4); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = MFInitAMMediaTypeFromMFMediaType(media_type, GUID_NULL, &am_type); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); video_info = (VIDEOINFOHEADER *)am_type.pbFormat; ok(video_info->bmiHeader.biWidth == 246, "got %lu\n", video_info->bmiHeader.biWidth); ok(video_info->bmiHeader.biHeight == -456, "got %ld\n", video_info->bmiHeader.biHeight); - ok(video_info->bmiHeader.biSizeImage == 448704, "got %lu\n", video_info->bmiHeader.biSizeImage); + ok(video_info->bmiHeader.biSizeImage == 246 * 456 * 4, "got %lu\n", video_info->bmiHeader.biSizeImage); CoTaskMemFree(am_type.pbFormat); IMFMediaType_DeleteAllItems(media_type);
@@ -9842,7 +9938,10 @@ static void test_MFCreateVideoMediaTypeFromVideoInfoHeader(void)
static void test_MFInitMediaTypeFromVideoInfoHeader(void) { + static const MFVideoArea expect_aperture = {.OffsetX = {.value = 1}, .OffsetY = {.value = 2}, .Area = {.cx = 3, .cy = 5}}; + static const RECT source = {1, 2, 4, 7}, target = {3, 2, 12, 9}; IMFMediaType *media_type; + MFVideoArea aperture; VIDEOINFOHEADER vih; UINT32 value32; UINT64 value64; @@ -9960,6 +10059,63 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void) hr = IMFMediaType_GetUINT32(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, &value32); ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr);
+ hr = IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_GetBlob(media_type, &MF_MT_GEOMETRIC_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_GetBlob(media_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_GetUINT32(media_type, &MF_MT_PAN_SCAN_ENABLED, &value32); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); + + /* only rcSource is considered, translated into both MF_MT_MINIMUM_DISPLAY_APERTURE and MF_MT_PAN_SCAN_APERTURE */ + value32 = 0xdeadbeef; + vih.rcSource = source; + vih.rcTarget = target; + hr = MFInitMediaTypeFromVideoInfoHeader(media_type, &vih, sizeof(vih), &GUID_NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_SIZE, &value64); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(value64 == ((UINT64)16 << 32 | 32), "Unexpected value %#I64x.\n", value64); + hr = IMFMediaType_GetUINT32(media_type, &MF_MT_SAMPLE_SIZE, &value32); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(value32 == 12345, "Unexpected value %#x.\n", value32); + hr = IMFMediaType_GetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, &value32); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); + + value32 = 0xdeadbeef; + memset(&aperture, 0xcd, sizeof(aperture)); + hr = IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(value32 == sizeof(aperture), "got %d.\n", value32); + todo_wine + ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n"); + + value32 = 0xdeadbeef; + hr = IMFMediaType_GetUINT32(media_type, &MF_MT_PAN_SCAN_ENABLED, &value32); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(value32 == 1, "got %d.\n", (UINT32)value32); + + value32 = 0xdeadbeef; + memset(&aperture, 0xcd, sizeof(aperture)); + hr = IMFMediaType_GetBlob(media_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(value32 == sizeof(aperture), "got %d.\n", value32); + todo_wine + ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n"); + + hr = IMFMediaType_GetItem(media_type, &MF_MT_GEOMETRIC_APERTURE, NULL); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); + + hr = MFInitMediaTypeFromVideoInfoHeader(media_type, &vih, sizeof(vih), &MFVideoFormat_NV12); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_FIXED_SIZE_SAMPLES, &value32); @@ -10047,8 +10203,11 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void)
static void test_MFInitMediaTypeFromVideoInfoHeader2(void) { + static const MFVideoArea expect_aperture = {.OffsetX = {.value = 1}, .OffsetY = {.value = 2}, .Area = {.cx = 3, .cy = 5}}; + static const RECT source = {1, 2, 4, 7}, target = {3, 2, 12, 9}; IMFMediaType *media_type; VIDEOINFOHEADER2 vih; + MFVideoArea aperture; UINT32 value32; UINT64 value64; HRESULT hr; @@ -10227,6 +10386,62 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(value32 == 1, "Unexpected value %#x.\n", value32);
+ hr = IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_GetBlob(media_type, &MF_MT_GEOMETRIC_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_GetBlob(media_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_GetUINT32(media_type, &MF_MT_PAN_SCAN_ENABLED, &value32); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); + + /* only rcSource is considered, translated into both MF_MT_MINIMUM_DISPLAY_APERTURE and MF_MT_PAN_SCAN_APERTURE */ + value32 = 0xdeadbeef; + vih.rcSource = source; + vih.rcTarget = target; + hr = MFInitMediaTypeFromVideoInfoHeader2(media_type, &vih, sizeof(vih), &GUID_NULL); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + hr = IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_SIZE, &value64); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(value64 == ((UINT64)16 << 32 | 32), "Unexpected value %#I64x.\n", value64); + hr = IMFMediaType_GetUINT32(media_type, &MF_MT_SAMPLE_SIZE, &value32); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(value32 == 12345, "Unexpected value %#x.\n", value32); + hr = IMFMediaType_GetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, &value32); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); + + value32 = 0xdeadbeef; + memset(&aperture, 0xcd, sizeof(aperture)); + hr = IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(value32 == sizeof(aperture), "got %d.\n", value32); + todo_wine + ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n"); + + value32 = 0xdeadbeef; + hr = IMFMediaType_GetUINT32(media_type, &MF_MT_PAN_SCAN_ENABLED, &value32); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(value32 == 1, "got %d.\n", (UINT32)value32); + + value32 = 0xdeadbeef; + memset(&aperture, 0xcd, sizeof(aperture)); + hr = IMFMediaType_GetBlob(media_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(value32 == sizeof(aperture), "got %d.\n", value32); + todo_wine + ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n"); + + hr = IMFMediaType_GetItem(media_type, &MF_MT_GEOMETRIC_APERTURE, NULL); + ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); +
/* biBitCount is used for implicit RGB format if GUID is NULL */ hr = MFInitMediaTypeFromVideoInfoHeader2(media_type, &vih, sizeof(vih), NULL); @@ -10305,6 +10520,8 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void)
static void test_MFInitMediaTypeFromAMMediaType(void) { + static const MFVideoArea expect_aperture = {.OffsetX = {.value = 13}, .OffsetY = {.value = 46}, .Area = {.cx = 110, .cy = 410}}; + static const RECT source = {13, 46, 123, 456}, target = {25, 34, 107, 409}; IMFMediaType *media_type; AM_MEDIA_TYPE mt; UINT32 value32; @@ -10355,6 +10572,7 @@ static void test_MFInitMediaTypeFromAMMediaType(void) { &MEDIASUBTYPE_h264, &MEDIASUBTYPE_h264 }, { &MEDIASUBTYPE_H264, &MFVideoFormat_H264 }, }; + MFVideoArea aperture; unsigned int i;
hr = MFCreateMediaType(&media_type); @@ -10474,6 +10692,36 @@ static void test_MFInitMediaTypeFromAMMediaType(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(value32 == 128, "Unexpected value %d.\n", value32);
+ /* only rcSource is considered, lSampleSize is ignored if biSizeImage was present */ + memcpy(&mt.subtype, &MEDIASUBTYPE_RGB32, sizeof(GUID)); + vih.rcSource = source; + vih.rcTarget = target; + vih.bmiHeader.biWidth = 432; + vih.bmiHeader.biHeight = -654; + vih.bmiHeader.biSizeImage = 12345678; + mt.lSampleSize = 87654321; + hr = MFInitMediaTypeFromAMMediaType(media_type, &mt); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + + hr = IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_SIZE, &value64); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok((UINT32)(value64 >> 32) == 432, "got %d.\n", (UINT32)(value64 >> 32)); + ok((UINT32)value64 == 654, "got %d.\n", (UINT32)value64); + hr = IMFMediaType_GetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, &value32); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ok(value32 == 432 * 4, "got %d.\n", (UINT32)value32); + hr = IMFMediaType_GetUINT32(media_type, &MF_MT_SAMPLE_SIZE, &value32); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(value32 == 12345678, "got %d.\n", (UINT32)value32); + hr = IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); + todo_wine + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine + ok(value32 == sizeof(aperture), "got %d.\n", value32); + todo_wine + ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n"); + vih.bmiHeader.biHeight = 24; for (i = 0; i < ARRAY_SIZE(guid_types); ++i) {
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfplat/mediatype.c | 50 ++++++++++++++--------------------------- 1 file changed, 17 insertions(+), 33 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 1832e0147bc..15e85f2f937 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -4074,46 +4074,30 @@ HRESULT WINAPI MFInitMediaTypeFromAMMediaType(IMFMediaType *media_type, const AM
if (IsEqualGUID(&am_type->majortype, &MEDIATYPE_Video)) { - if (IsEqualGUID(&am_type->formattype, &FORMAT_VideoInfo)) - { - const VIDEOINFOHEADER *vih = (const VIDEOINFOHEADER *)am_type->pbFormat; - const GUID *subtype; - DWORD height; - LONG stride; - - subtype = get_mf_subtype_for_am_subtype(&am_type->subtype); - height = abs(vih->bmiHeader.biHeight); - - mediatype_set_guid(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video, &hr); - mediatype_set_guid(media_type, &MF_MT_SUBTYPE, subtype, &hr); - mediatype_set_uint64(media_type, &MF_MT_PIXEL_ASPECT_RATIO, 1, 1, &hr); - mediatype_set_uint32(media_type, &MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive, &hr); - mediatype_set_uint64(media_type, &MF_MT_FRAME_SIZE, vih->bmiHeader.biWidth, height, &hr); - mediatype_set_uint32(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, 1, &hr); + const GUID *subtype = get_mf_subtype_for_am_subtype(&am_type->subtype);
- if (SUCCEEDED(mf_get_stride_for_bitmap_info_header(subtype->Data1, &vih->bmiHeader, &stride))) - { - mediatype_set_uint32(media_type, &MF_MT_DEFAULT_STRIDE, stride, &hr); - mediatype_set_uint32(media_type, &MF_MT_SAMPLE_SIZE, abs(stride) * height, &hr); - mediatype_set_uint32(media_type, &MF_MT_FIXED_SIZE_SAMPLES, 1, &hr); - } - else - { - if (am_type->bFixedSizeSamples) - mediatype_set_uint32(media_type, &MF_MT_FIXED_SIZE_SAMPLES, 1, &hr); - if (am_type->lSampleSize) - mediatype_set_uint32(media_type, &MF_MT_SAMPLE_SIZE, am_type->lSampleSize, &hr); - } - - return hr; - } + if (IsEqualGUID(&am_type->formattype, &FORMAT_VideoInfo)) + hr = MFInitMediaTypeFromVideoInfoHeader(media_type, (VIDEOINFOHEADER *)am_type->pbFormat, am_type->cbFormat, subtype); + else if (IsEqualGUID(&am_type->formattype, &FORMAT_VideoInfo2)) + hr = MFInitMediaTypeFromVideoInfoHeader2(media_type, (VIDEOINFOHEADER2 *)am_type->pbFormat, am_type->cbFormat, subtype); else { FIXME("Unsupported format type %s.\n", debugstr_guid(&am_type->formattype)); + return E_NOTIMPL; } + + if (!am_type->bTemporalCompression && FAILED(IMFMediaType_GetItem(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, NULL))) + mediatype_set_uint32(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, 1, &hr); + if (am_type->bFixedSizeSamples && FAILED(IMFMediaType_GetItem(media_type, &MF_MT_FIXED_SIZE_SAMPLES, NULL))) + mediatype_set_uint32(media_type, &MF_MT_FIXED_SIZE_SAMPLES, 1, &hr); + if (am_type->lSampleSize && FAILED(IMFMediaType_GetItem(media_type, &MF_MT_SAMPLE_SIZE, NULL))) + mediatype_set_uint32(media_type, &MF_MT_SAMPLE_SIZE, am_type->lSampleSize, &hr); } else + { FIXME("Unsupported major type %s.\n", debugstr_guid(&am_type->majortype)); + return E_NOTIMPL; + }
- return E_NOTIMPL; + return hr; }
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfplat/mediatype.c | 3 +++ dlls/mfplat/tests/mfplat.c | 9 --------- 2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 15e85f2f937..f09a20d68fe 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3791,6 +3791,9 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader2(IMFMediaType *media_type, con mediatype_set_uint32(media_type, &MF_MT_ALL_SAMPLES_INDEPENDENT, 1, &hr); }
+ if (vih->bmiHeader.biSizeImage) + mediatype_set_uint32(media_type, &MF_MT_SAMPLE_SIZE, vih->bmiHeader.biSizeImage, &hr); + return hr; }
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 3320e3287eb..3ef01a07de5 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -10013,9 +10013,7 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void) hr = MFInitMediaTypeFromVideoInfoHeader(media_type, &vih, sizeof(vih), &GUID_NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_SAMPLE_SIZE, &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == 12345, "Unexpected value %#x.\n", value32); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_AVG_BITRATE, &value32); ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); @@ -10078,9 +10076,7 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(value64 == ((UINT64)16 << 32 | 32), "Unexpected value %#I64x.\n", value64); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_SAMPLE_SIZE, &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == 12345, "Unexpected value %#x.\n", value32); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, &value32); ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); @@ -10278,9 +10274,7 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) hr = MFInitMediaTypeFromVideoInfoHeader2(media_type, &vih, sizeof(vih), &GUID_NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_SAMPLE_SIZE, &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == 12345, "Unexpected value %#x.\n", value32); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_AVG_BITRATE, &value32); ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); @@ -10405,9 +10399,7 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(value64 == ((UINT64)16 << 32 | 32), "Unexpected value %#I64x.\n", value64); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_SAMPLE_SIZE, &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == 12345, "Unexpected value %#x.\n", value32); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, &value32); ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); @@ -10712,7 +10704,6 @@ static void test_MFInitMediaTypeFromAMMediaType(void) ok(value32 == 432 * 4, "got %d.\n", (UINT32)value32); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_SAMPLE_SIZE, &value32); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == 12345678, "got %d.\n", (UINT32)value32); hr = IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); todo_wine
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfplat/mediatype.c | 14 ++++++++++++++ dlls/mfplat/tests/mfplat.c | 19 ------------------- 2 files changed, 14 insertions(+), 19 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index f09a20d68fe..c9ca4c471e7 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3794,6 +3794,20 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader2(IMFMediaType *media_type, con if (vih->bmiHeader.biSizeImage) mediatype_set_uint32(media_type, &MF_MT_SAMPLE_SIZE, vih->bmiHeader.biSizeImage, &hr);
+ if (vih->rcSource.left || vih->rcSource.top || vih->rcSource.right || vih->rcSource.bottom) + { + MFVideoArea aperture = {{0}}; + + aperture.OffsetX.value = vih->rcSource.left; + aperture.OffsetY.value = vih->rcSource.top; + aperture.Area.cx = vih->rcSource.right - vih->rcSource.left; + aperture.Area.cy = vih->rcSource.bottom - vih->rcSource.top; + + mediatype_set_uint32(media_type, &MF_MT_PAN_SCAN_ENABLED, 1, &hr); + mediatype_set_blob(media_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture), &hr); + mediatype_set_blob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &hr); + } + return hr; }
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 3ef01a07de5..c1cedec16c4 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -10084,28 +10084,20 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void) value32 = 0xdeadbeef; memset(&aperture, 0xcd, sizeof(aperture)); hr = IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == sizeof(aperture), "got %d.\n", value32); - todo_wine ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n");
value32 = 0xdeadbeef; hr = IMFMediaType_GetUINT32(media_type, &MF_MT_PAN_SCAN_ENABLED, &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == 1, "got %d.\n", (UINT32)value32);
value32 = 0xdeadbeef; memset(&aperture, 0xcd, sizeof(aperture)); hr = IMFMediaType_GetBlob(media_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == sizeof(aperture), "got %d.\n", value32); - todo_wine ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n");
hr = IMFMediaType_GetItem(media_type, &MF_MT_GEOMETRIC_APERTURE, NULL); @@ -10407,28 +10399,20 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) value32 = 0xdeadbeef; memset(&aperture, 0xcd, sizeof(aperture)); hr = IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == sizeof(aperture), "got %d.\n", value32); - todo_wine ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n");
value32 = 0xdeadbeef; hr = IMFMediaType_GetUINT32(media_type, &MF_MT_PAN_SCAN_ENABLED, &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == 1, "got %d.\n", (UINT32)value32);
value32 = 0xdeadbeef; memset(&aperture, 0xcd, sizeof(aperture)); hr = IMFMediaType_GetBlob(media_type, &MF_MT_PAN_SCAN_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == sizeof(aperture), "got %d.\n", value32); - todo_wine ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n");
hr = IMFMediaType_GetItem(media_type, &MF_MT_GEOMETRIC_APERTURE, NULL); @@ -10706,11 +10690,8 @@ static void test_MFInitMediaTypeFromAMMediaType(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(value32 == 12345678, "got %d.\n", (UINT32)value32); hr = IMFMediaType_GetBlob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == sizeof(aperture), "got %d.\n", value32); - todo_wine ok(!memcmp(&aperture, &expect_aperture, sizeof(aperture)), "unexpected aperture\n");
vih.bmiHeader.biHeight = 24;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfplat/mediatype.c | 23 +++++++++++++++-------- dlls/mfplat/tests/mfplat.c | 12 ------------ 2 files changed, 15 insertions(+), 20 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index c9ca4c471e7..6ed23c0ef6a 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3923,9 +3923,8 @@ static HRESULT init_am_media_type_audio_format(AM_MEDIA_TYPE *am_type, UINT32 us static void init_video_info_header2(VIDEOINFOHEADER2 *vih, const GUID *subtype, IMFMediaType *media_type) { struct uncompressed_video_format *video_format = mf_get_video_format(subtype); - UINT32 image_size, bitrate, sample_size; + UINT32 image_size, bitrate, sample_size, width, height; UINT64 frame_size, frame_rate; - INT32 width, height;
vih->bmiHeader.biSize = sizeof(vih->bmiHeader); vih->bmiHeader.biPlanes = 1; @@ -3948,18 +3947,26 @@ static void init_video_info_header2(VIDEOINFOHEADER2 *vih, const GUID *subtype, if (SUCCEEDED(IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_SIZE, &frame_size))) { BOOL bottom_up = vih->bmiHeader.biCompression == BI_RGB || vih->bmiHeader.biCompression == BI_BITFIELDS; + INT32 stride;
- if (FAILED(IMFMediaType_GetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, (UINT32 *)&width))) - width = (frame_size >> 32) * (bottom_up ? -1 : 1); + width = frame_size >> 32; + if (FAILED(IMFMediaType_GetUINT32(media_type, &MF_MT_DEFAULT_STRIDE, (UINT32 *)&stride))) + stride = width * (bottom_up ? -1 : 1); else if (video_format) - width /= video_format->bpp / 8; + stride /= video_format->bpp / 8; height = (UINT32)frame_size;
- vih->bmiHeader.biWidth = abs(width); - vih->bmiHeader.biHeight = height * (bottom_up && width >= 0 ? -1 : 1); + vih->bmiHeader.biWidth = abs(stride); + vih->bmiHeader.biHeight = height * (bottom_up && stride >= 0 ? -1 : 1);
- if (SUCCEEDED(MFCalculateImageSize(subtype, abs(width), height, &image_size))) + if (SUCCEEDED(MFCalculateImageSize(subtype, abs(stride), height, &image_size))) vih->bmiHeader.biSizeImage = image_size; + + if (vih->bmiHeader.biWidth > width) + { + vih->rcSource.right = vih->rcTarget.right = width; + vih->rcSource.bottom = vih->rcTarget.bottom = height; + } } }
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index c1cedec16c4..7277346ebfe 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -7619,16 +7619,12 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); video_info = (VIDEOINFOHEADER *)am_type.pbFormat; ok(video_info->rcSource.left == 0, "got %lu\n", video_info->rcSource.left); - todo_wine ok(video_info->rcSource.right == 123, "got %lu\n", video_info->rcSource.right); ok(video_info->rcSource.top == 0, "got %lu\n", video_info->rcSource.top); - todo_wine ok(video_info->rcSource.bottom == 456, "got %lu\n", video_info->rcSource.bottom); ok(video_info->rcTarget.left == 0, "got %lu\n", video_info->rcTarget.left); - todo_wine ok(video_info->rcTarget.right == 123, "got %lu\n", video_info->rcTarget.right); ok(video_info->rcTarget.top == 0, "got %lu\n", video_info->rcTarget.top); - todo_wine ok(video_info->rcTarget.bottom == 456, "got %lu\n", video_info->rcTarget.bottom); ok(video_info->bmiHeader.biWidth == 246, "got %lu\n", video_info->bmiHeader.biWidth); ok(video_info->bmiHeader.biHeight == 456, "got %ld\n", video_info->bmiHeader.biHeight); @@ -7642,16 +7638,12 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); video_info = (VIDEOINFOHEADER *)am_type.pbFormat; ok(video_info->rcSource.left == 0, "got %lu\n", video_info->rcSource.left); - todo_wine ok(video_info->rcSource.right == 123, "got %lu\n", video_info->rcSource.right); ok(video_info->rcSource.top == 0, "got %lu\n", video_info->rcSource.top); - todo_wine ok(video_info->rcSource.bottom == 456, "got %lu\n", video_info->rcSource.bottom); ok(video_info->rcTarget.left == 0, "got %lu\n", video_info->rcTarget.left); - todo_wine ok(video_info->rcTarget.right == 123, "got %lu\n", video_info->rcTarget.right); ok(video_info->rcTarget.top == 0, "got %lu\n", video_info->rcTarget.top); - todo_wine ok(video_info->rcTarget.bottom == 456, "got %lu\n", video_info->rcTarget.bottom); ok(video_info->bmiHeader.biWidth == 246, "got %lu\n", video_info->bmiHeader.biWidth); ok(video_info->bmiHeader.biHeight == -456, "got %ld\n", video_info->bmiHeader.biHeight); @@ -7674,16 +7666,12 @@ static void test_MFInitAMMediaTypeFromMFMediaType(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); video_info = (VIDEOINFOHEADER *)am_type.pbFormat; ok(video_info->rcSource.left == 0, "got %lu\n", video_info->rcSource.left); - todo_wine ok(video_info->rcSource.right == 123, "got %lu\n", video_info->rcSource.right); ok(video_info->rcSource.top == 0, "got %lu\n", video_info->rcSource.top); - todo_wine ok(video_info->rcSource.bottom == 456, "got %lu\n", video_info->rcSource.bottom); ok(video_info->rcTarget.left == 0, "got %lu\n", video_info->rcTarget.left); - todo_wine ok(video_info->rcTarget.right == 123, "got %lu\n", video_info->rcTarget.right); ok(video_info->rcTarget.top == 0, "got %lu\n", video_info->rcTarget.top); - todo_wine ok(video_info->rcTarget.bottom == 456, "got %lu\n", video_info->rcTarget.bottom); ok(video_info->bmiHeader.biWidth == 246, "got %lu\n", video_info->bmiHeader.biWidth); ok(video_info->bmiHeader.biHeight == 456, "got %ld\n", video_info->bmiHeader.biHeight);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfplat/tests/mfplat.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+)
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 7277346ebfe..e6ed89225d5 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -8206,16 +8206,40 @@ static void test_MFAverageTimePerFrameToFrameRate(void) unsigned int numerator; unsigned int denominator; UINT64 avgtime; + BOOL todo; } frame_rate_tests[] = { + { 60000, 1001, 166863, TRUE }, { 60000, 1001, 166833 }, + { 60000, 1001, 166803, TRUE }, + + { 30000, 1001, 333697, TRUE }, { 30000, 1001, 333667 }, + { 30000, 1001, 333637, TRUE }, + + { 24000, 1001, 417218, TRUE }, { 24000, 1001, 417188 }, + { 24000, 1001, 417158, TRUE }, + + { 60, 1, 166697, TRUE }, { 60, 1, 166667 }, + { 60, 1, 166637, TRUE }, + + { 30, 1, 333363, TRUE }, { 30, 1, 333333 }, + { 30, 1, 333303, TRUE }, + + { 50, 1, 200030, TRUE }, { 50, 1, 200000 }, + { 50, 1, 199970, TRUE }, + + { 25, 1, 400030, TRUE }, { 25, 1, 400000 }, + { 25, 1, 399970, TRUE }, + + { 24, 1, 416697, TRUE }, { 24, 1, 416667 }, + { 24, 1, 416637, TRUE },
{ 1000000, 25641, 256410 }, { 10000000, 83333, 83333 }, @@ -8240,6 +8264,7 @@ static void test_MFAverageTimePerFrameToFrameRate(void) numerator = denominator = 12345; hr = MFAverageTimePerFrameToFrameRate(frame_rate_tests[i].avgtime, &numerator, &denominator); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + todo_wine_if(frame_rate_tests[i].todo) ok(numerator == frame_rate_tests[i].numerator && denominator == frame_rate_tests[i].denominator, "%u: unexpected %u/%u, expected %u/%u.\n", i, numerator, denominator, frame_rate_tests[i].numerator, frame_rate_tests[i].denominator);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfplat/mediatype.c | 82 +++++++++++++++++++------------------- dlls/mfplat/tests/mfplat.c | 34 ++++++++-------- 2 files changed, 57 insertions(+), 59 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 6ed23c0ef6a..0fd8402d4d2 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3353,15 +3353,45 @@ HRESULT WINAPI MFConvertColorInfoToDXVA(DWORD *dxva_info, const MFVIDEOFORMAT *f
struct frame_rate { - UINT64 key; - UINT64 value; + UINT64 time; + UINT64 rate; +}; + +static const struct frame_rate known_rates[] = +{ +#define KNOWN_RATE(ft,n,d) { ft, ((UINT64)n << 32) | d } + KNOWN_RATE(417188, 24000, 1001), + KNOWN_RATE(416667, 24, 1), + KNOWN_RATE(400000, 25, 1), + KNOWN_RATE(333667, 30000, 1001), + KNOWN_RATE(333333, 30, 1), + KNOWN_RATE(200000, 50, 1), + KNOWN_RATE(166833, 60000, 1001), + KNOWN_RATE(166667, 60, 1), +#undef KNOWN_RATE };
-static int __cdecl frame_rate_compare(const void *a, const void *b) +static const struct frame_rate *known_rate_from_rate(UINT64 rate) +{ + UINT i; + for (i = 0; i < ARRAY_SIZE(known_rates); i++) + { + if (rate == known_rates[i].rate) + return known_rates + i; + } + return NULL; +} + +static const struct frame_rate *known_rate_from_time(UINT64 time) { - const UINT64 *key = a; - const struct frame_rate *known_rate = b; - return *key == known_rate->key ? 0 : ( *key < known_rate->key ? 1 : -1 ); + UINT i; + for (i = 0; i < ARRAY_SIZE(known_rates); i++) + { + if (time >= known_rates[i].time - 30 + && time <= known_rates[i].time + 30) + return known_rates + i; + } + return NULL; }
/*********************************************************************** @@ -3369,29 +3399,13 @@ static int __cdecl frame_rate_compare(const void *a, const void *b) */ HRESULT WINAPI MFFrameRateToAverageTimePerFrame(UINT32 numerator, UINT32 denominator, UINT64 *avgframetime) { - static const struct frame_rate known_rates[] = - { -#define KNOWN_RATE(n,d,ft) { ((UINT64)n << 32) | d, ft } - KNOWN_RATE(60000, 1001, 166833), - KNOWN_RATE(30000, 1001, 333667), - KNOWN_RATE(24000, 1001, 417188), - KNOWN_RATE(60, 1, 166667), - KNOWN_RATE(50, 1, 200000), - KNOWN_RATE(30, 1, 333333), - KNOWN_RATE(25, 1, 400000), - KNOWN_RATE(24, 1, 416667), -#undef KNOWN_RATE - }; UINT64 rate = ((UINT64)numerator << 32) | denominator; const struct frame_rate *entry;
TRACE("%u, %u, %p.\n", numerator, denominator, avgframetime);
- if ((entry = bsearch(&rate, known_rates, ARRAY_SIZE(known_rates), sizeof(*known_rates), - frame_rate_compare))) - { - *avgframetime = entry->value; - } + if ((entry = known_rate_from_rate(rate))) + *avgframetime = entry->time; else *avgframetime = numerator ? denominator * (UINT64)10000000 / numerator : 0;
@@ -3417,29 +3431,15 @@ static unsigned int get_gcd(unsigned int a, unsigned int b) */ HRESULT WINAPI MFAverageTimePerFrameToFrameRate(UINT64 avgtime, UINT32 *numerator, UINT32 *denominator) { - static const struct frame_rate known_rates[] = - { -#define KNOWN_RATE(ft,n,d) { ft, ((UINT64)n << 32) | d } - KNOWN_RATE(417188, 24000, 1001), - KNOWN_RATE(416667, 24, 1), - KNOWN_RATE(400000, 25, 1), - KNOWN_RATE(333667, 30000, 1001), - KNOWN_RATE(333333, 30, 1), - KNOWN_RATE(200000, 50, 1), - KNOWN_RATE(166833, 60000, 1001), - KNOWN_RATE(166667, 60, 1), -#undef KNOWN_RATE - }; const struct frame_rate *entry; unsigned int gcd;
TRACE("%s, %p, %p.\n", wine_dbgstr_longlong(avgtime), numerator, denominator);
- if ((entry = bsearch(&avgtime, known_rates, ARRAY_SIZE(known_rates), sizeof(*known_rates), - frame_rate_compare))) + if ((entry = known_rate_from_time(avgtime))) { - *numerator = entry->value >> 32; - *denominator = entry->value; + *numerator = entry->rate >> 32; + *denominator = entry->rate; } else if (avgtime) { diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index e6ed89225d5..b6d63f42d1c 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -8206,40 +8206,39 @@ static void test_MFAverageTimePerFrameToFrameRate(void) unsigned int numerator; unsigned int denominator; UINT64 avgtime; - BOOL todo; } frame_rate_tests[] = { - { 60000, 1001, 166863, TRUE }, + { 60000, 1001, 166863 }, { 60000, 1001, 166833 }, - { 60000, 1001, 166803, TRUE }, + { 60000, 1001, 166803 },
- { 30000, 1001, 333697, TRUE }, + { 30000, 1001, 333697 }, { 30000, 1001, 333667 }, - { 30000, 1001, 333637, TRUE }, + { 30000, 1001, 333637 },
- { 24000, 1001, 417218, TRUE }, + { 24000, 1001, 417218 }, { 24000, 1001, 417188 }, - { 24000, 1001, 417158, TRUE }, + { 24000, 1001, 417158 },
- { 60, 1, 166697, TRUE }, + { 60, 1, 166697 }, { 60, 1, 166667 }, - { 60, 1, 166637, TRUE }, + { 60, 1, 166637 },
- { 30, 1, 333363, TRUE }, + { 30, 1, 333363 }, { 30, 1, 333333 }, - { 30, 1, 333303, TRUE }, + { 30, 1, 333303 },
- { 50, 1, 200030, TRUE }, + { 50, 1, 200030 }, { 50, 1, 200000 }, - { 50, 1, 199970, TRUE }, + { 50, 1, 199970 },
- { 25, 1, 400030, TRUE }, + { 25, 1, 400030 }, { 25, 1, 400000 }, - { 25, 1, 399970, TRUE }, + { 25, 1, 399970 },
- { 24, 1, 416697, TRUE }, + { 24, 1, 416697 }, { 24, 1, 416667 }, - { 24, 1, 416637, TRUE }, + { 24, 1, 416637 },
{ 1000000, 25641, 256410 }, { 10000000, 83333, 83333 }, @@ -8264,7 +8263,6 @@ static void test_MFAverageTimePerFrameToFrameRate(void) numerator = denominator = 12345; hr = MFAverageTimePerFrameToFrameRate(frame_rate_tests[i].avgtime, &numerator, &denominator); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine_if(frame_rate_tests[i].todo) ok(numerator == frame_rate_tests[i].numerator && denominator == frame_rate_tests[i].denominator, "%u: unexpected %u/%u, expected %u/%u.\n", i, numerator, denominator, frame_rate_tests[i].numerator, frame_rate_tests[i].denominator);
From: Rémi Bernon rbernon@codeweavers.com
Native seems to also treat some frame rate specially, matching a wide range of time per frame into the same predefined frame rates. --- dlls/mfplat/mediatype.c | 7 +++++++ dlls/mfplat/tests/mfplat.c | 4 ---- 2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 0fd8402d4d2..96d9a07973e 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3808,6 +3808,13 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader2(IMFMediaType *media_type, con mediatype_set_blob(media_type, &MF_MT_MINIMUM_DISPLAY_APERTURE, (BYTE *)&aperture, sizeof(aperture), &hr); }
+ if (SUCCEEDED(hr) && vih->AvgTimePerFrame) + { + UINT32 num, den; + if (SUCCEEDED(hr = MFAverageTimePerFrameToFrameRate(vih->AvgTimePerFrame, &num, &den))) + mediatype_set_uint64(media_type, &MF_MT_FRAME_RATE, num, den, &hr); + } + return hr; }
diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index b6d63f42d1c..66c0f0d7951 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -10058,9 +10058,7 @@ static void test_MFInitMediaTypeFromVideoInfoHeader(void) hr = MFInitMediaTypeFromVideoInfoHeader(media_type, &vih, sizeof(vih), &GUID_NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_RATE, &value64); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value64 == ((UINT64)10000000 << 32 | 1151617), "Unexpected value %#I64x.\n", value64);
hr = IMFMediaType_GetUINT32(media_type, &MF_MT_FIXED_SIZE_SAMPLES, &value32); @@ -10311,9 +10309,7 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) hr = MFInitMediaTypeFromVideoInfoHeader2(media_type, &vih, sizeof(vih), &GUID_NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_RATE, &value64); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value64 == ((UINT64)10000000 << 32 | 1151617), "Unexpected value %#I64x.\n", value64);
value32 = 0xdeadbeef;
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfplat/mediatype.c | 39 +++++++++++++++++++++++++++++++++++++- dlls/mfplat/tests/mfplat.c | 4 ---- 2 files changed, 38 insertions(+), 5 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 96d9a07973e..eaabad59689 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -21,6 +21,7 @@ #include "mfplat_private.h" #include <math.h>
+#include "dxva.h" #include "dxva2api.h" #include "uuids.h" #include "strmif.h" @@ -3815,6 +3816,24 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader2(IMFMediaType *media_type, con mediatype_set_uint64(media_type, &MF_MT_FRAME_RATE, num, den, &hr); }
+ if (vih->dwControlFlags & AMCONTROL_COLORINFO_PRESENT) + { + DXVA_ExtendedFormat *format = (DXVA_ExtendedFormat *)&vih->dwControlFlags; + + if (format->VideoChromaSubsampling) + mediatype_set_uint32(media_type, &MF_MT_VIDEO_CHROMA_SITING, format->VideoChromaSubsampling, &hr); + if (format->NominalRange) + mediatype_set_uint32(media_type, &MF_MT_VIDEO_NOMINAL_RANGE, format->NominalRange, &hr); + if (format->VideoTransferMatrix) + mediatype_set_uint32(media_type, &MF_MT_YUV_MATRIX, format->VideoTransferMatrix, &hr); + if (format->VideoLighting) + mediatype_set_uint32(media_type, &MF_MT_VIDEO_LIGHTING, format->VideoLighting, &hr); + if (format->VideoPrimaries) + mediatype_set_uint32(media_type, &MF_MT_VIDEO_PRIMARIES, format->VideoPrimaries, &hr); + if (format->VideoTransferFunction) + mediatype_set_uint32(media_type, &MF_MT_TRANSFER_FUNCTION, format->VideoTransferFunction, &hr); + } + return hr; }
@@ -3930,7 +3949,8 @@ static HRESULT init_am_media_type_audio_format(AM_MEDIA_TYPE *am_type, UINT32 us static void init_video_info_header2(VIDEOINFOHEADER2 *vih, const GUID *subtype, IMFMediaType *media_type) { struct uncompressed_video_format *video_format = mf_get_video_format(subtype); - UINT32 image_size, bitrate, sample_size, width, height; + DXVA_ExtendedFormat *format = (DXVA_ExtendedFormat *)&vih->dwControlFlags; + UINT32 image_size, bitrate, sample_size, width, height, value; UINT64 frame_size, frame_rate;
vih->bmiHeader.biSize = sizeof(vih->bmiHeader); @@ -3975,6 +3995,23 @@ static void init_video_info_header2(VIDEOINFOHEADER2 *vih, const GUID *subtype, vih->rcSource.bottom = vih->rcTarget.bottom = height; } } + + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_CHROMA_SITING, &value))) + format->VideoChromaSubsampling = value; + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_NOMINAL_RANGE, &value))) + format->NominalRange = value; + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_YUV_MATRIX, &value))) + format->VideoTransferMatrix = value; + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_LIGHTING, &value))) + format->VideoLighting = value; + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_PRIMARIES, &value))) + format->VideoPrimaries = value; + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_TRANSFER_FUNCTION, &value))) + format->VideoTransferFunction = value; + + if (format->VideoChromaSubsampling || format->NominalRange || format->VideoTransferMatrix + || format->VideoLighting || format->VideoPrimaries || format->VideoTransferFunction) + format->SampleFormat = AMCONTROL_COLORINFO_PRESENT; }
static HRESULT init_am_media_type_video_format(AM_MEDIA_TYPE *am_type, UINT32 user_size, IMFMediaType *media_type) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 66c0f0d7951..38bb9651823 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -10348,9 +10348,7 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) hr = MFInitMediaTypeFromVideoInfoHeader2(media_type, &vih, sizeof(vih), &GUID_NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_YUV_MATRIX, &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == MFVideoTransferMatrix_SMPTE240M, "Unexpected value %#x.\n", value32); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_NOMINAL_RANGE, &value32); ok(hr == MF_E_ATTRIBUTENOTFOUND, "Unexpected hr %#lx.\n", hr); @@ -10360,9 +10358,7 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) hr = MFInitMediaTypeFromVideoInfoHeader2(media_type, &vih, sizeof(vih), &GUID_NULL); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_NOMINAL_RANGE, &value32); - todo_wine ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == MFNominalRange_Wide, "Unexpected value %#x.\n", value32);
hr = IMFMediaType_GetUINT32(media_type, &MF_MT_FIXED_SIZE_SAMPLES, &value32);
From: Rémi Bernon rbernon@codeweavers.com
--- dlls/mfplat/mediatype.c | 24 +++++++++++++++++++++++- dlls/mfplat/tests/mfplat.c | 1 - 2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index eaabad59689..35fce38652b 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3781,7 +3781,6 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader2(IMFMediaType *media_type, con mediatype_set_guid(media_type, &MF_MT_MAJOR_TYPE, &MFMediaType_Video, &hr); mediatype_set_guid(media_type, &MF_MT_SUBTYPE, subtype, &hr); mediatype_set_uint64(media_type, &MF_MT_PIXEL_ASPECT_RATIO, 1, 1, &hr); - mediatype_set_uint32(media_type, &MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive, &hr); mediatype_set_uint64(media_type, &MF_MT_FRAME_SIZE, vih->bmiHeader.biWidth, height, &hr);
if (SUCCEEDED(mf_get_stride_for_bitmap_info_header(subtype->Data1, &vih->bmiHeader, &stride))) @@ -3834,6 +3833,13 @@ HRESULT WINAPI MFInitMediaTypeFromVideoInfoHeader2(IMFMediaType *media_type, con mediatype_set_uint32(media_type, &MF_MT_TRANSFER_FUNCTION, format->VideoTransferFunction, &hr); }
+ if (!(vih->dwInterlaceFlags & AMINTERLACE_IsInterlaced)) + mediatype_set_uint32(media_type, &MF_MT_INTERLACE_MODE, MFVideoInterlace_Progressive, &hr); + else if (vih->dwInterlaceFlags & AMINTERLACE_DisplayModeBobOrWeave) + mediatype_set_uint32(media_type, &MF_MT_INTERLACE_MODE, MFVideoInterlace_MixedInterlaceOrProgressive, &hr); + else + FIXME("dwInterlaceFlags %#lx not implemented\n", vih->dwInterlaceFlags); + return hr; }
@@ -4012,6 +4018,22 @@ static void init_video_info_header2(VIDEOINFOHEADER2 *vih, const GUID *subtype, if (format->VideoChromaSubsampling || format->NominalRange || format->VideoTransferMatrix || format->VideoLighting || format->VideoPrimaries || format->VideoTransferFunction) format->SampleFormat = AMCONTROL_COLORINFO_PRESENT; + + if (SUCCEEDED(IMFMediaType_GetUINT32(media_type, &MF_MT_INTERLACE_MODE, &value))) + { + switch (value) + { + case MFVideoInterlace_Progressive: + break; + case MFVideoInterlace_MixedInterlaceOrProgressive: + vih->dwInterlaceFlags = AMINTERLACE_DisplayModeBobOrWeave | AMINTERLACE_IsInterlaced; + break; + default: + FIXME("MF_MT_INTERLACE_MODE %u not implemented!\n", value); + vih->dwInterlaceFlags = AMINTERLACE_IsInterlaced; + break; + } + } }
static HRESULT init_am_media_type_video_format(AM_MEDIA_TYPE *am_type, UINT32 user_size, IMFMediaType *media_type) diff --git a/dlls/mfplat/tests/mfplat.c b/dlls/mfplat/tests/mfplat.c index 38bb9651823..14873422d04 100644 --- a/dlls/mfplat/tests/mfplat.c +++ b/dlls/mfplat/tests/mfplat.c @@ -10318,7 +10318,6 @@ static void test_MFInitMediaTypeFromVideoInfoHeader2(void) ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); hr = IMFMediaType_GetUINT32(media_type, &MF_MT_INTERLACE_MODE, &value32); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); - todo_wine ok(value32 == MFVideoInterlace_MixedInterlaceOrProgressive, "Unexpected value %#x.\n", value32);
vih.dwPictAspectRatioX = 123;
Updated to use MFAverageTimePerFrameToFrameRate, with more tests and fixes for it to losely match frame times.
This merge request was approved by Nikolay Sivov.