diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-07-11 16:42:52 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-07-11 16:43:27 +0200 |
commit | c6c172d1738b187fda1ad80cec357910be01ff58 (patch) | |
tree | 56359a8219a630b72cc2b3c4e1d30de285669329 /libavformat/mpegts.c | |
parent | c9d64abedfc2f69968d48da89aea9e1184a128d5 (diff) | |
download | ffmpeg-c6c172d1738b187fda1ad80cec357910be01ff58.tar.gz |
avformat/mpegts: skip updating programs/streams when determining duration
Fixes Ticket2441
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r-- | libavformat/mpegts.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index d03fe2f126..e814ab49a0 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -137,6 +137,8 @@ struct MpegTSContext { /** to detect seek */ int64_t last_pos; + int skip_changes; + /******************************************/ /* private mpegts data */ /* scan context */ @@ -173,6 +175,8 @@ static const AVOption mpegts_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 }, + {"skip_changes", "Skip changing / adding streams / programs.", offsetof(MpegTSContext, skip_changes), AV_OPT_TYPE_INT, + {.i64 = 0}, 0, 1, 0 }, { NULL }, }; @@ -237,6 +241,7 @@ static void clear_avprogram(MpegTSContext *ts, unsigned int programid) { AVProgram *prg = NULL; int i; + for (i = 0; i < ts->stream->nb_programs; i++) if (ts->stream->programs[i]->id == programid) { prg = ts->stream->programs[i]; @@ -952,6 +957,9 @@ static int mpegts_push_data(MpegTSFilter *filter, /* stream not present in PMT */ if (!pes->st) { + if (ts->skip_changes) + goto skip; + pes->st = avformat_new_stream(ts->stream, NULL); if (!pes->st) return AVERROR(ENOMEM); @@ -1721,6 +1729,8 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len if (h->tid != PMT_TID) return; + if (ts->skip_changes) + return; clear_program(ts, h->id); pcr_pid = get16(&p, p_end); @@ -1874,6 +1884,8 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len return; if (h->tid != PAT_TID) return; + if (ts->skip_changes) + return; ts->stream->ts_id = h->id; @@ -1942,6 +1954,8 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len return; if (h->tid != SDT_TID) return; + if (ts->skip_changes) + return; onid = get16(&p, p_end); if (onid < 0) return; |