summaryrefslogtreecommitdiff
path: root/libavcodec/hevcdec.c
diff options
context:
space:
mode:
authorSteve Lhomme <robux4@gmail.com>2017-04-03 09:29:46 +0200
committerJames Almer <jamrial@gmail.com>2017-04-06 11:38:15 -0300
commit157e57a1810c6783779b046c1817a4f9737b2cb3 (patch)
tree8aa1bc2141c029a3381d894ada77ccee16fd29da /libavcodec/hevcdec.c
parentb378f5bd640177801681479ddb9fe80ececd9cf8 (diff)
lavc: Add Content Light Level side metadata found in HEVC
These data are necessary when transmitting HDR over HDMI. Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/hevcdec.c')
-rw-r--r--libavcodec/hevcdec.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/libavcodec/hevcdec.c b/libavcodec/hevcdec.c
index f9e8ff0c9f..af55416ad3 100644
--- a/libavcodec/hevcdec.c
+++ b/libavcodec/hevcdec.c
@@ -2644,6 +2644,24 @@ static int set_side_data(HEVCContext *s)
"min_luminance=%f, max_luminance=%f\n",
av_q2d(metadata->min_luminance), av_q2d(metadata->max_luminance));
}
+ // Decrement the mastering display flag when IRAP frame has no_rasl_output_flag=1
+ // so the side data persists for the entire coded video sequence.
+ if (s->sei_content_light_present > 0 &&
+ IS_IRAP(s) && s->no_rasl_output_flag) {
+ s->sei_content_light_present--;
+ }
+ if (s->sei_content_light_present) {
+ AVContentLightMetadata *metadata =
+ av_content_light_metadata_create_side_data(out);
+ if (!metadata)
+ return AVERROR(ENOMEM);
+ metadata->MaxCLL = s->max_content_light_level;
+ metadata->MaxFALL = s->max_pic_average_light_level;
+
+ av_log(s->avctx, AV_LOG_DEBUG, "Content Light Level Metadata:\n");
+ av_log(s->avctx, AV_LOG_DEBUG, "MaxCLL=%d, MaxFALL=%d\n",
+ metadata->MaxCLL, metadata->MaxFALL);
+ }
if (s->a53_caption) {
AVFrameSideData* sd = av_frame_new_side_data(out,