[FFmpeg-soc] [soc]: r5354 - concat/libavformat/avplaylist.c

gkovacs subversion at mplayerhq.hu
Sun Aug 30 00:44:43 CEST 2009


Author: gkovacs
Date: Sun Aug 30 00:44:42 2009
New Revision: 5354

Log:
subtract removed index's nb_streams and durations values from summed lists

Modified:
   concat/libavformat/avplaylist.c

Modified: concat/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Sun Aug 30 00:36:41 2009	(r5353)
+++ concat/libavformat/avplaylist.c	Sun Aug 30 00:44:42 2009	(r5354)
@@ -121,7 +121,7 @@ int av_playlist_insert_playlist(AVPlayli
 
 int av_playlist_remove_item(AVPlaylistContext *ctx, int pos)
 {
-    int i;
+    int i, cur_offset;
     int64_t *durations_tmp;
     unsigned int *nb_streams_list_tmp;
     AVFormatContext **formatcontext_list_tmp;
@@ -137,8 +137,12 @@ int av_playlist_remove_item(AVPlaylistCo
         return AVERROR_NOMEM;
     } else
         ctx->flist = flist_tmp;
+    if (pos > 0)
+        cur_offset = ctx->durations[pos] - ctx->durations[pos - 1];
+    else
+        cur_offset = ctx->durations[pos];
     for (i = pos; i < ctx->pelist_size; ++i)
-        ctx->durations[i] = ctx->durations[i + 1];
+        ctx->durations[i] = ctx->durations[i + 1] - cur_offset;
     durations_tmp = av_realloc(ctx->durations,
                                sizeof(*(ctx->durations)) * (ctx->pelist_size));
     if (!durations_tmp) {
@@ -146,8 +150,12 @@ int av_playlist_remove_item(AVPlaylistCo
         return AVERROR_NOMEM;
     } else
         ctx->durations = durations_tmp;
+    if (pos > 0)
+        cur_offset = ctx->nb_streams_list[pos] - ctx->nb_streams_list[pos - 1];
+    else
+        cur_offset = ctx->nb_streams_list[pos];
     for (i = pos; i < ctx->pelist_size; ++i)
-        ctx->nb_streams_list[i] = ctx->nb_streams_list[i + 1];
+        ctx->nb_streams_list[i] = ctx->nb_streams_list[i + 1] - cur_offset;
     nb_streams_list_tmp = av_realloc(ctx->nb_streams_list,
                                      sizeof(*(ctx->nb_streams_list)) * (ctx->pelist_size));
     if (!nb_streams_list_tmp) {


More information about the FFmpeg-soc mailing list