mfplat: Handle more video subtypes in MFInitMediaTypeFromAMMediaType().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2023-04-09 18:09:47 +02:00 committed by Alexandre Julliard
parent 357f0e9a49
commit 69b98b2b79
3 changed files with 50 additions and 1 deletions

View file

@ -673,7 +673,6 @@ static void test_query_accept(void)
{
memcpy(&req_mt.subtype, subtype_tests[i], sizeof(GUID));
hr = IPin_QueryAccept(pin, &req_mt);
todo_wine_if(i)
ok(hr == S_OK, "Got hr %#lx.\n", hr);
}

View file

@ -26,6 +26,7 @@
#include "ks.h"
#include "ksmedia.h"
#include "amvideo.h"
#include "wmcodecdsp.h"
WINE_DEFAULT_DEBUG_CHANNEL(mfplat);
@ -3593,6 +3594,22 @@ static const GUID * get_mf_subtype_for_am_subtype(const GUID *subtype)
if (IsEqualGUID(subtype, &MEDIASUBTYPE_RGB32))
return &MFVideoFormat_RGB32;
else if (IsEqualGUID(subtype, &MEDIASUBTYPE_ARGB32))
return &MFVideoFormat_ARGB32;
else if (IsEqualGUID(subtype, &MEDIASUBTYPE_I420))
return &MFVideoFormat_I420;
else if (IsEqualGUID(subtype, &MEDIASUBTYPE_AYUV))
return &MFVideoFormat_AYUV;
else if (IsEqualGUID(subtype, &MEDIASUBTYPE_YV12))
return &MFVideoFormat_YV12;
else if (IsEqualGUID(subtype, &MEDIASUBTYPE_YUY2))
return &MFVideoFormat_YUY2;
else if (IsEqualGUID(subtype, &MEDIASUBTYPE_UYVY))
return &MFVideoFormat_UYVY;
else if (IsEqualGUID(subtype, &MEDIASUBTYPE_YVYU))
return &MFVideoFormat_YVYU;
else if (IsEqualGUID(subtype, &MEDIASUBTYPE_NV12))
return &MFVideoFormat_NV12;
else
{
FIXME("Unknown subtype %s.\n", debugstr_guid(subtype));

View file

@ -56,6 +56,7 @@
#undef EXTERN_GUID
#define EXTERN_GUID DEFINE_GUID
#include "mfd3d12.h"
#include "wmcodecdsp.h"
DEFINE_GUID(DUMMY_CLSID, 0x12345678,0x1234,0x1234,0x12,0x13,0x14,0x15,0x16,0x17,0x18,0x19);
DEFINE_GUID(DUMMY_GUID1, 0x12345678,0x1234,0x1234,0x21,0x21,0x21,0x21,0x21,0x21,0x21,0x21);
@ -8421,6 +8422,22 @@ static void test_MFInitMediaTypeFromAMMediaType(void)
{0}, {0}, 0, 0, 0,
{sizeof(BITMAPINFOHEADER), 32, 24, 1, 0, 0xdeadbeef}
};
static const struct guid_type_pair
{
const GUID *am_type;
const GUID *mf_type;
} guid_types[] =
{
{ &MEDIASUBTYPE_I420, &MFVideoFormat_I420 },
{ &MEDIASUBTYPE_AYUV, &MFVideoFormat_AYUV },
{ &MEDIASUBTYPE_YV12, &MFVideoFormat_YV12 },
{ &MEDIASUBTYPE_YUY2, &MFVideoFormat_YUY2 },
{ &MEDIASUBTYPE_UYVY, &MFVideoFormat_UYVY },
{ &MEDIASUBTYPE_YVYU, &MFVideoFormat_YVYU },
{ &MEDIASUBTYPE_NV12, &MFVideoFormat_NV12 },
{ &MEDIASUBTYPE_ARGB32, &MFVideoFormat_ARGB32 },
};
unsigned int i;
hr = MFCreateMediaType(&media_type);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
@ -8539,6 +8556,22 @@ static void test_MFInitMediaTypeFromAMMediaType(void)
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(value32 == 128, "Unexpected value %d.\n", value32);
vih.bmiHeader.biHeight = 24;
for (i = 0; i < ARRAY_SIZE(guid_types); ++i)
{
memcpy(&mt.subtype, guid_types[i].am_type, sizeof(GUID));
hr = MFInitMediaTypeFromAMMediaType(media_type, &mt);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = IMFMediaType_GetGUID(media_type, &MF_MT_MAJOR_TYPE, &guid);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(IsEqualGUID(&guid, &MFMediaType_Video), "Unexpected guid %s.\n", debugstr_guid(&guid));
hr = IMFMediaType_GetGUID(media_type, &MF_MT_SUBTYPE, &guid);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
ok(IsEqualGUID(&guid, guid_types[i].mf_type), "Unexpected guid %s.\n", debugstr_guid(&guid));
}
IMFMediaType_Release(media_type);
}