summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorKevin Mitchell <kevmitch@gmail.com>2014-11-05 18:16:32 -0800
committerKevin Mitchell <kevmitch@gmail.com>2014-11-07 01:14:03 -0800
commit351608e5ccb9314684d10bedf9025b1e872641e9 (patch)
tree5a6987ec1febf72015d4ade144780334b8e7d7a5 /player
parent83aab1d4be67fceb8c0cd27297cca086f1a9c3c5 (diff)
downloadmpv-351608e5ccb9314684d10bedf9025b1e872641e9.tar.bz2
mpv-351608e5ccb9314684d10bedf9025b1e872641e9.tar.xz
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.
Diffstat (limited to 'player')
-rw-r--r--player/command.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 451cb740a8..27ba3244a1 100644
--- a/player/command.c
+++ b/player/command.c
@@ -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);
}
+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,
int action, void *arg)
{
@@ -3182,6 +3206,7 @@ static const struct m_property mp_properties[] = {
M_PROPERTY_ALIAS("sub", "sid"),
{"window-minimized", mp_property_win_minimized},
+ {"display-names", mp_property_display_names},
{"mpv-version", mp_property_version},