OSDN Git Service

simplify seek() failure check
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 26 Sep 2006 16:09:56 +0000 (16:09 +0000)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 26 Sep 2006 16:09:56 +0000 (16:09 +0000)
Originally committed as revision 6339 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/aviobuf.c

index e0832c6..ef72c19 100644 (file)
@@ -123,9 +123,6 @@ offset_t url_fseek(ByteIOContext *s, offset_t offset, int whence)
         /* can do the seek inside the buffer */
         s->buf_ptr = s->buffer + offset1;
     } else {
-        if (!s->seek)
-            return -EPIPE;
-
 #ifdef CONFIG_MUXERS
         if (s->write_flag) {
             flush_buffer(s);
@@ -136,7 +133,7 @@ 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->opaque, offset, SEEK_SET) == (offset_t)-EPIPE)
+        if (!s->seek || s->seek(s->opaque, offset, SEEK_SET) == (offset_t)-EPIPE)
             return -EPIPE;
         s->pos = offset;
     }