diff mbox

[FFmpeg-devel] avformat/matroskadec: export Content Light Level metadata

Message ID 20170425181040.7920-1-jamrial@gmail.com
State Accepted
Headers show

Commit Message

James Almer April 25, 2017, 6:10 p.m. UTC
Based on a patch by Hendrik Leppkes

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavformat/matroskadec.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

Comments

James Almer April 30, 2017, 11:06 p.m. UTC | #1
On 4/25/2017 3:10 PM, James Almer wrote:
> Based on a patch by Hendrik Leppkes
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavformat/matroskadec.c | 15 +++++++++++++++
>  1 file changed, 15 insertions(+)

Pushed.
diff mbox

Patch

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 47873cccd8..fa786a8457 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.