diff options
author | Steve Lhomme <robux4@gmail.com> | 2017-04-03 09:29:46 +0200 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-04-06 11:38:15 -0300 |
commit | 157e57a1810c6783779b046c1817a4f9737b2cb3 (patch) | |
tree | 8aa1bc2141c029a3381d894ada77ccee16fd29da /libavcodec/hevc_sei.c | |
parent | b378f5bd640177801681479ddb9fe80ececd9cf8 (diff) | |
download | ffmpeg-157e57a1810c6783779b046c1817a4f9737b2cb3.tar.gz |
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/hevc_sei.c')
-rw-r--r-- | libavcodec/hevc_sei.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c index 8fc026cf1e..bb299d5a9f 100644 --- a/libavcodec/hevc_sei.c +++ b/libavcodec/hevc_sei.c @@ -102,6 +102,19 @@ static int decode_nal_sei_mastering_display_info(HEVCContext *s) return 0; } +static int decode_nal_sei_content_light_info(HEVCContext *s) +{ + GetBitContext *gb = &s->HEVClc->gb; + // Max and average light levels + s->max_content_light_level = get_bits_long(gb, 16); + s->max_pic_average_light_level = get_bits_long(gb, 16); + // As this SEI message comes before the first frame that references it, + // initialize the flag to 2 and decrement on IRAP access unit so it + // persists for the coded video sequence (e.g., between two IRAPs) + s-> sei_content_light_present = 2; + return 0; +} + static int decode_nal_sei_frame_packing_arrangement(HEVCContext *s) { GetBitContext *gb = &s->HEVClc->gb; @@ -304,6 +317,8 @@ static int decode_nal_sei_prefix(HEVCContext *s, int type, int size) } case SEI_TYPE_MASTERING_DISPLAY_INFO: return decode_nal_sei_mastering_display_info(s); + case SEI_TYPE_CONTENT_LIGHT_LEVEL_INFO: + return decode_nal_sei_content_light_info(s); case SEI_TYPE_ACTIVE_PARAMETER_SETS: active_parameter_sets(s); av_log(s->avctx, AV_LOG_DEBUG, "Skipped PREFIX SEI %d\n", type); |