diff options
author | Ronald S. Bultje <rsbultje@gmail.com> | 2007-01-30 10:48:39 +0000 |
---|---|---|
committer | Guillaume Poirier <gpoirier@mplayerhq.hu> | 2007-01-30 10:48:39 +0000 |
commit | 68fcdbf1e570d16ca76e28a1f799dfa72a62e79a (patch) | |
tree | 03123e3eba4c8e8911ef88b7ddca16b9fac495e1 /libavformat/aviobuf.c | |
parent | eabbae730cf732afeb7c2a085e0e5c1e7b1b8614 (diff) | |
download | ffmpeg-streaming-68fcdbf1e570d16ca76e28a1f799dfa72a62e79a.zip ffmpeg-streaming-68fcdbf1e570d16ca76e28a1f799dfa72a62e79a.tar.gz |
Fix misbehaviour in url_fseek() when seeking fails.
The return value of the seek function is -1 on error, not -EPIPE (the return value in url_seek() if no seek function pointer is set)
Patch by Ronald S. Bultje % rbultje A ronald P bitfreak P net %
Original thread:
date: Dec 31, 2006 9:25 PM
subject: [Ffmpeg-devel] Re: [PATCH] file length handling
Originally committed as revision 7766 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'libavformat/aviobuf.c')
-rw-r--r-- | libavformat/aviobuf.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index ab8fc1d..ca93c64 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -136,6 +136,8 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence) fill_buffer(s); s->buf_ptr = s->buf_end + offset - s->pos; } else { + offset_t res = -EPIPE; + #if defined(CONFIG_MUXERS) || defined(CONFIG_NETWORK) if (s->write_flag) { flush_buffer(s); @@ -146,8 +148,8 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence) s->buf_end = s->buffer; } s->buf_ptr = s->buffer; - if (!s->seek || s->seek(s->opaque, offset, SEEK_SET) == (offset_t)-EPIPE) - return -EPIPE; + if (!s->seek || (res = s->seek(s->opaque, offset, SEEK_SET)) < 0) + return res; s->pos = offset; } s->eof_reached = 0; |