aboutsummaryrefslogtreecommitdiffhomepage
path: root/options/m_option.c
Commit message (Collapse)AuthorAge
...
* vo, ao: disable positional parameter suboptionsGravatar wm42016-09-01
| | | | | | | | | | | | | | | | 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 aliasGravatar wm42016-08-31
| | | | | | | | | 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 clampingGravatar wm42016-08-31
| | | | | | | | | 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 flagGravatar wm42016-08-30
| | | | | | 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 optionsGravatar wm42016-08-17
| | | | Used by the next commit.
* m_option: simplify float value range handlingGravatar wm42016-08-17
| | | | | | 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 operationsGravatar wm42016-08-05
| | | | | 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 ALSAGravatar wm42016-08-04
| | | | | | | | | | | | | | | | | | | | | | | 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 sizeGravatar maniak13492016-05-22
| | | | | | | 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 appropriateGravatar wm42016-05-04
| | | | | | | | | | | | 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_NODEGravatar wm42016-04-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 outputGravatar wm42016-04-13
| | | | In particular get rid of the semi-deprecated ":" separator.
* m_option: add string conversion for --audio-channelsGravatar wm42016-04-13
| | | | Requested in #3040.
* mpv_talloc.h: rename from talloc.hGravatar Dmitrij D. Czarkoff2016-01-11
| | | | This change helps avoiding conflict with talloc.h from libtalloc.
* options: fix conversion of flags to stringsGravatar wm42015-07-01
| | | | | | | | | | 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 messageGravatar wm42015-06-27
| | | | | "mpv --ao=wasapi:help" on Linux gave "Option ao doesn't exist.". Completely misleading and stupid.
* audio: replace format name tableGravatar wm42015-06-26
| | | | Having a big switch() is simpler.
* options: make keyvalue list parsing less strictGravatar wm42015-06-10
| | | | | Affects for example --script-opts. A bunch of characters are now allowed in them without causing trouble to the user.
* options: change [...] to balanced quotesGravatar wm42015-04-19
| | | | | | | | 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 argumentGravatar wm42015-04-13
| | | | | | | 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 headersGravatar Marcin Kurczewski2015-04-13
| | | | Signed-off-by: wm4 <wm4@nowhere>
* video: cleanup stereo mode parsingGravatar wm42015-04-02
| | | | | | | | | 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 conversionGravatar wm42015-04-01
| | | | Fixes #1744.
* video: move colorspace overrides to vf_format, simplifyGravatar wm42015-03-31
| | | | | | | | | | | | | | | | | | | 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 argsGravatar wd02015-03-29
| | | | | | 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 typesGravatar wm42015-03-24
| | | | | | | | 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 initializationGravatar wm42015-03-23
|
* options: add flag option typeGravatar wm42015-03-04
|
* options: handle choice -> flag fallback automaticallyGravatar wm42015-02-27
| | | | | | | | | | | | | | | 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 parserGravatar wm42015-02-27
|
* options: change --msg-level optionGravatar wm42015-02-06
| | | | | | | | | | | | | | 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 listsGravatar wm42015-02-06
| | | | | | | | 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=x50Gravatar wm42015-02-04
| | | | | | 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 optionsGravatar wm42015-02-02
|
* options: fix parsing for --ab-loop-*Gravatar wm42014-12-12
| | | | Editing mistake. Oops.
* options: add slightly more sophistcated mechanism for option deprecationGravatar wm42014-12-11
|
* m_option: never return NOPTS value as number from propertiesGravatar wm42014-12-10
| | | | | | | | 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 failingGravatar wm42014-12-01
| | | | | | | | | | 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 warningGravatar wm42014-12-01
| | | | | This was relevant for --af and --vo (both use this option type, and have deprecated aliases).
* options: simplify channel map validationGravatar wm42014-12-01
| | | | | 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 checksGravatar wm42014-11-21
| | | | Found by Coverity; also see commit 85fb2af3.
* command: implement A-B loopsGravatar wm42014-11-18
| | | | | | | | | | | | | 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 metadataGravatar wm42014-11-13
| | | | | | | 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 jsonGravatar wm42014-10-23
| | | | | Useful for debugging and informational purposes. Not sure if it's sane in any form.
* lua: strictly free memory on errorsGravatar wm42014-10-19
| | | | | | | 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 supportGravatar wm42014-08-30
| | | | | | | | | | | | | | | | | | | | | 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 messageGravatar wm42014-08-28
|
* options: fix key-value-list optionsGravatar wm42014-08-05
| | | | | | | | 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 usesGravatar wm42014-07-01
| | | | | | | | | | | | | | | | 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 PTSGravatar Tsukasa OMOTO2014-06-29
| | | | Signed-off-by: wm4 <wm4@nowhere>