Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/mediatype.c | 34 ++++++++++++++++++++++++++++++++++ dlls/mfplat/mfplat.spec | 2 +- include/mfapi.h | 1 + 3 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index 843c09c5e09..5eaa4fdd08d 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -23,6 +23,7 @@ #include "initguid.h" #include "ks.h" #include "ksmedia.h" +#include "dxva2api.h"
#include "wine/debug.h"
@@ -2748,3 +2749,36 @@ HRESULT WINAPI MFCreateMFVideoFormatFromMFMediaType(IMFMediaType *media_type, MF
return S_OK; } + +/*********************************************************************** + * MFConvertColorInfoToDXVA (mfplat.@) + */ +HRESULT WINAPI MFConvertColorInfoToDXVA(DWORD *dxva_info, const MFVIDEOFORMAT *format) +{ + struct + { + UINT SampleFormat : 8; + UINT VideoChromaSubsampling : 4; + UINT NominalRange : 3; + UINT VideoTransferMatrix : 3; + UINT VideoLighting : 4; + UINT VideoPrimaries : 5; + UINT VideoTransferFunction : 5; + } *dxva_format = (void *)dxva_info; + + TRACE("%p, %p.\n", dxva_info, format); + + if (format->videoInfo.InterlaceMode == MFVideoInterlace_MixedInterlaceOrProgressive) + dxva_format->SampleFormat = DXVA2_SampleFieldInterleavedEvenFirst; + else + dxva_format->SampleFormat = format->videoInfo.InterlaceMode; + + dxva_format->VideoChromaSubsampling = format->videoInfo.SourceChromaSubsampling; + dxva_format->NominalRange = format->videoInfo.NominalRange; + dxva_format->VideoTransferMatrix = format->videoInfo.TransferMatrix; + dxva_format->VideoLighting = format->videoInfo.SourceLighting; + dxva_format->VideoPrimaries = format->videoInfo.ColorPrimaries; + dxva_format->VideoTransferFunction = format->videoInfo.TransferFunction; + + return S_OK; +} diff --git a/dlls/mfplat/mfplat.spec b/dlls/mfplat/mfplat.spec index e6069424fc9..16be972e5bd 100644 --- a/dlls/mfplat/mfplat.spec +++ b/dlls/mfplat/mfplat.spec @@ -34,7 +34,7 @@ @ stdcall MFCompareFullToPartialMediaType(ptr ptr) @ stub MFCompareSockaddrAddresses @ stub MFConvertColorInfoFromDXVA -@ stub MFConvertColorInfoToDXVA +@ stdcall MFConvertColorInfoToDXVA(ptr ptr) @ stub MFConvertFromFP16Array @ stub MFConvertToFP16Array @ stdcall MFCopyImage(ptr long ptr long long long) diff --git a/include/mfapi.h b/include/mfapi.h index e86fb526f13..06a5412cbc5 100644 --- a/include/mfapi.h +++ b/include/mfapi.h @@ -494,6 +494,7 @@ HRESULT WINAPI MFCalculateImageSize(REFGUID subtype, UINT32 width, UINT32 height HRESULT WINAPI MFCancelCreateFile(IUnknown *cancel_cookie); HRESULT WINAPI MFCancelWorkItem(MFWORKITEM_KEY key); BOOL WINAPI MFCompareFullToPartialMediaType(IMFMediaType *full_type, IMFMediaType *partial_type); +HRESULT WINAPI MFConvertColorInfoToDXVA(DWORD *dxva_info, const MFVIDEOFORMAT *format); HRESULT WINAPI MFCopyImage(BYTE *dest, LONG deststride, const BYTE *src, LONG srcstride, DWORD width, DWORD lines); HRESULT WINAPI MFCreate2DMediaBuffer(DWORD width, DWORD height, DWORD fourcc, BOOL bottom_up, IMFMediaBuffer **buffer); HRESULT WINAPI MFCreateAlignedMemoryBuffer(DWORD max_length, DWORD alignment, IMFMediaBuffer **buffer);