aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mpegts.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-11-04 01:30:15 +0100
committerMichael Niedermayer <michaelni@gmx.at>2014-11-08 21:35:20 +0100
commit29b1af40f3a09fafd36bcefb4483353e1b5d82bd (patch)
treed32e9a3a9940b269befdfbab2586f626cefad180 /libavformat/mpegts.c
parent6f21fb793238ab6a790b94b86084148d99373ddf (diff)
downloadffmpeg-29b1af40f3a09fafd36bcefb4483353e1b5d82bd.tar.gz
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@gmx.at>
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r--libavformat/mpegts.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 78aa13e8a1..d8e75d9c09 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)