diff options
author | Niklas Haas <git@haasn.xyz> | 2019-10-04 18:45:37 +0200 |
---|---|---|
committer | Niklas Haas <github-c6e1c8@haasn.xyz> | 2019-10-04 21:34:22 +0200 |
commit | cb95ce75b5c114b6fd2c6b37ac6941b6848c8014 (patch) | |
tree | 8b5efcb27976dd475a867767c661ed9715a8112c /player | |
parent | 6064720011c7864bb97b4bb6dd2872246908c1c5 (diff) | |
download | mpv-cb95ce75b5c114b6fd2c6b37ac6941b6848c8014.tar.bz2 mpv-cb95ce75b5c114b6fd2c6b37ac6941b6848c8014.tar.xz |
options: rename --video-aspect to --video-aspect-override
The justification for this is the fact that the `video-aspect` property
doesn't work well with `cycle_values` commands that include the value
"-1".
The "video-aspect" property has effectively no change in behavior, but
we may want to make it read-only in the future. I think it's probably
fine to leave as-is, though.
Fixes #6068.
Diffstat (limited to 'player')
-rw-r--r-- | player/command.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/player/command.c b/player/command.c index 6e1fc94e8a..0b26e7c9a0 100644 --- a/player/command.c +++ b/player/command.c @@ -2739,11 +2739,27 @@ static int mp_property_vf_fps(void *ctx, struct m_property *prop, return m_property_double_ro(action, arg, 1.0 / avg); } -/// Video aspect (RO) +/// Video aspect (RW) (deprecated) +// FIXME: please delete this mess as soon as the deprecation period is over static int mp_property_aspect(void *ctx, struct m_property *prop, int action, void *arg) { MPContext *mpctx = ctx; + struct m_config_option *opt; + opt = m_config_get_co_raw(mpctx->mconfig, bstr0("video-aspect-override")); + + struct command_ctx *cmd = mpctx->command_ctx; + for (int n = 0; n < cmd->num_warned_deprecated; n++) { + if (strcmp(cmd->warned_deprecated[n], prop->name) == 0) + goto skip_warn; + } + + MP_WARN(mpctx, "Warning: property 'video-aspect' is deprecated, refer to " + "'video-params/aspect' and 'video-aspect-override'.\n"); + MP_TARRAY_APPEND(cmd, cmd->warned_deprecated, cmd->num_warned_deprecated, + (char *)prop->name); + +skip_warn: ; float aspect = mpctx->opts->movie_aspect; if (mpctx->vo_chain && aspect <= 0) { @@ -2762,6 +2778,9 @@ static int mp_property_aspect(void *ctx, struct m_property *prop, } switch (action) { + case M_PROPERTY_GET_TYPE: + *(struct m_option *)arg = *(opt->opt); + return M_PROPERTY_OK; case M_PROPERTY_PRINT: { if (mpctx->opts->movie_aspect < 0) { *(char **)arg = talloc_asprintf(NULL, "%.3f (original)", aspect); @@ -2773,8 +2792,14 @@ static int mp_property_aspect(void *ctx, struct m_property *prop, *(float *)arg = aspect; return M_PROPERTY_OK; } + case M_PROPERTY_SET: { + int flags = M_SETOPT_RUNTIME; + if (m_config_set_option_raw_direct(mpctx->mconfig, opt, arg, flags) < 0) + return M_PROPERTY_ERROR; + return M_PROPERTY_OK; + } } - return mp_property_generic_option(mpctx, prop, action, arg); + return M_PROPERTY_NOT_IMPLEMENTED; } /// Selected subtitles (RW) |