1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-19 18:05:21 +00:00

client API: deprecate "no-..." option handling

The client API can do this (and there are apparently some libmpv using
projects which rely on this). But it's just unnecessary bloat as it
requires a separate code path from the option parser. It would be better
to remove this code. Formally deprecate it, including API bump and
warning in the API changes file to make it really clear.
This commit is contained in:
wm4 2016-08-31 17:28:42 +02:00
parent 7dde096d8a
commit b10dcecf7d
5 changed files with 31 additions and 18 deletions

View File

@ -32,7 +32,10 @@ API changes
::
--- mpv 0.19.0
--- mpv 0.21.0 ---
1.23 - deprecate setting "no-" options via mpv_set_option*(). For example,
instead of "no-video=" you should set "video=no".
--- mpv 0.19.0 ---
1.22 - add stream_cb API for custom protocols
--- mpv 0.18.1 ---
---- - remove "status" log level from mpv_request_log_messages() docs. This

View File

@ -24,6 +24,7 @@ Interface changes
not accessible under "options/..." anymore (instead, these are resolved
at parsing time). This does not affect options which start with "--no-",
but do not use the mechanism for negation options.
(Also see client API change for API version 1.23.)
--- mpv 0.20.0 ---
- add --image-display-duration option - this also means that image duration
is not influenced by --mf-fps anymore in the general case (this is an

View File

@ -36,15 +36,32 @@ Track Selection
See also ``--alang``. mpv normally prints available audio tracks on the
terminal when starting playback of a file.
``--audio`` is an alias for ``--aid``.
``--aid=no`` or ``--audio=no`` or ``--no-audio`` disables audio playback.
(The latter variant does not work with the client API.)
``--sid=<ID|auto|no>``
Display the subtitle stream specified by ``<ID>``. ``auto`` selects
the default, ``no`` disables subtitles.
See also ``--slang``, ``--no-sub``.
``--sub`` is an alias for ``--sid``.
``--sid=no`` or ``--sub=no`` or ``--no-sub`` disables subtitle decoding.
(The latter variant does not work with the client API.)
``--vid=<ID|auto|no>``
Select video channel. ``auto`` selects the default, ``no`` disables video.
``--video`` is an alias for ``--vid``.
``--vid=no`` or ``--video=no`` or ``--no-video`` disables video playback.
(The latter variant does not work with the client API.)
If vudeo is disabled, mpv will try to download the audio only if media is
streamed with youtube-dl, because it saves bandwidth. This is done by
setting the ytdl_format to "bestaudio/best" in the ytdl_hook.lua script.
``--ff-aid=<ID|auto|no>``, ``--ff-sid=<ID|auto|no>``, ``--ff-vid=<ID|auto|no>``
Select audio/subtitle/video streams by the FFmpeg stream index. The FFmpeg
stream index is relatively arbitrary, but useful when interacting with
@ -517,14 +534,6 @@ Video
``--vf-clr`` exist to modify a previously specified list, but you
should not need these for typical use.
``--no-video``
Do not play video. With some demuxers this may not work. In those cases
you can try ``--vo=null`` instead.
mpv will try to download the audio only if media is streamed with
youtube-dl, because it saves bandwidth. This is done by setting the ytdl_format
to "bestaudio/best" in the ytdl_hook.lua script.
``--untimed``
Do not sleep when outputting video frames. Useful for benchmarks when used
with ``--no-audio.``
@ -1092,9 +1101,6 @@ Audio
Audio delay in seconds (positive or negative float value). Positive values
delay the audio, and negative values delay the video.
``--no-audio``
Do not play sound.
``--mute=<auto|yes|no>``
Set startup audio mute status. ``auto`` (default) will not change the mute
status.
@ -1374,10 +1380,6 @@ Subtitles
Subtitles in ASS format are normally not changed intentionally, but
overriding them can be controlled with ``--ass-style-override``.
``--no-sub``
Do not select any subtitle when the file is loaded.
``--sub-demuxer=<[+]name>``
Force subtitle demuxer type for ``--sub-file``. Give the demuxer name as
printed by ``--sub-demuxer=help``.

View File

@ -215,7 +215,7 @@ extern "C" {
* relational operators (<, >, <=, >=).
*/
#define MPV_MAKE_VERSION(major, minor) (((major) << 16) | (minor) | 0UL)
#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 22)
#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION(1, 23)
/**
* Return the MPV_CLIENT_API_VERSION the mpv source has been compiled with.

View File

@ -707,6 +707,7 @@ int m_config_set_option_node(struct m_config *config, bstr name,
struct m_config_option *co = m_config_get_co(config, name);
if (!co) {
bstr orig_name = name;
co = m_config_find_negation_opt(config, &name);
if (!co)
return M_OPT_UNKNOWN;
@ -716,6 +717,12 @@ int m_config_set_option_node(struct m_config *config, bstr name,
tmp.format = MPV_FORMAT_STRING;
tmp.u.string = "no";
data = &tmp;
if (!co->warning_was_printed) {
MP_WARN(config, "Option '%.*s': setting 'no-' option via API is "
"deprecated and will stop working.\n", BSTR_P(orig_name));
co->warning_was_printed = true;
}
}
// Do this on an "empty" type to make setting the option strictly overwrite