[FFmpeg-devel] [PATCH] avformat/mpegtsenc: add an option to disable first PTS check.

Benoit Fouet benoit.fouet at free.fr
Fri Oct 24 16:40:15 CEST 2014


Fixes ticket #1598
---
 libavformat/mpegtsenc.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index d73b75f..74541d1 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -91,6 +91,7 @@ typedef struct MpegTSWrite {
     int tables_version;
 
     int omit_video_pes_length;
+    int first_pts_check;
 } MpegTSWrite;
 
 /* a PES packet header is generated every DEFAULT_PES_HEADER_FREQ packets */
@@ -691,7 +692,7 @@ static int mpegts_write_header(AVFormatContext *s)
         pids[i]                = ts_st->pid;
         ts_st->payload_pts     = AV_NOPTS_VALUE;
         ts_st->payload_dts     = AV_NOPTS_VALUE;
-        ts_st->first_pts_check = 1;
+        ts_st->first_pts_check = ts->first_pts_check;
         ts_st->cc              = 15;
         /* update PCR pid by using the first video stream */
         if (st->codec->codec_type == AVMEDIA_TYPE_VIDEO &&
@@ -1473,6 +1474,9 @@ static const AVOption options[] = {
     { "pcr_period", "PCR retransmission time",
       offsetof(MpegTSWrite, pcr_period), AV_OPT_TYPE_INT,
       { .i64 = PCR_RETRANS_TIME }, 0, INT_MAX, AV_OPT_FLAG_ENCODING_PARAM },
+    { "first_pts_check", "Check the first PTS value to be valid.",
+      offsetof(MpegTSWrite, first_pts_check), AV_OPT_TYPE_INT,
+      { .i64 = 1 }, 0, 1, AV_OPT_FLAG_ENCODING_PARAM },
     { NULL },
 };
 
-- 
2.1.2.532.g19b5d50



More information about the ffmpeg-devel mailing list