m_option: change confusing error messages for obj_settings_list

This option type is not used only by filter options: they're already
used by --ao, --vo, and --gpu-context. Replace the mentions of
"filter" to "item" instead, and changes some languages to improve clarity.

Also change the documentation on "Filter options" to describe what it
really is, and fix a typo.
This commit is contained in:
nanahi 2024-04-16 14:13:56 -04:00 committed by Kacper Michajłow
parent e968a505d6
commit 750dec880c
2 changed files with 21 additions and 20 deletions

View File

@ -557,7 +557,7 @@ Suffix Meaning
-pre Prepend 1 or more items (same syntax as -set)
-clr Clear the option (remove all items)
-remove Delete item if present (does not interpret escapes)
-toggle Append an item, or remove if if it already exists (no escapes)
-toggle Append an item, or remove it if it already exists (no escapes)
============= ===============================================
``-append`` is meant as a simple way to append a single item without having
@ -591,23 +591,24 @@ appropriate structured data type.
Prior to mpv 0.33, ``:`` was also recognized as separator by ``-set``.
Filter options
~~~~~~~~~~~~~~
Object settings list options
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
This is a very complex option type for the ``--af`` and ``--vf`` options only.
They often require complicated escaping. See `VIDEO FILTERS`_ for details. They
support the following operations:
This is a very complex option type for some options, such as ``--af`` and ``--vf``.
They often require complicated escaping. See `VIDEO FILTERS`_ for details.
They support the following operations:
============= ===============================================
Suffix Meaning
============= ===============================================
-set Set a list of filters (using ``,`` as separator)
-append Append single filter
-add Append 1 or more filters (same syntax as -set)
-pre Prepend 1 or more filters (same syntax as -set)
-clr Clear the option (remove all filters)
-remove Delete filter if present
-toggle Append a filter, or remove if if it already exists
-set Set a list of items (using ``,`` as separator)
-append Append single item
-add Append 1 or more items (same syntax as -set)
-pre Prepend 1 or more items (same syntax as -set)
-clr Clear the option (remove all items)
-remove Delete item if present
-toggle Append an item, or remove it if it already exists
-help Pseudo operation that prints a help text to the terminal
============= ===============================================

View File

@ -3166,7 +3166,7 @@ print_help: ;
} else if (list->print_unknown_entry_help) {
list->print_unknown_entry_help(log, mp_tprintf(80, "%.*s", BSTR_P(name)));
} else {
mp_warn(log, "Option %.*s: item %.*s doesn't exist.\n",
mp_warn(log, "Option %.*s: item '%.*s' isn't supported.\n",
BSTR_P(opt_name), BSTR_P(name));
}
r = M_OPT_EXIT;
@ -3221,7 +3221,7 @@ static int parse_obj_settings(struct mp_log *log, struct bstr opt, int op,
int idx = bstrspn(*pstr, NAMECH);
str = bstr_splice(*pstr, 0, idx);
if (!str.len) {
mp_err(log, "Option %.*s: filter name expected.\n", BSTR_P(opt));
mp_err(log, "Option %.*s: item name expected.\n", BSTR_P(opt));
return M_OPT_INVALID;
}
*pstr = bstr_cut(*pstr, idx);
@ -3238,7 +3238,7 @@ static int parse_obj_settings(struct mp_log *log, struct bstr opt, int op,
char name[80];
snprintf(name, sizeof(name), "%.*s", BSTR_P(str));
if (list->check_unknown_entry && !list->check_unknown_entry(name)) {
mp_err(log, "Option %.*s: %.*s doesn't exist.\n",
mp_err(log, "Option %.*s: '%.*s' isn't supported.\n",
BSTR_P(opt), BSTR_P(str));
return M_OPT_INVALID;
}
@ -3332,15 +3332,15 @@ static int parse_obj_settings_list(struct mp_log *log, const m_option_t *opt,
" %s-set\n"
" Overwrite the old list with the given list\n\n"
" %s-append\n"
" Append the given filter to the current list\n\n"
" Append the given item to the current list\n\n"
" %s-add\n"
" Append the given list to the current list\n\n"
" %s-pre\n"
" Prepend the given list to the current list\n\n"
" %s-remove\n"
" Remove the given filter from the current list\n\n"
" Remove the given item from the current list\n\n"
" %s-toggle\n"
" Add the filter to the list, or remove it if it's already added.\n\n"
" Add the item to the list, or remove it if it's already added.\n\n"
" %s-clr\n"
" Clear the current list.\n\n",
opt->name, opt->name, opt->name, opt->name, opt->name,
@ -3420,7 +3420,7 @@ static int parse_obj_settings_list(struct mp_log *log, const m_option_t *opt,
if (op != OP_NONE && res && res[0].name && res[1].name) {
if (op == OP_APPEND) {
mp_err(log, "Option %.*s: -append takes only 1 filter (no ',').\n",
mp_err(log, "Option %.*s: -append takes only 1 item (no ',').\n",
BSTR_P(name));
free_obj_settings_list(&res);
return M_OPT_INVALID;