summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-08-02 01:35:32 +0200
committerwm4 <wm4@nowhere>2014-08-02 01:53:21 +0200
commitbe337aa41567b6603ad5b017ff8add6a5f1e0bd8 (patch)
treebd8b34b7e6ede5dcb97cd5d8019102ddc5195bf3 /player/command.c
parent16e5ec88e11523ae8336344584b9e6fc8aa515c8 (diff)
downloadmpv-be337aa41567b6603ad5b017ff8add6a5f1e0bd8.tar.bz2
mpv-be337aa41567b6603ad5b017ff8add6a5f1e0bd8.tar.xz
command: add a property that returns a list of all properties
Also remove the undocumented Lua mp.property_list() function.
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/player/command.c b/player/command.c
index dee8729b04..df44df5f69 100644
--- a/player/command.c
+++ b/player/command.c
@@ -2623,6 +2623,30 @@ static int mp_property_options(void *ctx, struct m_property *prop,
return M_PROPERTY_NOT_IMPLEMENTED;
}
+static const struct m_property mp_properties[];
+
+static int mp_property_list(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ 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 **list = NULL;
+ int num = 0;
+ for (int n = 0; mp_properties[n].name; n++) {
+ MP_TARRAY_APPEND(NULL, list, num,
+ talloc_strdup(NULL, mp_properties[n].name));
+ }
+ MP_TARRAY_APPEND(NULL, list, num, NULL);
+ *(char ***)arg = list;
+ 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)}
@@ -2780,6 +2804,7 @@ static const struct m_property mp_properties[] = {
M_PROPERTY_ALIAS("sub", "sid"),
{"options", mp_property_options},
+ {"property-list", mp_property_list},
{0},
};
@@ -2809,11 +2834,6 @@ static const char *const *const mp_event_property_change[] = {
};
#undef E
-const struct m_property *mp_get_property_list(void)
-{
- return mp_properties;
-}
-
static bool is_property_set(int action, void *val)
{
switch (action) {