summaryrefslogtreecommitdiffstats
path: root/options
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-05-05 23:53:06 +0200
committerwm4 <wm4@nowhere>2014-05-05 23:56:01 +0200
commit7fb5df0d3e67230ec8f962c30ed36ea9b9c71ee7 (patch)
treee8ab2e3b10e9ec96a7d12b3a6db1ccaacdbe1467 /options
parent7c01dee153fe8b7dabbc4ff8f206097f4191b48f (diff)
downloadmpv-7fb5df0d3e67230ec8f962c30ed36ea9b9c71ee7.tar.bz2
mpv-7fb5df0d3e67230ec8f962c30ed36ea9b9c71ee7.tar.xz
options: print replacement for renamed/replaced options
Basically, extract the option table from DOCS/man/en/changes.rst, and search the table if an option wasn't found. If there's an entry about it, print it. Hopefully this behavior is slightly more userfriendly. This is strictly bound to option names. It doesn't work for option values, nor does it attempt to emulate the old option.
Diffstat (limited to 'options')
-rw-r--r--options/m_config.c88
1 files changed, 87 insertions, 1 deletions
diff --git a/options/m_config.c b/options/m_config.c
index bdd54a9d20..632f27b64f 100644
--- a/options/m_config.c
+++ b/options/m_config.c
@@ -38,6 +38,8 @@
static const union m_option_value default_value;
+static const char *replaced_opts;
+
// Profiles allow to predefine some sets of options that can then
// be applied later on with the internal -profile option.
#define MAX_PROFILE_DEPTH 20
@@ -480,8 +482,18 @@ static int m_config_parse_option(struct m_config *config, struct bstr name,
bool set = !(flags & M_SETOPT_CHECK_ONLY);
struct m_config_option *co = m_config_get_co(config, name);
- if (!co)
+ if (!co) {
+ char s[80];
+ snprintf(s, sizeof(s), "|%.*s#", BSTR_P(name));
+ char *msg = strstr(replaced_opts, s);
+ if (msg) {
+ msg += strlen(s);
+ char *end = strchr(msg, '|');
+ MP_FATAL(config, "The --%.*s option was renamed or replaced: %.*s\n",
+ BSTR_P(name), (int)(end - msg), msg);
+ }
return M_OPT_UNKNOWN;
+ }
// This is the only mandatory function
assert(co->opt->type->parse);
@@ -820,3 +832,77 @@ void *m_config_alloc_struct(void *talloc_ctx,
memcpy(substruct, subopts->defaults, subopts->size);
return substruct;
}
+
+// This is used for printing error messages on unknown options.
+static const char *replaced_opts =
+ "|a52drc#--ad-lavc-ac3drc=level"
+ "|afm#--ad"
+ "|aspect#--video-aspect"
+ "|ass-bottom-margin#--vf=sub=bottom:top"
+ "|ass#--sub-ass"
+ "|audiofile-cache#--audio-file-cache"
+ "|audiofile#--audio-file"
+ "|benchmark#--untimed (no stats)"
+ "|capture#--stream-capture=<filename>"
+ "|channels#--audio-channels (changed semantics)"
+ "|cursor-autohide-delay#--cursor-autohide"
+ "|delay#--audio-delay"
+ "|dumpstream#--stream-dump=<filename>"
+ "|dvdangle#--dvd-angle"
+ "|endpos#--length"
+ "|font#--osd-font"
+ "|forcedsubsonly#--sub-forced-only"
+ "|format#--audio-format"
+ "|fstype#--x11-fstype"
+ "|hardframedrop#--framedrop=hard"
+ "|identify#removed; use TOOLS/mpv_identify.sh"
+ "|lavdopts#--vd-lavc-..."
+ "|lavfdopts#--demuxer-lavf-..."
+ "|lircconf#--input-lirc-conf"
+ "|mixer-channel#AO suboptions (alsa, oss)"
+ "|mixer#AO suboptions (alsa, oss)"
+ "|mouse-movements#--input-cursor"
+ "|msgcolor#--msg-color"
+ "|msglevel#--msg-level (changed semantics)"
+ "|msgmodule#--msg-module"
+ "|name#--x11-name"
+ "|noar#--no-input-appleremote"
+ "|noautosub#--no-sub-auto"
+ "|noconsolecontrols#--no-input-terminal"
+ "|nojoystick#--no-input-joystick"
+ "|nosound#--no-audio"
+ "|osdlevel#--osd-level"
+ "|panscanrange#--video-zoom, --video-pan-x/y"
+ "|playing-msg#--term-playing-msg"
+ "|pp#'--vf=pp=[...]'"
+ "|pphelp#--vf=pp:help"
+ "|rawaudio#--demuxer-rawaudio-..."
+ "|rawvideo#--demuxer-rawvideo-..."
+ "|spugauss#--sub-gauss"
+ "|srate#--audio-samplerate"
+ "|ss#--start"
+ "|stop-xscreensaver#--stop-screensaver"
+ "|sub-fuzziness#--sub-auto"
+ "|sub#--sub-file"
+ "|subcp#--sub-codepage"
+ "|subdelay#--sub-delay"
+ "|subfile#--sub"
+ "|subfont-text-scale#--sub-scale"
+ "|subfont#--sub-text-font"
+ "|subfps#--sub-fps"
+ "|subpos#--sub-pos"
+ "|tvscan#--tv-scan"
+ "|use-filename-title#--title='${filename}'"
+ "|vc#--vd=..., --hwdec=..."
+ "|vobsub#--sub (pass the .idx file)"
+ "|xineramascreen#--screen (different values)"
+ "|xy#--autofit"
+ "|zoom#Inverse available as ``--video-unscaled"
+ "|media-keys#--input-media-keys"
+ "|lirc#--input-lirc"
+ "|right-alt-gr#--input-right-alt-gr"
+ "|autosub#--sub-auto"
+ "|native-fs#--fs-missioncontrol"
+ "|status-msg#--term-status-msg"
+ "|"
+;