summaryrefslogtreecommitdiffstats
path: root/options/m_config.c
Commit message (Collapse)AuthorAgeFilesLines
* osdep: rename atomics.h to atomic.hwm42016-09-071-1/+1
| | | | | The standard header is stdatomic.h, so the extra "s" freaks me out every time I look at it.
* m_config: avoid accidentally causing deprecation warningswm42016-09-051-41/+52
| | | | | | | | | It has to copy each option, whether it's deprecated or not. This would print a warning on every deprecated sub-option, even if it's not used. Yep, this is very stupid. At least m_config_get_co() gets actually slightly cleaner, because it separates the search and the deprecation handling.
* options: add automagic hack for handling sub-option deprecationswm42016-09-051-5/+47
| | | | | | | | | | | | | | | | | I decided that it's too much work to convert all the VO/AOs to the new option system manually at once. So here's a shitty hack instead, which achieves almost the same thing. (The only user-visible difference is that e.g. --vo=name:help will list the sub-options normally, instead of showing them as deprecation placeholders. Also, the sub-option parser will verify each option normally, instead of deferring to the global option parser.) Another advantage is that once we drop the deprecated options, converting the remaining things will be easier, because we obviously don't need to add the compatibility hacks. Using this mechanism is separate in the next commit to keep the diff noise down.
* options: add a mechanism to make sub-option replacement slightly easierwm42016-09-051-0/+16
| | | | | | | | Instead of requiring each VO or AO to manually add members to MPOpts and the global option table, make it possible to register them automatically via vo_driver/ao_driver.global_opts members. This avoids modifying options.c/options.h every time, including having to duplicate the exact ifdeffery used to enable a driver.
* m_config: move parts of m_config_add_option into its own functionwm42016-09-051-26/+36
| | | | Preparation for the next commit.
* config: allow profile forward-references in default profilewm42016-09-021-2/+9
| | | | | | | | This works by first parsing a config file into the default profile, and applying it once parsing the whole file is finished. This won't work across config files (not even if you include other config files via "include=file.conf").
* m_config: make sure profile values are never NULLwm42016-09-021-5/+4
| | | | | | | | | | Apparently this was supposed to be handled - but badly at best. Make unset values always have the value "" instead of NULL to avoid special-cases. In particular, this fixes passing NULL to a %s format specifier to printf in show_profile(). Glibc prints this as "(null)", but it's undefined behavior, and other libcs can crash.
* vo_opengl: deprecate sub-options, add them as global optionswm42016-09-021-20/+36
| | | | | | | | | | | | | | | | | | | | | | | | 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>.
* m_config: add some convenience functionswm42016-09-021-0/+21
| | | | To be used by the following commits.
* m_config: introduce basic mechanism to synchronize global option updateswm42016-09-021-4/+203
| | | | | | | | | | | | | | | | | | The way option runtime changes are handled is pretty bad in the current codebase. There's a big option struct (MPOpts), which contains almost everything, and for which no synchronization mechanism exists. This was handled by either making some options read-only after initialization, duplicating the option struct, using sub-options (in the VO), and so on. Introduce a mechanism that creates a copy of the global options (or parts of it), and provides a well-defined way to update them in a thread-safe way. Most code can remain the same, just that all the component glue code has to explicitly make use of it first. There is still lots of room for improvement. For example, the update mechanism could be better.
* m_config: add helper function for initializing af/ao/vf/vo suboptionswm42016-09-021-3/+19
| | | | | | | | Normally I'd prefer a bunch of smaller functions with fewer parameters over a single function with a lot of parameters. But future changes will require messing with the parameters in a slightly more complex way, so a combined function will be needed anyway. The now-unused "global" parameter is required for later as well.
* command: add options to property listwm42016-09-011-1/+11
| | | | | | | | | | | Now options are accessible through the property list as well, which unifies them to a degree. Not all options support runtime changes (meaning affected components need to be restarted for the options to take effects). Remove from the manpage those properties which are cleanly mapped to options anyway. From the user-perspective they're just options available through the property interface.
* m_config: fix "no-" option handling with sub-optionswm42016-09-011-1/+1
| | | | | | | | | | E.g. --vf=scale=no-arnd didn't work, because it didn't recognize no-arnd as flag option. The top-level command line parser is not affected by this, because it uses the result of m_config_option_requires_param() differently and assumes unknown parameters do not necessarily require a parameter. (The suboption parser can't do this.)
* m_config: remove an unused functionwm42016-08-311-16/+6
| | | | Well, almost unused.
* m_config: remove some aliasing checkswm42016-08-311-19/+2
| | | | | We strictly assume no aliasing (the previous commit removed the last case), so remove the checks.
* m_option: replace --no-video-aspect aliaswm42016-08-311-15/+2
| | | | | | | | | 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_config: deprecate top-level suboptionswm42016-08-311-0/+5
| | | | | | | | | | | | | | | This is a really old weird MPlayer feature. While the MPlayer requires you to use the sub-option syntax in these cases, mpv "flattens" them to normal options. The still-supported alternate sub-option syntax remains a weird artifact that hopefully nobody uses. For example you can do "-sub-text font=Foo:color=0.5" instead of using "--sub-text-font=Foo --sub-text-color=0.5". For --sub-text this is an accidental feature, but it used to be documented for --demuxer-rawaudio and some others. This should just be removed, but for now only print a warning to preempt complaints from weird users wanting this feature back.
* client API: deprecate "no-..." option handlingwm42016-08-311-0/+7
| | | | | | | | The client API can do this (and there are apparently some libmpv using projects which rely on this). But it's just unnecessary bloat as it requires a separate code path from the option parser. It would be better to remove this code. Formally deprecate it, including API bump and warning in the API changes file to make it really clear.
* m_config: introduce and use OPT_ALIAS for some optionswm42016-08-311-8/+6
| | | | | | | | | | | | | | OPT_ALIAS redirects the options at a higher level, instead of introducing "duplicate" options with different name but same backing storage. This uses the OPT_REPLACED mechanisms - only the deprecation warning had to be made conditional. Note that e.g. --no-video still works, because the "--no-..." redirection and OPT_ALIAS are orthogonal. The deprecated --sub -> --sub-file alias had to be dropped, because it essentially conflicts with --no-sub. If anyone complains, this could probably still be undone by letting m_config_find_negation_opt do a special mapping for --no-sub. (Which would be dumb, but simple and effective.)
* m_config: handle --no-... options differentlywm42016-08-311-53/+44
| | | | | | | Instead of adding "no-"-prefixed aliases to the internal option list, which will act like normal options, do it in the parsing stage. This turns out to be simpler (and cheaper), and avoids adding aliased options.
* m_config: pass parent option in m_config_add_option()wm42016-08-301-9/+10
| | | | | Instead of just the parent name. This is a minor refactor as preparation for other things.
* m_config: rename is_generated to is_hiddenwm42016-08-301-6/+6
| | | | | | More appropriate. Originally it really was for automatically added options, but now it even needed some stupid comments to indicate that it was used for simply hiding options.
* m_option: remove M_OPT_TYPE_DYNAMIC flagwm42016-08-301-1/+1
| | | | | | 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_config: profile option values can be NULLwm42016-08-291-1/+2
| | | | Sigh.
* command: export profile list as a propertywm42016-08-281-0/+27
| | | | | | | Targeted at scripts, which can do whatever they want with it. This comes with the promise that they could get randomly broken any time. See #977.
* options: add a deprecation warning printing mechanismwm42016-06-291-0/+7
| | | | | | | | | | We have a warning mechanism for removed and for replaced options, but none yet for options which have been simply deprecated. For the following commit. (Fun fact: just adding the m_option field increases binary size by 14KB.)
* vo_opengl: somewhat simplify suboption handling messwm42016-06-041-14/+37
| | | | | | | | | | | | | | | Enable m_sub_options_copy() to copy nested sub-options, and also enable it to create an option struct from defaults. We can get rid of most of the crap in assign_options() now. Calling handle_scaler_opt() to get a static allocation for scaler name is still needed. It's moved to reinit_scaler(), which seems to be a better place for it. Without it, dangling pointers could be created when options are changed. (And in fact, this fixes possible dangling pointers for window.name.) In theory we could create a dynamic copy, but that seemed even more messy. Chance of regressions.
* mpv_talloc.h: rename from talloc.hDmitrij D. Czarkoff2016-01-111-1/+1
| | | | This change helps avoiding conflict with talloc.h from libtalloc.
* Remove some VLAswm42015-11-061-12/+4
| | | | | | | | They are evil and should be eradicated. Some of these were pretty dumb anyway. There are probably some more around in platform specific code or other code not enabled by default on Linux.
* options: handle terminal/logging settings eagerlywm42015-11-041-13/+18
| | | | | | | | | | | Update msg.c state immediately if a terminal or logging setting is set. Until now, this was delayed until mp[v]_initialize() was called. When using the client API, you could easily miss logged error messages, even when logging was initialized early on by calling mpv_request_log_messages(). (Properties can't be used for this either, because properties do not work before mpv_initialize().)
* command: add property indicating per-file optionswm42015-07-231-0/+2
| | | | Fixes #2165, more or less.
* m_config: make m_config_set_profile() use a namewm42015-05-071-9/+14
| | | | Is simpler and avoids exposing profile structs to a degree.
* Update license headersMarcin Kurczewski2015-04-131-5/+4
| | | | Signed-off-by: wm4 <wm4@nowhere>
* options: rewrite config file parserwm42015-04-041-0/+8
| | | | | | | | | | | | | | | | The format doesn't change. Some details are different, though. For example, it will now accept option values with spaces even if they're not quoted. (I see no reason why the user should be forced to add quotes.) The code is now smaller and should be much easier to extend. It also can load config from in-memory buffers, which might be helpful in the future. read_file() should eventually be replaced with stream_read_complete(). But since the latter function may access options under various circumstances, and also needs access to the mpv_global struct, there is a separate implementation for now.
* m_config: remove assertion for option names with length 0wm42015-03-291-2/+4
| | | | | | | | | There's actually no reason why we should assert. It's unexpected and "should" not happen, but actually there are several ways to make it happen. Still, add a check m_config_get_co(), to avoid matching pseudo-entries with no name.
* m_config: log options set by the client API toowm42015-02-161-0/+7
|
* options: don't list removed optionswm42015-01-251-0/+3
|
* options: don't cut off long options in --list-optionswm42015-01-061-1/+1
| | | | | | | This was by design, so that overly long options don't mess up the column layout, but I guess it doesn't have much worth. Fixes #1426.
* options: make --no-... options work for OPT_REPLACED toowm42014-12-111-7/+21
| | | | | | | | Do this by automatically adding the option, if the aliased option name also has a "no-..." variant. Could be easier by manually adding "no-..." variants to the option list, but this seems better because you can't just forget it.
* options: add slightly more sophistcated mechanism for option deprecationwm42014-12-111-92/+34
|
* m_config: add function to copy all optionswm42014-10-061-1/+14
| | | | Needed to copy the global option struct in the next commit.
* cocoa: remove --fs-missioncontrolStefano Pigozzi2014-10-051-1/+0
| | | | | | | This is the first of a series of commits that will change the Cocoa way in a way that is easily embeddable inside parent views. To reach that point common code must avoid referencing the parent NSWindow since that could be the host application's window.
* options: remove --volstepwm42014-09-211-0/+1
| | | | | | | It's just confusing; users are encouraged to edit input.conf instead (changing the argument to the "add" command). Update input.conf to keep the old behavior.
* options: add M_OPT_FILE flag to mark options that want a file(list)Alessandro Ghedini2014-09-131-0/+2
|
* m_config: fix theoretic undefined behaviorwm42014-09-131-4/+7
| | | | | | | | | The memcpy() is actually not enough: the types are incompatible, and no memcpy, union, etc. will change that. (Although no real compiler will ever break this.) Attempt to make this theoretically correct by actually using a struct pointer. It's not the same struct type, but supposedly it's ok, because all struct pointers always have the same size and representation in standard C.
* player: redo how stream caching and pausing on low cache workswm42014-08-271-0/+2
| | | | | | | | | | | | | | | | | | | Add the --cache-secs option, which literally overrides the value of --demuxer-readahead-secs if the stream cache is active. The default value is very high (10 seconds), which means it can act as network cache. Remove the old behavior of trying to pause once the byte cache runs low. Instead, do something similar wit the demuxer cache. The nice thing is that we can guess how many seconds of video it has cached, and we can make better decisions. But for now, apply a relatively naive heuristic: if the cache is below 0.5 secs, pause, and wait until at least 2 secs are available. Note that due to timestamp reordering, the estimated cached duration of video might be inaccurate, depending on the file format. If the file format has DTS, it's easy, otherwise the duration will seemingly jump back and forth.
* build: include <strings.h> for strcasecmp()wm42014-07-101-0/+1
| | | | | | | It happens to work without strings.h on glibc or with _GNU_SOURCE, but the POSIX standard requires including <strings.h>. Hopefully fixes OSX build.
* options: remove bogus replacement message for --fstypewm42014-07-051-1/+0
| | | | CC: @mpv-player/stable
* options: add --autosub-match to option replacement listwm42014-07-051-0/+1
| | | | CC: @mpv-player/stable
* options: remove some more stuffwm42014-06-131-16/+11
| | | | | | | | The "classic" sub-option stuff is not really needed anymore. The only remaining use can be emulated in a simpler way. But note that this breaks the --screenshot option (instead of the "flat" options like --screenshot-...). This was undocumented and discouraged, so it shouldn't affect anyone.
* options: remove some unneeded stuffwm42014-06-131-7/+2
| | | | | No options pointing to global variables are in use anymore, so that part can be removed.
* options: remove OPT_FLAG_CONSTANTSwm42014-06-131-1/+1
| | | | | | | This means use of the min/max fields can be dropped for the flag option type, which makes some things slightly easier. I'm also not sure if the client API handled the case of flag not being 0 or 1 correctly, and this change gets rid of this concern.
* options: turn --idx, --forceidx into --indexwm42014-06-131-0/+2
| | | | | | | | | | | | Also clarify the semantics. It seems --idx didn't do anything. Possibly it used to change how the now removed legacy demuxers like demux_avi used to behave. Or maybe it was accidental. --forceidx basically becomes --index=force. It's possible that new index modes will be added in the future, so I'm keeping it extensible, instead of e.g. creating --force-index.
* Add more constwm42014-06-111-2/+2
| | | | | | | While I'm not very fond of "const", it's important for declarations (it decides whether a symbol is emitted in a read-only or read/write section). Fix all these cases, so we have writeable global data only when we really need.
* m_config: add function to copy subopt-structwm42014-06-111-0/+37
|
* cache: redo options and default settingswm42014-05-201-1/+0
| | | | | | | | | | | | Some options change from percentages to number of kilobytes; there are no cache options using percentages anymore. Raise the default values. The cache is now 25000 kilobytes, although if your connection is slow enough, the maximum is probably never reached. (Although all the memory will still be used as seekback-cache.) Remove the separate --audio-file-cache option, and use the cache default settings for it.
* options: unify code for setting string and "raw" optionswm42014-05-181-42/+83
| | | | | | | | | The code paths for setting options by string and by direct "raw" value were too different, which resulted in some weird code. Make the code paths closer to each other. Also, use this to remove the weirdness in the mpv_set_option() implementation.
* options: print replacement for renamed/replaced optionswm42014-05-051-1/+87
| | | | | | | | | 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.
* client API: make mpv_set_option set options nativelywm42014-04-221-21/+24
| | | | | | | | | | | | | | | | | | | | | | | | This should fix some issues, such as not being able to set the "no-video" option with MPV_FORMAT_FLAG. Note that this changes semantics a bit. Now setting an option strictly overwrite it, even if the corresponding command line option does not. For example, if we change --sub to append by default, then setting the "sub" option via the client API would still never append. (Oddly, this also applies to --vf-add, which will overwrite the old value when using the client API.) I'm doing this because there's no proper separation between the command line parser and setting an option using the MPV_FORMAT_STRING format. Maybe the solution to this mess would be adding format aware code (i.e. m_option_set_node) to every option type, and falling back to strings only if needed - but this would mean that you couldn't set e.g. an integer option using MPV_FORMAT_STRING, which doesn't seem to be ideal either. In conclusion, the current approach seems to be most robust, but I'm open to suggestions should someone find that these semantics are a problem.
* encode: don't apply default config optionswm4