mfplat/mediatype: Append user data in MFCreateMFVideoFormatFromMFMediaType.
This commit is contained in:
parent
75a5263c60
commit
b1d7c03514
2 changed files with 14 additions and 6 deletions
dlls/mfplat
|
@ -3247,17 +3247,20 @@ static UINT32 media_type_get_uint32(IMFMediaType *media_type, REFGUID guid)
|
||||||
*/
|
*/
|
||||||
HRESULT WINAPI MFCreateMFVideoFormatFromMFMediaType(IMFMediaType *media_type, MFVIDEOFORMAT **video_format, UINT32 *size)
|
HRESULT WINAPI MFCreateMFVideoFormatFromMFMediaType(IMFMediaType *media_type, MFVIDEOFORMAT **video_format, UINT32 *size)
|
||||||
{
|
{
|
||||||
UINT32 palette_size = 0;
|
UINT32 palette_size = 0, user_data_size = 0;
|
||||||
MFVIDEOFORMAT *format;
|
MFVIDEOFORMAT *format;
|
||||||
INT32 stride;
|
INT32 stride;
|
||||||
GUID guid;
|
GUID guid;
|
||||||
|
|
||||||
TRACE("%p, %p, %p.\n", media_type, video_format, size);
|
TRACE("%p, %p, %p.\n", media_type, video_format, size);
|
||||||
|
|
||||||
*size = sizeof(*format);
|
|
||||||
|
|
||||||
if (SUCCEEDED(IMFMediaType_GetBlobSize(media_type, &MF_MT_PALETTE, &palette_size)))
|
if (SUCCEEDED(IMFMediaType_GetBlobSize(media_type, &MF_MT_PALETTE, &palette_size)))
|
||||||
*size += palette_size;
|
*size = offsetof(MFVIDEOFORMAT, surfaceInfo.Palette[palette_size / sizeof(MFPaletteEntry) + 1]);
|
||||||
|
else
|
||||||
|
*size = sizeof(*format);
|
||||||
|
|
||||||
|
if (SUCCEEDED(IMFMediaType_GetBlobSize(media_type, &MF_MT_USER_DATA, &user_data_size)))
|
||||||
|
*size += user_data_size;
|
||||||
|
|
||||||
if (!(format = CoTaskMemAlloc(*size)))
|
if (!(format = CoTaskMemAlloc(*size)))
|
||||||
return E_OUTOFMEMORY;
|
return E_OUTOFMEMORY;
|
||||||
|
@ -3316,6 +3319,11 @@ HRESULT WINAPI MFCreateMFVideoFormatFromMFMediaType(IMFMediaType *media_type, MF
|
||||||
IMFMediaType_GetBlob(media_type, &MF_MT_PALETTE, (UINT8 *)format->surfaceInfo.Palette, palette_size, NULL);
|
IMFMediaType_GetBlob(media_type, &MF_MT_PALETTE, (UINT8 *)format->surfaceInfo.Palette, palette_size, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user_data_size)
|
||||||
|
{
|
||||||
|
IMFMediaType_GetBlob(media_type, &MF_MT_USER_DATA, (UINT8 *)format + *size - user_data_size, user_data_size, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7144,7 +7144,7 @@ static void test_MFCreateMFVideoFormatFromMFMediaType(void)
|
||||||
hr = MFCreateMFVideoFormatFromMFMediaType(media_type, &video_format, &size);
|
hr = MFCreateMFVideoFormatFromMFMediaType(media_type, &video_format, &size);
|
||||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||||
ok(!!video_format, "Unexpected format.\n");
|
ok(!!video_format, "Unexpected format.\n");
|
||||||
todo_wine ok(size == expect_size, "Unexpected size %u.\n", size);
|
ok(size == expect_size, "Unexpected size %u.\n", size);
|
||||||
ok(video_format->dwSize == size, "Unexpected size %u.\n", size);
|
ok(video_format->dwSize == size, "Unexpected size %u.\n", size);
|
||||||
CoTaskMemFree(video_format);
|
CoTaskMemFree(video_format);
|
||||||
|
|
||||||
|
@ -7155,7 +7155,7 @@ static void test_MFCreateMFVideoFormatFromMFMediaType(void)
|
||||||
hr = MFCreateMFVideoFormatFromMFMediaType(media_type, &video_format, &size);
|
hr = MFCreateMFVideoFormatFromMFMediaType(media_type, &video_format, &size);
|
||||||
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
|
||||||
ok(!!video_format, "Unexpected format.\n");
|
ok(!!video_format, "Unexpected format.\n");
|
||||||
todo_wine ok(size == expect_size, "Unexpected size %u.\n", size);
|
ok(size == expect_size, "Unexpected size %u.\n", size);
|
||||||
ok(video_format->dwSize == size, "Unexpected size %u.\n", size);
|
ok(video_format->dwSize == size, "Unexpected size %u.\n", size);
|
||||||
CoTaskMemFree(video_format);
|
CoTaskMemFree(video_format);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue