Mercurial > libavformat.hg
diff utils.c @ 5941:bde9a4b67f86 libavformat
Reusing the probe buffer to rewind the ByteIOContext in ff_probe_input_buffer() instead of seeking back to the start of the file. Once exhausted, the size of the buffer is reduced.
author | thardin |
---|---|
date | Thu, 08 Apr 2010 09:02:27 +0000 |
parents | d9f196991fe4 |
children | 57789f5d12cf |
line wrap: on
line diff
--- a/utils.c Wed Apr 07 19:40:46 2010 +0000 +++ b/utils.c Thu Apr 08 09:02:27 2010 +0000 @@ -516,19 +516,16 @@ } } - av_free(buf); - if (!*fmt) { + av_free(buf); return AVERROR_INVALIDDATA; } - if (url_fseek(*pb, 0, SEEK_SET) < 0) { - url_fclose(*pb); - if (url_fopen(pb, filename, URL_RDONLY) < 0) - return AVERROR(EIO); - } - - return 0; + /* rewind. reuse probe buffer to avoid seeking */ + if ((ret = ff_rewind_with_probe_data(*pb, buf, pd.buf_size)) < 0) + av_free(buf); + + return ret; } int av_open_input_file(AVFormatContext **ic_ptr, const char *filename,