summaryrefslogtreecommitdiffstats
path: root/stream
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2013-06-16 22:52:49 +0200
committerwm4 <wm4@nowhere>2013-06-16 22:52:49 +0200
commitfa30dc415419a6a22d31f79095e0a0d41bc61905 (patch)
treeeb6b281ddbea2ab555fece42b15aa514d3db232e /stream
parent0221f16b3664ca17913cb2e3171e73a104a9df6f (diff)
downloadmpv-fa30dc415419a6a22d31f79095e0a0d41bc61905.tar.bz2
mpv-fa30dc415419a6a22d31f79095e0a0d41bc61905.tar.xz
cache: fix compilation on Libav
Appears Libav doesn't have av_clip64(). So implement our own.
Diffstat (limited to 'stream')
-rw-r--r--stream/cache.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/stream/cache.c b/stream/cache.c
index 39c0701848..5a34447701 100644
--- a/stream/cache.c
+++ b/stream/cache.c
@@ -119,6 +119,13 @@ enum {
CACHE_CTRL_PING = -2,
};
+static int64_t mp_clipi64(int64_t val, int64_t min, int64_t max)
+{
+ val = FFMIN(val, max);
+ val = FFMAX(val, min);
+ return val;
+}
+
// pthread_cond_timedwait() with a relative timeout in seconds
static int cond_timed_wait(pthread_cond_t *cond, pthread_mutex_t *mutex,
double timeout)
@@ -229,7 +236,7 @@ static bool cache_fill(struct priv *s)
}
// number of buffer bytes which should be preserved in backwards direction
- int64_t back = av_clip64(read - s->min_filepos, 0, s->back_size);
+ int64_t back = mp_clipi64(read - s->min_filepos, 0, s->back_size);
// number of buffer bytes that are valid and can be read
int64_t newb = FFMAX(s->max_filepos - read, 0);