On 07/15/2009 04:39 PM, gkovacs wrote:
Author: gkovacs Date: Thu Jul 16 01:39:02 2009 New Revision: 4719Log: 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;
I'm not sure fopen is adequate here. Can playlist be using any url ? If so I think url_fopen should be used. -- Baptiste COUDURIER GnuPG Key Id: 0x5C1ABAAA Key fingerprint 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA FFmpeg maintainer http://www.ffmpeg.org _______________________________________________ FFmpeg-soc mailing list [email protected] https://lists.mplayerhq.hu/mailman/listinfo/ffmpeg-soc
