summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDudemanguy <random342@airmail.cc>2021-08-09 08:51:50 -0500
committerDudemanguy <random342@airmail.cc>2021-08-09 16:33:39 +0000
commit77f2fd97f89c93be6595dde29b86384047f05ba2 (patch)
treee8b18347d40a8e4373cdeb2845f064ef7e202610
parent8d4f10fcc0837573a54ccc1f3c9951fa2bedd6ed (diff)
downloadmpv-77f2fd97f89c93be6595dde29b86384047f05ba2.tar.bz2
mpv-77f2fd97f89c93be6595dde29b86384047f05ba2.tar.xz
command: merge window-scale code together
Based on a small patch originally written by @avih. Instead of duplicating the window-scale logic in update_window_scale, just call the mp_property_current_window_scale function with the M_PROPERTY_SET action and a NULL property.
-rw-r--r--player/command.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/player/command.c b/player/command.c
index 02a008ef57..d703c39afe 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2331,6 +2331,7 @@ static int mp_property_current_window_scale(void *ctx, struct m_property *prop,
return M_PROPERTY_UNAVAILABLE;
if (action == M_PROPERTY_SET) {
+ // Also called by update_window_scale as a NULL property.
double scale = *(double *)arg;
int s[2] = {vid_w * scale, vid_h * scale};
if (s[0] <= 0 || s[1] <= 0)
@@ -2351,20 +2352,9 @@ static int mp_property_current_window_scale(void *ctx, struct m_property *prop,
static void update_window_scale(struct MPContext *mpctx)
{
- struct vo *vo = mpctx->video_out;
- if (!vo)
- return;
-
- struct mp_image_params params = get_video_out_params(mpctx);
- int vid_w, vid_h;
- mp_image_params_get_dsize(&params, &vid_w, &vid_h);
- if (vid_w < 1 || vid_h < 1)
- return;
-
double scale = mpctx->opts->vo->window_scale;
- int s[2] = {vid_w * scale, vid_h * scale};
- if (s[0] > 0 && s[1] > 0)
- vo_control(vo, VOCTRL_SET_UNFS_WINDOW_SIZE, s);
+ mp_property_current_window_scale(mpctx, (struct m_property *)NULL,
+ M_PROPERTY_SET, (void*)&scale);
}
static int mp_property_display_fps(void *ctx, struct m_property *prop,