Browse code

avformat/mpegtsenc: make the pes packet length omission optional

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>

Michael Niedermayer authored on 2014/04/22 23:09:46
Showing 1 changed files
... ...
@@ -86,6 +86,8 @@ typedef struct MpegTSWrite {
86 86
     int flags;
87 87
     int copyts;
88 88
     int tables_version;
89
+
90
+    int omit_video_pes_length
89 91
 } MpegTSWrite;
90 92
 
91 93
 /* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */
... ...
@@ -124,6 +126,8 @@ static const AVOption options[] = {
124 124
       offsetof(MpegTSWrite, copyts), AV_OPT_TYPE_INT, {.i64=-1}, -1, 1, AV_OPT_FLAG_ENCODING_PARAM},
125 125
     { "tables_version", "set PAT, PMT and SDT version",
126 126
       offsetof(MpegTSWrite, tables_version), AV_OPT_TYPE_INT, {.i64=0}, 0, 31, AV_OPT_FLAG_ENCODING_PARAM},
127
+    { "omit_video_pes_length", "Ommit the PES packet length for video packets",
128
+      offsetof(MpegTSWrite, omit_video_pes_length), AV_OPT_TYPE_INT, {.i64=1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
127 129
     { NULL },
128 130
 };
129 131
 
... ...
@@ -1066,7 +1070,7 @@ static void mpegts_write_pes(AVFormatContext *s, AVStream *st,
1066 1066
             }
1067 1067
             if (len > 0xffff)
1068 1068
                 len = 0;
1069
-            if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
1069
+            if (ts->omit_video_pes_length && st->codec->codec_type == AVMEDIA_TYPE_VIDEO) {
1070 1070
                 len = 0;
1071 1071
             }
1072 1072
             *q++ = len >> 8;