path: root/stream
diff options
authorwm4 <wm4@nowhere>2012-08-05 23:34:28 +0200
committerwm4 <wm4@nowhere>2012-08-05 23:51:49 +0200
commit94782e464d985b6e653618d8a61cf2ee817c3e9f (patch)
treeab0aa78634cff9e743340d86537e8ec1a94d989a /stream
parent039a6194a473564f37525e94b689494c00145c5d (diff)
options: get rid of ambiguous option parsing
Options parsing used to be ambiguous, as in the splitting into option and values pairs was ambiguous. Example: -option -something It wasn't clear whether -option actually takes an argument or not. The string "-something" could either be a separate option, or an argument to "-option". The code had to call the option specific parser function to resolve this. This made everything complicated and didn't even have a real use. There was only one case where this was actually used: string lists (m_option_type_string_list) and options based on it. That is because this option type actually turns a single option into a proxy for several real arguments, e.g. "vf*" can handle "-vf-add" and "-vf-clr". Options suffixed with "-clr" are the only options of this group which take no arguments. This is ambiguous only with the "old syntax" (as shown above). The "new" option syntax always puts option name and value into same argument. (E.g. "--option=--something" or "--option" "--something".) Simplify the code by making it statically known whether an option takes a parameter or not with the flag M_OPT_TYPE_OLD_SYNTAX_NO_PARAM. If it's set, the option parser assumes the option takes no argument. The only real ambiguity left, string list options that end on "-clr", are special cased in the parser. Remove some duplication of the logic in the command line parser by moving all argument splitting logic into split_opt(). (It's arguable whether that can be considered code duplication, but now the code is a bit simpler anyway. This might be subjective.) Remove the "ambiguous" parameter from all option parsing related code. Make m_config unaware of the pre-parsing concept. Make most CONF_NOCFG options also CONF_GLOBAL (except those explicitly usable as per-file options.)
Diffstat (limited to 'stream')
1 files changed, 1 insertions, 1 deletions
diff --git a/stream/stream.c b/stream/stream.c
index db389c45c7..d4f0c8ae97 100644
--- a/stream/stream.c
+++ b/stream/stream.c
@@ -160,7 +160,7 @@ static stream_t *open_stream_plugin(const stream_info_t *sinfo,
if(sinfo->opts_url) {
m_option_t url_opt =
{ "stream url", arg , CONF_TYPE_CUSTOM_URL, 0, 0 ,0, (void *)sinfo->opts };
- if (m_option_parse(&url_opt, bstr0("stream url"), bstr0(filename), false, arg) < 0) {
+ if (m_option_parse(&url_opt, bstr0("stream url"), bstr0(filename), arg) < 0) {
mp_tmsg(MSGT_OPEN,MSGL_ERR, "URL parsing failed on url %s\n",filename);
return NULL;