[FFmpeg-soc] [soc]: r4718 - in concat/libavformat: m3u.c pls.c xspf.c

gkovacs subversion at mplayerhq.hu
Thu Jul 16 01:30:37 CEST 2009


Author: gkovacs
Date: Thu Jul 16 01:30:37 2009
New Revision: 4718

Log:
simplified demuxer code

Modified:
   concat/libavformat/m3u.c
   concat/libavformat/pls.c
   concat/libavformat/xspf.c

Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c	Thu Jul 16 01:20:26 2009	(r4717)
+++ concat/libavformat/m3u.c	Thu Jul 16 01:30:37 2009	(r4718)
@@ -63,9 +63,8 @@ static int m3u_probe(AVProbeData *p)
 static int m3u_list_files(ByteIOContext *s, PlaylistContext *ctx, const char *filename)
 {
     char **flist;
-    int i, j;
-    int bufsize = 0;
-    i = flist = 0;
+    int i, bufsize;
+    i = bufsize = flist = 0;
     while (1) {
         char *q;
         char linebuf[1024] = {0};
@@ -83,15 +82,9 @@ static int m3u_list_files(ByteIOContext 
         av_strlcpy(flist[i], linebuf, q-linebuf+1);
         flist[i++][q-linebuf] = 0;
     }
-    ctx->pelist_size = i;
     flist[i] = 0;
     ff_playlist_relative_paths(flist, dirname(filename));
-    ctx->pelist = av_malloc(ctx->pelist_size * sizeof(*(ctx->pelist)));
-    memset(ctx->pelist, 0, ctx->pelist_size * sizeof(*(ctx->pelist)));
-    for (i = 0; i < ctx->pelist_size; ++i) {
-        ctx->pelist[i] = av_malloc(sizeof(*(ctx->pelist[i])));
-        ctx->pelist[i]->filename = flist[i];
-    }
+    ff_playlist_add_stringlist(ctx, flist, i);
     av_free(flist);
     return 0;
 }

Modified: concat/libavformat/pls.c
==============================================================================
--- concat/libavformat/pls.c	Thu Jul 16 01:20:26 2009	(r4717)
+++ concat/libavformat/pls.c	Thu Jul 16 01:30:37 2009	(r4718)
@@ -107,16 +107,9 @@ static int pls_list_files(ByteIOContext 
     if (!flist) // no files have been found
         return AVERROR_EOF;
     flist[j] = 0;
-    ctx->pelist_size = j;
     ff_playlist_relative_paths(flist, dirname(filename));
-    ctx->pelist = av_malloc(ctx->pelist_size * sizeof(*(ctx->pelist)));
-    memset(ctx->pelist, 0, ctx->pelist_size * sizeof(*(ctx->pelist)));
-    for (i = 0; i < ctx->pelist_size; ++i) {
-        ctx->pelist[i] = av_malloc(sizeof(*(ctx->pelist[i])));
-        ctx->pelist[i]->filename = flist[i];
-    }
+    ff_playlist_add_stringlist(ctx, flist, j);
     av_free(flist);
-    return 0;
 }
 
 static int pls_read_header(AVFormatContext *s,

Modified: concat/libavformat/xspf.c
==============================================================================
--- concat/libavformat/xspf.c	Thu Jul 16 01:20:26 2009	(r4717)
+++ concat/libavformat/xspf.c	Thu Jul 16 01:30:37 2009	(r4718)
@@ -111,14 +111,8 @@ static int xspf_list_files(ByteIOContext
     if (!flist) // no files have been found
         return AVERROR_EOF;
     flist[j] = 0;
-    ctx->pelist_size = j;
     ff_playlist_relative_paths(flist, dirname(filename));
-    ctx->pelist = av_malloc(ctx->pelist_size * sizeof(*(ctx->pelist)));
-    memset(ctx->pelist, 0, ctx->pelist_size * sizeof(*(ctx->pelist)));
-    for (i = 0; i < ctx->pelist_size; ++i) {
-        ctx->pelist[i] = av_malloc(sizeof(*(ctx->pelist[i])));
-        ctx->pelist[i]->filename = flist[i];
-    }
+    ff_playlist_add_stringlist(ctx, flist, j);
     av_free(flist);
     return 0;
 }


More information about the FFmpeg-soc mailing list