summaryrefslogtreecommitdiffstats
path: root/options/m_option.c
Commit message (Collapse)AuthorAgeFilesLines
* Revert "parse_commandline: fail gracefully on bad args"wm42017-06-241-1/+1
| | | | | | This reverts commit 38b05daf7d16898f4a63e4ccf48479d8964e6e19. There was actually no LGPL relicensing agreement with wd0.
* options: simplify and rename m_option_type_storewm42017-06-231-38/+18
| | | | | | | | | | This was an annoying option type. And still is. But at least it's on the same level as m_option_type_print_fn now, and can probably cleaned up further like it. Both types are for options that are only on the command line, always have special handling (i.e. do something with them in parse_commandline.c before passing them to the generic m_config.c/m_option.c layers), and are m_options only for --list-options and (oddly) the split_opt_silent() function.
* options: unbreak -hwm42017-06-231-0/+2
| | | | Sure is a simple thing to break.
* Revert "m_option: make geometry code GPL-only"wm42017-06-221-32/+0
| | | | | | | | | | | | | | | | | | This reverts commit e30fe38a212d52bca4693941a7cfa9e44b675a66. The original author as well as the author from d568eaa2 agreed to LGPL now. The only one missing is 0842caf6 (Henk could not be reached, and that will probably stay this way). When I discussed this with someone else who knows a lot about copyright (j-b), the conclusion was that the rewrite was actually enough to remove all past copyright. Only the syntax and the option name remained the same, but code, code structure, and architecture all changed radically. So I'm content with dropping the GPL part. (m_option.c is still formally GPL due to the special agreement with michael, but once this is fullfilled, we will change the license to LGPL without further checks.)
* m_option: make geometry code GPL-onlywm42017-06-211-0/+32
| | | | | | | | | | | In commit eb22569ff082b, I claimed that the geometry parsing code was rewritten. But I'm not sure if it's rewritten enough, or if copyright claims could still be made. Given that the original code was self-contained, and could be considered a separate work, it's probably safer (and more up to the standards applied to this relicensing) to leave this as GPL code. The rewrite/code move can be seen with: git diff f2dcdca...ccaed5e
* img_format: minor simplificationwm42017-06-181-1/+1
|
* options: change license of most files to LGPL (except options.c/.h)wm42017-06-121-0/+2
| | | | | | | | | | | | | | | | | | | | | | | All authors of the current code have agreed (as far as this commit requires). options.c/options.h will take more effort, because it contains all the option declarations, and thus is touched extremely often. m_option.c is technically still GPL, because of commit 2c82d5a1d85378dd0 (michael has agreed to LGPL, but only once the core of mpv is LGPL). The geometry parsing code in m_option.c was originally by someone who could not be reached. However, it was heavily rewritten anyway, and only the syntax remains (i.e. not copyright-relevant). parse_commandline.c contains a change by "adland" (commit 1d0ac71ae8ba), who could not be reached - this this specific part is GPL only. Fortunately, it matters only for DVD (and even then is more like a hack, but whatever). There are some other relevant changes, but they have all been reverted, moved somewhere else, deleted, or replaced.
* m_option: revert commit 2793a70e0fb3wm42017-06-121-3/+2
|
* m_option: fix leaks with OPT_KEYVALUELIST optionswm42017-06-081-0/+3
| | | | | For example, specifying --script-opts multiple times could leak some data.
* 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
| |