mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-30 05:31:15 +00:00
avviddec: Update for video-hdr struct change
See the change of -base https://gitlab.freedesktop.org/gstreamer/gst-plugins-base/-/merge_requests/594
This commit is contained in:
parent
c8b8884791
commit
39e6f846e0
1 changed files with 44 additions and 55 deletions
|
@ -1127,39 +1127,33 @@ static gboolean
|
||||||
mastering_display_metadata_av_to_gst (AVMasteringDisplayMetadata * av,
|
mastering_display_metadata_av_to_gst (AVMasteringDisplayMetadata * av,
|
||||||
GstVideoMasteringDisplayInfo * gst)
|
GstVideoMasteringDisplayInfo * gst)
|
||||||
{
|
{
|
||||||
|
const guint64 chroma_scale = 50000;
|
||||||
|
const guint64 luma_scale = 10000;
|
||||||
|
gint i;
|
||||||
|
|
||||||
/* Use only complete mastering meta */
|
/* Use only complete mastering meta */
|
||||||
if (!av->has_primaries || !av->has_luminance)
|
if (!av->has_primaries || !av->has_luminance)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
gst->Wx_n = av->white_point[0].num;
|
for (i = 0; i < G_N_ELEMENTS (gst->display_primaries); i++) {
|
||||||
gst->Wx_d = av->white_point[0].den;
|
gst->display_primaries[i].x = (guint16) gst_util_uint64_scale (chroma_scale,
|
||||||
|
av->display_primaries[i][0].num, av->display_primaries[i][0].den);
|
||||||
|
gst->display_primaries[i].y = (guint16) gst_util_uint64_scale (chroma_scale,
|
||||||
|
av->display_primaries[i][1].num, av->display_primaries[i][1].den);
|
||||||
|
}
|
||||||
|
|
||||||
gst->Wy_n = av->white_point[1].num;
|
gst->white_point.x = (guint16) gst_util_uint64_scale (chroma_scale,
|
||||||
gst->Wy_d = av->white_point[1].den;
|
av->white_point[0].num, av->white_point[0].den);
|
||||||
|
gst->white_point.y = (guint16) gst_util_uint64_scale (chroma_scale,
|
||||||
|
av->white_point[1].num, av->white_point[1].den);
|
||||||
|
|
||||||
gst->Rx_n = av->display_primaries[0][0].num;
|
|
||||||
gst->Rx_d = av->display_primaries[0][0].den;
|
|
||||||
|
|
||||||
gst->Ry_n = av->display_primaries[0][1].num;
|
gst->max_display_mastering_luminance =
|
||||||
gst->Ry_d = av->display_primaries[0][1].den;
|
(guint32) gst_util_uint64_scale (luma_scale,
|
||||||
|
av->max_luminance.num, av->max_luminance.den);
|
||||||
gst->Gx_n = av->display_primaries[1][0].num;
|
gst->min_display_mastering_luminance =
|
||||||
gst->Gx_d = av->display_primaries[1][0].den;
|
(guint32) gst_util_uint64_scale (luma_scale,
|
||||||
|
av->min_luminance.num, av->min_luminance.den);
|
||||||
gst->Gy_n = av->display_primaries[1][1].num;
|
|
||||||
gst->Gy_d = av->display_primaries[1][1].den;
|
|
||||||
|
|
||||||
gst->Bx_n = av->display_primaries[2][0].num;
|
|
||||||
gst->Bx_d = av->display_primaries[2][0].den;
|
|
||||||
|
|
||||||
gst->By_n = av->display_primaries[2][1].num;
|
|
||||||
gst->By_d = av->display_primaries[2][1].den;
|
|
||||||
|
|
||||||
gst->max_luma_n = av->max_luminance.num;
|
|
||||||
gst->max_luma_d = av->max_luminance.den;
|
|
||||||
|
|
||||||
gst->min_luma_n = av->min_luminance.num;
|
|
||||||
gst->min_luma_d = av->min_luminance.den;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1168,11 +1162,8 @@ static gboolean
|
||||||
content_light_metadata_av_to_gst (AVContentLightMetadata * av,
|
content_light_metadata_av_to_gst (AVContentLightMetadata * av,
|
||||||
GstVideoContentLightLevel * gst)
|
GstVideoContentLightLevel * gst)
|
||||||
{
|
{
|
||||||
gst->maxCLL_n = av->MaxCLL;
|
gst->max_content_light_level = av->MaxCLL;
|
||||||
gst->maxCLL_d = 1;
|
gst->max_frame_average_light_level = av->MaxFALL;
|
||||||
|
|
||||||
gst->maxFALL_n = av->MaxFALL;
|
|
||||||
gst->maxFALL_d = 1;
|
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
@ -1316,26 +1307,26 @@ gst_ffmpegviddec_negotiate (GstFFMpegVidDec * ffmpegdec,
|
||||||
if (!gst_structure_has_field (in_s, "mastering-display-info")) {
|
if (!gst_structure_has_field (in_s, "mastering-display-info")) {
|
||||||
AVFrameSideData *sd = av_frame_get_side_data (picture,
|
AVFrameSideData *sd = av_frame_get_side_data (picture,
|
||||||
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
|
AV_FRAME_DATA_MASTERING_DISPLAY_METADATA);
|
||||||
GstVideoMasteringDisplayInfo mastering;
|
GstVideoMasteringDisplayInfo minfo;
|
||||||
|
|
||||||
if (sd
|
if (sd
|
||||||
&& mastering_display_metadata_av_to_gst ((AVMasteringDisplayMetadata *)
|
&& mastering_display_metadata_av_to_gst ((AVMasteringDisplayMetadata *)
|
||||||
sd->data, &mastering)) {
|
sd->data, &minfo)) {
|
||||||
GST_LOG_OBJECT (ffmpegdec, "update mastering display info");
|
GST_LOG_OBJECT (ffmpegdec, "update mastering display info: "
|
||||||
GST_LOG_OBJECT (ffmpegdec, "\tRed (%u/%u, %u/%u)", mastering.Rx_n,
|
"Red(%u, %u) "
|
||||||
mastering.Rx_d, mastering.Ry_n, mastering.Ry_d);
|
"Green(%u, %u) "
|
||||||
GST_LOG_OBJECT (ffmpegdec, "\tGreen(%u/%u, %u/%u)", mastering.Gx_n,
|
"Blue(%u, %u) "
|
||||||
mastering.Gx_d, mastering.Gy_n, mastering.Gy_d);
|
"White(%u, %u) "
|
||||||
GST_LOG_OBJECT (ffmpegdec, "\tBlue (%u/%u, %u/%u)", mastering.Bx_n,
|
"max_luminance(%u) "
|
||||||
mastering.Bx_d, mastering.By_n, mastering.By_d);
|
"min_luminance(%u) ",
|
||||||
GST_LOG_OBJECT (ffmpegdec, "\tWhite(%u/%u, %u/%u)", mastering.Wx_n,
|
minfo.display_primaries[0].x, minfo.display_primaries[0].y,
|
||||||
mastering.Wx_d, mastering.Wy_n, mastering.Wy_d);
|
minfo.display_primaries[1].x, minfo.display_primaries[1].y,
|
||||||
GST_LOG_OBJECT (ffmpegdec,
|
minfo.display_primaries[2].x, minfo.display_primaries[2].y,
|
||||||
"\tmax_luminance:(%u/%u), min_luminance:(%u/%u)",
|
minfo.white_point.x, minfo.white_point.y,
|
||||||
mastering.max_luma_n, mastering.max_luma_d, mastering.min_luma_n,
|
minfo.max_display_mastering_luminance,
|
||||||
mastering.min_luma_d);
|
minfo.min_display_mastering_luminance);
|
||||||
|
|
||||||
if (!gst_video_mastering_display_info_add_to_caps (&mastering,
|
if (!gst_video_mastering_display_info_add_to_caps (&minfo,
|
||||||
output_state->caps)) {
|
output_state->caps)) {
|
||||||
GST_WARNING_OBJECT (ffmpegdec,
|
GST_WARNING_OBJECT (ffmpegdec,
|
||||||
"Couldn't set mastering display info to caps");
|
"Couldn't set mastering display info to caps");
|
||||||
|
@ -1346,17 +1337,15 @@ gst_ffmpegviddec_negotiate (GstFFMpegVidDec * ffmpegdec,
|
||||||
if (!gst_structure_has_field (in_s, "content-light-level")) {
|
if (!gst_structure_has_field (in_s, "content-light-level")) {
|
||||||
AVFrameSideData *sd = av_frame_get_side_data (picture,
|
AVFrameSideData *sd = av_frame_get_side_data (picture,
|
||||||
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
|
AV_FRAME_DATA_CONTENT_LIGHT_LEVEL);
|
||||||
GstVideoContentLightLevel level;
|
GstVideoContentLightLevel cll;
|
||||||
|
|
||||||
if (sd && content_light_metadata_av_to_gst ((AVContentLightMetadata *)
|
if (sd && content_light_metadata_av_to_gst ((AVContentLightMetadata *)
|
||||||
sd->data, &level)) {
|
sd->data, &cll)) {
|
||||||
GST_LOG_OBJECT (ffmpegdec, "update content light level");
|
GST_LOG_OBJECT (ffmpegdec, "update content light level: "
|
||||||
GST_LOG_OBJECT (ffmpegdec,
|
"maxCLL:(%u), maxFALL:(%u)", cll.max_content_light_level,
|
||||||
"\tmaxCLL:(%u/%u), maxFALL:(%u/%u)", level.maxCLL_n, level.maxCLL_d,
|
cll.max_frame_average_light_level);
|
||||||
level.maxFALL_n, level.maxFALL_d);
|
|
||||||
|
|
||||||
if (!gst_video_content_light_level_add_to_caps (&level,
|
if (!gst_video_content_light_level_add_to_caps (&cll, output_state->caps)) {
|
||||||
output_state->caps)) {
|
|
||||||
GST_WARNING_OBJECT (ffmpegdec,
|
GST_WARNING_OBJECT (ffmpegdec,
|
||||||
"Couldn't set content light level to caps");
|
"Couldn't set content light level to caps");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue