Skip to content

Commit

Permalink
options: remove --vf-defaults and --af-defaults
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Dudemanguy committed Sep 20, 2023
1 parent 73d1b58 commit 40a9af3
Show file tree
Hide file tree
Showing 7 changed files with 7 additions and 41 deletions.
4 changes: 2 additions & 2 deletions DOCS/man/af.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
8 changes: 0 additions & 8 deletions DOCS/man/vf.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 1 addition & 13 deletions filters/user_filters.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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;
Expand Down
11 changes: 1 addition & 10 deletions options/m_config_frontend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
3 changes: 1 addition & 2 deletions options/m_config_frontend.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 0 additions & 4 deletions options/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)},
Expand Down
4 changes: 2 additions & 2 deletions options/options.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 40a9af3

Please sign in to comment.