[FFmpeg-soc] [soc]: r5289 - in concat/libavformat: avplaylist.h concatgen.c playlist.c

gkovacs subversion at mplayerhq.hu
Wed Aug 26 07:58:26 CEST 2009


Author: gkovacs
Date: Wed Aug 26 07:58:26 2009
New Revision: 5289

Log:
include current duration in summed durations list

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

Modified: concat/libavformat/avplaylist.h
==============================================================================
--- concat/libavformat/avplaylist.h	Wed Aug 26 07:51:19 2009	(r5288)
+++ concat/libavformat/avplaylist.h	Wed Aug 26 07:58:26 2009	(r5289)
@@ -44,7 +44,7 @@ typedef struct AVPlaylistContext {
     AVFormatContext **formatcontext_list;  /**< List of AVFormatContext for each playlist item */
     int pelist_size;                       /**< Number of playlist elements stored in formatcontext_list */
     int pe_curidx;                         /**< Index of the AVFormatContext in formatcontext_list that packets are being read from */
-    int64_t *durations;                    /**< Sum of previous durations, in AV_TIME_BASE units, for each playlist item */
+    int64_t *durations;                    /**< Sum of current and previous durations, in AV_TIME_BASE units, for each playlist item */
     unsigned int *nb_streams_list;         /**< Sum of current and previous number of streams in each playlist item*/
     AVFormatContext *master_formatcontext; /**< Parent AVFormatContext of which priv_data is this playlist. NULL if playlist is used standalone. */
 } AVPlaylistContext;

Modified: concat/libavformat/concatgen.c
==============================================================================
--- concat/libavformat/concatgen.c	Wed Aug 26 07:51:19 2009	(r5288)
+++ concat/libavformat/concatgen.c	Wed Aug 26 07:58:26 2009	(r5289)
@@ -61,9 +61,11 @@ int ff_concatgen_read_packet(AVFormatCon
                 pkt->stream_index = stream_index + streams_offset;
                 if (!ic->streams[stream_index]->codec->has_b_frames ||
                     ic->streams[stream_index]->codec->codec->id == CODEC_ID_MPEG1VIDEO) {
-                    int64_t time_offset_localbase = av_rescale_q(ctx->durations[ctx->pe_curidx],
-                                                                 AV_TIME_BASE_Q,
-                                                                 ic->streams[stream_index]->time_base);
+                    int64_t time_offset_localbase = 0;
+                    if (ctx->pe_curidx > 0)
+                        time_offset_localbase = av_rescale_q(ctx->durations[ctx->pe_curidx - 1],
+                                                             AV_TIME_BASE_Q,
+                                                             ic->streams[stream_index]->time_base);
                     if (pkt->dts != AV_NOPTS_VALUE)
                         pkt->dts += time_offset_localbase;
                     if (pkt->pts != AV_NOPTS_VALUE)

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Wed Aug 26 07:51:19 2009	(r5288)
+++ concat/libavformat/playlist.c	Wed Aug 26 07:58:26 2009	(r5289)
@@ -86,7 +86,7 @@ int ff_playlist_populate_context(AVPlayl
         ctx->durations[pe_curidx] = ctx->durations[pe_curidx - 1] + ctx->formatcontext_list[pe_curidx]->duration;
         ctx->nb_streams_list[pe_curidx] = ctx->nb_streams_list[pe_curidx - 1] + ctx->formatcontext_list[pe_curidx]->nb_streams;
     } else {
-        ctx->durations[pe_curidx] = 0;
+        ctx->durations[pe_curidx] = ctx->formatcontext_list[pe_curidx]->duration;
         ctx->nb_streams_list[pe_curidx] = ctx->formatcontext_list[pe_curidx]->nb_streams;
     }
     return 0;


More information about the FFmpeg-soc mailing list