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

gkovacs subversion at mplayerhq.hu
Wed Aug 26 03:34:29 CEST 2009


Author: gkovacs
Date: Wed Aug 26 03:34:29 2009
New Revision: 5281

Log:
pass AVPlaylistContext to set_streams rather than AVFormatContext since master_formatcontext points to it

Modified:
   concat/libavformat/concatgen.c
   concat/libavformat/m3u.c
   concat/libavformat/playlist.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	Wed Aug 26 03:28:06 2009	(r5280)
+++ concat/libavformat/concatgen.c	Wed Aug 26 03:34:29 2009	(r5281)
@@ -85,7 +85,7 @@ int ff_concatgen_read_packet(AVFormatCon
                     av_log(NULL, AV_LOG_ERROR, "Failed to switch to AVFormatContext %d\n", ctx->pe_curidx);
                     break;
                 }
-                if (ctx->master_formatcontext == s && (ff_playlist_set_streams(s)) < 0) {
+                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);
                     break;
                 }
@@ -125,8 +125,7 @@ int ff_concatgen_read_seek(AVFormatConte
         av_log(NULL, AV_LOG_ERROR, "Failed to switch to AVFormatContext %d\n", ctx->pe_curidx);
         return err;
     }
-    if (ctx->master_formatcontext == s)
-        err = ff_playlist_set_streams(s);
+    err = ff_playlist_set_streams(ctx);
     if (err < 0) {
         av_log(NULL, AV_LOG_ERROR, "Failed to open codecs for streams in %d\n", ctx->pe_curidx);
         return err;

Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c	Wed Aug 26 03:28:06 2009	(r5280)
+++ concat/libavformat/m3u.c	Wed Aug 26 03:34:29 2009	(r5281)
@@ -103,7 +103,7 @@ static int m3u_read_header(AVFormatConte
     s->priv_data = ctx;
     ctx->master_formatcontext = s;
     ff_playlist_populate_context(ctx, ctx->pe_curidx);
-    ff_playlist_set_streams(s);
+    ff_playlist_set_streams(ctx);
     return 0;
 }
 

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Wed Aug 26 03:28:06 2009	(r5280)
+++ concat/libavformat/playlist.c	Wed Aug 26 03:34:29 2009	(r5281)
@@ -75,11 +75,13 @@ int ff_playlist_populate_context(AVPlayl
     return 0;
 }
 
-int ff_playlist_set_streams(AVFormatContext *s)
+int ff_playlist_set_streams(AVPlaylistContext *ctx)
 {
     int i;
-    AVPlaylistContext *ctx = s->priv_data;
-    AVFormatContext *ic = ctx->formatcontext_list[ctx->pe_curidx];
+    AVFormatContext *s, *ic;
+    if (!(s = ctx->master_formatcontext))
+        return 0;
+    ic = ctx->formatcontext_list[ctx->pe_curidx];
     int offset = av_playlist_streams_offset_from_playidx(ctx, ctx->pe_curidx);
     ic->iformat->read_header(ic, NULL);
     for (i = 0; i < ic->nb_streams; ++i) {

Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h	Wed Aug 26 03:28:06 2009	(r5280)
+++ concat/libavformat/playlist.h	Wed Aug 26 03:34:29 2009	(r5281)
@@ -47,10 +47,11 @@ AVFormatContext *ff_playlist_alloc_forma
 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.
- *  @param s AVFormatContext of the concat-type demuxer, which contains the AVPlaylistContext and substreams.
+ *  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.
  *  @return Returns 0 upon success, or negative upon failure.
  */
-int ff_playlist_set_streams(AVFormatContext *s);
+int ff_playlist_set_streams(AVPlaylistContext *ctx);
 
 #endif /* AVFORMAT_PLAYLIST_H */
 

Modified: concat/libavformat/pls.c
==============================================================================
--- concat/libavformat/pls.c	Wed Aug 26 03:28:06 2009	(r5280)
+++ concat/libavformat/pls.c	Wed Aug 26 03:34:29 2009	(r5281)
@@ -122,7 +122,7 @@ static int pls_read_header(AVFormatConte
     s->priv_data = ctx;
     ctx->master_formatcontext = s;
     ff_playlist_populate_context(ctx, ctx->pe_curidx);
-    ff_playlist_set_streams(s);
+    ff_playlist_set_streams(ctx);
     return 0;
 }
 

Modified: concat/libavformat/utils.c.diff
==============================================================================
--- concat/libavformat/utils.c.diff	Wed Aug 26 03:28:06 2009	(r5280)
+++ concat/libavformat/utils.c.diff	Wed Aug 26 03:34:29 2009	(r5281)
@@ -1,5 +1,5 @@
 diff --git a/libavformat/utils.c b/libavformat/utils.c
-index 4cec286..ceae77d 100644
+index 4cec286..71475e5 100644
 --- a/libavformat/utils.c
 +++ b/libavformat/utils.c
 @@ -27,6 +27,8 @@
@@ -35,7 +35,7 @@ index 4cec286..ceae77d 100644
 +                av_playlist_add_filelist(playlist_ctx, flist, flist_len);
 +                av_strlcpy(ic->filename, filename, sizeof(ic->filename));
 +                ff_playlist_populate_context(playlist_ctx, playlist_ctx->pe_curidx);
-+                ff_playlist_set_streams(ic);
++                ff_playlist_set_streams(playlist_ctx);
 +                *ic_ptr = ic;
 +                return 0;
 +            }

Modified: concat/libavformat/xspf.c
==============================================================================
--- concat/libavformat/xspf.c	Wed Aug 26 03:28:06 2009	(r5280)
+++ concat/libavformat/xspf.c	Wed Aug 26 03:34:29 2009	(r5281)
@@ -145,7 +145,7 @@ static int xspf_read_header(AVFormatCont
     s->priv_data = ctx;
     ctx->master_formatcontext = s;
     ff_playlist_populate_context(ctx, ctx->pe_curidx);
-    ff_playlist_set_streams(s);
+    ff_playlist_set_streams(ctx);
     return 0;
 }
 


More information about the FFmpeg-soc mailing list