[FFmpeg-cvslog] mpeg12enc: add seq_disp_ext option for deciding when to write a sequence_display_extension

Marton Balint git at videolan.org
Sat Jun 14 19:54:51 CEST 2014


ffmpeg | branch: master | Marton Balint <cus at passwd.hu> | Sat Jun 14 17:07:28 2014 +0200| [9236f7b5a23b4907f7b2bf6346ecd88e6d76f1e0] | committer: Michael Niedermayer

mpeg12enc: add seq_disp_ext option for deciding when to write a sequence_display_extension

Signed-off-by: Marton Balint <cus at passwd.hu>
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 doc/encoders.texi      |   24 ++++++++++++++++++++++++
 libavcodec/mpeg12enc.c |    6 +++++-
 libavcodec/mpegvideo.h |    1 +
 libavcodec/version.h   |    2 +-
 4 files changed, 31 insertions(+), 2 deletions(-)

diff --git a/doc/encoders.texi b/doc/encoders.texi
index 70d5c68..2781574 100644
--- a/doc/encoders.texi
+++ b/doc/encoders.texi
@@ -2042,6 +2042,30 @@ fastest.
 
 @end table
 
+ at section mpeg2
+
+MPEG-2 video encoder.
+
+ at subsection Options
+
+ at table @option
+ at item seq_disp_ext @var{integer}
+Specifies if the encoder should write a sequence_display_extension to the
+output.
+ at table @option
+ at item -1
+ at itemx auto
+Decide automatically to write it or not (this is the default) by checking if
+the data to be written is different from the default or unspecified values.
+ at item 0
+ at itemx never
+Never write it.
+ at item 1
+ at itemx always
+Always write it.
+ at end table
+ at end table
+
 @section png
 
 PNG image encoder.
diff --git a/libavcodec/mpeg12enc.c b/libavcodec/mpeg12enc.c
index 4fb9c44..0dbcda8 100644
--- a/libavcodec/mpeg12enc.c
+++ b/libavcodec/mpeg12enc.c
@@ -350,7 +350,7 @@ static void mpeg1_encode_sequence_header(MpegEncContext *s)
                                 s->avctx->color_trc != AVCOL_TRC_UNSPECIFIED ||
                                 s->avctx->colorspace != AVCOL_SPC_UNSPECIFIED);
 
-            if (use_seq_disp_ext) {
+            if (s->seq_disp_ext == 1 || (s->seq_disp_ext == -1 && use_seq_disp_ext)) {
                 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
@@ -1123,6 +1123,10 @@ static const AVOption mpeg2_options[] = {
     COMMON_OPTS
     { "non_linear_quant", "Use nonlinear quantizer.",    OFFSET(q_scale_type),   AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
     { "alternate_scan",   "Enable alternate scantable.", OFFSET(alternate_scan), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, VE },
+    { "seq_disp_ext",     "Write sequence_display_extension blocks.", OFFSET(seq_disp_ext), AV_OPT_TYPE_INT, { .i64 = -1 }, -1, 1, VE, "seq_disp_ext" },
+    {     "auto",   NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = -1},  0, 0, VE, "seq_disp_ext" },
+    {     "never",  NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = 0 },  0, 0, VE, "seq_disp_ext" },
+    {     "always", NULL, 0, AV_OPT_TYPE_CONST,  {.i64 = 1 },  0, 0, VE, "seq_disp_ext" },
     FF_MPV_COMMON_OPTS
     { NULL },
 };
diff --git a/libavcodec/mpegvideo.h b/libavcodec/mpegvideo.h
index 20dba38..ea0b7e5 100644
--- a/libavcodec/mpegvideo.h
+++ b/libavcodec/mpegvideo.h
@@ -588,6 +588,7 @@ typedef struct MpegEncContext {
     int q_scale_type;
     int intra_vlc_format;
     int alternate_scan;
+    int seq_disp_ext;
     int repeat_first_field;
     int chroma_420_type;
     int chroma_format;
diff --git a/libavcodec/version.h b/libavcodec/version.h
index d16e140..a48fb48 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -30,7 +30,7 @@
 
 #define LIBAVCODEC_VERSION_MAJOR 55
 #define LIBAVCODEC_VERSION_MINOR  66
-#define LIBAVCODEC_VERSION_MICRO 100
+#define LIBAVCODEC_VERSION_MICRO 101
 
 #define LIBAVCODEC_VERSION_INT  AV_VERSION_INT(LIBAVCODEC_VERSION_MAJOR, \
                                                LIBAVCODEC_VERSION_MINOR, \



More information about the ffmpeg-cvslog mailing list