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

gkovacs subversion at mplayerhq.hu
Thu Jul 16 01:39:03 CEST 2009


Author: gkovacs
Date: Thu Jul 16 01:39:02 2009
New Revision: 4719

Log:
made ff_playlist_relative_paths check list length

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:30:37 2009	(r4718)
+++ concat/libavformat/m3u.c	Thu Jul 16 01:39:02 2009	(r4719)
@@ -39,8 +39,6 @@ static int ff_concatgen_read_play(AVForm
 
 static int ff_concatgen_read_pause(AVFormatContext *s);
 
-static void ff_playlist_relative_paths(char **flist, const char *workingdir);
-
 /* The ffmpeg codecs we support, and the IDs they have in the file */
 static const AVCodecTag codec_m3u_tags[] = {
     { 0, 0 },
@@ -83,7 +81,7 @@ static int m3u_list_files(ByteIOContext 
         flist[i++][q-linebuf] = 0;
     }
     flist[i] = 0;
-    ff_playlist_relative_paths(flist, dirname(filename));
+    ff_playlist_relative_paths(flist, i, dirname(filename));
     ff_playlist_add_stringlist(ctx, flist, i);
     av_free(flist);
     return 0;

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Thu Jul 16 01:30:37 2009	(r4718)
+++ concat/libavformat/playlist.c	Thu Jul 16 01:39:02 2009	(r4719)
@@ -154,7 +154,7 @@ PlaylistContext *ff_playlist_from_encode
         return NULL;
     }
     ctx = ff_playlist_alloc_context();
-    ff_playlist_relative_paths(flist, workingdir);
+    ff_playlist_relative_paths(flist, len, workingdir);
     ff_playlist_add_stringlist(ctx, flist, len);
     return ctx;
 }
@@ -174,22 +174,22 @@ void ff_playlist_add_stringlist(Playlist
 }
 
 // converts list of mixed absolute and relative paths into all absolute paths
-void ff_playlist_relative_paths(char **flist, const char *workingdir)
+void ff_playlist_relative_paths(char **flist, int len, const char *workingdir)
 {
-    while (*flist != 0) { // determine if relative paths
+    int i;
+    for (i = 0; i < len; ++i) { // determine if relative paths
         FILE *file;
         char *fullfpath;
         int wdslen = strlen(workingdir);
-        int flslen = strlen(*flist);
+        int flslen = strlen(flist[i]);
         fullfpath = av_malloc(sizeof(char) * (wdslen+flslen+2));
         av_strlcpy(fullfpath, workingdir, wdslen+1);
         fullfpath[wdslen] = '/';
         fullfpath[wdslen+1] = 0;
-        av_strlcat(fullfpath, *flist, wdslen+flslen+2);
+        av_strlcat(fullfpath, flist[i], wdslen+flslen+2);
         if ((file = fopen(fullfpath, "r"))) {
             fclose(file);
-            *flist = fullfpath;
+            flist[i] = fullfpath;
         }
-        ++flist;
     }
 }

Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h	Thu Jul 16 01:30:37 2009	(r4718)
+++ concat/libavformat/playlist.h	Thu Jul 16 01:39:02 2009	(r4719)
@@ -98,6 +98,8 @@ void ff_playlist_set_context(AVFormatCon
  */
 AVStream *ff_playlist_get_stream(PlaylistContext *ctx, int pe_idx, int stream_index);
 
+void ff_playlist_relative_paths(char **flist, int len, const char *workingdir);
+
 void ff_playlist_split_encodedstring(char *s, char sep, char ***flist_ptr, int *len_ptr);
 
 PlaylistContext *ff_playlist_from_encodedstring(char *s, char sep);

Modified: concat/libavformat/pls.c
==============================================================================
--- concat/libavformat/pls.c	Thu Jul 16 01:30:37 2009	(r4718)
+++ concat/libavformat/pls.c	Thu Jul 16 01:39:02 2009	(r4719)
@@ -39,8 +39,6 @@ static int ff_concatgen_read_play(AVForm
 
 static int ff_concatgen_read_pause(AVFormatContext *s);
 
-static void ff_playlist_relative_paths(char **flist, const char *workingdir);
-
 /* The ffmpeg codecs we support, and the IDs they have in the file */
 static const AVCodecTag codec_pls_tags[] = {
     { 0, 0 },
@@ -107,7 +105,7 @@ static int pls_list_files(ByteIOContext 
     if (!flist) // no files have been found
         return AVERROR_EOF;
     flist[j] = 0;
-    ff_playlist_relative_paths(flist, dirname(filename));
+    ff_playlist_relative_paths(flist, j, dirname(filename));
     ff_playlist_add_stringlist(ctx, flist, j);
     av_free(flist);
 }

Modified: concat/libavformat/xspf.c
==============================================================================
--- concat/libavformat/xspf.c	Thu Jul 16 01:30:37 2009	(r4718)
+++ concat/libavformat/xspf.c	Thu Jul 16 01:39:02 2009	(r4719)
@@ -42,8 +42,6 @@ static int ff_concatgen_read_play(AVForm
 
 static int ff_concatgen_read_pause(AVFormatContext *s);
 
-static void ff_playlist_relative_paths(char **flist, const char *workingdir);
-
 /* The ffmpeg codecs we support, and the IDs they have in the file */
 static const AVCodecTag codec_xspf_tags[] = {
     { 0, 0 },
@@ -111,7 +109,7 @@ static int xspf_list_files(ByteIOContext
     if (!flist) // no files have been found
         return AVERROR_EOF;
     flist[j] = 0;
-    ff_playlist_relative_paths(flist, dirname(filename));
+    ff_playlist_relative_paths(flist, j, dirname(filename));
     ff_playlist_add_stringlist(ctx, flist, j);
     av_free(flist);
     return 0;


More information about the FFmpeg-soc mailing list