[FFmpeg-soc] [soc]: r5292 - in concat/libavformat: avplaylist.c avplaylist.h m3u.c pls.c utils.c.diff xspf.c

gkovacs subversion at mplayerhq.hu
Wed Aug 26 08:10:37 CEST 2009


Author: gkovacs
Date: Wed Aug 26 08:10:37 2009
New Revision: 5292

Log:
remove trivial convenience function playlist_add_filelist

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

Modified: concat/libavformat/avplaylist.c
==============================================================================
--- concat/libavformat/avplaylist.c	Wed Aug 26 08:04:23 2009	(r5291)
+++ concat/libavformat/avplaylist.c	Wed Aug 26 08:10:37 2009	(r5292)
@@ -88,17 +88,6 @@ int av_playlist_split_encodedstring(cons
     av_free(sepidx);
 }
 
-int av_playlist_add_filelist(AVPlaylistContext *ctx, const char **flist, int len)
-{
-    int i, err;
-    for (i = 0; i < len; ++i) {
-        err = av_playlist_add_path(ctx, flist[i]);
-        if (err)
-            return err;
-    }
-    return 0;
-}
-
 int av_playlist_add_path(AVPlaylistContext *ctx, const char *itempath)
 {
     int64_t *durations_tmp;

Modified: concat/libavformat/avplaylist.h
==============================================================================
--- concat/libavformat/avplaylist.h	Wed Aug 26 08:04:23 2009	(r5291)
+++ concat/libavformat/avplaylist.h	Wed Aug 26 08:10:37 2009	(r5292)
@@ -70,14 +70,6 @@ int av_playlist_split_encodedstring(cons
                                     char ***flist_ptr,
                                     int *len_ptr);
 
-/** @brief Adds playlist elements specified by a file list to a AVPlaylistContext.
- *  @param ctx Pre-allocated AVPlaylistContext to add elements to.
- *  @param flist List of filenames from which to construct the playlist.
- *  @param len Length of filename list.
- *  @return Returns 0 upon success, or negative upon failure.
- */
-int av_playlist_add_filelist(AVPlaylistContext *ctx, const char **flist, int len);
-
 /** @brief Creates and adds AVFormatContext for item located at specified path to a AVPlaylistContext.
  *  @param ctx Pre-allocated AVPlaylistContext to add elements to.
  *  @param itempath Absolute path to item for which to add a playlist element.

Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c	Wed Aug 26 08:04:23 2009	(r5291)
+++ concat/libavformat/m3u.c	Wed Aug 26 08:10:37 2009	(r5292)
@@ -86,7 +86,7 @@ static int m3u_read_header(AVFormatConte
 {
     AVPlaylistContext *ctx;
     char **flist;
-    int flist_len;
+    int flist_len, i;
     m3u_list_files(s->pb, &flist, &flist_len);
     if (!flist || flist_len <= 0) {
         fprintf(stderr, "no playlist items found in %s\n", s->filename);
@@ -98,7 +98,8 @@ static int m3u_read_header(AVFormatConte
         av_log(NULL, AV_LOG_ERROR, "failed to allocate AVPlaylistContext in m3u_read_header\n");
         return AVERROR_NOMEM;
     }
-    av_playlist_add_filelist(ctx, flist, flist_len);
+    for (i = 0; i < flist_len; ++i)
+        av_playlist_add_path(ctx, flist[i]);
     av_free(flist);
     s->priv_data = ctx;
     ctx->master_formatcontext = s;

Modified: concat/libavformat/pls.c
==============================================================================
--- concat/libavformat/pls.c	Wed Aug 26 08:04:23 2009	(r5291)
+++ concat/libavformat/pls.c	Wed Aug 26 08:10:37 2009	(r5292)
@@ -105,7 +105,7 @@ static int pls_read_header(AVFormatConte
 {
     AVPlaylistContext *ctx;
     char **flist;
-    int flist_len;
+    int flist_len, i;
     pls_list_files(s->pb, &flist, &flist_len);
     if (!flist || flist_len <= 0) {
         fprintf(stderr, "no playlist items found in %s\n", s->filename);
@@ -117,7 +117,8 @@ static int pls_read_header(AVFormatConte
         av_log(NULL, AV_LOG_ERROR, "failed to allocate AVPlaylistContext in pls_read_header\n");
         return AVERROR_NOMEM;
     }
-    av_playlist_add_filelist(ctx, flist, flist_len);
+    for (i = 0; i < flist_len; ++i)
+        av_playlist_add_path(ctx, flist[i]);
     av_free(flist);
     s->priv_data = ctx;
     ctx->master_formatcontext = s;

Modified: concat/libavformat/utils.c.diff
==============================================================================
--- concat/libavformat/utils.c.diff	Wed Aug 26 08:04:23 2009	(r5291)
+++ concat/libavformat/utils.c.diff	Wed Aug 26 08:10:37 2009	(r5292)
@@ -1,5 +1,5 @@
 diff --git a/libavformat/utils.c b/libavformat/utils.c
-index 4cec286..76cd878 100644
+index 4cec286..97c17f0 100644
 --- a/libavformat/utils.c
 +++ b/libavformat/utils.c
 @@ -27,6 +27,8 @@
@@ -16,12 +16,12 @@ index 4cec286..76cd878 100644
                         AVFormatParameters *ap)
  {
 -    int err, probe_size;
-+    int err, probe_size, flist_len;
++    int err, probe_size, flist_len, i;
 +    char **flist;
      AVProbeData probe_data, *pd = &probe_data;
      ByteIOContext *pb = NULL;
  
-@@ -447,6 +450,23 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
+@@ -447,6 +450,24 @@ int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,
          fmt = av_probe_input_format(pd, 0);
      }
  
@@ -32,7 +32,8 @@ index 4cec286..76cd878 100644
 +            AVPlaylistContext *playlist_ctx = ic->priv_data;
 +            if (playlist_ctx) {
 +                av_log(ic, AV_LOG_DEBUG, "Generating playlist from %s\n", filename);
-+                av_playlist_add_filelist(playlist_ctx, flist, flist_len);
++                for (i = 0; i < flist_len; ++i)
++                    av_playlist_add_path(playlist_ctx, flist[i]);
 +                av_strlcpy(ic->filename, filename, sizeof(ic->filename));
 +                ff_playlist_populate_context(playlist_ctx, playlist_ctx->pe_curidx);
 +                ff_playlist_set_streams(playlist_ctx);

Modified: concat/libavformat/xspf.c
==============================================================================
--- concat/libavformat/xspf.c	Wed Aug 26 08:04:23 2009	(r5291)
+++ concat/libavformat/xspf.c	Wed Aug 26 08:10:37 2009	(r5292)
@@ -128,7 +128,7 @@ static int xspf_read_header(AVFormatCont
 {
     AVPlaylistContext *ctx;
     char **flist;
-    int flist_len;
+    int flist_len, i;
     xspf_list_files(s->pb, &flist, &flist_len);
     if (!flist || flist_len <= 0) {
         fprintf(stderr, "no playlist items found in %s\n", s->filename);
@@ -140,7 +140,8 @@ static int xspf_read_header(AVFormatCont
         av_log(NULL, AV_LOG_ERROR, "failed to allocate AVPlaylistContext in xspf_read_header\n");
         return AVERROR_NOMEM;
     }
-    av_playlist_add_filelist(ctx, flist, flist_len);
+    for (i = 0; i < flist_len; ++i)
+        av_playlist_add_path(ctx, flist[i]);
     av_free(flist);
     s->priv_data = ctx;
     ctx->master_formatcontext = s;


More information about the FFmpeg-soc mailing list