summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrr- <rr-@sakuya.pl>2016-08-19 10:24:26 +0200
committerwm4 <wm4@nowhere>2016-08-19 22:51:46 +0200
commited644b0d3373f8ac1b3bf2ef8f797e1d1d8a775d (patch)
tree5b4b9d70268cef014538f99d97b9eeb056b3e8be
parent23993e91f37f2b15eb1a1103b2444a38b6bd66d3 (diff)
downloadmpv-ed644b0d3373f8ac1b3bf2ef8f797e1d1d8a775d.tar.bz2
mpv-ed644b0d3373f8ac1b3bf2ef8f797e1d1d8a775d.tar.xz
aspect: add --video-unscaled=downscale-big
-rw-r--r--DOCS/man/options.rst7
-rw-r--r--options/options.c3
-rw-r--r--video/out/aspect.c10
3 files changed, 13 insertions, 7 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 0301e6971d..7870d49c4d 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -738,10 +738,11 @@ Video
choices if you encounter video that has the wrong aspect ratio in mpv,
but seems to be correct in other players.
-``--video-unscaled``
+``--video-unscaled=<no|yes|downscale-big>``
Disable scaling of the video. If the window is larger than the video,
- black bars are added. Otherwise, the video is cropped. The video still
- can be influenced by the other ``--video-...`` options.
+ black bars are added. Otherwise, the video is cropped, unless the option
+ is set to ``downscale-big``, in which case the video is fit to window. The
+ video still can be influenced by the other ``--video-...`` options.
Note that the scaler algorithm may still be used, even if the video isn't
scaled. For example, this can influence chroma conversion. The video will
diff --git a/options/options.c b/options/options.c
index 1a8ecaca2f..0ef89650a3 100644
--- a/options/options.c
+++ b/options/options.c
@@ -454,7 +454,8 @@ const m_option_t mp_opts[] = {
OPT_FLOATRANGE("video-pan-y", vo.pan_y, 0, -3.0, 3.0),
OPT_FLOATRANGE("video-align-x", vo.align_x, 0, -1.0, 1.0),
OPT_FLOATRANGE("video-align-y", vo.align_y, 0, -1.0, 1.0),
- OPT_FLAG("video-unscaled", vo.unscaled, 0),
+ OPT_CHOICE("video-unscaled", vo.unscaled, 0,
+ ({"no", 0}, {"yes", 1}, {"downscale-big", 2})),
OPT_FLAG("force-rgba-osd-rendering", force_rgba_osd, 0),
OPT_CHOICE_OR_INT("video-rotate", video_rotate, 0, 0, 359,
({"no", -1})),
diff --git a/video/out/aspect.c b/video/out/aspect.c
index 205ee3b89f..5cd5b32573 100644
--- a/video/out/aspect.c
+++ b/video/out/aspect.c
@@ -27,10 +27,12 @@
#include "sub/osd.h"
static void aspect_calc_panscan(struct mp_vo_opts *opts,
- int w, int h, int d_w, int d_h, bool unscaled,
+ int w, int h, int d_w, int d_h, int unscaled,
int window_w, int window_h, double monitor_par,
int *out_w, int *out_h)
{
+ w *= monitor_par;
+
int fwidth = window_w;
int fheight = (float)window_w / d_w * d_h / monitor_par;
if (fheight > window_h || fheight < h) {
@@ -51,9 +53,11 @@ static void aspect_calc_panscan(struct mp_vo_opts *opts,
}
if (unscaled) {
- fwidth = w * monitor_par;
- fheight = h;
vo_panscan_area = 0;
+ if (unscaled != 2 || (w <= window_w && h <= window_h)) {
+ fwidth = w;
+ fheight = h;
+ }
}
*out_w = fwidth + vo_panscan_area * opts->panscan * f_w;