[FFmpeg-soc] [soc]: r4961 - in concat: ffplay.c.diff libavformat/concatgen.c libavformat/playlist.c libavformat/playlist.h upstreamrev

gkovacs subversion at mplayerhq.hu
Thu Aug 6 20:00:38 CEST 2009


Author: gkovacs
Date: Thu Aug  6 20:00:38 2009
New Revision: 4961

Log:
full-stream seeking for playlists now working

Modified:
   concat/ffplay.c.diff
   concat/libavformat/concatgen.c
   concat/libavformat/playlist.c
   concat/libavformat/playlist.h
   concat/upstreamrev

Modified: concat/ffplay.c.diff
==============================================================================
--- concat/ffplay.c.diff	Thu Aug  6 10:59:57 2009	(r4960)
+++ concat/ffplay.c.diff	Thu Aug  6 20:00:38 2009	(r4961)
@@ -1,5 +1,5 @@
 diff --git a/ffplay.c b/ffplay.c
-index 4d7abb3..826f320 100644
+index c976ac5..a505760 100644
 --- a/ffplay.c
 +++ b/ffplay.c
 @@ -29,6 +29,8 @@

Modified: concat/libavformat/concatgen.c
==============================================================================
--- concat/libavformat/concatgen.c	Thu Aug  6 10:59:57 2009	(r4960)
+++ concat/libavformat/concatgen.c	Thu Aug  6 20:00:38 2009	(r4961)
@@ -62,7 +62,7 @@ int ff_concatgen_read_packet(AVFormatCon
             // -32 AVERROR_EOF for avi, -51 for ogg
                 av_log(ic, AV_LOG_DEBUG, "Switching stream %d to %d\n", stream_index, ctx->pe_curidx+1);
                 ctx->durations[ctx->pe_curidx] = ic->duration;
-                ctx->pe_curidx = ff_playlist_stream_index_from_time(ctx, ff_playlist_time_offset(ctx->durations, ctx->pe_curidx));
+                ctx->pe_curidx = ff_playlist_stream_index_from_time(ctx, ff_playlist_time_offset(ctx->durations, ctx->pe_curidx), NULL);
                 ff_playlist_populate_context(ctx, ctx->pe_curidx);
                 ff_playlist_set_streams(s);
                 // have_switched_streams is set to avoid infinite loop
@@ -86,11 +86,23 @@ int ff_concatgen_read_seek(AVFormatConte
                            int64_t pts,
                            int flags)
 {
+    int i;
+    int64_t localpts_avtimebase, localpts, pts_avtimebase;
     PlaylistContext *ctx;
     AVFormatContext *ic;
     ctx = s->priv_data;
     ic = ctx->icl[ctx->pe_curidx];
-    return ic->iformat->read_seek(ic, stream_index, pts, flags);
+    ctx->durations[ctx->pe_curidx] = ic->duration;
+    pts_avtimebase = av_rescale_q(pts, ic->streams[stream_index]->time_base, AV_TIME_BASE_Q);
+    ctx->pe_curidx = ff_playlist_stream_index_from_time(ctx, pts_avtimebase, &localpts_avtimebase);
+    ff_playlist_populate_context(ctx, ctx->pe_curidx);
+    ff_playlist_set_streams(s);
+    ic = ctx->icl[ctx->pe_curidx];
+    localpts = av_rescale_q(localpts_avtimebase, AV_TIME_BASE_Q, ic->streams[stream_index]->time_base);
+    s->duration = 0;
+    for (i = 0; i < ctx->pe_curidx; ++i)
+        s->duration += ctx->durations[i];
+    return ic->iformat->read_seek(ic, stream_index, localpts, flags);
 }
 
 int64_t ff_concatgen_read_timestamp(AVFormatContext *s,

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Thu Aug  6 10:59:57 2009	(r4960)
+++ concat/libavformat/playlist.c	Thu Aug  6 20:00:38 2009	(r4961)
@@ -164,7 +164,7 @@ int64_t ff_playlist_time_offset(int64_t 
     return total;
 }
 
-int ff_playlist_stream_index_from_time(PlaylistContext *ctx, int64_t pts)
+int ff_playlist_stream_index_from_time(PlaylistContext *ctx, int64_t pts, int64_t *localpts)
 {
     int i;
     int64_t total;
@@ -174,5 +174,7 @@ int ff_playlist_stream_index_from_time(P
             break;
         total += ctx->durations[i++];
     }
+    if (localpts)
+        *localpts = pts-(total-ctx->durations[i-1]);
     return i;
 }

Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h	Thu Aug  6 10:59:57 2009	(r4960)
+++ concat/libavformat/playlist.h	Thu Aug  6 20:00:38 2009	(r4961)
@@ -123,12 +123,13 @@ void ff_playlist_add_path(PlaylistContex
  */
 int64_t ff_playlist_time_offset(int64_t *durations, const int pe_curidx);
 
-/** @fn int64_t ff_playlist_time_offset(int64_t *durations, int pe_curidx)
+/** @fn int ff_playlist_stream_index_from_time(PlaylistContext *ctx, int64_t pts, int64_t *localpts)
  *  @brief Calculates the index of the playlist item which would contain the timestamp specified in AV_TIME_BASE units.
  *  @param ctx PlaylistContext within which the list of playlist elements and durations are stored.
  *  @param pts Timestamp in AV_TIME_BASE.
+ *  @param localpts Time in the local demuxer's timeframe in AV_TIME_BASE units; if null, not calculated.
  *  @return Returns the index of the stream which covers the specified time range.
  */
-int ff_playlist_stream_index_from_time(PlaylistContext *ctx, int64_t pts);
+int ff_playlist_stream_index_from_time(PlaylistContext *ctx, int64_t pts, int64_t *localpts);
 
 #endif /* AVFORMAT_PLAYLIST_H */

Modified: concat/upstreamrev
==============================================================================
--- concat/upstreamrev	Thu Aug  6 10:59:57 2009	(r4960)
+++ concat/upstreamrev	Thu Aug  6 20:00:38 2009	(r4961)
@@ -1,13 +1,13 @@
 ffmpeg:
-svn: 19556
-git: 286d8e676cb471e8ee678de1dd30a99cf42498f3
-committer: mru
-commitdate: Fri, 31 Jul 2009 07:40:35 +0000
-commitlog: RTMP needs tcp_protocol
+svn: 19597
+git: 2d6e5ef7bc1cd33d7d3b34e9dff5cfa490ffaaef
+committer: diego
+commitdate: Wed, 5 Aug 2009 15:27:22 +0000
+commitlog: Do not check for both CONFIG_H263_ENCODER and CONFIG_FLV_ENCODER. The latter can never be enabled without the former.
 
 libswscale:
-svn: 19556
-git: 2e681b9f903764844ffc514d9da9b96799a4b59f
-committer: ramiro
-commitdate: Tue, 28 Jul 2009 05:45:47 +0000
-commitlog: MMX2 scaler: Remove {} block leftover from factorization in initMMX2Scaler(). Merge variable declarations to previous {} block and indent.
+svn: 19597
+git: b1af9a271e6f587dbcd2b19dbceb4d2ec8eace7e
+committer: cehoyos
+commitdate: Sat, 1 Aug 2009 21:30:36 +0000
+commitlog: Fix regression when converting to nv12/nv21.


More information about the FFmpeg-soc mailing list