summaryrefslogtreecommitdiffstats
path: root/options/m_option.c
Commit message (Collapse)AuthorAgeFilesLines
* video: support positional arguments for automatic lavfi option bridgewm42017-04-031-5/+22
| | | | | | Now e.g. --vf=pad=1000:1000 works. All in all pretty ugly and hacky. Just look away.
* command: change and simplify filter toggle syntaxwm42017-03-261-5/+23
| | | | | | | | | | | "@name:!" becomes simply "@name". This is actually slightly more complex to parse, but makes for a much simpler syntax and will be less weird to the user. Suggested by haasn. The old syntax is now rejected with an error. Also add some more explicit error checks, instead of e.g. allowing empty filter names and erroring only when it's not found.
* m_option: consistent af/vf filter entry "enabled" flag default valuewm42017-03-251-0/+1
| | | | | | | It should default to true, but setting the filter list via mpv_node (relevant for client API and Lua scripting) left it to false. Also "document" the flag.
* command: add better runtime filter toggling methodwm42017-03-251-7/+38
| | | | | | | | | | Basically, see the example in input.rst. This is better than the "old" vf-toggle method, because it doesn't require the user to duplicate the filter string in mpv.conf and input.conf. Some aspects of this changes are untested, so enjoy your alpha testing.
* m_option: optionally allow passing "no" to imgfmt option typeswm42017-03-021-4/+7
| | | | | | Needed for the following commit. Also, fix that uint32_t type - we always assumed int.
* options: some simplificationswm42016-11-291-56/+2
| | | | | | | | Remove more stuff that was needed only for legacy suboptions. One user-visible change is that parent-options like --tv are now not visible anymore. They lead to a special error message when used before, but now they're simply not part of the option list anymore.
* options: remove deprecated sub-option handling for --vo and --aowm42016-11-251-3/+14
| | | | | | | | Long planned. Leads to some sanity. There still are some rather gross things. Especially g_groups is ugly, and a hack that can hopefully be removed. (There is a plan for it, but whether it's implemented depends on how much energy is left.)
* options: simplify M_OPT_EXITwm42016-09-171-7/+7
| | | | | | | | | | | | | There were multiple values under M_OPT_EXIT (M_OPT_EXIT-n for n>=0). Somehow M_OPT_EXIT-n either meant error code n (with n==0 no error?), or the number of option valus consumed (0 or 1). The latter is MPlayer legacy, which left it to the option type parsers to determine whether an option took a value or not. All of this was changed in mpv, by requiring the user to use explicit syntax ("--opt=val" instead of "-opt val"). In any case, the n value wasn't even used (anymore), so rip this all out. Now M_OPT_EXIT-1 doesn't mean anything, and could be used by a new error code.
* options: fix --list-options after previous commitwm42016-09-101-1/+1
| | | | Fixes #3509.
* options: make --h list options according to a pattern passed to itwm42016-09-101-1/+1
| | | | | | Useless feature, but I want it. Won't work on Windows due to missing fnmatch().
* vo_opengl: deprecate sub-options, add them as global optionswm42016-09-021-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | vo_opengl sub-option were always rather annoying to handle. It seems better to make them global options instead. This is simpler and easier to use. The only disadvantage we are aware of is that it's not clear that many/all of these new global options work with vo_opengl only. --vo=opengl-hq is also deprecated. There is extensive compatibility with the old behavior. One exception is that --vo-defaults will not apply to opengl-hq (though with opengl it still works). vo-cmdline is also dysfunctional and will be removed in a following commit. These changes also affect opengl-cb. The update mechanism is still rather inefficient: it requires syncing with the VO after each option change, rather than batching updates. There's also no granularity (video.c just updates "everything", and if auto-ICC profiles are enabled, vo_opengl.c will fetch them on each update). Most of the manpage changes were done by Niklas Haas <git@haasn.xyz>.
* vo, ao: disable positional parameter suboptionswm42016-09-011-7/+9
| | | | | | | | | | | | | | | | Positional parameters cause problems because they can be ambiguous with flag options. If a flag option is removed or turned into a non-flag option, it'll usually be interpreted as value for the first sub-option (as positional parameter), resulting in very confusing error messages. This changes it into a simple "option not found" error. I don't expect that anyone really used positional parameters with --vo or --ao. Although the docs for --ao=pulse seem to encourage positional parameters for the host/sink options, which means it could possibly annoy some PulseAudio users. --vf and --af are still mostly used with positional parameters, so this must be a configurable option in the option parser.
* m_option: replace --no-video-aspect aliaswm42016-08-311-39/+24
| | | | | | | | | Instead, add a hacky OPT_ASPECT option type, which only exists to accept a "no" parameter, which in combination with the "--no-..." handling code makes --no-video-aspect work again. We can also remove the code in m_config.c, which only existed to make "--no-aspect" (a deprecated alias) to work.
* m_property: remove pointless explicitly clampingwm42016-08-311-47/+0
| | | | | | | | | This is basically dead code, and even the commit that added this code 4 years ago said that this should be for debugging only. (Though it is possible that the clamp callback was used for something else, and then unused again. Also, some of the clamping code remains and is used for internal checking, e.g. clamp_double().)
* m_option: remove M_OPT_TYPE_DYNAMIC flagwm42016-08-301-7/+2
| | | | | | It's actually redundant with whether m_option_type.free is set. Some option types were flagged inconsistently. Its only use was for running an additional sanity check without any real functionality.
* m_option: add mechanism to allow inf/-inf float optionswm42016-08-171-1/+2
| | | | Used by the next commit.
* m_option: simplify float value range handlingwm42016-08-171-21/+3
| | | | | | Use clamp_double() to handle all value restriction/verification. The error messages become a bit less nice, but they were kind of incomplete before.
* options: fix channels options copy/free operationswm42016-08-051-0/+6
| | | | | For some fucked up reason the arguments can be NULL. Makes no sense to me, but ok.
* audio: use --audio-channels=auto behavior, except on ALSAwm42016-08-041-25/+79
| | | | | | | | | | | | | | | | | | | | | | | This commit adds an --audio-channel=auto-safe mode, and makes it the default. This mode behaves like "auto" with most AOs, except with ao_alsa. The intention is to allow multichannel output by default on sane APIs. ALSA is not sane as in it's so low level that it will e.g. configure any layout over HDMI, even if the connected A/V receiver does not support it. The HDMI fuckup is of course not ALSA's fault, but other audio APIs normally isolate applications from dealing with this and require the user to globally configure the correct output layout. This will help with other AOs too. ao_lavc (encoding) is changed to the new semantics as well, because it used to force stereo (perhaps because encoding mode is supposed to produce safe files for crap devices?). Exclusive mode output on Windows might need to be adjusted accordingly, as it grants the same kind of low level access as ALSA (requires more research). In addition to the things mentioned above, the --audio-channels option is extended to accept a set of channel layouts. This is supposed to be the correct way to configure mpv ALSA multichannel output. You need to put a list of channel layouts that your A/V receiver supports.
* options: --geometry: center window position after applying sizemaniak13492016-05-221-0/+4
| | | | | | | Center window position after applying W and H parameters of the --geometry option. Passing valid X and Y values will still override the position. Fixes #2397.
* client API: access choices as flags if appropriatewm42016-05-041-2/+15
| | | | | | | | | | | | Options/properties that are choices, and which include "yes" or "no" values (or both) can now be read and written as MPV_FORMAT_FLAG. For write access, rejecting flags in these cases was obnoxiously unintuitive and inconvenient. For read access, the value of this is less convincing, and actually it's a major API change. At this point I probably have to admit that the finer details of the client API are very unstable.
* client API: improve mpv_set_property() handling of MPV_FORMAT_NODEwm42016-04-151-0/+15
| | | | | | | | | If a mpv_node wrapped a string, the behavior was different from calling mpv_set_property() with MPV_FORMAT_STRING directly. Change this. The original intention was to be strict about types if MPV_FORMAT_NODE is used. But I think the result was less than ideal, and the same change towards less strict behavior was made to mpv_set_option() ages ago.
* m_option: slightly improve --msg-level=help outputwm42016-04-131-1/+1
| | | | In particular get rid of the semi-deprecated ":" separator.
* m_option: add string conversion for --audio-channelswm42016-04-131-0/+8
| | | | Requested in #3040.
* mpv_talloc.h: rename from talloc.hDmitrij D. Czarkoff2016-01-111-1/+1
| | | | This change helps avoiding conflict with talloc.h from libtalloc.
* options: fix conversion of flags to stringswm42015-07-011-2/+7
| | | | | | | | | | This flags stuff tried to be too clever - if there are overlapping flags (e.g. exclusive or combined flags), the one matching with most bits has to be chosen. This fixes logging of the seek command. E.g. "relative" and "absolute" overlap to make them exclusive, but "relative" was always printed as it happened to match first.
* options: improve an error messagewm42015-06-271-2/+2
| | | | | "mpv --ao=wasapi:help" on Linux gave "Option ao doesn't exist.". Completely misleading and stupid.
* audio: replace format name tablewm42015-06-261-3/+7
| | | | Having a big switch() is simpler.
* options: make keyvalue list parsing less strictwm42015-06-101-7/+8
| | | | | Affects for example --script-opts. A bunch of characters are now allowed in them without causing trouble to the user.
* options: change [...] to balanced quoteswm42015-04-191-1/+12
| | | | | | | | Useful for dealing with libavfilter's terrible graph syntax. Not strictly backwards compatible (for example "[a[b]" fails now - the "[" within the quote is interpreted now). But hopefully it's obscure enough not to warrant any kind of compatibility hacks.
* options: don't let --vf-clr etc. take an argumentwm42015-04-131-0/+5
| | | | | | | It was ignored before. Passing an argument makes no sense, and might be mistaken for some form of --vf-del, so complain about it. This also affects --af-clr and the vf/af commands.
* Update license headersMarcin Kurczewski2015-04-131-5/+4
| | | | Signed-off-by: wm4 <wm4@nowhere>
* video: cleanup stereo mode parsingwm42015-04-021-53/+0
| | | | | | | | | Use OPT_CHOICE_C() instead of the custom parser. The functionality is pretty much equivalent. (On a side note, it seems --video-stereo-mode can't be removed, because it controls whether to "reduce" stereo video to mono, which is also the default. In fact I'm not sure how this should be handled at all.)
* options: fix --geometry to string conversionwm42015-04-011-6/+2
| | | | Fixes #1744.
* video: move colorspace overrides to vf_format, simplifywm42015-03-311-0/+10
| | | | | | | | | | | | | | | | | | | Remove the colorspace-related top-level options, add them to vf_format. They are rather obscure and not needed often, so it's better to get them out of the way. In particular, this gets rid of the semi-complicated logic in command.c (most of which was needed for OSD display and the direct feedback from the VO). It removes the duplicated color-related name mappings. This removes the ability to write the colormatrix and related properties. Since filters can be changed at runtime, there's no loss of functionality, except that you can't cycle automatically through the color constants anymore (but who needs to do this). This also changes the type of the mp_csp_names and related variables, so they can directly be used with OPT_CHOICE. This probably ended up a bit awkward, for the sake of not adding a new option type which would have used the previous format.
* parse_commandline: fail gracefully on bad argswd02015-03-291-1/+1
| | | | | | Args of zero length (i.e. --=) now display a proper error message. Signed-off-by: wm4 <wm4@nowhere>
* options: add conversion to string for geometry option typeswm42015-03-241-0/+31
| | | | | | | | Pretty messy, which is why it wasn't done at first. (Also, I'd really like to have simpler syntax and semantics for this damn option, but who knows when this will happen.) Fixes #1705.
* m_option: remove dead initializationwm42015-03-231-3/+3
|
* options: add flag option typewm42015-03-041-0/+117
|
* options: handle choice -> flag fallback automaticallywm42015-02-271-3/+17
| | | | | | | | | | | | | | | In the past it happened quite often that flag options (yes/no) were changed to choice options (yes/no/some more). The problem with this was that while flag options don't need a parameter, this wasn't the case with choice options. A hack was introduced to compensate for this: setting M_OPT_OPTIONAL_PARAM on the option, and an empty string ("") was added as choice, so that the choice could be used like a flag. So, for example, "--mute" would set the choice "". Fix this by 1. not requiring a parameter if there's a "yes" choice, and 2. redirect an empty parameter to "yes". The effect is that a choice option with the choices ["yes", "no"] is pretty much equivalent to a flag option.
* options: minor simplification in flag option parserwm42015-02-271-20/+14
|
* options: change --msg-level optionwm42015-02-061-56/+67
| | | | | | | | | | | | | | Make it accept "," as separator, instead of only ":". Do this by using the key-value-list parser. Before this, the option was stored as a string, with the option parser verifying that the option value as correct. Now it's stored pre-parsed, although the log levels still require separate verification and parsing-on-use to some degree (which is why the msg-level option type doesn't go away). Because the internal type changes, the client API "native" type also changes. This could be prevented with some more effort, but I don't think it's worth it - if MPV_FORMAT_STRING is used, it still works the same, just with a different separator on read accesses.
* options: allow ":" as separator in key-value listswm42015-02-061-1/+1
| | | | | | | | Before this, unquoted occurrences of ":" lead to parsing errors. There's no reason to reject it, especially since the traditional MPlayer syntax uses ":" as separator. (Which is also the reason why ":" was rejected before: the parser shares this code for handling splitting/quoting, and we merely checked explicitly whether the option was split on ",".)
* options: allow things like --geometry=x50wm42015-02-041-2/+3
| | | | | | Although the use is somewhat questionable, it seems strange that e.g. --geometry=50% works (and sets the width only), but setting the height only in a similar manner does not work.
* options: slightly improve help output for choice and flag optionswm42015-02-021-9/+12
|
* options: fix parsing for --ab-loop-*wm42014-12-121-1/+1
| | | | Editing mistake. Oops.
* options: add slightly more sophistcated mechanism for option deprecationwm42014-12-111-0/+8
|
* m_option: never return NOPTS value as number from propertieswm42014-12-101-5/+36
| | | | | | | | MP_NOPTS_VALUE (basically INT64_MIN) is basically an special timestamp value that means "unset" or "unknown". Its exact value is internal, and should never be returned or interpreted by any API. So return "no" instead (what is also what the parser accepts).
* options: fix channel map options sometimes failingwm42014-12-011-1/+1
| | | | | | | | | | Channel amp otpions were not copied correctly: it copied the size of a pointer to struct chmap, not the struct itself. Since mp_chmap is currently 9 bytes, this meant the last channel entry was not copied correctly on 64 bit systems, leading to very strange failures. It could be triggered especially when using the client API, because the client API always copies options on access (mpv command line options tend to work directly on options).
* options: fix swapped deprecated/replacement in warningwm42014-12-011-1/+1
| | | | | This was relevant for --af and --vo (both use this option type, and have deprecated aliases).
* options: simplify channel map validationwm42014-12-011-4/+3
| | | | | The min=-1 case was never used, and the channel map must always be valid (or in some cases, invalid but empty).
* Remove some unneeded NULL checkswm42014-11-211-16/+13
| | | | Found by Coverity; also see commit 85fb2af3.
* command: implement A-B loopswm42014-11-181-2/+7
| | | | | | | | | | | | | Probably needs to be polished a bit more. Also, might require a key binding that can set/clear the loop points in a more intuitive way. For now, something like this can be put into input.conf to use it: ctrl+y set ab-loop-a ${time-pos} # set A ctrl+x set ab-loop-b ${time-pos} # set B ctrl+c set ab-loop-a no # clear (mostly) Fixes #1241.
* command: export some option metadatawm42014-11-131-1/+1
| | | | | | | This might be interesting for GUIs and such. It's probably still a little bit insufficient. For example, the filter and audio/video output lists are not available through this.
* m_option: format mpv_node as jsonwm42014-10-231-1/+7
| | | | | Useful for debugging and informational purposes. Not sure if it's sane in any form.
* lua: strictly free memory on errorswm42014-10-191-1/+2
| | | | | | | Thanks to the recently introduced mp_lua_PITA(), this is "simple" now. It fixes leaks on Lua errors. The hack to avoid stack overflows manually isn't needed anymore, and the Lua error handler will take care of this.
* video: initial Matroska 3D supportwm42014-08-301-0/+53
| | | | | | | | | | | | | | | | | | | | | This inserts an automatic conversion filter if a Matroska file is marked as 3D (StereoMode element). The basic idea is similar to video rotation and colorspace handling: the 3D mode is added as a property to the video params. Depending on this property, a video filter can be inserted. As of this commit, extending mp_image_params is actually completely unnecessary - but the idea is that it will make it easier to integrate with VOs supporting stereo 3D mogrification. Although vo_opengl does support some stereo rendering, it didn't support the mode my sample file used, so I'll leave that part for later. Not that most mappings from Matroska mode to vf_stereo3d mode are probably wrong, and some are missing. Assuming that Matroska modes, and vf_stereo3d in modes, and out modes are all the same might be an oversimplification - we'll see. See issue #1045.
* options: more detailed output for --vf-... error messagewm42014-08-281-2/+4
|
* options: fix key-value-list optionswm42014-08-051-6/+11
| | | | | | | | The parser can be called with dst (the target) set to NULL if the option should be verified only. The code didn't respect this, and could result in crashes when used in config profiles or filter sub-options. Fixes #981.
* Audit and replace all ctype.h useswm42014-07-011-1/+0
| | | | | | | | | | | | | | | | Something like "char *s = ...; isdigit(s[0]);" triggers undefined behavior, because char can be signed, and thus s[0] can be a negative value. The is*() functions require unsigned char _or_ EOF. EOF is a special value outside of unsigned char range, thus the argument to the is*() functions can't be a char. This undefined behavior can actually trigger crashes if the implementation of these functions e.g. uses lookup tables, which are then indexed with out-of-range values. Replace all <ctype.h> uses with our own custom mp_is*() functions added with misc/ctype.h. As a bonus, these functions are locale-independent. (Although currently, we _require_ C locale for other reasons.)
* options: support setting start time relative to start PTSTsukasa OMOTO2014-06-291-2/+5
| | |