[FFmpeg-cvslog] mpegts: update AVProgram after pmt change

XBMC git at videolan.org
Tue Dec 25 20:38:55 CET 2012


ffmpeg | branch: master | XBMC <> | Sun Dec 16 09:53:18 2012 +0100| [4c41fc88df5c507e0f239b4c16f85573f7b49702] | committer: Michael Niedermayer

mpegts: update AVProgram after pmt change

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

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

 libavformat/mpegts.c |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index 5bd3c06..a6e07fa 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -182,10 +182,25 @@ typedef struct PESContext {
 
 extern AVInputFormat ff_mpegts_demuxer;
 
+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];
+            break;
+        }
+    if (!prg)
+        return;
+    prg->nb_stream_indexes = 0;
+}
+
 static void clear_program(MpegTSContext *ts, unsigned int programid)
 {
     int i;
 
+    clear_avprogram(ts, programid);
     for(i=0; i<ts->nb_prg; i++)
         if(ts->prg[i].id == programid)
             ts->prg[i].nb_pids = 0;
@@ -193,6 +208,9 @@ 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;
 }



More information about the ffmpeg-cvslog mailing list