[FFmpeg-soc] [soc]: r5352 - in concat/libavformat: concatgen.c m3u.c playlist.h pls.c utils.c.diff xspf.c

gkovacs subversion at mplayerhq.hu
Sun Aug 30 00:35:11 CEST 2009


Author: gkovacs
Date: Sun Aug 30 00:35:11 2009
New Revision: 5352

Log:
remove ff_playlist_populate_context

Modified:
   concat/libavformat/concatgen.c
   concat/libavformat/m3u.c
   concat/libavformat/playlist.h
   concat/libavformat/pls.c
   concat/libavformat/utils.c.diff
   concat/libavformat/xspf.c

Modified: concat/libavformat/concatgen.c
==============================================================================
--- concat/libavformat/concatgen.c	Sun Aug 30 00:24:36 2009	(r5351)
+++ concat/libavformat/concatgen.c	Sun Aug 30 00:35:11 2009	(r5352)
@@ -81,10 +81,11 @@ 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->pe_curidx++;
-                if (ff_playlist_populate_context(ctx, ctx->pe_curidx) < 0) {
-                    av_log(NULL, AV_LOG_ERROR, "Failed to switch to AVFormatContext %d\n", ctx->pe_curidx);
-                    break;
+                if (!ctx->formatcontext_list[++ctx->pe_curidx]) {
+                    if (!(ctx->formatcontext_list[ctx->pe_curidx] = ff_playlist_alloc_formatcontext(ctx->flist[ctx->pe_curidx]))) {
+                        av_log(NULL, AV_LOG_ERROR, "Failed to switch to AVFormatContext %d\n", ctx->pe_curidx);
+                        break;
+                    }
                 }
                 if ((ff_playlist_set_streams(ctx)) < 0) {
                     av_log(NULL, AV_LOG_ERROR, "Failed to open codecs for streams in %d\n", ctx->pe_curidx);
@@ -121,10 +122,11 @@ int ff_concatgen_read_seek(AVFormatConte
     ctx->pe_curidx = ff_playlist_stream_index_from_time(ctx,
                                                         pts_avtimebase,
                                                         &localpts_avtimebase);
-    err = ff_playlist_populate_context(ctx, ctx->pe_curidx);
-    if (err < 0) {
-        av_log(NULL, AV_LOG_ERROR, "Failed to switch to AVFormatContext %d\n", ctx->pe_curidx);
-        return err;
+    if (!ctx->formatcontext_list[ctx->pe_curidx]) {
+        if (!(ctx->formatcontext_list[ctx->pe_curidx] = ff_playlist_alloc_formatcontext(ctx->flist[ctx->pe_curidx]))) {
+            av_log(NULL, AV_LOG_ERROR, "Failed to switch to AVFormatContext %d\n", ctx->pe_curidx);
+            return AVERROR_NOFMT;
+        }
     }
     err = ff_playlist_set_streams(ctx);
     if (err < 0) {

Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c	Sun Aug 30 00:24:36 2009	(r5351)
+++ concat/libavformat/m3u.c	Sun Aug 30 00:35:11 2009	(r5352)
@@ -105,7 +105,10 @@ static int m3u_read_header(AVFormatConte
     av_free(flist);
     s->priv_data = ctx;
     ctx->master_formatcontext = s;
-    ff_playlist_populate_context(ctx, ctx->pe_curidx);
+    if (!ctx->formatcontext_list[ctx->pe_curidx]) {
+        if (!(ctx->formatcontext_list[ctx->pe_curidx] = ff_playlist_alloc_formatcontext(ctx->flist[ctx->pe_curidx])))
+            return AVERROR_NOFMT;
+    }
     ff_playlist_set_streams(ctx);
     return 0;
 }

Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h	Sun Aug 30 00:24:36 2009	(r5351)
+++ concat/libavformat/playlist.h	Sun Aug 30 00:35:11 2009	(r5352)
@@ -44,13 +44,6 @@ AVFormatContext *ff_playlist_alloc_forma
  */
 AVFormatContext *ff_playlist_alloc_concat_formatcontext(void);
 
-/** @brief Opens the playlist element with the specified index from the AVPlaylistContext.
- *  @param ctx AVPlaylistContext containing the desired playlist element.
- *  @param pe_curidx Index of the playlist element to be opened.
- *  @return Returns 0 upon success, or negative upon failure.
- */
-int ff_playlist_populate_context(AVPlaylistContext *ctx, int pe_curidx);
-
 /** @brief Sets the master concat-type demuxer's streams to those of its currently opened playlist element.
  *  Does nothing if using a standalone playlist (master_formatcontext is NULL).
  *  @param ctx AVPlaylistContext within which the list of playlist elements and durations are stored.

Modified: concat/libavformat/pls.c
==============================================================================
--- concat/libavformat/pls.c	Sun Aug 30 00:24:36 2009	(r5351)
+++ concat/libavformat/pls.c	Sun Aug 30 00:35:11 2009	(r5352)
@@ -124,7 +124,10 @@ static int pls_read_header(AVFormatConte
     av_free(flist);
     s->priv_data = ctx;
     ctx->master_formatcontext = s;
-    ff_playlist_populate_context(ctx, ctx->pe_curidx);
+    if (!ctx->formatcontext_list[ctx->pe_curidx]) {
+        if (!(ctx->formatcontext_list[ctx->pe_curidx] = ff_playlist_alloc_formatcontext(ctx->flist[ctx->pe_curidx])))
+            return AVERROR_NOFMT;
+    }
     ff_playlist_set_streams(ctx);
     return 0;
 }

Modified: concat/libavformat/utils.c.diff
==============================================================================
--- concat/libavformat/utils.c.diff	Sun Aug 30 00:24:36 2009	(r5351)
+++ concat/libavformat/utils.c.diff	Sun Aug 30 00:35:11 2009	(r5352)
@@ -1,5 +1,5 @@
 diff --git a/libavformat/utils.c b/libavformat/utils.c
-index 4cec286..1463428 100644
+index 4cec286..2d2549a 100644
 --- a/libavformat/utils.c
 +++ b/libavformat/utils.c
 @@ -27,6 +27,8 @@
@@ -21,7 +21,7 @@ index 4cec286..1463428 100644
      AVProbeData probe_data, *pd = &probe_data;
      ByteIOContext *pb = NULL;
  
-@@ -447,6 +450,27 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
+@@ -447,6 +450,30 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
          fmt = av_probe_input_format(pd, 0);
      }
  
@@ -38,7 +38,10 @@ index 4cec286..1463428 100644
 +                }
 +                av_free(flist);
 +                av_strlcpy(ic->filename, filename, sizeof(ic->filename));
-+                ff_playlist_populate_context(playlist_ctx, playlist_ctx->pe_curidx);
++                if (!playlist_ctx->formatcontext_list[playlist_ctx->pe_curidx]) {
++                    if (!(playlist_ctx->formatcontext_list[playlist_ctx->pe_curidx] = ff_playlist_alloc_formatcontext(playlist_ctx->flist[playlist_ctx->pe_curidx])))
++                        return AVERROR_NOFMT;
++                }
 +                ff_playlist_set_streams(playlist_ctx);
 +                *ic_ptr = ic;
 +                return 0;

Modified: concat/libavformat/xspf.c
==============================================================================
--- concat/libavformat/xspf.c	Sun Aug 30 00:24:36 2009	(r5351)
+++ concat/libavformat/xspf.c	Sun Aug 30 00:35:11 2009	(r5352)
@@ -147,7 +147,10 @@ static int xspf_read_header(AVFormatCont
     av_free(flist);
     s->priv_data = ctx;
     ctx->master_formatcontext = s;
-    ff_playlist_populate_context(ctx, ctx->pe_curidx);
+    if (!ctx->formatcontext_list[ctx->pe_curidx]) {
+        if (!(ctx->formatcontext_list[ctx->pe_curidx] = ff_playlist_alloc_formatcontext(ctx->flist[ctx->pe_curidx])))
+            return AVERROR_NOFMT;
+    }
     ff_playlist_set_streams(ctx);
     return 0;
 }


More information about the FFmpeg-soc mailing list