summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--audio/out/ao_lavc.c4
-rw-r--r--common/common.c16
-rw-r--r--common/encode_lavc.c2
-rw-r--r--demux/demux_mkv.c2
-rw-r--r--input/input.c9
-rw-r--r--misc/bstr.c14
-rw-r--r--misc/ring.c11
-rw-r--r--options/m_option.c9
-rw-r--r--stream/stream.c5
-rw-r--r--sub/draw_bmp.c7
-rw-r--r--sub/img_convert.c16
-rw-r--r--sub/osd_libass.c9
-rw-r--r--sub/sd_lavc.c4
-rw-r--r--video/out/bitmap_packer.c18
-rw-r--r--video/out/gpu/osd.c6
-rw-r--r--video/out/vo_vdpau.c12
16 files changed, 66 insertions, 78 deletions
diff --git a/audio/out/ao_lavc.c b/audio/out/ao_lavc.c
index 974d9d0b63..0973d9f529 100644
--- a/audio/out/ao_lavc.c
+++ b/audio/out/ao_lavc.c
@@ -146,7 +146,7 @@ static int init(struct ao *ao)
// enough frames for at least 0.25 seconds
ac->framecount = ceil(ao->samplerate * 0.25 / ac->aframesize);
// but at least one!
- ac->framecount = FFMAX(ac->framecount, 1);
+ ac->framecount = MPMAX(ac->framecount, 1);
ac->savepts = AV_NOPTS_VALUE;
ac->lastpts = AV_NOPTS_VALUE;
@@ -324,7 +324,7 @@ static int play(struct ao *ao, void **data, int samples, int flags)
talloc_free(tempdata);
- int taken = FFMIN(bufpos, orig_samples);
+ int taken = MPMIN(bufpos, orig_samples);
ectx->samples_since_last_pts += taken;
pthread_mutex_unlock(&ectx->lock);
diff --git a/common/common.c b/common/common.c
index e8a100dcc4..d0b2382b78 100644
--- a/common/common.c
+++ b/common/common.c
@@ -96,10 +96,10 @@ char *mp_format_time(double time, bool fractions)
// Set rc to the union of rc and rc2
void mp_rect_union(struct mp_rect *rc, const struct mp_rect *rc2)
{
- rc->x0 = FFMIN(rc->x0, rc2->x0);
- rc->y0 = FFMIN(rc->y0, rc2->y0);
- rc->x1 = FFMAX(rc->x1, rc2->x1);
- rc->y1 = FFMAX(rc->y1, rc2->y1);
+ rc->x0 = MPMIN(rc->x0, rc2->x0);
+ rc->y0 = MPMIN(rc->y0, rc2->y0);
+ rc->x1 = MPMAX(rc->x1, rc2->x1);
+ rc->y1 = MPMAX(rc->y1, rc2->y1);
}
// Returns whether or not a point is contained by rc
@@ -112,10 +112,10 @@ bool mp_rect_contains(struct mp_rect *rc, int x, int y)
// Return false if the result is empty.
bool mp_rect_intersection(struct mp_rect *rc, const struct mp_rect *rc2)
{
- rc->x0 = FFMAX(rc->x0, rc2->x0);
- rc->y0 = FFMAX(rc->y0, rc2->y0);
- rc->x1 = FFMIN(rc->x1, rc2->x1);
- rc->y1 = FFMIN(rc->y1, rc2->y1);
+ rc->x0 = MPMAX(rc->x0, rc2->x0);
+ rc->y0 = MPMAX(rc->y0, rc2->y0);
+ rc->x1 = MPMIN(rc->x1, rc2->x1);
+ rc->y1 = MPMIN(rc->y1, rc2->y1);
return rc->x1 > rc->x0 && rc->y1 > rc->y0;
}
diff --git a/common/encode_lavc.c b/common/encode_lavc.c
index 968ced280c..8066173d1c 100644
--- a/common/encode_lavc.c
+++ b/common/encode_lavc.c
@@ -720,7 +720,7 @@ int encode_lavc_getstatus(struct encode_lavc_context *ctx,
double now = mp_time_sec();
float minutes, megabytes, fps, x;
- float f = FFMAX(0.0001, relative_position);
+ float f = MPMAX(0.0001, relative_position);
pthread_mutex_lock(&ctx->lock);
diff --git a/demux/demux_mkv.c b/demux/demux_mkv.c
index f5d2394cd0..c54b2d43ba 100644
--- a/demux/demux_mkv.c
+++ b/demux/demux_mkv.c
@@ -3076,7 +3076,7 @@ static void demux_mkv_seek(demuxer_t *demuxer, double seek_pts, int flags)
if (!(flags & SEEK_FACTOR)) { /* time in secs */
mkv_index_t *index = NULL;
- seek_pts = FFMAX(seek_pts, 0);
+ seek_pts = MPMAX(seek_pts, 0);
int64_t target_timecode = seek_pts * 1e9 + 0.5;
if (create_index_until(demuxer, target_timecode) >= 0) {
diff --git a/input/input.c b/input/input.c
index 4dced9c78d..2b8a18a1a3 100644
--- a/input/input.c
+++ b/input/input.c
@@ -31,9 +31,6 @@
#include <pthread.h>
#include <assert.h>
-#include <libavutil/avstring.h>
-#include <libavutil/common.h>
-
#include "osdep/io.h"
#include "misc/rendezvous.h"
@@ -623,7 +620,7 @@ static void interpret_key(struct input_ctx *ictx, int code, double scale,
cmd->scale = 1;
cmd->scale_units = 1;
// Avoid spamming the player with too many commands
- scale_units = FFMIN(scale_units, 20);
+ scale_units = MPMIN(scale_units, 20);
for (int i = 0; i < scale_units - 1; i++)
mp_input_queue_cmd(ictx, mp_cmd_clone(cmd));
if (scale_units)
@@ -877,8 +874,8 @@ static void adjust_max_wait_time(struct input_ctx *ictx, double *time)
{
struct input_opts *opts = ictx->opts;
if (ictx->last_key_down && opts->ar_rate > 0 && ictx->ar_state >= 0) {
- *time = FFMIN(*time, 1.0 / opts->ar_rate);
- *time = FFMIN(*time, opts->ar_delay / 1000.0);
+ *time = MPMIN(*time, 1.0 / opts->ar_rate);
+ *time = MPMIN(*time, opts->ar_delay / 1000.0);
}
}
diff --git a/misc/bstr.c b/misc/bstr.c
index 09eb6af25b..4117514457 100644
--- a/misc/bstr.c
+++ b/misc/bstr.c
@@ -34,7 +34,7 @@ int bstrcmp(struct bstr str1, struct bstr str2)
{
int ret = 0;
if (str1.len && str2.len)
- ret = memcmp(str1.start, str2.start, FFMIN(str1.len, str2.len));
+ ret = memcmp(str1.start, str2.start, MPMIN(str1.len, str2.len));
if (!ret) {
if (str1.len == str2.len)
@@ -51,7 +51,7 @@ int bstrcasecmp(struct bstr str1, struct bstr str2)
{
int ret = 0;
if (str1.len && str2.len)
- ret = strncasecmp(str1.start, str2.start, FFMIN(str1.len, str2.len));
+ ret = strncasecmp(str1.start, str2.start, MPMIN(str1.len, str2.len));
if (!ret) {
if (str1.len == str2.len)
@@ -157,9 +157,9 @@ struct bstr bstr_splice(struct bstr str, int start, int end)
start += str.len;
if (end < 0)
end += str.len;
- end = FFMIN(end, str.len);
- start = FFMAX(start, 0);
- end = FFMAX(end, start);
+ end = MPMIN(end, str.len);
+ start = MPMAX(start, 0);
+ end = MPMAX(end, start);
str.start += start;
str.len = end - start;
return str;
@@ -169,7 +169,7 @@ long long bstrtoll(struct bstr str, struct bstr *rest, int base)
{
str = bstr_lstrip(str);
char buf[51];
- int len = FFMIN(str.len, 50);
+ int len = MPMIN(str.len, 50);
memcpy(buf, str.start, len);
buf[len] = 0;
char *endptr;
@@ -183,7 +183,7 @@ double bstrtod(struct bstr str, struct bstr *rest)
{
str = bstr_lstrip(str);
char buf[101];
- int len = FFMIN(str.len, 100);
+ int len = MPMIN(str.len, 100);
memcpy(buf, str.start, len);
buf[len] = 0;
char *endptr;
diff --git a/misc/ring.c b/misc/ring.c
index 58918a40a4..eb3c420cfc 100644
--- a/misc/ring.c
+++ b/misc/ring.c
@@ -18,8 +18,9 @@
*/
#include <inttypes.h>
-#include <libavutil/common.h>
#include <assert.h>
+
+#include "common/common.h"
#include "mpv_talloc.h"
#include "osdep/atomic.h"
#include "ring.h"
@@ -59,10 +60,10 @@ int mp_ring_read(struct mp_ring *buffer, unsigned char *dest, int len)
{
int size = mp_ring_size(buffer);
int buffered = mp_ring_buffered(buffer);
- int read_len = FFMIN(len, buffered);
+ int read_len = MPMIN(len, buffered);
int read_ptr = mp_ring_get_rpos(buffer) % size;
- int len1 = FFMIN(size - read_ptr, read_len);
+ int len1 = MPMIN(size - read_ptr, read_len);
int len2 = read_len - len1;
if (dest) {
@@ -84,10 +85,10 @@ int mp_ring_write(struct mp_ring *buffer, unsigned char *src, int len)
{
int size = mp_ring_size(buffer);
int free = mp_ring_available(buffer);
- int write_len = FFMIN(len, free);
+ int write_len = MPMIN(len, free);
int write_ptr = mp_ring_get_wpos(buffer) % size;
- int len1 = FFMIN(size - write_ptr, write_len);
+ int len1 = MPMIN(size - write_ptr, write_len);
int len2 = write_len - len1;
memcpy(buffer->buffer + write_ptr, src, len1);
diff --git a/options/m_option.c b/options/m_option.c
index 5df8b00291..d69d19fa08 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -31,7 +31,6 @@
#include <assert.h>
#include <libavutil/common.h>
-#include <libavutil/avstring.h>
#include "libmpv/client.h"
#include "player/client.h"
@@ -611,12 +610,12 @@ static void choice_get_min_max(const struct m_option *opt, int *min, int *max)
*min = INT_MAX;
*max = INT_MIN;
for (struct m_opt_choice_alternatives *alt = opt->priv; alt->name; alt++) {
- *min = FFMIN(*min, alt->value);
- *max = FFMAX(*max, alt->value);
+ *min = MPMIN(*min, alt->value);
+ *max = MPMAX(*max, alt->value);
}
if ((opt->flags & M_OPT_MIN) && (opt->flags & M_OPT_MAX)) {
- *min = FFMIN(*min, opt->min);
- *max = FFMAX(*max, opt->max);
+ *min = MPMIN(*min, opt->min);
+ *max = MPMAX(*max, opt->max);
}
}
diff --git a/stream/stream.c b/stream/stream.c
index fb758f9b1d..063c033bd4 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -22,7 +22,6 @@
#include <strings.h>
#include <assert.h>
-#include <libavutil/common.h>
#include "osdep/io.h"
#include "mpv_talloc.h"
@@ -458,7 +457,7 @@ int stream_read_partial(stream_t *s, char *buf, int buf_size)
if (!stream_fill_buffer(s))
return 0;
}
- int len = FFMIN(buf_size, s->buf_len - s->buf_pos);
+ int len = MPMIN(buf_size, s->buf_len - s->buf_pos);
memcpy(buf, &s->buffer[s->buf_pos], len);
s->buf_pos += len;
if (len > 0)
@@ -708,7 +707,7 @@ struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
talloc_free(buf);
return (struct bstr){NULL, 0};
}
- bufsize = FFMIN(bufsize + (bufsize >> 1), max_size + padding);
+ bufsize = MPMIN(bufsize + (bufsize >> 1), max_size + padding);
}
buf = talloc_realloc_size(talloc_ctx, buf, total_read + padding);
memset(&buf[total_read], 0, padding);
diff --git a/sub/draw_bmp.c b/sub/draw_bmp.c
index 4125fc3009..a4847b1534 100644
--- a/sub/draw_bmp.c
+++ b/sub/draw_bmp.c
@@ -22,7 +22,6 @@
#include <inttypes.h>
#include <libswscale/swscale.h>
-#include <libavutil/common.h>
#include "common/common.h"
#include "draw_bmp.h"
@@ -161,9 +160,9 @@ static void unpremultiply_and_split_BGR32(struct mp_image *img,
int div = (int) aval;
int add = div / 2;
if (aval) {
- rval = FFMIN(255, (rval * 255 + add) / div);
- gval = FFMIN(255, (gval * 255 + add) / div);
- bval = FFMIN(255, (bval * 255 + add) / div);
+ rval = MPMIN(255, (rval * 255 + add) / div);
+ gval = MPMIN(255, (gval * 255 + add) / div);
+ bval = MPMIN(255, (bval * 255 + add) / div);
irow[x] = bval + (gval << 8) + (rval << 16) + (aval << 24);
}
arow[x] = aval;
diff --git a/sub/img_convert.c b/sub/img_convert.c
index 0ce5c7ac0a..a70bb0a24c 100644
--- a/sub/img_convert.c
+++ b/sub/img_convert.c
@@ -17,9 +17,7 @@
#include <string.h>
#include <assert.h>
-
-#include <libavutil/mem.h>
-#include <libavutil/common.h>
+#include <limits.h>
#include "mpv_talloc.h"
@@ -52,15 +50,15 @@ bool mp_sub_bitmaps_bb(struct sub_bitmaps *imgs, struct mp_rect *out_bb)
struct mp_rect bb = {INT_MAX, INT_MAX, INT_MIN, INT_MIN};
for (int n = 0; n < imgs->num_parts; n++) {
struct sub_bitmap *p = &imgs->parts[n];
- bb.x0 = FFMIN(bb.x0, p->x);
- bb.y0 = FFMIN(bb.y0, p->y);
- bb.x1 = FFMAX(bb.x1, p->x + p->dw);
- bb.y1 = FFMAX(bb.y1, p->y + p->dh);
+ bb.x0 = MPMIN(bb.x0, p->x);
+ bb.y0 = MPMIN(bb.y0, p->y);
+ bb.x1 = MPMAX(bb.x1, p->x + p->dw);
+ bb.y1 = MPMAX(bb.y1, p->y + p->dh);
}
// avoid degenerate bounding box if empty
- bb.x0 = FFMIN(bb.x0, bb.x1);
- bb.y0 = FFMIN(bb.y0, bb.y1);
+ bb.x0 = MPMIN(bb.x0, bb.x1);
+ bb.y0 = MPMIN(bb.y0, bb.y1);
*out_bb = bb;
diff --git a/sub/osd_libass.c b/sub/osd_libass.c
index e51b7f4048..d5f7bb82bf 100644
--- a/sub/osd_libass.c
+++ b/sub/osd_libass.c
@@ -15,13 +15,12 @@
* License along with mpv. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
-#include <libavutil/common.h>
-
#include "config.h"
#include "mpv_talloc.h"
@@ -288,7 +287,7 @@ struct ass_draw {
static void ass_draw_start(struct ass_draw *d)
{
- d->scale = FFMAX(d->scale, 1);
+ d->scale = MPMAX(d->scale, 1);
d->text = talloc_asprintf_append(d->text, "{\\p%d}", d->scale);
}
@@ -368,9 +367,9 @@ static void get_osd_bar_box(struct osd_state *osd, struct osd_object *obj,
float base_size = 0.03125;
style->Outline *= *o_h / track->PlayResY / base_size;
// So that the chapter marks have space between them
- style->Outline = FFMIN(style->Outline, *o_h / 5.2);
+ style->Outline = MPMIN(style->Outline, *o_h / 5.2);
// So that the border is not 0
- style->Outline = FFMAX(style->Outline, *o_h / 32.0);
+ style->Outline = MPMAX(style->Outline, *o_h / 32.0);
// Rendering with shadow is broken (because there's more than one shape)
style->Shadow = 0;
diff --git a/sub/sd_lavc.c b/sub/sd_lavc.c
index 72c89913e0..d2e21fbd2b 100644
--- a/sub/sd_lavc.c
+++ b/sub/sd_lavc.c
@@ -249,8 +249,8 @@ static void read_sub_bitmaps(struct sd *sd, struct sub *sub)
b->stride = sub->data->stride[0];
b->bitmap = sub->data->planes[0] + pos.y * b->stride + pos.x * 4;
- sub->src_w = FFMAX(sub->src_w, b->x + b->w);
- sub->src_h = FFMAX(sub->src_h, b->y + b->h);
+ sub->src_w = MPMAX(sub->src_w, b->x + b->w);
+ sub->src_h = MPMAX(sub->src_h, b->y + b->h);
assert(r->nb_colors > 0);
assert(r->nb_colors <= 256);
diff --git a/video/out/bitmap_packer.c b/video/out/bitmap_packer.c
index 5169357e3a..4f7739f514 100644
--- a/video/out/bitmap_packer.c
+++ b/video/out/bitmap_packer.c
@@ -116,9 +116,9 @@ static int pack_rectangles(struct pos *in, struct pos *out, int num_rects,
if (maxy < 0)
stack[stackpos++] = s;
s.x = right;
- maxy = FFMAX(maxy, bottom);
+ maxy = MPMAX(maxy, bottom);
}
- *used_width = FFMAX(*used_width, s.x);
+ *used_width = MPMAX(*used_width, s.x);
if (maxy > 0)
s.bottom = maxy;
}
@@ -144,8 +144,8 @@ int packer_pack(struct bitmap_packer *packer)
fprintf(stderr, "Invalid OSD / subtitle bitmap size\n");
abort();
}
- xmax = FFMAX(xmax, in[i].x);
- ymax = FFMAX(ymax, in[i].y);
+ xmax = MPMAX(xmax, in[i].x);
+ ymax = MPMAX(ymax, in[i].y);
}
if (xmax > packer->w)
packer->w = 1 << (av_log2(xmax - 1) + 1);
@@ -157,8 +157,8 @@ int packer_pack(struct bitmap_packer *packer)
packer->w, packer->h,
packer->scratch, &used_width);
if (y >= 0) {
- packer->used_width = FFMIN(used_width, packer->w);
- packer->used_height = FFMIN(y, packer->h);
+ packer->used_width = MPMIN(used_width, packer->w);
+ packer->used_height = MPMIN(y, packer->h);
assert(packer->w == 0 || IS_POWER_OF_2(packer->w));
assert(packer->h == 0 || IS_POWER_OF_2(packer->h));
if (packer->padding) {
@@ -172,9 +172,9 @@ int packer_pack(struct bitmap_packer *packer)
int w_max = packer->w_max > 0 ? packer->w_max : INT_MAX;
int h_max = packer->h_max > 0 ? packer->h_max : INT_MAX;
if (packer->w <= packer->h && packer->w != w_max)
- packer->w = FFMIN(packer->w * 2, w_max);
+ packer->w = MPMIN(packer->w * 2, w_max);
else if (packer->h != h_max)
- packer->h = FFMIN(packer->h * 2, h_max);
+ packer->h = MPMIN(packer->h * 2, h_max);
else {
packer->w = w_orig;
packer->h = h_orig;
@@ -188,7 +188,7 @@ void packer_set_size(struct bitmap_packer *packer, int size)
packer->count = size;
if (size <= packer->asize)
return;
- packer->asize = FFMAX(packer->asize * 2, size);
+ packer->asize = MPMAX(packer->asize * 2, size);
talloc_free(packer->result);
talloc_free(packer->scratch);
packer->in = talloc_realloc(packer, packer->in, struct pos, packer->asize);
diff --git a/video/out/gpu/osd.c b/video/out/gpu/osd.c
index 3ab11fcb2b..63a04481d2 100644
--- a/video/out/gpu/osd.c
+++ b/video/out/gpu/osd.c
@@ -19,8 +19,6 @@
#include <assert.h>
#include <limits.h>
-#include <libavutil/common.h>
-
#include "common/common.h"
#include "common/msg.h"
#include "video/csputils.h"
@@ -140,8 +138,8 @@ static bool upload_osd(struct mpgl_osd *ctx, struct mpgl_osd_part *osd,
ra_tex_free(ra, &osd->texture);
osd->format = imgs->format;
- osd->w = FFMAX(32, req_w);
- osd->h = FFMAX(32, req_h);
+ osd->w = MPMAX(32, req_w);
+ osd->h = MPMAX(32, req_h);
MP_VERBOSE(ctx, "Reallocating OSD texture to %dx%d.\n", osd->w, osd->h);
diff --git a/video/out/vo_vdpau.c b/video/out/vo_vdpau.c
index 6bbd4f9e92..177fd5e270 100644
--- a/video/out/vo_vdpau.c
+++ b/video/out/vo_vdpau.c
@@ -31,8 +31,6 @@
#include <limits.h>
#include <assert.h>
-#include <libavutil/common.h>
-
#include "config.h"
#include "video/vdpau.h"
#include "video/vdpau_mixer.h"
@@ -810,7 +808,7 @@ static void flip_page(struct vo *vo)
* not make the target time in reality. Without this check we could drop
* every frame, freezing the display completely if video lags behind.
*/
- if (now > PREV_VSYNC(FFMAX(pts, vc->last_queue_time + vc->vsync_interval)))
+ if (now > PREV_VSYNC(MPMAX(pts, vc->last_queue_time + vc->vsync_interval)))
npts = UINT64_MAX;
/* Allow flipping a frame at a vsync if its presentation time is a
@@ -837,15 +835,15 @@ static void flip_page(struct vo *vo)
vc->dropped_time = ideal_pts;
- pts = FFMAX(pts, vc->last_queue_time + vc->vsync_interval);
- pts = FFMAX(pts, now);
+ pts = MPMAX(pts, vc->last_queue_time + vc->vsync_interval);
+ pts = MPMAX(pts, now);
if (npts < PREV_VSYNC(pts) + vc->vsync_interval)
goto drop;
int num_flips = update_presentation_queue_status(vo);
vsync = vc->recent_vsync_time + num_flips * vc->vsync_interval;
- pts = FFMAX(pts, now);
- pts = FFMAX(pts, vsync + (vc->vsync_interval >> 2));
+ pts = MPMAX(pts, now);
+ pts = MPMAX(pts, vsync + (vc->vsync_interval >> 2));
vsync = PREV_VSYNC(pts);
if (npts < vsync + vc->vsync_interval)
goto drop;