[FFmpeg-soc] [soc]: r4643 - in concat/libavformat: m3u.c playlist.c playlist.h
gkovacs
subversion at mplayerhq.hu
Mon Jul 6 23:30:59 CEST 2009
Author: gkovacs
Date: Mon Jul 6 23:30:59 2009
New Revision: 4643
Log:
removed ff_buf_getline
Modified:
concat/libavformat/m3u.c
concat/libavformat/playlist.c
concat/libavformat/playlist.h
Modified: concat/libavformat/m3u.c
==============================================================================
--- concat/libavformat/m3u.c Mon Jul 6 22:40:04 2009 (r4642)
+++ concat/libavformat/m3u.c Mon Jul 6 23:30:59 2009 (r4643)
@@ -48,13 +48,21 @@ static int m3u_list_files(ByteIOContext
i = 0;
flist = av_malloc(sizeof(char*) * bufsize);
while (1) {
- char *c = ff_buf_getline(s);
- if (c == NULL) // EOF
+ char *q;
+ char linebuf[1024] = {0};
+ if ((q = url_fgets(s, linebuf, sizeof(linebuf))) == NULL) // EOF
break;
- if (*c == 0) // hashed out
+ linebuf[sizeof(linebuf)-1] = 0; // cut off end if buffer overflowed
+ while (*q != 0) {
+ if (*q++ == '#')
+ *(q-1) = 0;
+ }
+ if (*linebuf == 0) // hashed out
continue;
flist = av_fast_realloc(flist, &bufsize, i+2);
- flist[i++] = c;
+ flist[i] = av_malloc(q-linebuf+1);
+ av_strlcpy(flist[i], linebuf, q-linebuf+1);
+ flist[i++][q-linebuf] = 0;
}
ctx->pelist_size = i;
flist[i] = 0;
Modified: concat/libavformat/playlist.c
==============================================================================
--- concat/libavformat/playlist.c Mon Jul 6 22:40:04 2009 (r4642)
+++ concat/libavformat/playlist.c Mon Jul 6 23:30:59 2009 (r4643)
@@ -74,36 +74,6 @@ PlaylistContext* ff_playlist_alloc_conte
return ctx;
}
-char* ff_buf_getline(ByteIOContext *s)
-{
- char *q;
- char *oq;
- int bufsize = 64;
- q = av_malloc(bufsize);
- oq = q;
- while (1) {
- int c = url_fgetc(s);
- if (c == EOF)
- return NULL;
- if (c == '\n')
- break;
- *q = c;
- if ((++q)-oq == bufsize) {
- oq = av_realloc(oq, bufsize+64);
- q = oq + bufsize;
- bufsize += 64;
- }
- }
- *q = 0;
- q = oq;
- while (*q != 0 && *q != '#') {
- ++q;
- }
- *q = 0;
- oq = av_realloc(oq, (q-oq)+1);
- return oq;
-}
-
void ff_split_wd_fn(const char *filepath,
char **workingdir,
char **filename)
Modified: concat/libavformat/playlist.h
==============================================================================
--- concat/libavformat/playlist.h Mon Jul 6 22:40:04 2009 (r4642)
+++ concat/libavformat/playlist.h Mon Jul 6 23:30:59 2009 (r4643)
@@ -57,8 +57,6 @@ PlaylistContext* ff_playlist_alloc_conte
int ff_playlist_populate_context(PlaylistContext *playlc, AVFormatContext *s, int stream_index);
-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);
More information about the FFmpeg-soc
mailing list