Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2014-03-02 01:55:37 +0400
committerMichael Niedermayer <michaelni@gmx.at>2014-03-23 23:31:05 +0400
commit938ff937100541d0060d4500c153e7459385658a (patch)
tree261f2f0cafd887ba32066e4880a8ad54f778fbd8 /libavformat
parent0c88d539f8284d8625749febffd9e7ca8ef2b3be (diff)
avformat/aviobuf: factorize buffer_size out
Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 2adf422ce24bd8038d5d2f50549d0d3fb4170171) Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/aviobuf.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c
index eb5a6e502d..18431e7086 100644
--- a/libavformat/aviobuf.c
+++ b/libavformat/aviobuf.c
@@ -201,12 +201,14 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
int64_t offset1;
int64_t pos;
int force = whence & AVSEEK_FORCE;
+ int buffer_size;
whence &= ~AVSEEK_FORCE;
if(!s)
return AVERROR(EINVAL);
- pos = s->pos - (s->write_flag ? 0 : (s->buf_end - s->buffer));
+ buffer_size = s->buf_end - s->buffer;
+ pos = s->pos - (s->write_flag ? 0 : buffer_size);
if (whence != SEEK_CUR && whence != SEEK_SET)
return AVERROR(EINVAL);
@@ -219,7 +221,7 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence)
}
offset1 = offset - pos;
if (!s->must_flush && (!s->direct || !s->seek) &&
- offset1 >= 0 && offset1 <= (s->buf_end - s->buffer)) {
+ offset1 >= 0 && offset1 <= buffer_size) {
/* can do the seek inside the buffer */
s->buf_ptr = s->buffer + offset1;
} else if ((!s->seekable ||