[FFmpeg-soc] [soc]: r5207 - concat/libavformat/xspf.c
gkovacs
subversion at mplayerhq.hu
Thu Aug 20 17:57:46 CEST 2009
Author: gkovacs
Date: Thu Aug 20 17:57:46 2009
New Revision: 5207
Log:
separate file listing and playlist generation in xspf
Modified:
concat/libavformat/xspf.c
Modified: concat/libavformat/xspf.c
==============================================================================
--- concat/libavformat/xspf.c Thu Aug 20 17:54:08 2009 (r5206)
+++ concat/libavformat/xspf.c Thu Aug 20 17:57:46 2009 (r5207)
@@ -71,9 +71,9 @@ static int xspf_probe(AVProbeData *p)
return 0;
}
-static int xspf_list_files(ByteIOContext *b, AVPlaylistContext *ctx, const char *filename)
+static int xspf_list_files(ByteIOContext *b, char ***flist_ptr, int *len_ptr)
{
- int i, j, k, c;
+ int i, j, c;
unsigned int buflen;
char state;
char **flist;
@@ -108,24 +108,28 @@ static int xspf_list_files(ByteIOContext
}
}
}
+ *flist_ptr = flist;
+ *len_ptr = j;
if (!flist) // no files have been found
return AVERROR_EOF;
flist[j] = 0;
- av_playlist_relative_paths(flist, j, dirname(filename));
- for (k = 0; k < j; ++k)
- av_playlist_add_path(ctx, flist[k]);
- av_free(flist);
return 0;
}
static int xspf_read_header(AVFormatContext *s,
AVFormatParameters *ap)
{
- AVPlaylistContext *ctx = av_mallocz(sizeof(*ctx));
- if (xspf_list_files(s->pb, ctx, s->filename)) {
+ AVPlaylistContext *ctx;
+ char **flist;
+ int flist_len;
+ xspf_list_files(s->pb, &flist, &flist_len);
+ if (!flist || flist_len <= 0) {
fprintf(stderr, "no playlist items found in %s\n", s->filename);
return AVERROR_EOF;
}
+ av_playlist_relative_paths(flist, flist_len, dirname(s->filename));
+ ctx = av_playlist_from_filelist(flist, flist_len);
+ av_free(flist);
s->priv_data = ctx;
av_playlist_populate_context(ctx, ctx->pe_curidx);
av_playlist_set_streams(s);
More information about the FFmpeg-soc
mailing list