summaryrefslogtreecommitdiffstats
path: root/player
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
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')
-rw-r--r--player/command.c30
-rw-r--r--player/command.h3
-rw-r--r--player/lua.c13
3 files changed, 25 insertions, 21 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) {
diff --git a/player/command.h b/player/command.h
index c9a07ff733..2f9770b714 100644
--- a/player/command.h
+++ b/player/command.h
@@ -33,9 +33,6 @@ void property_print_help(struct mp_log *log);
int mp_property_do(const char* name, int action, void* val,
struct MPContext *mpctx);
-const struct m_property *mp_get_property_list(void);
-int mp_find_property_index(const char *property);
-
void mp_notify(struct MPContext *mpctx, int event, void *arg);
void mp_notify_property(struct MPContext *mpctx, const char *property);
diff --git a/player/lua.c b/player/lua.c
index 81a6363d2a..ce0de907a5 100644
--- a/player/lua.c
+++ b/player/lua.c
@@ -699,18 +699,6 @@ static int script_set_property_native(lua_State *L)
}
-static int script_property_list(lua_State *L)
-{
- const struct m_property *props = mp_get_property_list();
- lua_newtable(L);
- for (int i = 0; props[i].name; i++) {
- lua_pushinteger(L, i + 1);
- lua_pushstring(L, props[i].name);
- lua_settable(L, -3);
- }
- return 1;
-}
-
static int script_get_property(lua_State *L)
{
struct script_ctx *ctx = get_ctx(L);
@@ -1099,7 +1087,6 @@ static const struct fn_entry main_fns[] = {
FN_ENTRY(set_property_native),
FN_ENTRY(raw_observe_property),
FN_ENTRY(raw_unobserve_property),
- FN_ENTRY(property_list),
FN_ENTRY(set_osd_ass),
FN_ENTRY(get_osd_resolution),
FN_ENTRY(get_screen_size),