[FFmpeg-soc] [soc]: r4642 - in concat/libavformat: playlist.c playlist.h

gkovacs subversion at mplayerhq.hu
Mon Jul 6 22:40:05 CEST 2009


Author: gkovacs
Date: Mon Jul  6 22:40:04 2009
New Revision: 4642

Log:
removed ff_conc_strings

Modified:
   concat/libavformat/playlist.c
   concat/libavformat/playlist.h

Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c	Mon Jul  6 22:08:38 2009	(r4641)
+++ concat/libavformat/playlist.c	Mon Jul  6 22:40:04 2009	(r4642)
@@ -74,29 +74,6 @@ PlaylistContext* ff_playlist_alloc_conte
     return ctx;
 }
 
-char* ff_conc_strings(char *string1,
-                      char *string2)
-{
-    char *str1;
-    char *str2;
-    char *str;
-    str1 = string1;
-    str2 = string2;
-    while (*string1 != 0)
-        ++string1;
-    while (*string2 != 0)
-        ++string2;
-    str = av_malloc((string1-str1)+(string2-str2));
-    string1 = str1;
-    string2 = str2;
-    while (*string1 != 0)
-        str[string1-str1] = *(string1++);
-    str += (string1-str1);
-    while (*string2 != 0)
-        str[string2-str2] = *(string2++);
-    return (str-string1)+str1;
-}
-
 char* ff_buf_getline(ByteIOContext *s)
 {
     char *q;
@@ -238,11 +215,18 @@ int64_t ff_playlist_get_duration(AVForma
     return durn;
 }
 
-void ff_playlist_relative_paths(char **flist, char *workingdir)
+void ff_playlist_relative_paths(char **flist, const char *workingdir)
 {
     while (*flist != 0) { // determine if relative paths
         FILE *file;
-        char *fullfpath = ff_conc_strings(workingdir, *flist);
+        char *fullfpath;
+        int wdslen = strlen(workingdir);
+        int flslen = strlen(*flist);
+        fullfpath = av_malloc(sizeof(char) * (wdslen+flslen+1));
+        av_strlcpy(fullfpath, workingdir, wdslen);
+        av_strlcpy(fullfpath+wdslen, *flist, flslen+1);
+        fullfpath[wdslen-1] = '/';
+        fullfpath[wdslen+flslen] = 0;
         file = fopen(fullfpath, "r");
         if (file) {
             fclose(file);

Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h	Mon Jul  6 22:08:38 2009	(r4641)
+++ concat/libavformat/playlist.h	Mon Jul  6 22:40:04 2009	(r4642)
@@ -57,14 +57,12 @@ PlaylistContext* ff_playlist_alloc_conte
 
 int ff_playlist_populate_context(PlaylistContext *playlc, AVFormatContext *s, int stream_index);
 
-char* ff_conc_strings(char *string1, char *string2);
-
 char* ff_buf_getline(ByteIOContext *s);
 
 void ff_split_wd_fn(const char *filepath, char **workingdir, char **filename);
 
 int64_t ff_playlist_get_duration(AVFormatContext *ic, int stream_index);
 
-void ff_playlist_relative_paths(char **flist, char *workingdir);
+void ff_playlist_relative_paths(char **flist, const char *workingdir);
 
 #endif /* _PLAYLIST_H */


More information about the FFmpeg-soc mailing list