summaryrefslogtreecommitdiffstats
path: root/player/command.c
diff options
context:
space:
mode:
Diffstat (limited to 'player/command.c')
-rw-r--r--player/command.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/player/command.c b/player/command.c
index 8576e36da7..32e4e3dfea 100644
--- a/player/command.c
+++ b/player/command.c
@@ -102,6 +102,12 @@ struct command_ctx {
struct ao_hotplug *hotplug;
struct mp_cmd_ctx *cache_dump_cmd; // in progress cache dumping
+
+ char **script_props;
+};
+
+static const struct m_option script_props_type = {
+ .type = &m_option_type_keyvalue_list
};
struct overlay {
@@ -3217,6 +3223,27 @@ static int mp_property_bindings(void *ctx, struct m_property *prop,
return M_PROPERTY_NOT_IMPLEMENTED;
}
+
+static int mp_property_script_props(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ struct command_ctx *cmd = mpctx->command_ctx;
+ switch (action) {
+ case M_PROPERTY_GET_TYPE:
+ *(struct m_option *)arg = script_props_type;
+ return M_PROPERTY_OK;
+ case M_PROPERTY_GET:
+ m_option_copy(&script_props_type, arg, &cmd->script_props);
+ return M_PROPERTY_OK;
+ case M_PROPERTY_SET:
+ m_option_copy(&script_props_type, &cmd->script_props, arg);
+ mp_notify_property(mpctx, prop->name);
+ 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)}
@@ -3391,6 +3418,8 @@ static const struct m_property mp_properties_base[] = {
{"command-list", mp_property_commands},
{"input-bindings", mp_property_bindings},
+ {"shared-script-properties", mp_property_script_props},
+
M_PROPERTY_ALIAS("video", "vid"),
M_PROPERTY_ALIAS("audio", "aid"),
M_PROPERTY_ALIAS("sub", "sid"),
@@ -5856,6 +5885,8 @@ void command_uninit(struct MPContext *mpctx)
overlay_uninit(mpctx);
ao_hotplug_destroy(ctx->hotplug);
+ m_option_free(&script_props_type, &ctx->script_props);
+
talloc_free(mpctx->command_ctx);
mpctx->command_ctx = NULL;
}