diff options
author | wm4 <wm4@nowhere> | 2016-06-18 19:31:23 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-06-18 19:31:23 +0200 |
commit | 0cf187caca31265bb4138995b3eb20686bb71be5 (patch) | |
tree | 442680e332014d3c315a33e7feee71f9cde8f064 /video/out/bitmap_packer.c | |
parent | 07c11656e3a108d646f7d7c686c497e19ce6d7fe (diff) | |
download | mpv-0cf187caca31265bb4138995b3eb20686bb71be5.tar.bz2 mpv-0cf187caca31265bb4138995b3eb20686bb71be5.tar.xz |
bitmap_packet: let max=0 mean unlimited
And remove the strange PACKER_MAX_WH define. This is more convenient for
users which don't care about limits, such as sd_lavc.c.
Diffstat (limited to 'video/out/bitmap_packer.c')
-rw-r--r-- | video/out/bitmap_packer.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/video/out/bitmap_packer.c b/video/out/bitmap_packer.c index 4ea8b0b62a..3f75a72bcb 100644 --- a/video/out/bitmap_packer.c +++ b/video/out/bitmap_packer.c @@ -22,6 +22,7 @@ #include <stdlib.h> #include <assert.h> #include <stdio.h> +#include <limits.h> #include <libavutil/common.h> @@ -170,10 +171,12 @@ int packer_pack(struct bitmap_packer *packer) } return packer->w != w_orig || packer->h != h_orig; } - if (packer->w <= packer->h && packer->w != packer->w_max) - packer->w = FFMIN(packer->w * 2, packer->w_max); - else if (packer->h != packer->h_max) - packer->h = FFMIN(packer->h * 2, packer->h_max); + 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); + else if (packer->h != h_max) + packer->h = FFMIN(packer->h * 2, h_max); else { packer->w = w_orig; packer->h = h_orig; |