summaryrefslogtreecommitdiffstats
path: root/options/m_config_frontend.c
Commit message (Collapse)AuthorAgeFilesLines
* m_property: add `>` for fixed precision floating-point expansionKacper Michajłow2024-03-211-1/+1
| | | | | | | | | | | | | | This enhancement makes it easier to create constant width property expansions, useful for the `--term-status-msg`. Additionally, it changes to `%f` printing with manual zero trimming, which is easier to control than `%g`. With this method, we can directly specify precision, not just significant numbers. This approach also avoids overly high precision for values less than 1, which is not necessary for a generic floating-point print function. A new print helper function is added, which can be used with adjusted precision for specific cases where a different default is needed. This also unifies the code slightly.
* ALL: use new mp_thread abstractionKacper Michajłow2023-11-051-5/+5
|
* m_option: initialize m_option_value union properlyKacper Michajłow2023-10-231-4/+3
| | | | | | | | | C standard says that `= {0}` activates and initializes first member of union. We expect whole union to be zeroed, it is used as default value. Initialize union with one zeroed default instance to ensure proper init. Fixes: #12711
* various: sort some standard headersNRK2023-10-201-6/+6
| | | | | | | | | | | | since i was going to fix the include order of stdatomic, might as well sort the surrouding includes in accordance with the project's coding style. some headers can sometime require specific include order. standard library headers usually don't. but mpv might "hack into" the standard headers (e.g pthreads) so that complicates things a bit more. hopefully nothing breaks. if it does, the style guide is to blame.
* osdep: remove atomic.hNRK2023-10-201-1/+1
| | | | | | | replace it with <stdatomic.h> and replace the mp_atomic_* typedefs with explicit _Atomic qualified types. also add missing config.h includes on some files.
* options: remove --vf-defaults and --af-defaultsDudemanguy2023-09-211-10/+1
| | | | | | | These were deprecated a long time ago and apparently didn't even work with lavfi filters. Go ahead and remove them and additionally clean up some code related to them. m_config_from_obj_desc_and_args becomes much simpler now and a couple of arguments can be completely removed.
* options: log profile name if there is no restore dataNatural-Harmonia-Gropius2022-10-281-1/+1
|
* options: const annotate all m_opt_choice_alternatives accessorsEmil Velikov2021-11-151-1/+1
| | | | | | | Constant data, most accessors are good but some were missing the explicit notation. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com>
* options: don't always set set-locally to trueGuido Cella2021-08-031-2/+1
| | | | | | | | | | | | | | | | Since 1d1d1fbff9 option-info/<name>/set-locally was being set to true for every option. This broke setting start from ytdl-hook, which doesn't overwrite start if it was set-locally. Fix this so that only adding an option to reset-on-next-file or setting file-local-options/<name> make set-locally true like before. However, it's arguable that just adding an option to reset-on-next-file without ever changing it should not make set-locally true, so that e.g. --reset-on-next-file=start 'https://youtube.com/watch?v=...&t=30' will start at 30, though it currently doesn't. Fixes #9081.
* manpage: fix watch-later-options examplesGuido Cella2021-07-211-3/+1
| | | | | | | | --watch-later-options-remove doesn't accept multiple options, so split the example. Also suggest the more correct -clr to empty the list, and remove the workaround to not print an error with --watch-later-options=
* options: add watch-later-optionsGuido Cella2021-07-211-0/+35
| | | | | | | | | | This allows configuring which options are saved by quit-watch-later. Fixes #4126, #4641 and #5567. Toggling a video or audio filter twice would treat the option as changed because the backup value is NULL, and the current value of vf/af is a list with one empty item, so obj_settings_list_equal had to be changed.
* options: add some way to more or less "unapply" profileswm42020-08-071-34/+117
| | | | | | | | | | | | | | | | | | | | | | | | Make it possible to restore from profiles by backing up the option values before profile application. This is sort of like unapplying a profile. Since there might be multiple ways to do this, a profile needs to explicitly provide the "profile-restore" option, which specifies how exactly this should be done. This is a big mess. There is not natural way to do this. Profile application is "destructive" and simply changes the values of the options. Maybe one could argue that the option system should have hierarchical "overlays" of profiles instead, where unset options will use the value of the lower profiles. Options set interactively by the user would be the top profile. Default values would be in the lowest profile. You could unapply a profile by simply removing it from this overlay stack. But uh, let's not, so here's something stupid. It reuses some code used for file local options to reduce code size. At least the overlay idea would still be possible in theory, and could be added as another profile-restore mode. This is used by the following commit.
* auto_profiles: add this scriptwm42020-08-051-0/+16
| | | | | | | | | | | | | | | | | | | | | This is taken from a somewhat older proof-of-concept script. The basic idea, and most of the implementation, is still the same. The way the profiles are actually defined changed. I still feel bad about this being a Lua script, and running user expressions as Lua code in a vaguely defined environment, but I guess as far as balance of effort/maintenance/results goes, this is fine. It's a bit bloated (the Lua scripting state is at least 150KB or so in total), so in order to enable this by default, I decided it should unload itself by default if no auto-profiles are used. (And currently, it does not actually rescan the profile list if a new config file is loaded some time later, so the script would do nothing anyway if no auto profiles were defined.) This still requires defining inverse profiles for "unapplying" a profile. Also this is still somewhat racy. Both will probably be alleviated to some degree in the future.
* options: change how option range min/max is handledwm42020-03-131-4/+5
| | | | | | | | | | | | | | | | | Before this commit, option declarations used M_OPT_MIN/M_OPT_MAX (and some other identifiers based on these) to signal whether an option had min/max values. Remove these flags, and make it use a range implicitly on the condition if min<max is true. This requires care in all cases when only M_OPT_MIN or M_OPT_MAX were set (instead of both). Generally, the commit replaces all these instances with using DBL_MAX/DBL_MIN for the "unset" part of the range. This also happens to fix some cases where you could pass over-large values to integer options, which were silently truncated, but now cause an error. This commit has some higher potential for regressions.
* options: more pushing code aroundwm42020-03-131-4/+47
| | | | | | | Try to remove m_config implementation details from m_config_frontend. Not sure if I like it. Seems to be ~100 lines of awkward code more, and not much is gained from it. Also it took way too long to do it, and there might be bugs.
* options: split m_config.c/hwm42020-03-131-0/+915
Move the "old" mostly command line parsing and option management related code to m_config_frontend.c/h. Move the the code that enables other part of the player to access options to m_config_core.c/h. "frontend" is out of lack of creativity for a better name. Unfortunately, the separation isn't quite clean yet. m_config_frontend.c still references some m_config_core.c implementation details, and m_config_new() is even left in m_config_core.c for now. There some odd functions that should be removed as well (marked as "Bad functions"). Fixing these things requires more changes and will be done separately. struct m_config is left with the current name to reduce diff noise. Also, since there are a _lot_ source files that include m_config.h, add a replacement m_config.h that "redirects" to m_config_core.h.