summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-07-02 16:26:41 +0200
committerwm4 <wm4@nowhere>2017-07-02 16:29:45 +0200
commite4bc563fd2dcff1059624efb7b948b2886a382ab (patch)
tree272d96d980aca685e92083f3097c7eed418e4860
parentd24f4587a7cb85e559b06d7a191bb28bbdbf52ad (diff)
downloadmpv-e4bc563fd2dcff1059624efb7b948b2886a382ab.tar.bz2
mpv-e4bc563fd2dcff1059624efb7b948b2886a382ab.tar.xz
options: change everything again
Fucking bullshit.
-rw-r--r--DOCS/interface-changes.rst12
-rw-r--r--DOCS/man/mpv.rst9
-rw-r--r--DOCS/man/options.rst43
-rw-r--r--options/m_config.c29
-rw-r--r--options/m_option.c33
-rw-r--r--options/m_option.h10
-rw-r--r--options/options.c21
-rw-r--r--player/command.c49
-rw-r--r--video/out/opengl/video.c8
-rw-r--r--video/out/opengl/video.h1
10 files changed, 135 insertions, 80 deletions
diff --git a/DOCS/interface-changes.rst b/DOCS/interface-changes.rst
index 9bdc251eaf..1d0f89a09e 100644
--- a/DOCS/interface-changes.rst
+++ b/DOCS/interface-changes.rst
@@ -40,12 +40,14 @@ Interface changes
- the deprecated handling of setting "no-" options via client API is dropped
- the following options change to append-by-default (and possibly separator):
--script
- --audio-file-paths
- --sub-paths
also, the following options are deprecated:
- --audio-file-paths => --audio-file-path
- --sub-paths => --sub-file-path
- --opengl-shaders => --opengl-shader
+ --sub-paths => --sub-file-paths
+ the following options are deprecated for setting via API:
+ "script" (use "scripts")
+ "sub-file" (use "sub-files")
+ "audio-file" (use "audio-files")
+ "external-file" (use "external-files")
+ (the compatibility hacks for this will be removed after this release)
- remove property `vo-performance`, and add `vo-passes` as a more general
replacement
--- mpv 0.25.0 ---
diff --git a/DOCS/man/mpv.rst b/DOCS/man/mpv.rst
index 9befe435da..fc36b7246c 100644
--- a/DOCS/man/mpv.rst
+++ b/DOCS/man/mpv.rst
@@ -429,8 +429,8 @@ Options for filenames do not use ``,`` as separator, but ``:`` (Unix) or ``;``
============= ===============================================
Suffix Meaning
============= ===============================================
--add Append 1 or more items
--add-str Append single item (avoids need for escaping)
+-add Append 1 or more items (may become alias for -append)
+-append Append single item (avoids need for escaping)
-clr Clear the option
-del Delete an existing item by integer index
-pre Prepend 1 or more items
@@ -442,8 +442,9 @@ this is strongly discouraged and deprecated, except for ``-set``.
Without suffix, the action taken is normally ``-set``.
-Some options (like ``--sub-file``, ``--audio-file``, ``--opengl-shader``) append
-one file per option use. Their default action is ``-add-str``.
+Some options (like ``--sub-file``, ``--audio-file``, ``--opengl-shader``) are
+aliases for the proper option with ``-append`` action. For example,
+``--sub-file`` is an alias for ``--sub-files-append``.
Playing DVDs
------------
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index c1fc4d96dc..a7ec35b3ae 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -67,7 +67,7 @@ Track Selection
stream index is relatively arbitrary, but useful when interacting with
other software using FFmpeg (consider ``ffprobe``).
- Note that with external tracks (added with ``--sub-file`` and similar
+ Note that with external tracks (added with ``--sub-files`` and similar
options), there will be streams with duplicate IDs. In this case, the
first stream in order is selected.
@@ -1362,13 +1362,16 @@ Audio
This option has no influence on files with normal video tracks.
-``--audio-file=<filename>``
- Play audio from an external file while viewing a video. Each use of this
- option will add a new audio track. The details are similar to how
- ``--sub-file`` works.
+``--audio-files=<files>``
+ Play audio from an external file while viewing a video.
This is a list option. See `List Options`_ for details.
+``--audio-file=<file>``
+ CLI/config file only alias for ``--audio-files-append``. Each use of this
+ option will add a new audio track. The details are similar to how
+ ``--sub-file`` works.
+
``--audio-format=<format>``
Select the sample format used for output from the audio filter layer to
the sound card. The values that ``<format>`` can adopt are listed below in
@@ -1439,10 +1442,7 @@ Audio
directories.
``--audio-file-paths=<path1:path2:...>``
- Deprecated, use ``--audio-file-path``.
-
-``--audio-file-path=path1>``
- Equivalent to ``--sub-file-path`` option, but for auto-loaded audio files.
+ Equivalent to ``--sub-file-paths`` option, but for auto-loaded audio files.
``--audio-client-name=<name>``
The application name the player reports to the audio API. Can be useful
@@ -1505,7 +1505,7 @@ Subtitles
``--sub-delay=<sec>``
Delays subtitles by ``<sec>`` seconds. Can be negative.
-``--sub-file=subtitlefile``
+``--sub-files=<file-list>``
Add a subtitle file to the list of external subtitles.
If you use ``--sub-file`` only once, this subtitle file is displayed by
@@ -1861,9 +1861,9 @@ Subtitles
Never applied to text subtitles.
``--sub-paths=<path1:path2:...>``
- Deprecated, use ``--sub-file-path``.
+ Deprecated, use ``--sub-file-paths``.
-``--sub-file-path=path``
+``--sub-file-paths=<path-list>``
Specify extra directories to search for subtitles matching the video.
Multiple directories can be separated by ":" (";" on Windows).
Paths can be relative or absolute. Relative paths are interpreted relative
@@ -1874,7 +1874,7 @@ Subtitles
.. admonition:: Example
Assuming that ``/path/to/video/video.avi`` is played and
- ``--sub-file-path=sub --sub-file-path=subtitles`` is specified, mpv
+ ``--sub-file-paths=sub:subtitles`` is specified, mpv
searches for subtitle files in these directories:
- ``/path/to/video/``
@@ -4167,7 +4167,7 @@ The following video options are currently all specific to ``--vo=opengl`` and
results, as can missing or incorrect display FPS information (see
``--display-fps``).
-``--opengl-shader=<file>``
+``--opengl-shaders=<file-list>``
Custom GLSL hooks. These are a flexible way to add custom fragment shaders,
which can be injected at almost arbitrary points in the rendering pipeline,
and access all previous intermediate textures. Each use of the option will
@@ -4333,9 +4333,8 @@ The following video options are currently all specific to ``--vo=opengl`` and
pass. When overwriting a texture marked ``fixed``, the WIDTH, HEIGHT and
OFFSET must be left at their default values.
-``--opengl-shaders=<files>``
- Deprecated option for ``--opengl-shader``. Command line parsing behaves
- slightly diffent. ``--opengl-shader-set`` gives exactly the same behavior.
+``--opengl-shader=<file>``
+ CLI/config file only alias for ``--opengl-shaders-append``.
``--deband``
Enable the debanding algorithm. This greatly reduces the amount of visible
@@ -5010,24 +5009,28 @@ Miscellaneous
for scripts which want to set a title, without overriding the user's
setting in ``--title``.
-``--external-file=<filename>``
+``--external-files=<file-list>``
Load a file and add all of its tracks. This is useful to play different
files together (for example audio from one file, video from another), or
for advanced ``--lavfi-complex`` used (like playing two video files at
the same time).
- Unlike ``--sub-file`` and ``--audio-file``, this includes all tracks, and
+ Unlike ``--sub-files`` and ``--audio-files``, this includes all tracks, and
does not cause default stream selection over the "proper" file. This makes
it slightly less intrusive.
This is a list option. See `List Options`_ for details.
+``--external-file=<file>``
+ CLI/config file only alias for ``--external-files-append``. Each use of this
+ option will add a new external files.
+
``--autoload-files=<yes|no>``
Automatically load/select external files (default: yes).
If set to ``no``, then do not automatically load external files as specified
by ``--sub-auto`` and ``--audio-file-auto``. If external files are forcibly
- added (like with ``--sub-file``), they will not be auto-selected.
+ added (like with ``--sub-files``), they will not be auto-selected.
This does not affect playlist expansion, redirection, or other loading of
referenced files like with ordered chapters.
diff --git a/options/m_config.c b/options/m_config.c
index ea58b5a3dd..604f4a8133 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -566,6 +566,9 @@ struct m_config_option *m_config_get_co(const struct m_config *config,
co->warning_was_printed = true;
}
return m_config_get_co(config, bstr0(alias));
+ } else if (co->opt->type == &m_option_type_cli_alias) {
+ // Pretend it does not exist.
+ return NULL;
} else if (co->opt->type == &m_option_type_removed) {
if (!co->warning_was_printed) {
char *msg = co->opt->priv;
@@ -806,8 +809,13 @@ static struct m_config_option *m_config_mogrify_cli_opt(struct m_config *config,
return co;
}
+ // Resolve CLI alias. (We don't allow you to combine them with "--no-".)
+ co = m_config_get_co_raw(config, *name);
+ if (co && co->opt->type == &m_option_type_cli_alias)
+ *name = bstr0((char *)co->opt->priv);
+
// Might be a suffix "action", like "--vf-add". Expensively check for
- // matches. (Also, we don't allow you to combine them with "--no-".)
+ // matches. (We don't allow you to combine them with "--no-".)
for (int n = 0; n < config->num_opts; n++) {
co = &config->opts[n];
const struct m_option_type *type = co->opt->type;
@@ -902,8 +910,19 @@ int m_config_set_option_node(struct m_config *config, bstr name,
int r;
struct m_config_option *co = m_config_get_co(config, name);
- if (!co)
- return M_OPT_UNKNOWN;
+ if (!co) {
+ co = m_config_get_co_raw(config, name);
+ if (co && co->opt->type == &m_option_type_cli_alias) {
+ /*bstr old_name = name;
+ co = m_config_mogrify_cli_opt(config, &name, &(bool){0}, &(int){0});
+ */
+ name = bstr0((char *)co->opt->priv);
+ MP_WARN(config, "Setting %.*s via API is deprecated, set %s instead.\n",
+ BSTR_P(name), co->opt->name);
+ } else {
+ return M_OPT_UNKNOWN;
+ }
+ }
// Do this on an "empty" type to make setting the option strictly overwrite
// the old value, as opposed to e.g. appending to lists.
@@ -1005,6 +1024,10 @@ void m_config_print_option_list(const struct m_config *config, const char *name)
MP_INFO(config, " [file]");
if (opt->flags & M_OPT_FIXED)
MP_INFO(config, " [no runtime changes]");
+ if (opt->type == &m_option_type_alias)
+ MP_INFO(config, " for %s", (char *)opt->priv);
+ if (opt->type == &m_option_type_cli_alias)
+ MP_INFO(config, " for %s (CLI/config files only)", (char *)opt->priv);
MP_INFO(config, "\n");
for (int n = 0; opt->type->actions && opt->type->actions[n].name; n++) {
const struct m_option_action *action = &opt->type->actions[n];
diff --git a/options/m_option.c b/options/m_option.c
index 9bdabd807e..162d57ee8e 100644
--- a/options/m_option.c
+++ b/options/m_option.c
@@ -1213,7 +1213,7 @@ static int parse_str_list_impl(struct mp_log *log, const m_option_t *opt,
if (bstr_endswith0(name, "-add")) {
op = OP_ADD;
- } else if (bstr_endswith0(name, "-add-str")) {
+ } else if (bstr_endswith0(name, "-append")) {
op = OP_ADD_STR;
} else if (bstr_endswith0(name, "-pre")) {
op = OP_PRE;
@@ -1395,33 +1395,7 @@ const m_option_type_t m_option_type_string_list = {
.set = str_list_set,
.actions = (const struct m_option_action[]){
{"add"},
- {"add-str"},
- {"clr", M_OPT_TYPE_OPTIONAL_PARAM},
- {"del"},
- {"pre"},
- {"set"},
- {0}
- },
-};
-
-static int parse_str_append_list(struct mp_log *log, const m_option_t *opt,
- struct bstr name, struct bstr param, void *dst)
-{
- return parse_str_list_impl(log, opt, name, param, dst, OP_ADD_STR);
-}
-
-const m_option_type_t m_option_type_string_append_list = {
- .name = "String list (append by default)",
- .size = sizeof(char **),
- .parse = parse_str_append_list,
- .print = print_str_list,
- .copy = copy_str_list,
- .free = free_str_list,
- .get = str_list_get,
- .set = str_list_set,
- .actions = (const struct m_option_action[]){
- {"add"},
- {"add-str"},
+ {"append"},
{"clr", M_OPT_TYPE_OPTIONAL_PARAM},
{"del"},
{"pre"},
@@ -3372,6 +3346,9 @@ const m_option_type_t m_option_type_node = {
const m_option_type_t m_option_type_alias = {
.name = "alias",
};
+const m_option_type_t m_option_type_cli_alias = {
+ .name = "alias",
+};
const m_option_type_t m_option_type_removed = {
.name = "removed",
};
diff --git a/options/m_option.h b/options/m_option.h
index dea3956f7f..6935c93594 100644
--- a/options/m_option.h
+++ b/options/m_option.h
@@ -65,6 +65,7 @@ extern const m_option_type_t m_option_type_node;
// Used internally by m_config.c
extern const m_option_type_t m_option_type_alias;
+extern const m_option_type_t m_option_type_cli_alias;
extern const m_option_type_t m_option_type_removed;
extern const m_option_type_t m_option_type_subconfig;
@@ -579,8 +580,8 @@ extern const char m_option_path_separator;
#define OPT_KEYVALUELIST(...) \
OPT_GENERAL(char**, __VA_ARGS__, .type = &m_option_type_keyvalue_list)
-#define OPT_PATHLIST(...) \
- OPT_GENERAL(char**, __VA_ARGS__, .type = &m_option_type_string_append_list, \
+#define OPT_PATHLIST(...) \
+ OPT_GENERAL(char**, __VA_ARGS__, .type = &m_option_type_string_list,\
.priv = (void *)&m_option_path_separator)
#define OPT_INT(...) \
@@ -713,6 +714,11 @@ extern const char m_option_path_separator;
// Same, with a generic deprecation message.
#define OPT_REPLACED(optname, newname) OPT_REPLACED_MSG(optname, newname, "")
+// Alias, resolved on the CLI/config file/profile parser level only.
+#define OPT_CLI_ALIAS(optname, newname) \
+ {.name = optname, .type = &m_option_type_cli_alias, .priv = newname, \
+ .flags = M_OPT_NOPROP, .offset = -1}
+
// "--optname" doesn't exist, but inform the user about a replacement with msg.
#define OPT_REMOVED(optname, msg) \
{.name = optname, .type = &m_option_type_removed, .priv = msg, \
diff --git a/options/options.c b/options/options.c
index db63efa9d2..2b9a630bc9 100644
--- a/options/options.c
+++ b/options/options.c
@@ -289,7 +289,8 @@ const m_option_t mp_opts[] = {
OPT_STRINGLIST("reset-on-next-file", reset_options, 0),
#if HAVE_LUA || HAVE_JAVASCRIPT
- OPT_PATHLIST("script", script_files, M_OPT_FIXED),
+ OPT_PATHLIST("scripts", script_files, M_OPT_FIXED),
+ OPT_CLI_ALIAS("script", "scripts-append"),
OPT_KEYVALUELIST("script-opts", script_opts, 0),
OPT_FLAG("load-scripts", auto_load_scripts, 0),
#endif
@@ -375,7 +376,8 @@ const m_option_t mp_opts[] = {
#endif
// demuxer.c - select audio/sub file/demuxer
- OPT_PATHLIST("audio-file", audio_files, 0),
+ OPT_PATHLIST("audio-files", audio_files, 0),
+ OPT_CLI_ALIAS("audio-file", "audio-files-append"),
OPT_STRING("demuxer", demuxer_name, 0),
OPT_STRING("audio-demuxer", audio_demuxer_name, 0),
OPT_STRING("sub-demuxer", sub_demuxer_name, 0),
@@ -459,10 +461,12 @@ const m_option_t mp_opts[] = {
// ------------------------- subtitles options --------------------
- OPT_PATHLIST("sub-file", sub_name, 0),
- OPT_PATHLIST("sub-file-path", sub_paths, 0),
- OPT_PATHLIST("audio-file-path", audiofile_paths, 0),
- OPT_PATHLIST("external-file", external_files, 0),
+ OPT_PATHLIST("sub-files", sub_name, 0),
+ OPT_CLI_ALIAS("sub-file", "sub-files-append"),
+ OPT_PATHLIST("sub-file-paths", sub_paths, 0),
+ OPT_PATHLIST("audio-file-paths", audiofile_paths, 0),
+ OPT_PATHLIST("external-files", external_files, 0),
+ OPT_CLI_ALIAS("external-file", "external-file-append"),
OPT_FLAG("autoload-files", autoload_files, 0),
OPT_FLOAT("sub-delay", sub_delay, UPDATE_OSD),
OPT_FLOAT("sub-fps", sub_fps, UPDATE_OSD),
@@ -832,10 +836,7 @@ const m_option_t mp_opts[] = {
OPT_REMOVED("fs-black-out-screens", NULL),
OPT_REPLACED_MSG("loop", "loop-playlist", "--loop will be changed to map to"
" --loop-file in future releases."),
- OPT_REPLACED_MSG("sub-paths", "sub-file-path",
- "passing multiple paths works differently now"),
- OPT_REPLACED_MSG("audio-file-paths", "audio-file-path",
- "passing multiple paths works differently now"),
+ OPT_REPLACED("sub-paths", "sub-file-paths"),
{0}
};
diff --git a/player/command.c b/player/command.c
index c7ea6d91f2..bd870e69fd 100644
--- a/player/command.c
+++ b/player/command.c
@@ -3717,6 +3717,37 @@ done:
return mp_property_do(real_property, action, arg, ctx);
}
+static int mp_property_shitfuck(void *ctx, struct m_property *prop,
+ int action, void *arg)
+{
+ MPContext *mpctx = ctx;
+ int flags = M_SETOPT_RUNTIME;
+ const char *rname = prop->priv;
+
+ MP_WARN(mpctx, "Do not use %s, use %s, bug reports will be ignored.\n",
+ prop->name, rname);
+
+ struct m_config_option *co = m_config_get_co_raw(mpctx->mconfig, bstr0(rname));
+ if (!co)
+ return M_PROPERTY_UNKNOWN;
+
+ switch (action) {
+ case M_PROPERTY_GET_TYPE:
+ *(struct m_option *)arg = *(co->opt);
+ return M_PROPERTY_OK;
+ case M_PROPERTY_GET:
+ if (!co->data)
+ return M_PROPERTY_NOT_IMPLEMENTED;
+ m_option_copy(co->opt, arg, co->data);
+ return M_PROPERTY_OK;
+ case M_PROPERTY_SET:
+ if (m_config_set_option_raw_direct(mpctx->mconfig, co, arg, flags) < 0)
+ return M_PROPERTY_ERROR;
+ return M_PROPERTY_OK;
+ }
+ return M_PROPERTY_NOT_IMPLEMENTED;
+}
+
static int access_options(struct m_property_action_arg *ka, bool local,
MPContext *mpctx)
{
@@ -5726,7 +5757,8 @@ void command_init(struct MPContext *mpctx)
for (int n = 0; n < num_opts; n++) {
struct m_config_option *co = m_config_get_co_index(mpctx->mconfig, n);
assert(co->name[0]);
- if (co->opt->flags & M_OPT_NOPROP)
+ if ((co->opt->flags & M_OPT_NOPROP) &&
+ co->opt->type != &m_option_type_cli_alias)
continue;
struct m_property prop = {0};
@@ -5741,6 +5773,21 @@ void command_init(struct MPContext *mpctx)
.priv = (void *)alias,
.is_option = true,
};
+ } else if (co->opt->type == &m_option_type_cli_alias) {
+ bstr rname = bstr0(co->opt->priv);
+ for (int i = rname.len - 1; i >= 0; i--) {
+ if (rname.start[i] == '-') {
+ rname.len = i;
+ break;
+ }
+ }
+
+ prop = (struct m_property){
+ .name = co->name,
+ .call = mp_property_shitfuck,
+ .priv = bstrto0(ctx, rname),
+ .is_option = true,
+ };
} else {
prop = (struct m_property){
.name = co->name,
diff --git a/video/out/opengl/video.c b/video/out/opengl/video.c
index 772d988fac..41ddf84722 100644
--- a/video/out/opengl/video.c
+++ b/video/out/opengl/video.c
@@ -395,9 +395,8 @@ const struct m_sub_options gl_video_conf = {
({"no", BLEND_SUBS_NO},
{"yes", BLEND_SUBS_YES},
{"video", BLEND_SUBS_VIDEO})),
- OPT_STRINGLIST("opengl-shaders", user_shaders_old, M_OPT_FILE,
- .deprecation_message = "use --opengl-shader (1 for each file)"),
- OPT_PATHLIST("opengl-shader", user_shaders, 0),
+ OPT_PATHLIST("opengl-shaders", user_shaders, 0),
+ OPT_CLI_ALIAS("opengl-shader", "opengl-shaders-append"),
OPT_FLAG("deband", deband, 0),
OPT_SUBSTRUCT("deband", deband_opts, deband_conf, 0),
OPT_FLOAT("sharpen", unsharp, 0),
@@ -1769,7 +1768,6 @@ static void gl_video_setup_hooks(struct gl_video *p)
});
}
- pass_hook_user_shaders(p, p->opts.user_shaders_old);
pass_hook_user_shaders(p, p->opts.user_shaders);
}
@@ -3127,8 +3125,6 @@ static bool check_dumb_mode(struct gl_video *p)
return false;
}
}
- if (o->user_shaders_old && o->user_shaders_old[0])
- return false;
if (o->user_shaders && o->user_shaders[0])
return false;
if (p->use_lut_3d)
diff --git a/video/out/opengl/video.h b/video/out/opengl/video.h
index 8526cecb84..6c41e70b1e 100644
--- a/video/out/opengl/video.h
+++ b/video/out/opengl/video.h
@@ -128,7 +128,6 @@ struct gl_video_opts {
int interpolation;
float interpolation_threshold;
int blend_subs;
- char **user_shaders_old;
char **user_shaders;
int deband;
struct deband_opts *deband_opts;