Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/mediatype.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index fae4d3e5055..e0dbb6a1a78 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -978,7 +978,7 @@ static const MFVIDEOFORMAT * WINAPI video_mediatype_GetVideoFormat(IMFVideoMedia TRACE("%p.\n", iface);
CoTaskMemFree(media_type->video_format); - if (FAILED(hr = MFCreateMFVideoFormatFromMFMediaType((IMFMediaType *)iface, &media_type->video_format, &size))) + if (FAILED(hr = MFCreateMFVideoFormatFromMFMediaType(&media_type->IMFMediaType_iface, &media_type->video_format, &size))) WARN("Failed to create format description, hr %#x.\n", hr);
return media_type->video_format; @@ -1378,9 +1378,11 @@ static const WAVEFORMATEX * WINAPI audio_mediatype_GetAudioFormat(IMFAudioMediaT TRACE("%p.\n", iface);
CoTaskMemFree(media_type->audio_format); - if (FAILED(hr = MFCreateWaveFormatExFromMFMediaType((IMFMediaType *)iface, &media_type->audio_format, &size, - MFWaveFormatExConvertFlag_Normal))) + if (FAILED(hr = MFCreateWaveFormatExFromMFMediaType(&media_type->IMFMediaType_iface, &media_type->audio_format, + &size, MFWaveFormatExConvertFlag_Normal))) + { WARN("Failed to create wave format description, hr %#x.\n", hr); + }
return media_type->audio_format; }
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/mfplat/mediatype.c | 33 ++++++++++++++------------------- 1 file changed, 14 insertions(+), 19 deletions(-)
diff --git a/dlls/mfplat/mediatype.c b/dlls/mfplat/mediatype.c index e0dbb6a1a78..fb90053c605 100644 --- a/dlls/mfplat/mediatype.c +++ b/dlls/mfplat/mediatype.c @@ -3063,10 +3063,16 @@ HRESULT WINAPI MFCreateVideoMediaTypeFromSubtype(const GUID *subtype, IMFVideoMe return S_OK; }
-static void media_type_get_ratio(UINT64 value, UINT32 *numerator, UINT32 *denominator) +static void media_type_get_ratio(IMFMediaType *media_type, const GUID *attr, UINT32 *numerator, + UINT32 *denominator) { - *numerator = value >> 32; - *denominator = value; + UINT64 value; + + if (SUCCEEDED(IMFMediaType_GetUINT64(media_type, attr, &value))) + { + *numerator = value >> 32; + *denominator = value; + } }
/*********************************************************************** @@ -3076,7 +3082,6 @@ HRESULT WINAPI MFCreateMFVideoFormatFromMFMediaType(IMFMediaType *media_type, MF { UINT32 flags, palette_size = 0, avgrate; MFVIDEOFORMAT *format; - UINT64 value; INT32 stride; GUID guid;
@@ -3101,14 +3106,11 @@ HRESULT WINAPI MFCreateMFVideoFormatFromMFMediaType(IMFMediaType *media_type, MF format->surfaceInfo.Format = guid.Data1; }
- if (SUCCEEDED(IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_SIZE, &value))) - media_type_get_ratio(value, &format->videoInfo.dwWidth, &format->videoInfo.dwHeight); - - if (SUCCEEDED(IMFMediaType_GetUINT64(media_type, &MF_MT_PIXEL_ASPECT_RATIO, &value))) - { - media_type_get_ratio(value, &format->videoInfo.PixelAspectRatio.Numerator, - &format->videoInfo.PixelAspectRatio.Denominator); - } + media_type_get_ratio(media_type, &MF_MT_FRAME_SIZE, &format->videoInfo.dwWidth, &format->videoInfo.dwHeight); + media_type_get_ratio(media_type, &MF_MT_PIXEL_ASPECT_RATIO, &format->videoInfo.PixelAspectRatio.Numerator, + &format->videoInfo.PixelAspectRatio.Denominator); + media_type_get_ratio(media_type, &MF_MT_FRAME_RATE, &format->videoInfo.FramesPerSecond.Numerator, + &format->videoInfo.FramesPerSecond.Denominator);
IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_CHROMA_SITING, &format->videoInfo.SourceChromaSubsampling); IMFMediaType_GetUINT32(media_type, &MF_MT_INTERLACE_MODE, &format->videoInfo.InterlaceMode); @@ -3116,13 +3118,6 @@ HRESULT WINAPI MFCreateMFVideoFormatFromMFMediaType(IMFMediaType *media_type, MF IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_PRIMARIES, &format->videoInfo.ColorPrimaries); IMFMediaType_GetUINT32(media_type, &MF_MT_YUV_MATRIX, &format->videoInfo.TransferMatrix); IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_LIGHTING, &format->videoInfo.SourceLighting); - - if (SUCCEEDED(IMFMediaType_GetUINT64(media_type, &MF_MT_FRAME_RATE, &value))) - { - media_type_get_ratio(value, &format->videoInfo.FramesPerSecond.Numerator, - &format->videoInfo.FramesPerSecond.Denominator); - } - IMFMediaType_GetUINT32(media_type, &MF_MT_VIDEO_NOMINAL_RANGE, &format->videoInfo.NominalRange); IMFMediaType_GetBlob(media_type, &MF_MT_GEOMETRIC_APERTURE, (UINT8 *)&format->videoInfo.GeometricAperture, sizeof(format->videoInfo.GeometricAperture), NULL);