diff options
author | wm4 <wm4@nowhere> | 2016-08-28 19:42:03 +0200 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2016-08-28 19:46:54 +0200 |
commit | f42e4374d55a3b68b0c4fcb342d9cdcd5d15c9c7 (patch) | |
tree | d5fd210634c38901cb5eaf97b8313647520a53b6 /player | |
parent | a9a55ea7f28894d9e72be5e8b2d5a9331f1e7be4 (diff) | |
download | mpv-f42e4374d55a3b68b0c4fcb342d9cdcd5d15c9c7.tar.bz2 mpv-f42e4374d55a3b68b0c4fcb342d9cdcd5d15c9c7.tar.xz |
command: export profile list as a property
Targeted at scripts, which can do whatever they want with it. This comes
with the promise that they could get randomly broken any time.
See #977.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c index d0e69834aa..e725f2f529 100644 --- a/player/command.c +++ b/player/command.c @@ -3668,6 +3668,22 @@ static int mp_property_list(void *ctx, struct m_property *prop, return M_PROPERTY_NOT_IMPLEMENTED; } +static int mp_profile_list(void *ctx, struct m_property *prop, + int action, void *arg) +{ + MPContext *mpctx = ctx; + switch (action) { + case M_PROPERTY_GET_TYPE: + *(struct m_option *)arg = (struct m_option){.type = CONF_TYPE_NODE}; + return M_PROPERTY_OK; + case M_PROPERTY_GET: { + *(struct mpv_node *)arg = m_config_get_profiles(mpctx->mconfig); + return M_PROPERTY_OK; + } + } + return M_PROPERTY_NOT_IMPLEMENTED; +} + // Redirect a property name to another #define M_PROPERTY_ALIAS(name, real_property) \ {(name), mp_property_alias, .priv = (real_property)} @@ -3911,6 +3927,7 @@ static const struct m_property mp_properties[] = { {"file-local-options", mp_property_local_options}, {"option-info", mp_property_option_info}, {"property-list", mp_property_list}, + {"profile-list", mp_profile_list}, // compatibility M_PROPERTY_ALIAS("video", "vid"), |