summaryrefslogtreecommitdiff
path: root/libavformat/matroskadec.c
diff options
context:
space:
mode:
authorJames Almer <jamrial@gmail.com>2017-04-25 15:04:00 -0300
committerJames Almer <jamrial@gmail.com>2017-04-30 20:04:50 -0300
commit095147ae0650799437390c81ae66d1151ceb9b31 (patch)
tree5356b41e4d1189064f3898cd034b2889f5bd6e81 /libavformat/matroskadec.c
parentd61f93bf04eb90d3998d654e233fcaa87e86768a (diff)
avformat/matroskadec: export Content Light Level metadata
Based on a patch by Hendrik Leppkes Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/matroskadec.c')
-rw-r--r--libavformat/matroskadec.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 47873cccd8..9e2c9bd2e2 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1869,6 +1869,21 @@ static int mkv_parse_video_color(AVStream *st, const MatroskaTrack *track) {
avcodec_chroma_pos_to_enum((color->chroma_siting_horz - 1) << 7,
(color->chroma_siting_vert - 1) << 7);
}
+ if (color->max_cll && color->max_fall) {
+ size_t size = 0;
+ int ret;
+ AVContentLightMetadata *metadata = av_content_light_metadata_alloc(&size);
+ if (!metadata)
+ return AVERROR(ENOMEM);
+ ret = av_stream_add_side_data(st, AV_PKT_DATA_CONTENT_LIGHT_LEVEL,
+ (uint8_t *)metadata, size);
+ if (ret < 0) {
+ av_freep(&metadata);
+ return ret;
+ }
+ metadata->MaxCLL = color->max_cll;
+ metadata->MaxFALL = color->max_fall;
+ }
if (has_mastering_primaries || has_mastering_luminance) {
// Use similar rationals as other standards.