[FFmpeg-soc] [soc]: r5270 - in concat/libavformat: avplaylist.c avplaylist.h utils.c.diff

gkovacs subversion at mplayerhq.hu
Tue Aug 25 10:32:01 CEST 2009


Author: gkovacs
Date: Tue Aug 25 10:32:01 2009
New Revision: 5270

Log:
separate playlist element addition from demuxer allocation

Modified:
   concat/libavformat/avplaylist.c
   concat/libavformat/avplaylist.h
   concat/libavformat/utils.c.diff

Modified: concat/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Tue Aug 25 10:23:19 2009	(r5269)
+++ concat/libavformat/avplaylist.c	Tue Aug 25 10:32:01 2009	(r5270)
@@ -124,15 +124,14 @@ AVPlaylistContext *av_playlist_get_conte
         return NULL;
 }
 
-AVFormatContext *av_playlist_formatcontext_from_filelist(const char **flist, int len)
+AVFormatContext *av_playlist_alloc_concat_formatcontext(void)
 {
     AVFormatContext *ic;
     AVPlaylistContext *ctx = av_mallocz(sizeof(*ctx));
     if (!ctx) {
-        av_log(NULL, AV_LOG_ERROR, "failed to allocate AVPlaylistContext in av_playlist_formatcontext_from_filelist\n");
+        av_log(NULL, AV_LOG_ERROR, "failed to allocate AVPlaylistContext in av_playlist_alloc_playlist_formatcontext\n");
         return NULL;
     }
-    av_playlist_add_filelist(ctx, flist, len);
     ic = avformat_alloc_context();
     ic->iformat = ff_concat_alloc_demuxer();
     ic->priv_data = ctx;

Modified: concat/libavformat/avplaylist.h
==============================================================================
--- concat/libavformat/avplaylist.h	Tue Aug 25 10:23:19 2009	(r5269)
+++ concat/libavformat/avplaylist.h	Tue Aug 25 10:32:01 2009	(r5270)
@@ -67,12 +67,10 @@ int av_playlist_populate_context(AVPlayl
  */
 int av_playlist_set_streams(AVFormatContext *s);
 
-/** @brief Allocates and populates a new AVFormatContext for a concat-type demuxer.
- *  @param flist List of filenames from which to construct the playlist.
- *  @param len Length of filename list.
+/** @brief Allocates a new AVFormatContext for a concat-type demuxer.
  *  @return Returns NULL if failed, or AVFormatContext if succeeded.
  */
-AVFormatContext *av_playlist_formatcontext_from_filelist(const char **flist, int len);
+AVFormatContext *av_playlist_alloc_concat_formatcontext(void);
 
 /** @brief Returns AVPlaylistContext continaed within a concat-type demuxer.
  *  @param ic AVFormatContext of the concat-type demuxer, which contains the AVPlaylistContext.

Modified: concat/libavformat/utils.c.diff
==============================================================================
--- concat/libavformat/utils.c.diff	Tue Aug 25 10:23:19 2009	(r5269)
+++ concat/libavformat/utils.c.diff	Tue Aug 25 10:32:01 2009	(r5270)
@@ -1,5 +1,5 @@
 diff --git a/libavformat/utils.c b/libavformat/utils.c
-index 4cec286..252e9d3 100644
+index 4cec286..2a13b4c 100644
 --- a/libavformat/utils.c
 +++ b/libavformat/utils.c
 @@ -27,6 +27,7 @@
@@ -20,17 +20,18 @@ index 4cec286..252e9d3 100644
      AVProbeData probe_data, *pd = &probe_data;
      ByteIOContext *pb = NULL;
  
-@@ -447,6 +449,22 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
+@@ -447,6 +449,23 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
          fmt = av_probe_input_format(pd, 0);
      }
  
 +    av_playlist_split_encodedstring(filename, ',', &flist, &flist_len);
 +    if (flist && flist_len > 1) {
-+        AVFormatContext *ic = av_playlist_formatcontext_from_filelist(flist, flist_len);
++        AVFormatContext *ic = av_playlist_alloc_concat_formatcontext();
 +        if (ic) {
 +            AVPlaylistContext *playlist_ctx = av_playlist_get_context(ic);
 +            if (playlist_ctx) {
 +                av_log(ic, AV_LOG_DEBUG, "Generating playlist from %s\n", filename);
++                av_playlist_add_filelist(playlist_ctx, flist, flist_len);
 +                av_strlcpy(ic->filename, filename, sizeof(ic->filename));
 +                av_playlist_populate_context(playlist_ctx, playlist_ctx->pe_curidx);
 +                av_playlist_set_streams(ic);


More information about the FFmpeg-soc mailing list