diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2013-02-04 23:41:53 +0100 |
---|---|---|
committer | Carl Eugen Hoyos <cehoyos@ag.or.at> | 2013-03-10 10:06:09 +0100 |
commit | d84c51904cad23ed76c38eec5080887dae7f5f27 (patch) | |
tree | 14e7ed93bd9ff081f779ec7d784fc853e60cf2fc | |
parent | 41313bdcc51159141a3c3737ea8d8cf05f506945 (diff) | |
download | ffmpeg-d84c51904cad23ed76c38eec5080887dae7f5f27.tar.gz |
mpegts: clear avprograms only for removed programs
Fixes Ticket2186
Requested-by: carl
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 806a66fd08a395486e763fb10588c5fd02e8d54e)
-rw-r--r-- | libavformat/mpegts.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c index a6e07fae9c..a6dff475e1 100644 --- a/libavformat/mpegts.c +++ b/libavformat/mpegts.c @@ -208,9 +208,6 @@ static void clear_program(MpegTSContext *ts, unsigned int programid) static void clear_programs(MpegTSContext *ts) { - int i; - for(i=0; i<ts->nb_prg; i++) - clear_avprogram(ts, ts->prg[i].id); av_freep(&ts->prg); ts->nb_prg=0; } @@ -1634,6 +1631,17 @@ static void pat_cb(MpegTSFilter *filter, const uint8_t *section, int section_len add_pid_to_pmt(ts, sid, pmt_pid); } } + + if (sid < 0) { + int i,j; + for (j=0; j<ts->stream->nb_programs; j++) { + for (i=0; i<ts->nb_prg; i++) + if (ts->prg[i].id == ts->stream->programs[j]->id) + break; + if (i==ts->nb_prg) + clear_avprogram(ts, ts->stream->programs[j]->id); + } + } } static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len) |