diff options
author | James Almer <jamrial@gmail.com> | 2016-10-15 11:17:37 -0300 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2016-11-02 17:07:04 -0300 |
commit | bab6b606752e5ba93f9d2d1b71f264dc8e3031b3 (patch) | |
tree | 8618de9dd6f5714f8d854734539e2d2579a7d026 /libavformat/matroskaenc.c | |
parent | a566c952f905639456966413fee0b5701867ddcd (diff) | |
download | ffmpeg-bab6b606752e5ba93f9d2d1b71f264dc8e3031b3.tar.gz |
avformat/matroskaenc: support writing Chroma Location elements
Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavformat/matroskaenc.c')
-rw-r--r-- | libavformat/matroskaenc.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 78540fb384..99f61fe56d 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -832,6 +832,14 @@ static int mkv_write_video_color(AVIOContext *pb, AVCodecParameters *par, AVStre par->color_range < AVCOL_RANGE_NB) { put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORRANGE, par->color_range); } + if (par->chroma_location != AVCHROMA_LOC_UNSPECIFIED && + par->chroma_location <= AVCHROMA_LOC_TOP) { + int xpos, ypos; + + avcodec_enum_to_chroma_pos(&xpos, &ypos, par->chroma_location); + put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGHORZ, (xpos >> 7) + 1); + put_ebml_uint(dyn_cp, MATROSKA_ID_VIDEOCOLORCHROMASITINGVERT, (ypos >> 7) + 1); + } if (side_data_size == sizeof(AVMasteringDisplayMetadata)) { ebml_master meta_element = start_ebml_master( dyn_cp, MATROSKA_ID_VIDEOCOLORMASTERINGMETA, 0); |