summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2019-12-20 12:47:00 +0100
committerwm4 <wm4@nowhere>2019-12-20 13:00:39 +0100
commit8e620c8e76ec0b8b5b5a0581f3f581cdf86923a4 (patch)
treee8569ca1122da5ec15c1da8ef5e475efb89b8225
parent8448fe0b62a4abfaab593d5e455fa259b1d79407 (diff)
downloadmpv-8e620c8e76ec0b8b5b5a0581f3f581cdf86923a4.tar.bz2
mpv-8e620c8e76ec0b8b5b5a0581f3f581cdf86923a4.tar.xz
command: add property returning hidpi scale
-rw-r--r--DOCS/man/input.rst6
-rw-r--r--player/command.c12
-rw-r--r--video/out/vo.h1
3 files changed, 19 insertions, 0 deletions
diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst
index 94e1f2fd27..d3e49fc83d 100644
--- a/DOCS/man/input.rst
+++ b/DOCS/man/input.rst
@@ -2073,6 +2073,12 @@ Property list
``vsync-jitter``
Estimated deviation factor of the vsync duration.
+``display-hidpi-scale``
+ The HiDPI scale factor as reported by the windowing backend. If no VO is
+ active, or if the VO does not report a value, this property is unavailable.
+ It may be saner to report an absolute DPI, however, this is the way HiDPI
+ support is implemented on most OS APIs. See also ``--hidpi-window-scale``.
+
``video-aspect`` (RW)
Deprecated. This is tied to ``--video-aspect-override``, but always
reports the current video aspect if video is active.
diff --git a/player/command.c b/player/command.c
index ea6e3bb76c..8b41631b4b 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2325,6 +2325,17 @@ static int mp_property_vsync_jitter(void *ctx, struct m_property *prop,
return m_property_double_ro(action, arg, stddev);
}
+static int mp_property_hidpi_scale(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ struct vo *vo = mpctx->video_out;
+ double scale = 0;
+ if (!vo || vo_control(vo, VOCTRL_GET_HIDPI_SCALE, &scale) < 1 || scale <= 0)
+ return M_PROPERTY_UNAVAILABLE;
+ return m_property_double_ro(action, arg, scale);
+}
+
static int mp_property_display_names(void *ctx, struct m_property *prop,
int action, void *arg)
{
@@ -3398,6 +3409,7 @@ static const struct m_property mp_properties_base[] = {
{"display-fps", mp_property_display_fps},
{"estimated-display-fps", mp_property_estimated_display_fps},
{"vsync-jitter", mp_property_vsync_jitter},
+ {"display-hidpi-scale", mp_property_hidpi_scale},
{"working-directory", mp_property_cwd},
diff --git a/video/out/vo.h b/video/out/vo.h
index f50df6c179..a05860cbc7 100644
--- a/video/out/vo.h
+++ b/video/out/vo.h
@@ -116,6 +116,7 @@ enum mp_voctrl {
VOCTRL_GET_ICC_PROFILE, // bstr*
VOCTRL_GET_AMBIENT_LUX, // int*
VOCTRL_GET_DISPLAY_FPS, // double*
+ VOCTRL_GET_HIDPI_SCALE, // double*
VOCTRL_GET_PREF_DEINT, // int*