summaryrefslogtreecommitdiffstats
path: root/options/m_config.c
Commit message (Collapse)AuthorAgeFilesLines
* msg: reinterpret a bunch of message levelsNiklas Haas2017-12-151-4/+4
| | | | | | | | | | | | | | | | | | | | | | I've decided that MP_TRACE means “noisy spam per frame”, whereas MP_DBG just means “more verbose debugging messages than MSGL_V”. Basically, MSGL_DBG shouldn't create spam per frame like it currently does, and MSGL_V should make sense to the end-user and provide mostly additional informational output. MP_DBG is basically what I want to make the new default for --log-file, so the cut-off point for MP_DBG is if we probably want to know if for debugging purposes but the user most likely doesn't care about on the terminal. Also, the debug callbacks for libass and ffmpeg got bumped in their verbosity levels slightly, because being external components they're a bit less relevant to mpv debugging, and a bit too over-eager in what they consider to be relevant information. I exclusively used the "try it on my machine and remove messages from MSGL_* until it does what I want it to" approach of refactoring, so YMMV.
* m_config: better variable namewm42017-09-221-5/+5
|
* options: properly handle deprecated options with CLI actionswm42017-09-221-8/+23
| | | | | | | | We want e.g. --opengl-shaders-append=foo to resolve to the new option, all while printing an option name. --opengl-shader is a similar case. These options are special, because they apply "actions" on actual options by specifying a suffix. So the alias/deprecation handling has to be part of resolving the actual option from prefix and suffix.
* options: add a thread-safe way to notify option updateswm42017-08-221-1/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | So far, we had a thread-safe way to read options, but no option update notification mechanism. Everything was funneled though the main thread's central mp_option_change_callback() function. For example, if the panscan options were changed, the function called vo_control() with VOCTRL_SET_PANSCAN to manually notify the VO thread of updates. This worked, but's pretty inconvenient. Most of these problems come from the fact that MPlayer was written as a single-threaded program. This commit works towards a more flexible mechanism. It adds an update callback to m_config_cache (the thing that is already used for thread-safe access of global options). This alone would still be rather inconvenient, at least in context of VOs. Add another mechanism on top of it that uses mp_dispatch_queue, and takes care of some annoying synchronization issues. We extend mp_dispatch_queue itself to make this easier and slightly more efficient. As a first application, use this to reimplement certain VO scaling and renderer options. The update_opts() function translates these to the "old" VOCTRLs, though. An annoyingly subtle issue is that m_config_cache's destructor now releases pending notifications, and must be released before the associated dispatch queue. Otherwise, it could happen that option updates during e.g. VO destruction queue or run stale entries, which is not expected. Rather untested. The singly-linked list code in dispatch.c is probably buggy, and I bet some aspects about synchronization are not entirely sane.
* options: fix --includewm42017-08-081-0/+2
| | | | | | | | This is really obnoxious. --include parses into the default profile, but when used on the command line, it did never get applied. So we have to apply it when the exact conditions for this are met. Fixes #4673.
* client API: drop some compatibility handlingwm42017-07-211-13/+2
| | | | See commit e4bc563fd2dcf for more information.
* options: change everything againwm42017-07-021-3/+26
| | | | Fucking bullshit.
* m_option: remove redundant indirectionswm42017-07-021-27/+23
| | | | | | Remove the various redundant m_config_set_option* calls, rename the remaining one to m_config_set_option_cli(), and merge the m_config_parse_option() function.
* options: list suffix actions as options toowm42017-06-271-2/+7
| | | | | | | These are not "really" separate actions, but on the command line they're obserable as such. So it would be a good idea to list them too. Adds about 117 options (holy fuck).
* options: handle suffixes like -add in a more generic waywm42017-06-261-28/+66
| | | | | | | | | | | | | | | | This affects options like --vf or --display-tags. These used a "*" suffix to match all options starting with a specific name, and handled the rest in the option parser. Change this to remove the "*" special case, and require every option parser to declare a list of allowed suffixes via m_option_type.actions. The new way is conceptually simpler, because we don't have to account for the "*" in a bunch of places anymore, and instead everything is centrally handled in the CLI part of the option parser, where it's actually needed. It automatically enables suffixes like -add for a bunch of other stringlist options.
* client API: drop old "no-" option emulationwm42017-06-261-22/+2
| | | | | | | You could do mpv_set_option(h, "no-fs", ""), which would behave like "--no-fs" on the command line. At one point, this had to be emulated for compatibility, and printed a deprecation warning. This was almost a year ago, so remove it.
* options: make mess to allow setting profile option with libmpvwm42017-06-151-81/+81
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Certain options, such as --profile, --help, and many others require special-handling, because they don't fit conceptually into the option and property model. They don't store data, but perform actions. This caused the situation that profiles could not be set when using libmpv in encoding mode (although you should probably not used libmpv in encoding mode). Using libmpv always ends up in calling m_config_set_option_raw_direct(), while --profile was handled in m_config_parse_option(). Solve this by moving the handling of this from m_config_parse_option() to m_config_set_option_raw_direct(). Actually we just stuff most of this into m_config_handle_special_options(), which is only called by the aforementioned function. Strangely this also means that the --h/--help option declarations need to be changed, because they used OPT_PRINT, and now the option "parser" is always invoked before the special code. Thus, make them a string. Them being OPT_PRINT was apparently always redundant. (The other option declarations are moved for cosmetic purposes only.) The most weird change is how co->data==NULL is handled. We now allow passing down involved options to m_config_set_option_raw_direct(). The thing is that we don't want them to error if the command line parser is using them (with special handling done there), while all other code paths should raise an error. We try using M_SETOPT_FROM_CMDLINE to distinguish these cases. Note that normal libmpv users are supposed to use the "apply-profile" command instead. This probably contains a bunch of bugs, which you should report.
* options: change license of most files to LGPL (except options.c/.h)wm42017-06-121-7/+7
| | | | | | | | | | | | | | | | | | | | | | | 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.
* options: deprecate --loopwm42017-04-101-5/+9
| | | | | | | | | | Also "announce" the plans to undeprecate it with changed semantics later. The deprecation period is needed to warn script authors and client API users (etc.) of the change. This is done because everyone seems to expect --loop to loop the current file, not the playlist. Even in cases when only 1 file is on the playlist, the --loop-file semantics seem to be preferred.
* options: change --h=... behaviorwm42016-12-161-7/+1
| | | | | Does not match a shell pattern anymore. Instead, a simple sub-string search is done.
* options: some simplificationswm42016-11-291-36/+17
| | | | | | | | 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-65/+100
| | | | | | | | 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: remove legacy global sub-option syntaxwm42016-11-221-54/+3
| | | | | | A bit of sanity, although a very small one. --vo sub-options are not affected by this yet.
* options: fnmatch: check existence instead of posixAvi Halachmi (:avih)2016-11-081-1/+0
|
* options: handle legacy no-* sub-optionswm42016-10-211-8/+21
| | | | | | | | These accidentally did nothing. They must be handled explicitly. Example: --vo=vdpau:no-composite-detect (Can't wait to get rid of this crap.)
* player: do not let pseudo-gui override user config settingswm42016-09-231-0/+7
| | | | | | | | Seems like this confused users quite often. Instead of --profile=pseudo-gui, --player-operation-mode=pseudo-gui now has to be used to invoke pseudo GUI mode. The old way still works, and still behaves in the old way.
* m_config, command: remove some minor code duplicationwm42016-09-231-3/+7
| | | | | | I would have been fine with this, but now I want to add another flag, and the duplication would become more messy than having a strange function for deduplication.
* client API: more or less deprecate mpv_set_option()wm42016-09-211-1/+3
| | | | | | | | | | | | | | | | | | | | | | With the merging of options and properties, the mpv_set_option() function is close to being useless, and mpv_set_property() can be used for everything instead. There are certain conflicts remaining, which are explained in depth in the docs. For now, none of this should affect existing code using the client API. Make mpv_set_property() redirect to mpv_set_option() before initialization. Remove some options marked as M_OPT_FIXED. The "pause" and "speed" options cannot be written anymore without the playloop being notified by it, so the M_OPT_FIXED does nothing. For "vo-mmcss-profile", the problem was lack of synchronization, which has been added. I'm not sure what the problem was with "frames" - I think it was only marked as M_OPT_FIXED because changing it during playback will have no effect. Except for pause/speed, these changes are needed to make them writable as properties after mpv_initialize(). Also replace all remaining uses of CONF_GLOBAL with M_OPT_FIXED.
* options: slightly better option update mechanismwm42016-09-191-7/+17
| | | | | | | | | | | | | | Extend the flag-based notification mechanism that was used via M_OPT_TERM. Make the vo_opengl update mechanism use this (which, btw., also fixes compilation with OpenGL renderers forcibly disabled). While this adds a 3rd mechanism and just seems to further the chaos, I'd rather have a very simple mechanism now, than actually furthering the mess by mixing old and new update mechanisms. In particular, we'll be able to remove quite some property implementations, and replace them with much simpler update handling. The new update mechanism can also more easily refactored once we have a final mechanism that handles everything in an uniform way.
* player: more option/property consistency fixeswm42016-09-181-5/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | Some properties had a different type from their equivalent options (such as mute, volume, deinterlace, edition). This wasn't really sane, as raw option values should be always within their bounds. On the other hand, these properties use a different type to reflect runtime limits (such as range of available editions), or simply to improve the "UI" (you don't want to cycle throuhg the completely useless "auto" value when cycling the "mute" property). Handle this by making them always return the option type, but also allowing them to provide a "constricted" type, which is used for UI purposes. All M_PROPERTY_GET_CONSTRICTED_TYPE changes are related to this. One consequence is that you can set the volume property to arbitrary high values just like with the --volume option, but using the "add" command it still restricts it to the --volume-max range. Also deprecate --chapter, as it is grossly incompatible to the chapter property. We pondered renaming it to --chapters, or introducing a more powerful --range option, but concluded that --start --end is actually enough. These changes appear to take care of the last gross property/option incompatibilities, although there might still be a few lurking.
* options: take care of propertly updating options on runtime changeswm42016-09-171-3/+23
| | | | | | | | | | | | | | | | | | | | | | All option write accesses are now put through the property interface, which means runtime option value verification and runtime updates are applied. This is done even for command line arguments and config files. This has many subtle and not-so-subtle consequences. The potential for unintended and intended subtle or not-subtle behavior changes is very large. Architecturally, this is us literally jumping through hoops. It really should work the other way around, with options being able to have callbacks for value verification and applying runtime updates. But this would require rewriting the entirety of command.c. This change is more practical, and if anything will at least allow incremental changes. Some options are too incompatible for this to work - these are excluded with an explicit blacklist. This change fixes many issues caused by the mismatch between properties and options. For example, this fixes #3281.
* options: fix pseudo-options like -vwm42016-09-171-1/+1
| | | | | | | Some pseudo-options do not have associated storage, which made m_config_set_option_raw() return failure. Regression due to commit d1d5e9dd.
* 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.
* m_config: make option setting always call m_config_set_option_raw()wm42016-09-171-14/+20
| | | | | | | | | | This makes m_config_set_option_raw() the function that is always called on the lowest level (as leaf function for all other functions). To do this, m_config_parse_option() has to do something special to deal with "impure" options like --vf-add, which work on the previous option value, instead of fully replacing it. m_config_set_option_raw() itself always completely replaced the previous value.
* options: kill M_OPT_GLOBAL flagwm42016-09-171-13/+2
| | | | | | This meant "cannot be used as per-file option" (wrt. playlist items). Doesn't make too much sense anymore, especially given how obscure per-file options are.
* options: fix another minor regressionwm42016-09-111-1/+2
| | | | vf_scale's "h" sub-option was interpreted as "--h".
* options: fix --list-options after previous commitwm42016-09-101-2/+3
| | | | Fixes #3509.
* options: make --h list options according to a pattern passed to itwm42016-09-101-4/+21
| | | | | | Useless feature, but I want it. Won't work on Windows due to missing fnmatch().
* m_config: remove another unused leftoverwm42016-09-101-12/+0
|
* stream, demux, config: remove some dead/unneeded option-related codewm42016-09-091-63/+5
| | | | | | | | | | This has all been made unnecessary recently. The change not to copy the global option struct in particular can be made because now nothing accesses the global options anymore in the demux and stream layers. Some code that was accidentally added/changed in commit 5e30e7a0 is also removed, because it was simply committed accidentally, and was never used.
* 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
| | |