diff options
author | James Almer <jamrial@gmail.com> | 2017-04-25 15:42:51 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2017-04-30 20:04:57 -0300 |
commit | 37cc1c1e9137fe72354945b1cd2851ffc972661d (patch) | |
tree | d2b29a18bf741fb4c2bf7893cfd229b250a9add9 /libavformat/matroskaenc.c | |
parent | 095147ae0650799437390c81ae66d1151ceb9b31 (diff) | |
download | ffmpeg-37cc1c1e9137fe72354945b1cd2851ffc972661d.tar.gz |
avformat/matroskaenc: add support for writing Content Light Level elements
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 9c7a213db9..f14936e3d2 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -844,8 +844,7 @@ static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStre uint8_t *colorinfo_ptr; int side_data_size = 0; int ret, colorinfo_size; - const uint8_t *side_data = av_stream_get_side_data( - st, AV_PKT_DATA_MASTERING_DISPLAY_METADATA, &side_data_size); + const uint8_t *side_data; ret = avio_open_dyn_buf(&dyn_cp); if (ret < 0) @@ -876,6 +875,18 @@ static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStre put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ, (xpos >> 7) + 1); put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT, (ypos >> 7) + 1); } + + side_data = av_stream_get_side_data(st, AV_PKT_DATA_CONTENT_LIGHT_LEVEL, + &side_data_size); + if (side_data_size) { + const AVContentLightMetadata *metadata = + (const AVContentLightMetadata*)side_data; + put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORMAXCLL, metadata->MaxCLL); + put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORMAXFALL, metadata->MaxFALL); + } + + side_data = av_stream_get_side_data(st, AV_PKT_DATA_MASTERING_DISPLAY_METADATA, + &side_data_size); if (side_data_size == sizeof(AVMasteringDisplayMetadata)) { ebml_master meta_element = start_ebml_master( dyn_cp, MATROSKA_ID_VIDEOCOLORMASTERINGMETA, 0); |