player: add --window-scale option

Requested. Works similar to the property with the same name.
This commit is contained in:
wm4 2015-04-24 22:52:01 +02:00
parent e11abdbad2
commit 72e505a944
4 changed files with 13 additions and 0 deletions

View File

@ -1724,6 +1724,14 @@ Window
(depending on the video aspect ratio, the width or height will be
larger than 500 in order to keep the aspect ratio the same).
``--window-scale=<factor>``
Resize the video window to a multiple (or fraction) of the video size. This
option is applied before ``--autofit`` and other options are applied (so
they override this option).
For example, ``--window-scale=0.5`` would show the window at half the
video size.
``--autosync=<factor>``
Gradually adjusts the A/V sync based on audio delay measurements.
Specifying ``--autosync=0``, the default, will cause frame timing to be

View File

@ -400,6 +400,7 @@ const m_option_t mp_opts[] = {
OPT_SIZE_BOX("autofit", vo.autofit, 0),
OPT_SIZE_BOX("autofit-larger", vo.autofit_larger, 0),
OPT_SIZE_BOX("autofit-smaller", vo.autofit_smaller, 0),
OPT_FLOATRANGE("window-scale", vo.window_scale, 0, 0.001, 100),
OPT_FLAG("force-window-position", vo.force_window_position, 0),
// vo name (X classname) and window title strings
OPT_STRING("x11-name", vo.winname, 0),
@ -662,6 +663,7 @@ const struct MPOpts mp_default_opts = {
.keepaspect_window = 1,
.border = 1,
.WinID = -1,
.window_scale = 1.0,
},
.allow_win_drag = 1,
.wintitle = "mpv - ${?media-title:${media-title}}${!media-title:No file.}",

View File

@ -30,6 +30,7 @@ typedef struct mp_vo_opts {
struct m_geometry autofit;
struct m_geometry autofit_larger;
struct m_geometry autofit_smaller;
float window_scale;
int keepaspect;
int keepaspect_window;

View File

@ -90,6 +90,8 @@ void vo_calc_window_geometry(struct vo *vo, const struct mp_rect *screen,
int d_h = params.d_h;
if ((vo->driver->caps & VO_CAP_ROTATE90) && params.rotate % 180 == 90)
MPSWAP(int, d_w, d_h);
d_w = MPCLAMP(d_w * opts->window_scale, 1, 16000);
d_h = MPCLAMP(d_h * opts->window_scale, 1, 16000);
int scr_w = screen->x1 - screen->x0;
int scr_h = screen->y1 - screen->y0;