Commit df26eae9 authored by Ziqing Hui's avatar Ziqing Hui Committed by Alexandre Julliard

mfplat: Support YVYU, NV11, MEDIASUBTYPE_RGB* media types.

parent 67be089a
...@@ -5752,8 +5752,8 @@ static void test_video_processor(void) ...@@ -5752,8 +5752,8 @@ static void test_video_processor(void)
&& !IsEqualGUID(&guid, &MEDIASUBTYPE_Y42T)) && !IsEqualGUID(&guid, &MEDIASUBTYPE_Y42T))
{ {
hr = MFCalculateImageSize(&guid, 16, 16, (UINT32 *)&input_info.cbSize); hr = MFCalculateImageSize(&guid, 16, 16, (UINT32 *)&input_info.cbSize);
todo_wine_if(IsEqualGUID(&guid, &MFVideoFormat_NV11) || IsEqualGUID(&guid, &MFVideoFormat_YVYU) todo_wine_if(IsEqualGUID(&guid, &MFVideoFormat_Y216)
|| IsEqualGUID(&guid, &MFVideoFormat_Y216) || IsEqualGUID(&guid, &MFVideoFormat_v410) || IsEqualGUID(&guid, &MFVideoFormat_v410)
|| IsEqualGUID(&guid, &MFVideoFormat_Y41P)) || IsEqualGUID(&guid, &MFVideoFormat_Y41P))
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
} }
......
...@@ -1357,6 +1357,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo ...@@ -1357,6 +1357,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo
break; break;
case MAKEFOURCC('I','M','C','2'): case MAKEFOURCC('I','M','C','2'):
case MAKEFOURCC('I','M','C','4'): case MAKEFOURCC('I','M','C','4'):
case MAKEFOURCC('N','V','1','1'):
plane_size = stride * 3 / 2 * height; plane_size = stride * 3 / 2 * height;
break; break;
case MAKEFOURCC('N','V','1','2'): case MAKEFOURCC('N','V','1','2'):
...@@ -1379,6 +1380,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo ...@@ -1379,6 +1380,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo
case MAKEFOURCC('I','M','C','3'): case MAKEFOURCC('I','M','C','3'):
case MAKEFOURCC('I','M','C','4'): case MAKEFOURCC('I','M','C','4'):
case MAKEFOURCC('Y','V','1','2'): case MAKEFOURCC('Y','V','1','2'):
case MAKEFOURCC('N','V','1','1'):
row_alignment = MF_128_BYTE_ALIGNMENT; row_alignment = MF_128_BYTE_ALIGNMENT;
break; break;
default: default:
...@@ -1397,6 +1399,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo ...@@ -1397,6 +1399,7 @@ static HRESULT create_2d_buffer(DWORD width, DWORD height, DWORD fourcc, BOOL bo
case MAKEFOURCC('Y','V','1','2'): case MAKEFOURCC('Y','V','1','2'):
case MAKEFOURCC('I','M','C','2'): case MAKEFOURCC('I','M','C','2'):
case MAKEFOURCC('I','M','C','4'): case MAKEFOURCC('I','M','C','4'):
case MAKEFOURCC('N','V','1','1'):
max_length = pitch * height * 3 / 2; max_length = pitch * height * 3 / 2;
break; break;
default: default:
......
...@@ -2646,13 +2646,20 @@ static const struct uncompressed_video_format video_formats[] = ...@@ -2646,13 +2646,20 @@ static const struct uncompressed_video_format video_formats[] =
{ &MFVideoFormat_IMC3, 2, 3, 0, 1 }, { &MFVideoFormat_IMC3, 2, 3, 0, 1 },
{ &MFVideoFormat_IMC4, 1, 0, 0, 1 }, { &MFVideoFormat_IMC4, 1, 0, 0, 1 },
{ &MFVideoFormat_IYUV, 1, 0, 0, 1 }, { &MFVideoFormat_IYUV, 1, 0, 0, 1 },
{ &MFVideoFormat_NV11, 1, 0, 0, 1 },
{ &MFVideoFormat_NV12, 1, 0, 0, 1 }, { &MFVideoFormat_NV12, 1, 0, 0, 1 },
{ &MFVideoFormat_D16, 2, 3, 0, 0 }, { &MFVideoFormat_D16, 2, 3, 0, 0 },
{ &MFVideoFormat_L16, 2, 3, 0, 0 }, { &MFVideoFormat_L16, 2, 3, 0, 0 },
{ &MFVideoFormat_UYVY, 2, 0, 0, 1 }, { &MFVideoFormat_UYVY, 2, 0, 0, 1 },
{ &MFVideoFormat_YUY2, 2, 0, 0, 1 }, { &MFVideoFormat_YUY2, 2, 0, 0, 1 },
{ &MFVideoFormat_YV12, 1, 0, 0, 1 }, { &MFVideoFormat_YV12, 1, 0, 0, 1 },
{ &MFVideoFormat_YVYU, 2, 0, 0, 1 },
{ &MFVideoFormat_A16B16G16R16F, 8, 3, 1, 0 }, { &MFVideoFormat_A16B16G16R16F, 8, 3, 1, 0 },
{ &MEDIASUBTYPE_RGB8, 1, 3, 1, 0 },
{ &MEDIASUBTYPE_RGB565, 2, 3, 1, 0 },
{ &MEDIASUBTYPE_RGB555, 2, 3, 1, 0 },
{ &MEDIASUBTYPE_RGB24, 3, 3, 1, 0 },
{ &MEDIASUBTYPE_RGB32, 4, 3, 1, 0 },
}; };
static struct uncompressed_video_format *mf_get_video_format(const GUID *subtype) 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 ...@@ -2732,6 +2739,9 @@ HRESULT WINAPI MFCalculateImageSize(REFGUID subtype, UINT32 width, UINT32 height
/* 2 x 2 block, interleaving UV for half the height */ /* 2 x 2 block, interleaving UV for half the height */
*size = ((width + 1) & ~1) * height * 3 / 2; *size = ((width + 1) & ~1) * height * 3 / 2;
break; break;
case MAKEFOURCC('N','V','1','1'):
*size = ((width + 3) & ~3) * height * 3 / 2;
break;
case D3DFMT_L8: case D3DFMT_L8:
case D3DFMT_L16: case D3DFMT_L16:
case D3DFMT_D16: case D3DFMT_D16:
...@@ -2772,6 +2782,7 @@ HRESULT WINAPI MFGetPlaneSize(DWORD fourcc, DWORD width, DWORD height, DWORD *si ...@@ -2772,6 +2782,7 @@ HRESULT WINAPI MFGetPlaneSize(DWORD fourcc, DWORD width, DWORD height, DWORD *si
case MAKEFOURCC('Y','V','1','2'): case MAKEFOURCC('Y','V','1','2'):
case MAKEFOURCC('I','4','2','0'): case MAKEFOURCC('I','4','2','0'):
case MAKEFOURCC('I','Y','U','V'): case MAKEFOURCC('I','Y','U','V'):
case MAKEFOURCC('N','V','1','1'):
*size = stride * height * 3 / 2; *size = stride * height * 3 / 2;
break; break;
default: default:
......
...@@ -4390,10 +4390,7 @@ static void test_MFCalculateImageSize(void) ...@@ -4390,10 +4390,7 @@ static void test_MFCalculateImageSize(void)
IsEqualGUID(ptr->subtype, &MFVideoFormat_A2R10G10B10); IsEqualGUID(ptr->subtype, &MFVideoFormat_A2R10G10B10);
hr = MFCalculateImageSize(ptr->subtype, ptr->width, ptr->height, &size); hr = MFCalculateImageSize(ptr->subtype, ptr->width, ptr->height, &size);
todo_wine_if(is_MEDIASUBTYPE_RGB(ptr->subtype) || IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
ok(hr == S_OK || (is_broken && hr == E_INVALIDARG), "%u: failed to calculate image size, hr %#lx.\n", i, hr); ok(hr == S_OK || (is_broken && hr == E_INVALIDARG), "%u: failed to calculate image size, hr %#lx.\n", i, hr);
todo_wine_if(is_MEDIASUBTYPE_RGB(ptr->subtype)
|| IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
ok(size == ptr->size, "%u: unexpected image size %u, expected %u. Size %u x %u, format %s.\n", i, size, ptr->size, ok(size == ptr->size, "%u: unexpected image size %u, expected %u. Size %u x %u, format %s.\n", i, size, ptr->size,
ptr->width, ptr->height, wine_dbgstr_an((char *)&ptr->subtype->Data1, 4)); ptr->width, ptr->height, wine_dbgstr_an((char *)&ptr->subtype->Data1, 4));
} }
...@@ -4425,7 +4422,6 @@ static void test_MFGetPlaneSize(void) ...@@ -4425,7 +4422,6 @@ static void test_MFGetPlaneSize(void)
hr = pMFGetPlaneSize(ptr->subtype->Data1, ptr->width, ptr->height, &size); hr = pMFGetPlaneSize(ptr->subtype->Data1, ptr->width, ptr->height, &size);
ok(hr == S_OK, "%u: failed to get plane size, hr %#lx.\n", i, hr); ok(hr == S_OK, "%u: failed to get plane size, hr %#lx.\n", i, hr);
todo_wine_if(IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
ok(size == plane_size, "%u: unexpected plane size %lu, expected %u. Size %u x %u, format %s.\n", i, size, plane_size, ok(size == plane_size, "%u: unexpected plane size %lu, expected %u. Size %u x %u, format %s.\n", i, size, plane_size,
ptr->width, ptr->height, wine_dbgstr_an((char*)&ptr->subtype->Data1, 4)); ptr->width, ptr->height, wine_dbgstr_an((char*)&ptr->subtype->Data1, 4));
} }
...@@ -5762,9 +5758,7 @@ static void test_MFGetStrideForBitmapInfoHeader(void) ...@@ -5762,9 +5758,7 @@ static void test_MFGetStrideForBitmapInfoHeader(void)
for (i = 0; i < ARRAY_SIZE(stride_tests); ++i) for (i = 0; i < ARRAY_SIZE(stride_tests); ++i)
{ {
hr = pMFGetStrideForBitmapInfoHeader(stride_tests[i].subtype->Data1, stride_tests[i].width, &stride); hr = pMFGetStrideForBitmapInfoHeader(stride_tests[i].subtype->Data1, stride_tests[i].width, &stride);
todo_wine_if(IsEqualGUID(stride_tests[i].subtype, &MFVideoFormat_NV11))
ok(hr == S_OK, "%u: failed to get stride, hr %#lx.\n", i, hr); ok(hr == S_OK, "%u: failed to get stride, hr %#lx.\n", i, hr);
todo_wine_if(IsEqualGUID(stride_tests[i].subtype, &MFVideoFormat_NV11))
ok(stride == stride_tests[i].stride, "%u: format %s, unexpected stride %ld, expected %ld.\n", i, ok(stride == stride_tests[i].stride, "%u: format %s, unexpected stride %ld, expected %ld.\n", i,
wine_dbgstr_an((char *)&stride_tests[i].subtype->Data1, 4), stride, stride_tests[i].stride); wine_dbgstr_an((char *)&stride_tests[i].subtype->Data1, 4), stride, stride_tests[i].stride);
} }
...@@ -5977,10 +5971,7 @@ static void test_MFCreate2DMediaBuffer(void) ...@@ -5977,10 +5971,7 @@ static void test_MFCreate2DMediaBuffer(void)
continue; continue;
hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->subtype->Data1, FALSE, &buffer); hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->subtype->Data1, FALSE, &buffer);
todo_wine_if(IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
ok(hr == S_OK, "Failed to create a buffer, hr %#lx.\n", hr); ok(hr == S_OK, "Failed to create a buffer, hr %#lx.\n", hr);
if (hr != S_OK)
continue;
hr = IMFMediaBuffer_GetMaxLength(buffer, &length); hr = IMFMediaBuffer_GetMaxLength(buffer, &length);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
...@@ -6121,10 +6112,7 @@ static void test_MFCreate2DMediaBuffer(void) ...@@ -6121,10 +6112,7 @@ static void test_MFCreate2DMediaBuffer(void)
continue; continue;
hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->subtype->Data1, FALSE, &buffer); hr = pMFCreate2DMediaBuffer(ptr->width, ptr->height, ptr->subtype->Data1, FALSE, &buffer);
todo_wine_if(IsEqualGUID(ptr->subtype, &MFVideoFormat_NV11))
ok(hr == S_OK, "Failed to create a buffer, hr %#lx.\n", hr); ok(hr == S_OK, "Failed to create a buffer, hr %#lx.\n", hr);
if (hr != S_OK)
continue;
hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer, (void **)&_2dbuffer); hr = IMFMediaBuffer_QueryInterface(buffer, &IID_IMF2DBuffer, (void **)&_2dbuffer);
ok(hr == S_OK, "Failed to get interface, hr %#lx.\n", hr); ok(hr == S_OK, "Failed to get interface, hr %#lx.\n", hr);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment