options: remove --vf-defaults and --af-defaults

These were deprecated a long time ago and apparently didn't even work
with lavfi filters. Go ahead and remove them and additionally clean up
some code related to them. m_config_from_obj_desc_and_args becomes much
simpler now and a couple of arguments can be completely removed.
This commit is contained in:
Dudemanguy 2023-09-19 23:51:51 -05:00
parent fb46666395
commit 177fe48d79
8 changed files with 8 additions and 41 deletions

View File

@ -84,6 +84,7 @@ Interface changes
- remove deprecated `--oaoffset`, `--oafirst`, `--ovoffset`, `--ovfirst`,
`--demuxer-force-retry-on-eof`, `--fit-border` options
- remove deprecated `--record-file` option
- remove deprecated `--vf-defaults` and `--af-defaults` options
--- mpv 0.36.0 ---
- add `--target-contrast`
- Target luminance value is now also applied when ICC profile is used.

View File

@ -19,8 +19,8 @@ syntax is:
The ``--vf`` description describes how libavfilter can be used and how to
workaround deprecated mpv filters.
See ``--vf`` group of options for info on how ``--af-defaults``, ``--af-add``,
``--af-pre``, ``--af-del``, ``--af-clr``, and possibly others work.
See ``--vf`` group of options for info on how ``--af-add``, ``--af-pre``,
``--af-del``, ``--af-clr``, and possibly others work.
Available filters are:

View File

@ -55,14 +55,6 @@ above in combination with the ``vf`` command (see `COMMAND INTERFACE`_) to get
more control over this. Initially disabled filters with ``!`` are useful for
this as well.
You can also set defaults for each filter. The defaults are applied before the
normal filter parameters. This is deprecated and never worked for the
libavfilter bridge.
``--vf-defaults=<filter1[=parameter1:parameter2:...],filter2,...>``
Set defaults for each filter. (Deprecated. ``--af-defaults`` is deprecated
as well.)
.. note::
To get a full list of available video filters, see ``--vf=help`` and

View File

@ -134,16 +134,13 @@ struct mp_filter *mp_create_user_filter(struct mp_filter *parent,
const char *name, char **args)
{
const struct m_obj_list *obj_list = NULL;
const char *defs_name = NULL;
enum mp_frame_type frame_type = 0;
if (type == MP_OUTPUT_CHAIN_VIDEO) {
frame_type = MP_FRAME_VIDEO;
obj_list = &vf_obj_list;
defs_name = "vf-defaults";
} else if (type == MP_OUTPUT_CHAIN_AUDIO) {
frame_type = MP_FRAME_AUDIO;
obj_list = &af_obj_list;
defs_name = "af-defaults";
}
assert(frame_type && obj_list);
@ -163,18 +160,9 @@ struct mp_filter *mp_create_user_filter(struct mp_filter *parent,
void *options = NULL;
if (desc.options) {
struct m_obj_settings *defs = NULL;
if (defs_name) {
mp_read_option_raw(parent->global, defs_name,
&m_option_type_obj_settings_list, &defs);
}
struct m_config *config =
m_config_from_obj_desc_and_args(NULL, parent->log, parent->global,
&desc, name, defs, args);
struct m_option dummy = {.type = &m_option_type_obj_settings_list};
m_option_free(&dummy, &defs);
&desc, args);
if (!config)
goto done;

View File

@ -168,18 +168,9 @@ static int m_config_set_obj_params(struct m_config *config, struct mp_log *log,
struct m_config *m_config_from_obj_desc_and_args(void *ta_parent,
struct mp_log *log, struct mpv_global *global, struct m_obj_desc *desc,
const char *name, struct m_obj_settings *defaults, char **args)
char **args)
{
struct m_config *config = m_config_from_obj_desc(ta_parent, log, global, desc);
for (int n = 0; defaults && defaults[n].name; n++) {
struct m_obj_settings *entry = &defaults[n];
if (name && strcmp(entry->name, name) == 0) {
if (m_config_set_obj_params(config, log, global, desc, entry->attribs) < 0)
goto error;
}
}
if (m_config_set_obj_params(config, log, global, desc, args) < 0)
goto error;

View File

@ -115,10 +115,9 @@ struct m_config *m_config_new(void *talloc_ctx, struct mp_log *log,
// different sub-options for every filter (represented by separate desc
// structs).
// args is an array of key/value pairs (args=[k0, v0, k1, v1, ..., NULL]).
// name/defaults is only needed for the legacy af-defaults/vf-defaults options.
struct m_config *m_config_from_obj_desc_and_args(void *ta_parent,
struct mp_log *log, struct mpv_global *global, struct m_obj_desc *desc,
const char *name, struct m_obj_settings *defaults, char **args);
char **args);
// Like m_config_from_obj_desc_and_args(), but don't allocate option the
// struct, i.e. m_config.optstruct==NULL. This is used by the sub-option

View File

@ -574,11 +574,7 @@ static const m_option_t mp_opts[] = {
// ------------------------- codec/vfilter options --------------------
{"af-defaults", OPT_SETTINGSLIST(af_defs, &af_obj_list),
.deprecation_message = "use --af + enable/disable flags"},
{"af", OPT_SETTINGSLIST(af_settings, &af_obj_list)},
{"vf-defaults", OPT_SETTINGSLIST(vf_defs, &vf_obj_list),
.deprecation_message = "use --vf + enable/disable flags"},
{"vf", OPT_SETTINGSLIST(vf_settings, &vf_obj_list)},
{"", OPT_SUBSTRUCT(filter_opts, filter_conf)},

View File

@ -299,8 +299,8 @@ typedef struct MPOpts {
int force_srate;
double playback_speed;
bool pitch_correction;
struct m_obj_settings *vf_settings, *vf_defs;
struct m_obj_settings *af_settings, *af_defs;
struct m_obj_settings *vf_settings;
struct m_obj_settings *af_settings;
struct filter_opts *filter_opts;
struct dec_wrapper_opts *dec_wrapper;
char **sub_name;