[FFmpeg-soc] [soc]: r5280 - in concat/libavformat: avplaylist.c avplaylist.h concatgen.c m3u.c pls.c xspf.c

gkovacs subversion at mplayerhq.hu
Wed Aug 26 03:28:06 CEST 2009


Author: gkovacs
Date: Wed Aug 26 03:28:06 2009
New Revision: 5280

Log:
introduce master_avformatcontext attribute to indicate whether playlist is standalone or contained within demuxer

Modified:
   concat/libavformat/avplaylist.c
   concat/libavformat/avplaylist.h
   concat/libavformat/concatgen.c
   concat/libavformat/m3u.c
   concat/libavformat/pls.c
   concat/libavformat/xspf.c

Modified: concat/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Wed Aug 26 03:12:58 2009	(r5279)
+++ concat/libavformat/avplaylist.c	Wed Aug 26 03:28:06 2009	(r5280)
@@ -57,6 +57,7 @@ AVFormatContext *av_playlist_alloc_conca
     ic = avformat_alloc_context();
     ic->iformat = ff_concat_alloc_demuxer();
     ic->priv_data = ctx;
+    ctx->master_formatcontext = ic;
     return ic;
 }
 

Modified: concat/libavformat/avplaylist.h
==============================================================================
--- concat/libavformat/avplaylist.h	Wed Aug 26 03:12:58 2009	(r5279)
+++ concat/libavformat/avplaylist.h	Wed Aug 26 03:28:06 2009	(r5280)
@@ -46,6 +46,7 @@ typedef struct AVPlaylistContext {
     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 */
     int *nb_streams_list;                 /**< List of the 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;
 
 /** @brief Allocates a new AVFormatContext for a concat-type demuxer.

Modified: concat/libavformat/concatgen.c
==============================================================================
--- concat/libavformat/concatgen.c	Wed Aug 26 03:12:58 2009	(r5279)
+++ concat/libavformat/concatgen.c	Wed Aug 26 03:28:06 2009	(r5280)
@@ -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 ((ff_playlist_set_streams(s)) < 0) {
+                if (ctx->master_formatcontext == s && (ff_playlist_set_streams(s)) < 0) {
                     av_log(NULL, AV_LOG_ERROR, "Failed to open codecs for streams in %d\n", ctx->pe_curidx);
                     break;
                 }
@@ -125,7 +125,8 @@ int ff_concatgen_read_seek(AVFormatConte
         av_log(NULL, AV_LOG_ERROR, "Failed to switch to AVFormatContext %d\n", ctx->pe_curidx);
         return err;
     }
-    err = ff_playlist_set_streams(s);
+    if (ctx->master_formatcontext == s)
+        err = ff_playlist_set_streams(s);
     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:12:58 2009	(r5279)
+++ concat/libavformat/m3u.c	Wed Aug 26 03:28:06 2009	(r5280)
@@ -101,6 +101,7 @@ static int m3u_read_header(AVFormatConte
     av_playlist_add_filelist(ctx, flist, flist_len);
     av_free(flist);
     s->priv_data = ctx;
+    ctx->master_formatcontext = s;
     ff_playlist_populate_context(ctx, ctx->pe_curidx);
     ff_playlist_set_streams(s);
     return 0;

Modified: concat/libavformat/pls.c
==============================================================================
--- concat/libavformat/pls.c	Wed Aug 26 03:12:58 2009	(r5279)
+++ concat/libavformat/pls.c	Wed Aug 26 03:28:06 2009	(r5280)
@@ -120,6 +120,7 @@ static int pls_read_header(AVFormatConte
     av_playlist_add_filelist(ctx, flist, flist_len);
     av_free(flist);
     s->priv_data = ctx;
+    ctx->master_formatcontext = s;
     ff_playlist_populate_context(ctx, ctx->pe_curidx);
     ff_playlist_set_streams(s);
     return 0;

Modified: concat/libavformat/xspf.c
==============================================================================
--- concat/libavformat/xspf.c	Wed Aug 26 03:12:58 2009	(r5279)
+++ concat/libavformat/xspf.c	Wed Aug 26 03:28:06 2009	(r5280)
@@ -143,6 +143,7 @@ static int xspf_read_header(AVFormatCont
     av_playlist_add_filelist(ctx, flist, flist_len);
     av_free(flist);
     s->priv_data = ctx;
+    ctx->master_formatcontext = s;
     ff_playlist_populate_context(ctx, ctx->pe_curidx);
     ff_playlist_set_streams(s);
     return 0;


More information about the FFmpeg-soc mailing list