0
0
mirror of https://github.com/mpv-player/mpv.git synced 2024-09-20 20:03:10 +02:00

command: add display-names property

Call VOCTRL_GET_DISPLAY_NAMES it when the property is
requested. The vo should return the names of the displays that the mpv
window is covering.  For example, with x11 vos, xrandr names LVDS1,
HDMI1, etc.
This commit is contained in:
Kevin Mitchell 2014-11-05 18:16:32 -08:00
parent 83aab1d4be
commit 351608e5cc
2 changed files with 29 additions and 0 deletions

View File

@ -1118,6 +1118,10 @@ Property list
``window-minimized`` ``window-minimized``
Return whether the video window is minimized or not. Return whether the video window is minimized or not.
``display-names``
Names of the displays that the mpv window covers. On X11, these
are the xrandr names (LVDS1, HDMI1, DP1, VGA1, etc.).
``video-aspect`` (RW) ``video-aspect`` (RW)
Video aspect, see ``--video-aspect``. Video aspect, see ``--video-aspect``.

View File

@ -2460,6 +2460,30 @@ static int mp_property_win_minimized(void *ctx, struct m_property *prop,
return m_property_flag_ro(action, arg, state & VO_WIN_STATE_MINIMIZED); return m_property_flag_ro(action, arg, state & VO_WIN_STATE_MINIMIZED);
} }
static int mp_property_display_names(void *ctx, struct m_property *prop,
int action, void *arg)
{
MPContext *mpctx = ctx;
struct vo *vo = mpctx->video_out;
if (!vo)
return M_PROPERTY_UNAVAILABLE;
switch (action) {
case M_PROPERTY_GET_TYPE:
*(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_STRING_LIST};
return M_PROPERTY_OK;
case M_PROPERTY_GET: {
char** display_names;
if (vo_control(vo, VOCTRL_GET_DISPLAY_NAMES, &display_names) < 1)
return M_PROPERTY_UNAVAILABLE;
*(char ***)arg = display_names;
return M_PROPERTY_OK;
}
}
return M_PROPERTY_NOT_IMPLEMENTED;
}
static int mp_property_vo_configured(void *ctx, struct m_property *prop, static int mp_property_vo_configured(void *ctx, struct m_property *prop,
int action, void *arg) int action, void *arg)
{ {
@ -3182,6 +3206,7 @@ static const struct m_property mp_properties[] = {
M_PROPERTY_ALIAS("sub", "sid"), M_PROPERTY_ALIAS("sub", "sid"),
{"window-minimized", mp_property_win_minimized}, {"window-minimized", mp_property_win_minimized},
{"display-names", mp_property_display_names},
{"mpv-version", mp_property_version}, {"mpv-version", mp_property_version},