summaryrefslogtreecommitdiffstats
path: root/m_config.c
Commit message (Collapse)AuthorAgeFilesLines
* m_config: reallow specifying static default values for string optionswm42012-08-021-1/+1
| | | | | | | | | | | | Commit dc2a4863af9b0e introduced a new way of specifying default values for strings (you're supposed to use OPTDEF_STR() instead of putting it into the option struct, such as it was done in defaultopts.c). The code to handle the old way was explicitly disabled, which caused random crashes when used. Allow the old way again. With the main option struct in particular, I see no reason why some option defaults should be specified in defaultopts.c, and some directly along the options.
* mplayer: turn playtree into a list, and change per-file option handlingwm42012-07-311-132/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Summary: - There is no playtree anymore. It's reduced to a simple list. - Options are now always global. You can still have per-file options, but these are optional and require special syntax. - The slave command pt_step has been removed, and playlist_next and playlist_prev added. (See etc/input.conf changes.) This is a user visible incompatible change, and will break slave-mode applications. - The pt_clear slave command is renamed to playlist_clear. - Playtree entries could have multiple files. This is not the case anymore, and playlist entries have always exactly one entry. Whenever something adds more than one file (like ASX playlists or dvd:// or dvdnav:// on the command line), all files are added as separate playlist entries. Note that some of the changes are quite deep and violent. Expect regressions. The playlist parsing code in particular is of low quality. I didn't try to improve it, and merely spent to least effort necessary to keep it somehow working. (Especially ASX playlist handling.) The playtree code was complicated and bloated. It was also barely used. Most users don't even know that mplayer manages the playlist as tree, or how to use it. The most obscure features was probably specifying a tree on command line (with '{' and '}' to create/close tree nodes). It filled the player code with complexity and confused users with weird slave commands like pt_up. Replace the playtree with a simple flat playlist. Playlist parsers that actually return trees are changed to append all files to the playlist pre-order. It used to be the responsibility of the playtree code to change per-file config options. Now this is done by the player core, and the playlist code is free of such details. Options are not per-file by default anymore. This was a very obscure and complicated feature that confused even experienced users. Consider the following command line: mplayer file1.mkv file2.mkv --no-audio file3.mkv This will disable the audio for file2.mkv only, because options are per-file by default. To make the option affect all files, you're supposed to put it before the first file. This is bad, because normally you don't need per-file options. They are very rarely needed, and the only reasonable use cases I can imagine are use of the encode backend (mplayer encode branch), or for debugging. The normal use case is made harder, and the feature is perceived as bug. Even worse, correct usage is hard to explain for users. Make all options global by default. The position of an option isn't significant anymore (except for options that compensate each other, consider --shuffle --no-shuffle). One other important change is that no options are reset anymore if a new file is started. If you change settings with slave mode commands, they will not be changed by playing a new file. (Exceptions include settings that are too file specific, like audio/subtitle stream selection.) There is still some need for per-file options. Debugging and encoding are use cases that profit from per-file options. Per-file profiles (as well as per-protocol and per-VO/AO options) need the implementation related mechanisms to backup and restore options when the playback file changes. Simplify the save-slot stuff, which is possible because there is no hierarchical play tree anymore. Now there's a simple backup field. Add a way to specify per-file options on command line. Example: mplayer f1.mkv -o0 --{ -o1 f2.mkv -o2 f3.mkv --} f4.mkv -o3 will have the following options per file set: f1.mkv, f4.mkv: -o0 -o3 f2.mkv, f3.mkv: -o0 -o3 -o1 -o2 The options --{ and --} start and end per-file options. All files inside the { } will be affected by the options equally (similar to how global options and multiple files are handled). When playback of a file starts, the per-file options are set according to the command line. When playback ends, the per-file options are restored to the values when playback started.
* bstr: rename bstr() function to bstr0(), and typedef bstr to struct bstrwm42012-07-281-7/+7
| | | | | Replace all uses of bstr() with bstr0(). Also remove the ridiculous C++ workaround.
* options: support "no-foo" syntax for flag suboptionsUoti Urpala2012-07-271-6/+23
| | | | | | | Allow using "no-foo" as an alternative to "foo=no" for flag suboptions, similarly to what top-level flag options already support. This means things like "--lavdopts=no-fast" or "--vo=vdpau:no-chroma-deint" are now supported.
* options: make option struct the talloc parent of optionsUoti Urpala2012-07-161-5/+8
| | | | | | | | | | | Allocate dynamically-allocated option values as talloc children of the option struct. This will allow implementing per-object (VO etc) options so that simply freeing the object will free associated options too. This doesn't change quite every allocation in m_option.c, but the exceptions are legacy types which will not matter for new per-object options.
* options: support parsing values into substructsUoti Urpala2012-07-161-47/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add an alternate mode for option parser objects (struct m_config) which is not inherently tied to any particular instance of an option value struct. Instead, this type or parsers can be used to initialize defaults in or parse values into a struct given as a parameter. They do not have the save slot functionality used for main player configuration. The new functionality will be used to replace the separate subopt_helper.c parsing code that is currently used to parse per-object suboptions in VOs etc. Previously, option default values were handled by initializing them in external code before creating a parser. This initialization was done with constants even for dynamically-allocated types like strings. Because trying to free a pointer to a constant would cause a crash when trying to replace the default with another value, parser initialization code then replaced all the original defaults with dynamically-allocated copies. This replace-with-copy behavior is no longer supported for new-style options; instead the option definition itself may contain a default value (new OPTDEF macros), and the new function m_config_initialize() is used to set all options to their default values. Convert the existing initialized dynamically allocated options in main config (the string options --dumpfile, --term-osd-esc, --input=conf) to use this. Other non-dynamic ones could be later converted to use this style of initialization too. There's currently no public call to free all dynamically allocated options in a given option struct because I intend to use talloc functionality for that (make them children of the struct and free with it).
* options: simplify option parsing/setting machineryUoti Urpala2012-05-081-67/+49
| | | | | | | | | | | | Each option type had three separate operations to copy option values between memory locations: copy between general memory locations ("copy"), copy from general memory to active configuration of the program ("set"), and in the other direction ("save"). No normal option depends on this distinction any more. Change everything to define and use a single "copy" operation only. Change the special options "include" and "profile", which depended on hacky option types, to be special-cased directly in option parsing instead. Remove the now unused option types m_option_type_func and m_option_type_func_param.
* options: add "disabled option" functionalityUoti Urpala2011-09-041-12/+35
| | | | | | | | | | | Add functionality to mark options that depend on features disabled at compile time as disabled rather than not compiling the option definitions at all. This allows printing a warning about the option not being available because of a disabled feature, instead of just "unknown option". Because the option definitions are still compiled fully, this only works for definitions that do not reference symbols which are not available if the feature is disabled. Use the new functionality for options depending on libass.
* options: change option parsing to use bstrUoti Urpala2011-07-291-35/+40
| | | | | | Using bstr allows simpler parsing code, especially because it avoids the need to modify or copy strings just to terminate extracted substrings.
* options: indicate ambiguous option parameters explicitlyUoti Urpala2011-07-291-14/+19
| | | | | | | | Command line options like "-foo xyz" are ambiguous: "xyz" may be a parameter to the option "foo" or an unrelated argument. Instead of relying on the struct m_config mode field (commandline/file) pass parameters to specify ambiguous mode explicitly. Meant for "--foo" options which are never ambiguous on command line either.
* options: free option defaults when freeing configUoti Urpala2011-07-061-0/+5
| | | | | | | Possibly read-only default values of option variables are replaced with dynamically allocated defaults when registering options. Free these when freeing the overall config object on exit to clean up leak report results.
* options: allocate dynamic options with tallocUoti Urpala2011-07-061-3/+3
| | | | | | | | | Allocate data structures for dynamic option values with talloc. Hopefully there's no code left that tries to modify those dynamic option values outside the option parser and relies on them being malloc-allocated. Currently talloc functionality isn't used much and the allocations are not hierarchical, so the main practical use for now is just to allow very easy checking for memory leaks.
* cleanup: reformat and clean up m_config.[ch]Uoti Urpala2011-07-061-396/+409
| | | | | m_config.c changes include removal of "#ifdef MP_DEBUG" from around some assert lines.
* cleanup: remove more warningsClément Bœsch2011-05-021-3/+3
|
* options: remove CONF_OLD option flagUoti Urpala2011-01-311-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The resulting semantics of this flag are weird enough that they're unlikely to be what is wanted in any situation. Remove the flag and convert the two options using it, -screenw and -screenh, to use CONF_NOSAVE instead. I'm not sure why those specific options had the flag and if any flag is really needed, but I don't want to check in detail now and using CONF_NOSAVE should keep about the same behavior in practice. A bit more detail about the weird behavior this flag had: When not using file groups, the flag had the same behavior as CONF_NOSAVE, namely that when switching files the option would not be reset to the global value (only possible file-specific settings were applied). When using file groups, group-specific options would apply to the _first two_ files in the group, but for the rest after the first two, settings would not be reset when changing files (wtf?). This was a result of the following sequence: 1) push higher-level settings, enter group 2) apply group-specific settings 3) push settings before applying ones specific to file 1 in group 4) apply file 1 settings, play file 1 5) pop settings to return to group settings 6) push settings before applying ones specific to file 2 7) apply file 2 settings 8) pop settings Here the option was set at 2). 3) saved it because it had been set after last push, so 5) restored the setting and it was used for file 2 too. However 6) no longer saved it because there had been pushes after the original setting in 2), thus 8) no longer restored the setting and the option was no longer forced to any particular value when playing further files after that.
* commands: add generic option -> property wrapperUoti Urpala2010-12-181-2/+2
| | | | | | | | | Add mp_property_generic_option(), a property function that can be used for generic option-based properties that do not require any action beyond manipulating the value of the option variable. Currently it directly implements GET and SET, plus STEP_UP for "choice" options only. Use it to add a property for -pts-association-mode (not particularly useful in normal use, but serves as a test).
* options: fix autoloaded profile handling of flag optionsUoti Urpala2010-11-151-0/+3
| | | | | | | When loading automatically enabled profiles (like "[extension.avi]") flag options were handled as on the command line; for example "fs=no" was interpreted like "-fs" on command line, ignoring the "no" part. Fix the parsing to treat them the same as other config file entries.
* cleanup: don't check for NULL before free()diego2010-11-081-1/+1
| | | | | | patch by Clément Bœsch, ubitux gmail com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32598 b3059339-0415-0410-9bf9-f77b7e298cf2
* m_config.c: cosmetics: Move functions to avoid forward declarationsdiego2010-11-021-114/+108
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32387 b3059339-0415-0410-9bf9-f77b7e298cf2
* m_config.[ch]: mark some function parameters constdiego2010-11-021-6/+6
| | | | | | patch by Clément Bœsch, ubitux gmail com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32386 b3059339-0415-0410-9bf9-f77b7e298cf2
* Delete things related to old translation systemUoti Urpala2010-03-101-1/+0
| | | | | Remove the help/ subdirectory, configure code to create toplevel help_mp.h, and all the '#include "help_mp.h"' lines from .c files.
* Merge svn changes up to r30748Uoti Urpala2010-03-101-6/+6
|\
| * Make more option-parsing related function arguments const.reimar2010-02-251-4/+4
| | | | | | | | | | | | | | Prerequisite for making stream_open filename const in a proper way. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30737 b3059339-0415-0410-9bf9-f77b7e298cf2
| * Mark m_config_get_option_ptr() as static, it is only used within the file.diego2010-02-201-1/+1
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30673 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Merge svn changes up to r30475Uoti Urpala2010-03-091-0/+17
|\|
| * Add license header to all top-level files missing them.diego2010-01-301-0/+17
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30471 b3059339-0415-0410-9bf9-f77b7e298cf2
| * whitespace cosmetics: Remove all trailing whitespace.diego2009-05-131-13/+13
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Restore collapsed whitespace in output messagesUoti Urpala2010-03-071-1/+1
| | | | | | | | | | | | | | | | | | For some reason commit e306174952d42e1cd6cc5efc50ae6bb0410501bc, which replaced translation macro names with the corresponding English strings, also collapsed multiple consecutive space characters into one. Change most of these back. In a couple of cases the amount of whitespace is important for alignment, and for the rest it at least keeps the strings closer to the existing translations.
* | Remove trailing whitespace from most filesUoti Urpala2009-07-071-10/+10
| |
* | Translation system changes part 2: replace macros by stringsAmar Takhar2009-07-071-14/+14
| | | | | | | | | | Replace all MSGTR_ macros in the source by the corresponding English string.
* | Translation system changes part 1: wrap translated stringsAmar Takhar2009-07-071-14/+14
| | | | | | | | | | Replace mp_msg() calls which have a translated string as the format argument with mp_tmsg and add _() around all other translated strings.
* | m_config.c: Remove unused function m_config_get_option_ptrUoti Urpala2008-08-121-14/+0
| |
* | options: Make dynamic dup hack work with new optionsUoti Urpala2008-04-301-4/+7
| | | | | | | | | | | | | | | | The option system has a hack that converts default values (potentially constants) of dynamically allocated options to allocated ones when the options are first added to the config system, so that all values can be equally freed later. Make this work with new-style options in the option struct too.
* | m_config.c: Cosmetics: fix nested block lacking indentationUoti Urpala2008-04-301-16/+17
| |
* | Mark some constant symbols as suchUoti Urpala2008-04-261-1/+1
| |
* | Move global mconfig to mpctxUoti Urpala2008-04-261-2/+9
| | | | | | | | | | | | | | | | | | | | | | The global was used in the function cfg_include which handles the -include option. Make the address available in that function by creating a new dynamically allocated option in m_config_new that has the address in the option's private data. asxparser.c also used the global. Making it available through all ways the code could get called required a number of relatively straightforward changes to playtree and menu code.
* | Convert m_config.c to use tallocUoti Urpala2008-04-261-62/+32
| |
* | Start of new option systemUoti Urpala2008-04-231-9/+32
|/ | | | | | | | First part of option restructuring. The aim is to move option values from a huge number of separate globals to a single non-global struct. This part adds some support for parsing option values into such struct instances, and moves one example option (fixed-vo) to the struct.
* Replace the trivial command line preparser with a more robust versionalbeu2008-04-131-0/+7
| | | | | | | allowing all kind of options to be used. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26440 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add some const qualifiers to reduce warningsuau2008-04-021-4/+5
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26320 b3059339-0415-0410-9bf9-f77b7e298cf2
* typo fix: inited --> initializeddiego2008-02-141-3/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25994 b3059339-0415-0410-9bf9-f77b7e298cf2
* export m_config_set_profile()ben2008-01-101-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25662 b3059339-0415-0410-9bf9-f77b7e298cf2
* First try to mark some things in m_config correctly as constreimar2007-12-021-8/+8
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25253 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix some typos in commentsreimar2007-07-281-5/+5
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23888 b3059339-0415-0410-9bf9-f77b7e298cf2
* Remove some more useless *alloc castsreimar2007-07-191-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23826 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix obvious typo, although the exact effect is still unclear to me, see also ↵reimar2006-11-191-1/+1
| | | | | | | | | bug #593. Patch by jose nazario [jose <at> monkey org]. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21070 b3059339-0415-0410-9bf9-f77b7e298cf2
* rm unnecesary casts from void* - part 3reynaldo2006-07-021-5/+5
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18884 b3059339-0415-0410-9bf9-f77b7e298cf2
* Rename some misspelled and misnamed messages.diego2006-04-281-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18336 b3059339-0415-0410-9bf9-f77b7e298cf2
* Doxygen attack!albeu2006-04-241-0/+4
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18259 b3059339-0415-0410-9bf9-f77b7e298cf2
* 10L fix missing return statement.albeu2006-03-131-0/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17857 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix the MSG?_FIXME and make the profiles help translatable.albeu2006-01-251-11/+11
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17482 b3059339-0415-0410-9bf9-f77b7e298cf2
* Make -list-options work in both MPlayer and MEncoder.albeu2006-01-241-0/+11
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17473 b3059339-0415-0410-9bf9-f77b7e298cf2
* Profiles support.albeu2006-01-241-0/+195
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17472 b3059339-0415-0410-9bf9-f77b7e298cf2
* a few 10l fixes by Wei Jiang <jiangw98@yahoo.com>faust32004-10-311-2/+7
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13825 b3059339-0415-0410-9bf9-f77b7e298cf2
* printf --> mp_msg by the Wanderer <inverseparadox at comcast dot net>diego2004-10-201-9/+10
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13700 b3059339-0415-0410-9bf9-f77b7e298cf2
* 100l to albeu for his english grammar, and 10l to me becouse I noticed that ↵alex2003-08-131-2/+2
| | | | | | lately (my backward compatibilty macro uses M_OPT_UNKNOWN) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10596 b3059339-0415-0410-9bf9-f77b7e298cf2
* Removed the historic cfgparser and switched full to the new config parser ↵alex2003-08-131-6/+0
| | | | |