[FFmpeg-soc] [soc]: r4621 - in concat/libavformat: datanode.c datanode.h m3u.c playlist.c playlist.h pls.c
gkovacs
subversion at mplayerhq.hu
Sun Jul 5 22:38:14 CEST 2009
Author: gkovacs
Date: Sun Jul 5 22:38:14 2009
New Revision: 4621
Log:
fixed stringlist export and rel paths
Modified:
concat/libavformat/datanode.c
concat/libavformat/datanode.h
concat/libavformat/m3u.c
concat/libavformat/playlist.c
concat/libavformat/playlist.h
concat/libavformat/pls.c
Modified: concat/libavformat/datanode.c
==============================================================================
--- concat/libavformat/datanode.c Sun Jul 5 21:52:51 2009 (r4620)
+++ concat/libavformat/datanode.c Sun Jul 5 22:38:14 2009 (r4621)
@@ -193,18 +193,27 @@ void ff_stringlist_append(StringList *l,
l->str = str;
}
+char *ff_stringlist_at(StringList *l, int i)
+{
+ while ((i-- > 0))
+ l = l->next;
+ return l->str;
+}
+
void ff_stringlist_export(StringList *l, char ***flist_ptr, unsigned int *lfx_ptr)
{
unsigned int i;
char **flist;
unsigned int strlen = ff_stringlist_len(l);
*lfx_ptr = strlen;
- flist = av_malloc(sizeof(*flist)*(strlen+1));
- memset(flist, 0, sizeof(*flist)*(strlen+1));
- for (i = 0; l && (i < strlen); ++i) {
- flist[i] = (l = l->next);
+ *flist_ptr = av_malloc(sizeof(**flist_ptr)*(strlen+1));
+ memset(*flist_ptr, 0, sizeof(**flist_ptr)*(strlen+1));
+ flist = *flist_ptr;
+ for (i = 0; i < strlen; ++i) {
+ flist[i] = l->str;
+ l = l->next;
}
- *flist_ptr = flist;
+ flist[i] = 0;
}
unsigned int ff_stringlist_len(StringList *l)
@@ -212,7 +221,7 @@ unsigned int ff_stringlist_len(StringLis
unsigned int i = 0;
while ((l = l->next))
++i;
- return i;
+ return i+1;
}
void ff_stringlist_print(StringList *l)
Modified: concat/libavformat/datanode.h
==============================================================================
--- concat/libavformat/datanode.h Sun Jul 5 21:52:51 2009 (r4620)
+++ concat/libavformat/datanode.h Sun Jul 5 22:38:14 2009 (r4621)
@@ -60,6 +60,8 @@ StringList *ff_stringlist_alloc();
void ff_stringlist_append(StringList *l, char *str);
+char *ff_stringlist_at(StringList *l, int i);
+
void ff_stringlist_export(StringList *l, char ***flist_ptr, unsigned int *lfx_ptr);
void ff_stringlist_print(StringList *l);
Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c Sun Jul 5 21:52:51 2009 (r4620)
+++ concat/libavformat/m3u.c Sun Jul 5 22:38:14 2009 (r4621)
@@ -65,16 +65,7 @@ static int m3u_list_files(ByteIOContext
*flist_ptr = ofl;
*lfx_ptr = i;
ofl[i] = 0;
- while (*ofl != 0) { // determine if relative paths
- FILE *file;
- char *fullfpath = ff_conc_strings(workingdir, *ofl);
- file = fopen(fullfpath, "r");
- if (file) {
- fclose(file);
- *ofl = fullfpath;
- }
- ++ofl;
- }
+ ff_playlist_relative_paths(ofl, workingdir);
return 0;
}
Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c Sun Jul 5 21:52:51 2009 (r4620)
+++ concat/libavformat/playlist.c Sun Jul 5 22:38:14 2009 (r4621)
@@ -259,3 +259,16 @@ int64_t ff_playlist_get_duration(AVForma
return durn;
}
+void ff_playlist_relative_paths(char **flist, char *workingdir)
+{
+ while (*flist != 0) { // determine if relative paths
+ FILE *file;
+ char *fullfpath = ff_conc_strings(workingdir, *flist);
+ file = fopen(fullfpath, "r");
+ if (file) {
+ fclose(file);
+ *flist = fullfpath;
+ }
+ ++flist;
+ }
+}
Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h Sun Jul 5 21:52:51 2009 (r4620)
+++ concat/libavformat/playlist.h Sun Jul 5 22:38:14 2009 (r4621)
@@ -66,4 +66,6 @@ void ff_split_wd_fn(char *filepath, char
int64_t ff_playlist_get_duration(AVFormatContext *ic, int stream_index);
+void ff_playlist_relative_paths(char **flist, char *workingdir);
+
#endif /* _PLAYLIST_H */
Modified: concat/libavformat/pls.c
==============================================================================
--- concat/libavformat/pls.c Sun Jul 5 21:52:51 2009 (r4620)
+++ concat/libavformat/pls.c Sun Jul 5 22:38:14 2009 (r4621)
@@ -54,6 +54,7 @@ static int pls_list_files(ByteIOContext
ff_datanode_filter_values_by_name(d, l, "File");
ff_stringlist_print(l);
ff_stringlist_export(l, flist_ptr, lfx_ptr);
+ ff_playlist_relative_paths(*flist_ptr, workingdir);
return 0;
}
More information about the FFmpeg-soc
mailing list