From 13afc2150beeb1117e9c1724b2910e41ee4cc28b Mon Sep 17 00:00:00 2001 From: wm4 Date: Mon, 25 Nov 2019 01:16:03 +0100 Subject: command: change af/vf property behavior wrt. filter creation failures The behavior is slightly different in a messy way. The change is in line with the option-to-property bridge removal mentioned some commits ago and thus is deemed necessary. --- DOCS/interface-changes.rst | 4 ++++ DOCS/man/input.rst | 14 ++++++++------ player/command.c | 13 +++++++------ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst index 0e9ca4998a..a33bfd8be2 100644 --- a/DOCS/interface-changes.rst +++ b/DOCS/interface-changes.rst @@ -47,6 +47,10 @@ Interface changes property now is unavailable if no VO exists (or the VO did not return a display FPS), instead of returning the option value in this case. The property will keep existing, but writing to it is deprecated. + - the vf/af properties now do not reject the set value anymore, even if + filter chain initialization fails. Instead, the vf/af options are always + set to the user's value, even if it does not reflect the "runtime" vf/af + chain. --- mpv 0.30.0 --- - add `--d3d11-output-format` to enable explicit selection of a D3D11 swap chain format. diff --git a/DOCS/man/input.rst b/DOCS/man/input.rst index a098de99e2..ced5363ea1 100644 --- a/DOCS/man/input.rst +++ b/DOCS/man/input.rst @@ -2708,12 +2708,13 @@ caveats with some properties (due to historical reasons): ``vf``, ``af`` If you set the properties during playback, and the filter chain fails to - reinitialize, the new value will be rejected. Setting the option or - setting the property outside of playback will always succeed/fail in the - same way. Also, there are no ``vf-add`` etc. properties, but you can use - the ``vf``/``af`` group of commands to achieve the same. + reinitialize, the option will be set, but the runtime filter chain does not + change. On the other hand, the next video to be played will fail, because + the initial filter chain cannot be created. - Option changes at runtime are affected by this as well. + This behavior changed in mpv 0.31.0. Before this, the new value was rejected + *iff* video (for ``vf``) or audio (for ``af``) was active. If playback was + not active, the behavior was the same as the current behavior. ``edition`` While a file is loaded, the property will always return the effective @@ -2726,7 +2727,8 @@ caveats with some properties (due to historical reasons): uses, you should use the ``loadlist`` command instead. ``window-scale`` - Might verify the set value when setting while a window is created. + Returns the current window values if a window exists, and the option value + otherwise. ``profile``, ``include`` These are write-only, and will perform actions as they are written to, diff --git a/player/command.c b/player/command.c index e7471e47fd..74db80e7b9 100644 --- a/player/command.c +++ b/player/command.c @@ -2989,17 +2989,12 @@ static char *print_obj_osd_list(struct m_obj_settings *list) static int property_filter(struct m_property *prop, int action, void *arg, MPContext *mpctx, enum stream_type mt) { - switch (action) { - case M_PROPERTY_PRINT: { + if (action == M_PROPERTY_PRINT) { struct m_config_option *opt = m_config_get_co(mpctx->mconfig, bstr0(prop->name)); *(char **)arg = print_obj_osd_list(*(struct m_obj_settings **)opt->data); return M_PROPERTY_OK; } - case M_PROPERTY_SET: - return set_filters(mpctx, mt, *(struct m_obj_settings **)arg) >= 0 - ? M_PROPERTY_OK : M_PROPERTY_ERROR; - } return mp_property_generic_option(mpctx, prop, action, arg); } @@ -6314,6 +6309,12 @@ void mp_option_change_callback(void *ctx, struct m_config_option *co, int flags) if (opt_ptr == &opts->record_file) open_recorder(mpctx, false); + + if (opt_ptr == &opts->vf_settings) + set_filters(mpctx, STREAM_VIDEO, opts->vf_settings); + + if (opt_ptr == &opts->af_settings) + set_filters(mpctx, STREAM_AUDIO, opts->af_settings); } void mp_notify_property(struct MPContext *mpctx, const char *property) -- cgit v1.2.3