command: add property returning hidpi scale

This commit is contained in:
wm4 2019-12-20 12:47:00 +01:00
parent 8448fe0b62
commit 8e620c8e76
3 changed files with 19 additions and 0 deletions

View File

@ -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.

View File

@ -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},

View File

@ -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*