summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-10-04 13:19:21 +0200
committerwm4 <wm4@nowhere>2016-10-04 13:23:11 +0200
commit75cab315ea3b6bb8858368f5df504dec0e683967 (patch)
treeb346fb4fc8d27382240d4b8b785a8b31ddb82a11 /player
parentba3f6f3779ff12a80e61b4e95d8e70f666b6c4e0 (diff)
downloadmpv-75cab315ea3b6bb8858368f5df504dec0e683967.tar.bz2
mpv-75cab315ea3b6bb8858368f5df504dec0e683967.tar.xz
command: include deprecated/aliased options in property bridge
If we really want client API users to use mpv_set_property() instead of mpv_set_option(), then compatibility handling of deprecated options should be included. Otherwise, there's the danger that client API users either break too early (and without a warning), or mpv_set_option() will continue to have a reason to exist.
Diffstat (limited to 'player')
-rw-r--r--player/command.c46
1 files changed, 28 insertions, 18 deletions
diff --git a/player/command.c b/player/command.c
index b502080ed5..468a1cc901 100644
--- a/player/command.c
+++ b/player/command.c
@@ -4046,11 +4046,6 @@ static const struct m_property mp_properties_base[] = {
// conflicts with option
M_PROPERTY_DEPRECATED_ALIAS("audio-format", "audio-codec-name"),
-
- M_PROPERTY_DEPRECATED_ALIAS("ass-style-override", "sub-ass-style-override"),
- M_PROPERTY_DEPRECATED_ALIAS("ass-use-margins", "sub-ass-use-margins"),
- M_PROPERTY_DEPRECATED_ALIAS("ass-vsfilter-aspect-compat",
- "sub-ass-vsfilter-aspect-compat"),
};
// Each entry describes which properties an event (possibly) changes.
@@ -5603,26 +5598,41 @@ void command_init(struct MPContext *mpctx)
for (int n = 0; n < num_opts; n++) {
struct m_config_option *co = m_config_get_co_index(mpctx->mconfig, n);
assert(co->name[0]);
- if (!co->data || (co->opt->flags & M_OPT_NOPROP) ||
+ if ((co->opt->flags & M_OPT_NOPROP) ||
(co->opt->type->flags & M_OPT_TYPE_HAS_CHILD))
continue;
- struct m_property prop = {
- .name = co->name,
- .call = mp_property_generic_option,
- };
+ struct m_property prop = {0};
+
+ if (co->data) {
+ prop = (struct m_property){
+ .name = co->name,
+ .call = mp_property_generic_option,
+ };
- bstr bname = bstr0(prop.name);
- if (bstr_eatend0(&bname, "*")) {
- prop.name = bstrto0(ctx, bname);
- prop.call = mp_property_generic_option_star;
+ bstr bname = bstr0(prop.name);
+ if (bstr_eatend0(&bname, "*")) {
+ prop.name = bstrto0(ctx, bname);
+ prop.call = mp_property_generic_option_star;
+ }
+ } else if (co->opt->type == &m_option_type_alias) {
+ const char *alias = (const char *)co->opt->priv;
+
+ prop = (struct m_property){
+ .name = co->name,
+ .call = co->opt->deprecation_message ?
+ mp_property_deprecated_alias : mp_property_alias,
+ .priv = (void *)alias,
+ };
}
- // The option might be covered by a manual property already.
- if (m_property_list_find(ctx->properties, prop.name))
- continue;
+ if (prop.name) {
+ // The option might be covered by a manual property already.
+ if (m_property_list_find(ctx->properties, prop.name))
+ continue;
- ctx->properties[count++] = prop;
+ ctx->properties[count++] = prop;
+ }
}
}