summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2020-06-03 17:26:08 +0200
committerwm4 <wm4@nowhere>2020-06-03 17:26:44 +0200
commit5f49009849271ecd995f9f41e4eb2a36a0fc024a (patch)
treee3c0dc420eef17af7bafe8406aa22998123ce4d3
parentbaa7b5c8dd35365a8a62aa39c84394e5315b79e0 (diff)
downloadmpv-5f49009849271ecd995f9f41e4eb2a36a0fc024a.tar.bz2
mpv-5f49009849271ecd995f9f41e4eb2a36a0fc024a.tar.xz
options: add --video-scale-x/y
Requested. Fixes: #6303
-rw-r--r--DOCS/man/options.rst9
-rw-r--r--options/options.c4
-rw-r--r--options/options.h1
-rw-r--r--video/out/aspect.c8
4 files changed, 18 insertions, 4 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 95cd12a7b3..769db4d837 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -1467,6 +1467,15 @@ Video
This option is disabled if the ``--no-keepaspect`` option is used.
+``--video-scale-x=<value>``, ``--video-scale-y=<value>``
+ Multiply the video display size with the given value (default: 1.0). If a
+ non-default value is used, this will be different from the window size, so
+ video will be either cut off, or black bars are added.
+
+ This value is multiplied with the value derived from ``--video-zoom`` and
+ the normal video aspect aspect ratio. This option is disabled if the
+ ``--no-keepaspect`` option is used.
+
``--video-align-x=<-1-1>``, ``--video-align-y=<-1-1>``
Moves the video rectangle within the black borders, which are usually added
to pad the video to screen if video and screen aspect ratios are different.
diff --git a/options/options.c b/options/options.c
index 22ae8e77e5..4467c106ba 100644
--- a/options/options.c
+++ b/options/options.c
@@ -136,6 +136,8 @@ static const m_option_t mp_vo_opt_list[] = {
{"video-pan-y", OPT_FLOAT(pan_y), M_RANGE(-3.0, 3.0)},
{"video-align-x", OPT_FLOAT(align_x), M_RANGE(-1.0, 1.0)},
{"video-align-y", OPT_FLOAT(align_y), M_RANGE(-1.0, 1.0)},
+ {"video-scale-x", OPT_FLOAT(scale_x), M_RANGE(0, 10000.0)},
+ {"video-scale-y", OPT_FLOAT(scale_y), M_RANGE(0, 10000.0)},
{"video-margin-ratio-left", OPT_FLOAT(margin_x[0]), M_RANGE(0.0, 1.0)},
{"video-margin-ratio-right", OPT_FLOAT(margin_x[1]), M_RANGE(0.0, 1.0)},
{"video-margin-ratio-top", OPT_FLOAT(margin_y[0]), M_RANGE(0.0, 1.0)},
@@ -177,6 +179,8 @@ const struct m_sub_options vo_sub_opts = {
.screen_id = -1,
.fsscreen_id = -1,
.panscan = 0.0f,
+ .scale_x = 1.0f,
+ .scale_y = 1.0f,
.keepaspect = 1,
.keepaspect_window = 1,
.hidpi_window_scale = 1,
diff --git a/options/options.h b/options/options.h
index 92e0d7c129..45d0747358 100644
--- a/options/options.h
+++ b/options/options.h
@@ -31,6 +31,7 @@ typedef struct mp_vo_opts {
float zoom;
float pan_x, pan_y;
float align_x, align_y;
+ float scale_x, scale_y;
float margin_x[2];
float margin_y[2];
int unscaled;
diff --git a/video/out/aspect.c b/video/out/aspect.c
index 7307ed6b34..c07fdce84a 100644
--- a/video/out/aspect.c
+++ b/video/out/aspect.c
@@ -77,12 +77,12 @@ static void clamp_size(int size, int *start, int *end)
static void src_dst_split_scaling(int src_size, int dst_size,
int scaled_src_size,
- float zoom, float align, float pan,
+ float zoom, float align, float pan, float scale,
int *src_start, int *src_end,
int *dst_start, int *dst_end,
int *osd_margin_a, int *osd_margin_b)
{
- scaled_src_size *= powf(2, zoom);
+ scaled_src_size *= powf(2, zoom) * scale;
align = (align + 1) / 2;
*src_start = 0;
@@ -168,11 +168,11 @@ void mp_get_src_dst_rects(struct mp_log *log, struct mp_vo_opts *opts,
vid_window_w, vid_window_h, monitor_par,
&scaled_width, &scaled_height);
src_dst_split_scaling(src_w, vid_window_w, scaled_width,
- opts->zoom, opts->align_x, opts->pan_x,
+ opts->zoom, opts->align_x, opts->pan_x, opts->scale_x,
&src.x0, &src.x1, &dst.x0, &dst.x1,
&osd.ml, &osd.mr);
src_dst_split_scaling(src_h, vid_window_h, scaled_height,
- opts->zoom, opts->align_y, opts->pan_y,
+ opts->zoom, opts->align_y, opts->pan_y, opts->scale_y,
&src.y0, &src.y1, &dst.y0, &dst.y1,
&osd.mt, &osd.mb);
}