summaryrefslogtreecommitdiffstats
path: root/mpvcore
diff options
context:
space:
mode:
Diffstat (limited to 'mpvcore')
-rw-r--r--mpvcore/mp_common.h1
-rw-r--r--mpvcore/mplayer.c2
2 files changed, 2 insertions, 1 deletions
diff --git a/mpvcore/mp_common.h b/mpvcore/mp_common.h
index 543c22073e..ecd84e33b6 100644
--- a/mpvcore/mp_common.h
+++ b/mpvcore/mp_common.h
@@ -36,6 +36,7 @@
#define MPMAX(a, b) ((a) > (b) ? (a) : (b))
#define MPMIN(a, b) ((a) > (b) ? (b) : (a))
+#define MPCLAMP(a, min, max) (((a) < (min)) ? (min) : (((a) > (max)) ? (max) : (a)))
#define MPSWAP(type, a, b) \
do { type SWAP_tmp = b; b = a; a = SWAP_tmp; } while (0)
#define MP_ARRAY_SIZE(s) (sizeof(s) / sizeof((s)[0]))
diff --git a/mpvcore/mplayer.c b/mpvcore/mplayer.c
index f076faf2b0..917f445556 100644
--- a/mpvcore/mplayer.c
+++ b/mpvcore/mplayer.c
@@ -3234,7 +3234,7 @@ double get_current_pos_ratio(struct MPContext *mpctx, bool use_range)
}
if (use_range) {
if (mpctx->opts->play_frames > 0)
- ans = max(ans, 1.0 -
+ ans = MPMAX(ans, 1.0 -
mpctx->max_frames / (double) mpctx->opts->play_frames);
}
return ans;