[FFmpeg-cvslog] avformat/matroskaenc: support writing Chroma Location elements

James Almer git at videolan.org
Wed Nov 2 22:24:19 EET 2016


ffmpeg | branch: master | James Almer <jamrial at gmail.com> | Sat Oct 15 11:17:37 2016 -0300| [bab6b606752e5ba93f9d2d1b71f264dc8e3031b3] | committer: James Almer

avformat/matroskaenc: support writing Chroma Location elements

Signed-off-by: James Almer <jamrial at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bab6b606752e5ba93f9d2d1b71f264dc8e3031b3
---

 libavformat/matroskaenc.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c
index 78540fb..99f61fe 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);



More information about the ffmpeg-cvslog mailing list