summaryrefslogtreecommitdiffstats
path: root/m_config.h
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'input_changes' into masterwm42012-10-121-0/+3
|\ | | | | | | | | | | | | | | Conflicts: DOCS/man/en/vo.rst etc/input.conf input/input.c m_property.c
| * commands: add more property-option bridge uses, rename some optionswm42012-10-121-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | Make more properties use the property-to-option bridge to reduce code size and to enforce consistency. Some options are renamed to the same as the properties (the property names are better in all cases). Do some other minor cleanups. One bigger issue was memory management of strings: M_PROPERTY_TO_STRING assumed the strings were statically allocated, and no dynamic allocations could be returned. Fix this in case the need for such properties arises in the future. Get rid of m_property_string_ro(), because it's not always clear that the "action" parameter is M_PROPERTY_SET and the string argument will be used.
* | options: handle alias options differentlywm42012-09-231-5/+4
|/ | | | | | | | | | | When setting an alias option, its value is not saved in the file-local options case. The ensure_backup function in m_config.c exits if it encounters an aliased option, because it should not be saved additionally to the original option. However, the original option is likely never saved in this case. Change it so that ensure_backup always accesses the original option. The original option is the one that first appears in the option list.
* m_config: support auto-allocated sub-structswm42012-08-061-0/+6
| | | | | | | | | | | | | | Given your option struct has a field that is a pointer to another struct, this commit allows you to declare options that write into that other struct. The code in m_config will dereference the pointer field on its own if such an option is accessed. If the field is NULL on initialization of the containing m_config, the struct is automatically allocated. OPT_SUBSTRUCT() can be used to declare such a field. struct m_sub_options is used to describe the pointed-to struct, and includes size and defaults if the struct has to be allocated by m_config.
* m_config: support flatten and merge flags for suboptionswm42012-08-061-0/+2
| | | | | | | | | | | | | | | | | | M_OPT_PREFIXED allows adding top-level options with the suboption mechanism. The point of this is that, even though these options are top-level options, they don't need to be added directly to a top- level option array (such as mplayer_opts[]). Instead, the suboption can be defined in a separate source file. Only a suboption declaration is needed to add these options. M_OPT_MERGE is similar to M_OPT_PREFIXED, but doesn't add the name of the suboptions entry as prefix. Given you have a suboption declaration "prefix" and the suboption "subopt", you can pass them as follows on the command line: normal: --prefix=subopt=value M_OPT_PREFIXED: --prefix-subopt=value M_OPT_MERGE: --subopt=value
* options: get rid of some compatibility stuffwm42012-08-061-2/+0
| | | | | | | | | Doesn't make sense because we broke/are going to break compatibility with everything anyway. Remove mechanism for warning the user against disabled options. Remove colorspace alternative option values.
* options: get rid of ambiguous option parsingwm42012-08-051-18/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Options parsing used to be ambiguous, as in the splitting into option and values pairs was ambiguous. Example: -option -something It wasn't clear whether -option actually takes an argument or not. The string "-something" could either be a separate option, or an argument to "-option". The code had to call the option specific parser function to resolve this. This made everything complicated and didn't even have a real use. There was only one case where this was actually used: string lists (m_option_type_string_list) and options based on it. That is because this option type actually turns a single option into a proxy for several real arguments, e.g. "vf*" can handle "-vf-add" and "-vf-clr". Options suffixed with "-clr" are the only options of this group which take no arguments. This is ambiguous only with the "old syntax" (as shown above). The "new" option syntax always puts option name and value into same argument. (E.g. "--option=--something" or "--option" "--something".) Simplify the code by making it statically known whether an option takes a parameter or not with the flag M_OPT_TYPE_OLD_SYNTAX_NO_PARAM. If it's set, the option parser assumes the option takes no argument. The only real ambiguity left, string list options that end on "-clr", are special cased in the parser. Remove some duplication of the logic in the command line parser by moving all argument splitting logic into split_opt(). (It's arguable whether that can be considered code duplication, but now the code is a bit simpler anyway. This might be subjective.) Remove the "ambiguous" parameter from all option parsing related code. Make m_config unaware of the pre-parsing concept. Make most CONF_NOCFG options also CONF_GLOBAL (except those explicitly usable as per-file options.)
* m_config: implement m_config_new in terms of m_config_simplewm42012-08-041-2/+1
| | | | | Also change m_config_simple() such that you need to register options using m_config_register_options().
* mplayer: turn playtree into a list, and change per-file option handlingwm42012-07-311-30/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+2
| | | | | Replace all uses of bstr() with bstr0(). Also remove the ridiculous C++ workaround.
* options: support parsing values into substructsUoti Urpala2012-07-161-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-2/+3
| | | | | | | | | | | | 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-0/+2
| | | | | | | | | | | 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-7/+22
| | | | | | 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-8/+20
| | | | | | | | 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.
* cleanup: reformat and clean up m_config.[ch]Uoti Urpala2011-07-061-132/+95
| | | | | m_config.c changes include removal of "#ifdef MP_DEBUG" from around some assert lines.
* m_config.[ch]: mark some function parameters constdiego2010-11-021-4/+4
| | | | | | patch by Clément Bœsch, ubitux gmail com git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32386 b3059339-0415-0410-9bf9-f77b7e298cf2
* Merge svn changes up to r30475Uoti Urpala2010-03-091-0/+18
|\
| * Add license header to all top-level files missing them.diego2010-01-301-0/+18
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30471 b3059339-0415-0410-9bf9-f77b7e298cf2
| * whitespace cosmetics: Remove all trailing whitespace.diego2009-05-131-4/+4
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Remove trailing whitespace from most filesUoti Urpala2009-07-071-4/+4
| |
* | Move global mconfig to mpctxUoti Urpala2008-04-261-1/+2
| | | | | | | | | | | | | | | | | | | | | | 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-2/+0
| |
* | Start of new option systemUoti Urpala2008-04-231-1/+3
|/ | | | | | | | 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.
* Add MPLAYER_ prefix to multiple inclusion guards.diego2008-02-221-3/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26061 b3059339-0415-0410-9bf9-f77b7e298cf2
* export m_config_set_profile()ben2008-01-101-0/+9
| | | | 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-3/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25253 b3059339-0415-0410-9bf9-f77b7e298cf2
* Do not use leading underscores in multiple inclusion guards, they are reserved.diego2007-07-021-3/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23709 b3059339-0415-0410-9bf9-f77b7e298cf2
* spelling/grammar/wording fixes in doxygen and non-doxygen commentsdiego2006-04-271-7/+7
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18317 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix most of the mistakes pointed out by Diego.albeu2006-04-251-6/+6
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18284 b3059339-0415-0410-9bf9-f77b7e298cf2
* Doxygen attack!albeu2006-04-241-5/+116
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18259 b3059339-0415-0410-9bf9-f77b7e298cf2
* Profiles support.albeu2006-01-241-0/+25
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17472 b3059339-0415-0410-9bf9-f77b7e298cf2
* alignment for SPARC64, second tryreimar2004-09-041-1/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13247 b3059339-0415-0410-9bf9-f77b7e298cf2
* Removed the historic cfgparser and switched full to the new config parser ↵alex2003-08-131-34/+3
| | | | | | (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
* min/max float->doublearpi2003-08-121-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10583 b3059339-0415-0410-9bf9-f77b7e298cf2
* Don't save restore all options wich point to the same variable.albeu2003-04-121-0/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9913 b3059339-0415-0410-9bf9-f77b7e298cf2
* Fix the Gui with NEW_CONFIGalbeu2002-11-121-0/+3
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8169 b3059339-0415-0410-9bf9-f77b7e298cf2
* New config system + cleanup of header inter dependencyalbeu2002-11-121-0/+87
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8165 b3059339-0415-0410-9bf9-f77b7e298cf2