summaryrefslogtreecommitdiffstats
path: root/m_config.c
Commit message (Collapse)AuthorAgeFilesLines
* 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
| | | | | | (altought some macros still remain for compatibility). As a side effect 90% of the warning messages are gone from the core. Things should be cleaner now and less confusing for newbies. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10595 b3059339-0415-0410-9bf9-f77b7e298cf2
* Don't save restore all options wich point to the same variable.albeu2003-04-121-4/+21
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9913 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add the new -vf option wich is the same as vop in reverse order.albeu2003-03-151-1/+1
| | | | | | | | Syntax is we decided, so you can give the nomes or not with both vop and vf. vf take precedence over vop. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9594 b3059339-0415-0410-9bf9-f77b7e298cf2
* print meaningful error message for missing parameterarpi2003-02-021-1/+11
| | | | | | | noticed by Colin Leroy <colin@colino.net> git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9223 b3059339-0415-0410-9bf9-f77b7e298cf2
* better error handling for invalud suboptionsarpi2003-01-111-2/+9
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8895 b3059339-0415-0410-9bf9-f77b7e298cf2
* print meaningful error messagearpi2003-01-111-1/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8893 b3059339-0415-0410-9bf9-f77b7e298cf2
* 10l fix by eviv bulgroz <ebulgroz@yahoo.com>arpi2002-12-211-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8513 b3059339-0415-0410-9bf9-f77b7e298cf2
* New config system + cleanup of header inter dependencyalbeu2002-11-121-0/+347
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8165 b3059339-0415-0410-9bf9-f77b7e298cf2