From 5841685e09dd1ae92de6adf20f3dc1f23fcda750 Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 18 May 2014 00:03:47 +0200 Subject: command: add a disc-menu-active property Returns whether a DVD/BD menu is active. As requested by #788. --- player/command.c | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'player/command.c') diff --git a/player/command.c b/player/command.c index 512f2b478a..fd0f589053 100644 --- a/player/command.c +++ b/player/command.c @@ -512,6 +512,15 @@ static int mp_property_disc_title(m_option_t *prop, int action, void *arg, } } +static int mp_property_disc_menu(m_option_t *prop, int action, void *arg, + MPContext *mpctx) +{ + int state = mp_nav_in_menu(mpctx); + if (state < 0) + return M_PROPERTY_UNAVAILABLE; + return m_property_int_ro(prop, action, arg, !!state); +} + /// Current chapter (RW) static int mp_property_chapter(m_option_t *prop, int action, void *arg, MPContext *mpctx) @@ -2359,6 +2368,8 @@ static const m_option_t mp_properties[] = { { "time-remaining", mp_property_remaining, CONF_TYPE_TIME }, { "playtime-remaining", mp_property_playtime_remaining, CONF_TYPE_TIME }, { "disc-title", mp_property_disc_title, CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL }, + { "disc-menu-active", mp_property_disc_menu, CONF_TYPE_FLAG, + M_OPT_RANGE, 0, 1, NULL }, { "chapter", mp_property_chapter, CONF_TYPE_INT, M_OPT_MIN, -1, 0, NULL }, M_OPTION_PROPERTY_CUSTOM("edition", mp_property_edition), -- cgit v1.2.3