[FFmpeg-cvslog] avformat/mpegts: add scan_all_pmts option

Michael Niedermayer git at videolan.org
Sat Nov 8 21:43:53 CET 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Nov  4 01:30:15 2014 +0100| [29b1af40f3a09fafd36bcefb4483353e1b5d82bd] | committer: Michael Niedermayer

avformat/mpegts: add scan_all_pmts option

This allows selecting if the demuxer should consider all streams to be
found after the first PMT and add further streams during decoding or if it rather
should scan all that are within the analyze-duration and other limits

Fixes Ticket3762

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

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

 libavformat/mpegts.c |    8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 78aa13e..d8e75d9 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -141,6 +141,8 @@ struct MpegTSContext {
     int skip_changes;
     int skip_clear;
 
+    int scan_all_pmts;
+
     int resync_size;
 
     /******************************************/
@@ -165,6 +167,8 @@ static const AVOption options[] = {
      {.i64 = 1}, 0, 1, AV_OPT_FLAG_DECODING_PARAM },
     {"ts_packetsize", "Output option carrying the raw packet size.", offsetof(MpegTSContext, raw_packet_size), AV_OPT_TYPE_INT,
      {.i64 = 0}, 0, 0, AV_OPT_FLAG_DECODING_PARAM | AV_OPT_FLAG_EXPORT | AV_OPT_FLAG_READONLY },
+    {"scan_all_pmts",   "Scan and combine all PMTs", offsetof(MpegTSContext, scan_all_pmts), AV_OPT_TYPE_INT,
+     { .i64 =  -1}, -1, 1,  AV_OPT_FLAG_DECODING_PARAM },
     {"skip_changes", "Skip changing / adding streams / programs.", offsetof(MpegTSContext, skip_changes), AV_OPT_TYPE_INT,
      {.i64 = 0}, 0, 1, 0 },
     {"skip_clear", "Skip clearing programs.", offsetof(MpegTSContext, skip_clear), AV_OPT_TYPE_INT,
@@ -1803,6 +1807,8 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
 
     if (h->tid != PMT_TID)
         return;
+    if (!ts->scan_all_pmts && ts->skip_changes)
+        return;
 
     if (!ts->skip_clear)
         clear_program(ts, h->id);
@@ -2194,7 +2200,7 @@ static int handle_packet(MpegTSContext *ts, const uint8_t *packet)
 
         // stop find_stream_info from waiting for more streams
         // when all programs have received a PMT
-        if (ts->stream->ctx_flags & AVFMTCTX_NOHEADER) {
+        if (ts->stream->ctx_flags & AVFMTCTX_NOHEADER && ts->scan_all_pmts <= 0) {
             int i;
             for (i = 0; i < ts->nb_prg; i++) {
                 if (!ts->prg[i].pmt_found)



More information about the ffmpeg-cvslog mailing list