[libav-devel] [PATCH] mpeg2: adding sequence display extension information

Marc-Antoine ARNAUD arnaud.marcantoine at gmail.com
Tue Jun 3 10:13:00 CEST 2014


---
 libavcodec/mpeg12enc.c |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index c12491e..476ba0a 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -286,6 +286,18 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
             put_bits(&s->pb, 1, s->low_delay);
             put_bits(&s->pb, 2, 0);                 // frame_rate_ext_n
             put_bits(&s->pb, 5, 0);                 // frame_rate_ext_d
+
+            put_header(s, EXT_START_CODE);
+            put_bits(&s->pb, 4, 2);                 // sequence display extension
+            put_bits(&s->pb, 3, 0);                 // video format: 0 is components
+            put_bits(&s->pb, 1, 1); // color description
+            put_bits(&s->pb, 8, s->avctx->color_primaries);  // colorspace
+            put_bits(&s->pb, 8, s->avctx->color_trc); // color transfer
+            put_bits(&s->pb, 8, s->avctx->colorspace); // color matrix
+            put_bits(&s->pb, 14, s->width); // display horizontal size
+            put_bits(&s->pb, 1, 1);     // marker
+            put_bits(&s->pb, 14, s->height); // display vertical size
+            put_bits(&s->pb, 3, 0);     // remaining 3 bits are zero padding
         }
 
         put_header(s, GOP_START_CODE);
-- 
1.7.7



More information about the libav-devel mailing list