[FFmpeg-soc] [soc]: r4721 - in concat/libavformat: m3u.c playlist.c playlist.h pls.c xspf.c

gkovacs subversion at mplayerhq.hu
Thu Jul 16 02:33:14 CEST 2009


Author: gkovacs
Date: Thu Jul 16 02:33:14 2009
New Revision: 4721

Log:
replaced ff_playlist_add_stringlist with ff_playlist_add_path

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

Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c	Thu Jul 16 01:59:35 2009	(r4720)
+++ concat/libavformat/m3u.c	Thu Jul 16 02:33:14 2009	(r4721)
@@ -61,7 +61,7 @@ static int m3u_probe(AVProbeData *p)
 static int m3u_list_files(ByteIOContext *s, PlaylistContext *ctx, const char *filename)
 {
     char **flist;
-    int i, bufsize;
+    int i, k, bufsize;
     i = bufsize = flist = 0;
     while (1) {
         char *q;
@@ -82,7 +82,8 @@ static int m3u_list_files(ByteIOContext 
     }
     flist[i] = 0;
     ff_playlist_relative_paths(flist, i, dirname(filename));
-    ff_playlist_add_stringlist(ctx, flist, i);
+    for (k = 0; k < i; ++k)
+        ff_playlist_add_path(ctx, flist[k]);
     av_free(flist);
     return 0;
 }

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Thu Jul 16 01:59:35 2009	(r4720)
+++ concat/libavformat/playlist.c	Thu Jul 16 02:33:14 2009	(r4721)
@@ -64,7 +64,7 @@ PlaylistContext* ff_playlist_alloc_conte
 {
     int i;
     PlaylistContext *ctx = av_malloc(sizeof(*ctx));
-    ctx->pe_curidx = 0;
+    memset(ctx, 0, sizeof(*ctx));
     ctx->time_offsets_size = 2; // TODO don't assume we have just 2 streams
     ctx->time_offsets = av_malloc(sizeof(*(ctx->time_offsets)) * ctx->time_offsets_size);
     for (i = 0; i < ctx->time_offsets_size; ++i)
@@ -155,22 +155,18 @@ PlaylistContext *ff_playlist_from_encode
     }
     ctx = ff_playlist_alloc_context();
     ff_playlist_relative_paths(flist, len, workingdir);
-    ff_playlist_add_stringlist(ctx, flist, len);
+    for (i = 0; i < len; ++i)
+        ff_playlist_add_path(ctx, flist[i]);
     return ctx;
 }
 
-void ff_playlist_add_stringlist(PlaylistContext *ctx, char **flist, int len)
+void ff_playlist_add_path(PlaylistContext *ctx, char *itempath)
 {
-    int i;
-    ctx->pelist_size = len;
-    ctx->pelist = av_malloc(ctx->pelist_size * sizeof(*(ctx->pelist)));
-    memset(ctx->pelist, 0, ctx->pelist_size * sizeof(*(ctx->pelist)));
-    for (i = 0; i < ctx->pelist_size; ++i) {
-        ctx->pelist[i] = av_malloc(sizeof(*(ctx->pelist[i])));
-        memset(ctx->pelist[i], 0, sizeof(*(ctx->pelist[i])));
-        ctx->pelist[i]->filename = flist[i];
-    }
-    ctx->pe_curidx = 0;
+    ctx->pelist_size++;
+    ctx->pelist = av_realloc(ctx->pelist, ctx->pelist_size * sizeof(PlayElem*));
+    ctx->pelist[ctx->pelist_size-1] = av_malloc(sizeof(*(ctx->pelist[ctx->pelist_size-1])));
+    memset(ctx->pelist[ctx->pelist_size-1], 0, sizeof(*(ctx->pelist[ctx->pelist_size-1])));
+    ctx->pelist[ctx->pelist_size-1]->filename = itempath;
 }
 
 // converts list of mixed absolute and relative paths into all absolute paths

Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h	Thu Jul 16 01:59:35 2009	(r4720)
+++ concat/libavformat/playlist.h	Thu Jul 16 02:33:14 2009	(r4721)
@@ -123,12 +123,11 @@ void ff_playlist_split_encodedstring(cha
  */
 PlaylistContext *ff_playlist_from_encodedstring(char *s, char sep);
 
-/** @fn void ff_playlist_add_stringlist(PlaylistContext *ctx, char **flist, int len)
- *  @brief Adds PlayElem for each element in a string list to a PlaylistContext.
+/** @fn void ff_playlist_add_path(PlaylistContext *ctx, char *itempath)
+ *  @brief Adds PlayElem for item located at specified path to a PlaylistContext.
  *  @param ctx Pre-allocated PlaylistContext to add elements to.
- *  @param List of null-terminated strings with absolute paths to playlist elements.
- *  @param len Number of paths in flist.
+ *  @param Absolute path to item for which to add a playlist element.
  */
-void ff_playlist_add_stringlist(PlaylistContext *ctx, char **flist, int len);
+void ff_playlist_add_path(PlaylistContext *ctx, char *itempath);
 
 #endif /* AVFORMAT_PLAYLIST_H */

Modified: concat/libavformat/pls.c
==============================================================================
--- concat/libavformat/pls.c	Thu Jul 16 01:59:35 2009	(r4720)
+++ concat/libavformat/pls.c	Thu Jul 16 02:33:14 2009	(r4721)
@@ -60,7 +60,7 @@ static int pls_probe(AVProbeData *p)
 
 static int pls_list_files(ByteIOContext *b, PlaylistContext *ctx, const char *filename)
 {
-    int i, j, c;
+    int i, j, k, c;
     unsigned int buflen;
     char state;
     char **flist;
@@ -106,8 +106,10 @@ static int pls_list_files(ByteIOContext 
         return AVERROR_EOF;
     flist[j] = 0;
     ff_playlist_relative_paths(flist, j, dirname(filename));
-    ff_playlist_add_stringlist(ctx, flist, j);
+    for (k = 0; k < j; ++k)
+        ff_playlist_add_path(ctx, flist[k]);
     av_free(flist);
+    return 0;
 }
 
 static int pls_read_header(AVFormatContext *s,

Modified: concat/libavformat/xspf.c
==============================================================================
--- concat/libavformat/xspf.c	Thu Jul 16 01:59:35 2009	(r4720)
+++ concat/libavformat/xspf.c	Thu Jul 16 02:33:14 2009	(r4721)
@@ -63,7 +63,7 @@ static int xspf_probe(AVProbeData *p)
 
 static int xspf_list_files(ByteIOContext *b, PlaylistContext *ctx, const char *filename)
 {
-    int i, j, c;
+    int i, j, k, c;
     unsigned int buflen;
     char state;
     char **flist;
@@ -110,7 +110,8 @@ static int xspf_list_files(ByteIOContext
         return AVERROR_EOF;
     flist[j] = 0;
     ff_playlist_relative_paths(flist, j, dirname(filename));
-    ff_playlist_add_stringlist(ctx, flist, j);
+    for (k = 0; k < j; ++k)
+        ff_playlist_add_path(ctx, flist[k]);
     av_free(flist);
     return 0;
 }


More information about the FFmpeg-soc mailing list