[FFmpeg-soc] [soc]: r5365 - in concat/libavformat: avplaylist.c concatgen.c

gkovacs subversion at mplayerhq.hu
Sun Aug 30 01:15:58 CEST 2009


Author: gkovacs
Date: Sun Aug 30 01:15:58 2009
New Revision: 5365

Log:
update durations for master formatcontext after inserting or removing playlist items

Modified:
   concat/libavformat/avplaylist.c
   concat/libavformat/concatgen.c

Modified: concat/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Sun Aug 30 01:09:53 2009	(r5364)
+++ concat/libavformat/avplaylist.c	Sun Aug 30 01:15:58 2009	(r5365)
@@ -110,6 +110,9 @@ int av_playlist_insert_item(AVPlaylistCo
         return AVERROR_NOMEM;
     }
     av_strlcpy(ctx->flist[pos], itempath, itempath_len + 1);
+    // duration is updated in case it's checked by a parent demuxer (chained concat demuxers)
+    if (ctx->master_formatcontext)
+        ctx->master_formatcontext->duration = ctx->durations[ctx->pelist_size - 1];
     return 0;
 }
 
@@ -191,6 +194,9 @@ int av_playlist_remove_item(AVPlaylistCo
         return AVERROR_NOMEM;
     } else
         ctx->formatcontext_list = formatcontext_list_tmp;
+    // duration is updated in case it's checked by a parent demuxer (chained concat demuxers)
+    if (ctx->master_formatcontext)
+        ctx->master_formatcontext->duration = ctx->durations[ctx->pelist_size - 1];
     return 0;
 }
 

Modified: concat/libavformat/concatgen.c
==============================================================================
--- concat/libavformat/concatgen.c	Sun Aug 30 01:09:53 2009	(r5364)
+++ concat/libavformat/concatgen.c	Sun Aug 30 01:15:58 2009	(r5365)
@@ -100,10 +100,6 @@ int ff_concatgen_read_packet(AVFormatCon
                 }
                 // have_switched_streams is set to avoid infinite loop
                 have_switched_streams = 1;
-                // duration is updated in case it's checked by a parent demuxer (chained concat demuxers)
-                s->duration = 0;
-                for (i = 0; i < ctx->pe_curidx; ++i)
-                    s->duration += ctx->durations[i];
                 continue;
             } else {
                 av_log(ic, AV_LOG_ERROR, "Packet read error %d\n", ret);


More information about the FFmpeg-soc mailing list