Skip to content

Commit df26eae

Browse files
ziqinghjulliard
authored andcommitted
mfplat: Support YVYU, NV11, MEDIASUBTYPE_RGB* media types.
1 parent 67be089 commit df26eae

File tree

4 files changed

+16
-14
lines changed

4 files changed

+16
-14
lines changed

dlls/mf/tests/transform.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -5752,8 +5752,8 @@ static void test_video_processor(void)
57525752
&& !IsEqualGUID(&guid, &MEDIASUBTYPE_Y42T))
57535753
{
57545754
hr = MFCalculateImageSize(&guid, 16, 16, (UINT32 *)&input_info.cbSize);
5755-
todo_wine_if(IsEqualGUID(&guid, &MFVideoFormat_NV11) || IsEqualGUID(&guid, &MFVideoFormat_YVYU)
5756-
|| IsEqualGUID(&guid, &MFVideoFormat_Y216) || IsEqualGUID(&guid, &MFVideoFormat_v410)
5755+
todo_wine_if(IsEqualGUID(&guid, &MFVideoFormat_Y216)
5756+
|| IsEqualGUID(&guid, &MFVideoFormat_v410)
57575757
|| IsEqualGUID(&guid, &MFVideoFormat_Y41P))
57585758
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
57595759
}

dlls/mfplat/buffer.c

+3
Original file line numberDiff line numberDiff line change
@@ -1357,6 +1357,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo
13571357
break;
13581358
case MAKEFOURCC('I','M','C','2'):
13591359
case MAKEFOURCC('I','M','C','4'):
1360+
case MAKEFOURCC('N','V','1','1'):
13601361
plane_size = stride * 3 / 2 * height;
13611362
break;
13621363
case MAKEFOURCC('N','V','1','2'):
@@ -1379,6 +1380,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo
13791380
case MAKEFOURCC('I','M','C','3'):
13801381
case MAKEFOURCC('I','M','C','4'):
13811382
case MAKEFOURCC('Y','V','1','2'):
1383+
case MAKEFOURCC('N','V','1','1'):
13821384
row_alignment = MF_128_BYTE_ALIGNMENT;
13831385
break;
13841386
default:
@@ -1397,6 +1399,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo
13971399
case MAKEFOURCC('Y','V','1','2'):
13981400
case MAKEFOURCC('I','M','C','2'):
13991401
case MAKEFOURCC('I','M','C','4'):
1402+
case MAKEFOURCC('N','V','1','1'):
14001403
max_length = pitch * height * 3 / 2;
14011404
break;
14021405
default:

dlls/mfplat/mediatype.c

+11
Original file line numberDiff line numberDiff line change
@@ -2646,13 +2646,20 @@ static const struct uncompressed_video_format video_formats[] =
26462646
{ &MFVideoFormat_IMC3, 2, 3, 0, 1 },
26472647
{ &MFVideoFormat_IMC4, 1, 0, 0, 1 },
26482648
{ &MFVideoFormat_IYUV, 1, 0, 0, 1 },
2649+
{ &MFVideoFormat_NV11, 1, 0, 0, 1 },
26492650
{ &MFVideoFormat_NV12, 1, 0, 0, 1 },
26502651
{ &MFVideoFormat_D16, 2, 3, 0, 0 },
26512652
{ &MFVideoFormat_L16, 2, 3, 0, 0 },
26522653
{ &MFVideoFormat_UYVY, 2, 0, 0, 1 },
26532654
{ &MFVideoFormat_YUY2, 2, 0, 0, 1 },
26542655
{ &MFVideoFormat_YV12, 1, 0, 0, 1 },
2656+
{ &MFVideoFormat_YVYU, 2, 0, 0, 1 },
26552657
{ &MFVideoFormat_A16B16G16R16F, 8, 3, 1, 0 },
2658+
{ &MEDIASUBTYPE_RGB8, 1, 3, 1, 0 },
2659+
{ &MEDIASUBTYPE_RGB565, 2, 3, 1, 0 },
2660+
{ &MEDIASUBTYPE_RGB555, 2, 3, 1, 0 },
2661+
{ &MEDIASUBTYPE_RGB24, 3, 3, 1, 0 },
2662+
{ &MEDIASUBTYPE_RGB32, 4, 3, 1, 0 },
26562663
};
26572664

26582665
static struct uncompressed_video_format *mf_get_video_format(const GUID *subtype)
@@ -2732,6 +2739,9 @@ HRESULT WINAPI MFCalculateImageSize(REFGUID subtype, UINT32 width, UINT32 height
27322739
/* 2 x 2 block, interleaving UV for half the height */
27332740
*size = ((width + 1) & ~1) * height * 3 / 2;
27342741
break;
2742+
case MAKEFOURCC('N','V','1','1'):
2743+
*size = ((width + 3) & ~3) * height * 3 / 2;
2744+
break;
27352745
case D3DFMT_L8:
27362746
case D3DFMT_L16:
27372747
case D3DFMT_D16:
@@ -2772,6 +2782,7 @@ HRESULT WINAPI MFGetPlaneSize(DWORD fourcc, DWORD width, DWORD height, DWORD *si
27722782
case MAKEFOURCC('Y','V','1','2'):
27732783
case MAKEFOURCC('I','4','2','0'):
27742784
case MAKEFOURCC('I','Y','U','V'):
2785+
case MAKEFOURCC('N','V','1','1'):
27752786
*size = stride * height * 3 / 2;
27762787
break;
27772788
default:

dlls/mfplat/tests/mfplat.c

-12
Original file line numberDiff line numberDiff line change
@@ -4390,10 +4390,7 @@ static void test_MFCalculateImageSize(void)
43904390
IsEqualGUID(ptr->subtype, &MFVideoFormat_A2R10G10B10);
43914391

43924392
hr = MFCalculateImageSize(ptr->subtype, ptr->width, ptr->height, &size);
4393-
todo_wine_if(is_MEDIASUBTYPE_RGB(ptr->subtype) || IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
43944393
ok(hr == S_OK || (is_broken && hr == E_INVALIDARG), "%u: failed to calculate image size, hr %#lx.\n", i, hr);
4395-
todo_wine_if(is_MEDIASUBTYPE_RGB(ptr->subtype)
4396-
|| IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
43974394
ok(size == ptr->size, "%u: unexpected image size %u, expected %u. Size %u x %u, format %s.\n", i, size, ptr->size,
43984395
ptr->width, ptr->height, wine_dbgstr_an((char *)&ptr->subtype->Data1, 4));
43994396
}
@@ -4425,7 +4422,6 @@ static void test_MFGetPlaneSize(void)
44254422

44264423
hr = pMFGetPlaneSize(ptr->subtype->Data1, ptr->width, ptr->height, &size);
44274424
ok(hr == S_OK, "%u: failed to get plane size, hr %#lx.\n", i, hr);
4428-
todo_wine_if(IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
44294425
ok(size == plane_size, "%u: unexpected plane size %lu, expected %u. Size %u x %u, format %s.\n", i, size, plane_size,
44304426
ptr->width, ptr->height, wine_dbgstr_an((char*)&ptr->subtype->Data1, 4));
44314427
}
@@ -5762,9 +5758,7 @@ static void test_MFGetStrideForBitmapInfoHeader(void)
57625758
for (i = 0; i < ARRAY_SIZE(stride_tests); ++i)
57635759
{
57645760
hr = pMFGetStrideForBitmapInfoHeader(stride_tests[i].subtype->Data1, stride_tests[i].width, &stride);
5765-
todo_wine_if(IsEqualGUID(stride_tests[i].subtype, &MFVideoFormat_NV11))
57665761
ok(hr == S_OK, "%u: failed to get stride, hr %#lx.\n", i, hr);
5767-
todo_wine_if(IsEqualGUID(stride_tests[i].subtype, &MFVideoFormat_NV11))
57685762
ok(stride == stride_tests[i].stride, "%u: format %s, unexpected stride %ld, expected %ld.\n", i,
57695763
wine_dbgstr_an((char *)&stride_tests[i].subtype->Data1, 4), stride, stride_tests[i].stride);
57705764
}
@@ -5977,10 +5971,7 @@ static void test_MFCreate2DMediaBuffer(void)
59775971
continue;
59785972

59795973
hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->subtype->Data1, FALSE, &buffer);
5980-
todo_wine_if(IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
59815974
ok(hr == S_OK, "Failed to create a buffer, hr %#lx.\n", hr);
5982-
if (hr != S_OK)
5983-
continue;
59845975

59855976
hr = IMFMediaBuffer_GetMaxLength(buffer, &length);
59865977
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
@@ -6121,10 +6112,7 @@ static void test_MFCreate2DMediaBuffer(void)
61216112
continue;
61226113

61236114
hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->subtype->Data1, FALSE, &buffer);
6124-
todo_wine_if(IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
61256115
ok(hr == S_OK, "Failed to create a buffer, hr %#lx.\n", hr);
6126-
if (hr != S_OK)
6127-
continue;
61286116

61296117
hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer, (void **)&_2dbuffer);
61306118
ok(hr == S_OK, "Failed to get interface, hr %#lx.\n", hr);

0 commit comments

Comments
 (0)