From ef81c9d6c40baf4e6c888dcfa577ee753fd3019a Mon Sep 17 00:00:00 2001 From: Haihao Xiang Date: Thu, 25 Jul 2019 22:55:09 +0800 Subject: [PATCH] msdkdec: Update frame info from video parameters A 10bit stream may have different depth values for Luma and Chroma, and MSDK requires the frame info must match the corresponding video parameters --- sys/msdk/gstmsdkdec.c | 2 ++ sys/msdk/msdk.c | 9 +++++++++ sys/msdk/msdk.h | 4 ++++ 3 files changed, 15 insertions(+) diff --git a/sys/msdk/gstmsdkdec.c b/sys/msdk/gstmsdkdec.c index 6fd5724c13..70638803d9 100644 --- a/sys/msdk/gstmsdkdec.c +++ b/sys/msdk/gstmsdkdec.c @@ -205,6 +205,8 @@ get_surface (GstMsdkDec * thiz, GstBuffer * buffer) goto failed_unref_buffer2; } + gst_msdk_update_mfx_frame_info_from_mfx_video_param (&i->surface->Info, + &thiz->param); thiz->decoded_msdk_surfaces = g_list_append (thiz->decoded_msdk_surfaces, i); return i; diff --git a/sys/msdk/msdk.c b/sys/msdk/msdk.c index c977535e06..3e96837adc 100644 --- a/sys/msdk/msdk.c +++ b/sys/msdk/msdk.c @@ -377,3 +377,12 @@ gst_msdk_get_video_format_from_mfx_fourcc (mfxU32 fourcc) return GST_VIDEO_FORMAT_UNKNOWN; } + +void +gst_msdk_update_mfx_frame_info_from_mfx_video_param (mfxFrameInfo * mfx_info, + mfxVideoParam * param) +{ + mfx_info->BitDepthLuma = param->mfx.FrameInfo.BitDepthLuma; + mfx_info->BitDepthChroma = param->mfx.FrameInfo.BitDepthChroma; + mfx_info->Shift = param->mfx.FrameInfo.Shift; +} diff --git a/sys/msdk/msdk.h b/sys/msdk/msdk.h index ba662c5e67..0ab64af412 100644 --- a/sys/msdk/msdk.h +++ b/sys/msdk/msdk.h @@ -74,6 +74,10 @@ gst_msdk_get_surface_from_buffer (GstBuffer * buf); GstVideoFormat gst_msdk_get_video_format_from_mfx_fourcc (mfxU32 fourcc); +void +gst_msdk_update_mfx_frame_info_from_mfx_video_param (mfxFrameInfo * mfx_info, + mfxVideoParam * param); + G_END_DECLS #endif /* __MSDK_H__ */