summaryrefslogtreecommitdiffstats
path: root/m_option.h
Commit message (Collapse)AuthorAgeFilesLines
* options: remove "no" options variantswm42012-07-301-1/+1
| | | | | | | | | | | | | The old option parser required adding two options for each flag option: e.g. "-video" and "-novideo". Later, code was added to handle the "no-" prefix automatically for flag options. Remove the "no" prefixed options entirely (unless they are not flag options, then just rename them), and require the user to use the "no-" prefix instead. You can't use the old prefix anymore. Old: -novideo New: --no-video
* Merge remote-tracking branch 'origin/master'wm42012-07-281-19/+42
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: .gitignore bstr.c cfg-mplayer.h defaultopts.c libvo/video_out.c The conflict in bstr.c is due to uau adding a bstr_getline function in commit 2ba8b91a97e7e8. This function already existed in this branch. While uau's function is obviously derived from mine, it's incompatible. His function preserves line breaks, while mine strips them. Add a bstr_strip_linebreaks function, fix all other uses of bstr_getline, and pick uau's implementation. In .gitignore, change vo_gl3_shaders.h to use an absolute path additional to resolving the merge conflict.
| * options: make option struct the talloc parent of optionsUoti Urpala2012-07-161-4/+7
| | | | | | | | | | | | | | | | | | | | | | 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-15/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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).
* | Merge remote-tracking branch 'origin/master'wm42012-05-201-69/+2
|\|
| * options: simplify option parsing/setting machineryUoti Urpala2012-05-081-69/+2
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* | Merge remote-tracking branch 'origin/master' into my_masterwm42012-03-161-0/+1
|\| | | | | | | | | | | | | | | Conflicts: command.c mp_core.h mplayer.c screenshot.c
| * core: remove old EDL mode (--edl option)Uoti Urpala2012-03-091-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the old EDL implementation that was activated with the --edl option. It is mostly redundant and inferior compared to the newer demux_edl support, though currently there's no support for using the same EDL files with the new implementation and the mute functionality of the old implementation is not supported. The main reason to remove the old implementation at this point is that the mute functionality would conflict with following audio volume handling changes, and working on the old code would be a wasted effort in the long run as at some point it would be removed anyway. The --edlout functionality is kept for now, even though after this commit there is no code that could directly read its output.
* | options: allow choice options without parameterwm42012-01-181-0/+5
|/ | | | | | | | | | | If an m_option_type_choice option is declared with M_OPT_IMPLICIT_DEFAULT in its flags, it doesn't require a parameter. For example, if --opt is such an option, it can be invoked as "--opt=val", "-opt", or "--opt". The last two will set the option to the first choice the option declares. Note that "-opt val" (using the old option syntax) is not allowed in this case, as it would be ambiguous. Normal option parsing should be unaffected.
* options: add "disabled option" functionalityUoti Urpala2011-09-041-0/+5
| | | | | | | | | | | 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: commandline: print error type for parse failuresUoti Urpala2011-07-291-0/+2
| | | | | | | | | | | | If parsing an option fails, print a string corresponding to the parse function return value (M_OPT_MISSING_PARAM etc). The primary motivation is that the parsing code already outputs messages explaining most problems, but does not itself print anything in the missing parameter case. Before double-dash --options such errors were rare (or rather they resulted in the next commandline argument being silently misinterpreted as an argument to the previous option instead); but now an argument like "--ss" should give a better indication about the problem than just "Error parsing option".
* core: improve --loop handlingUoti Urpala2011-07-291-0/+1
| | | | | | | | Make per-file loop option start from --ss position, not always 0. Do looping in more cases; before looping was only done when encountering real end of file, now it also happens for example at --endpos or --frames limits. Also move the --ss option to the option struct.
* options: change option parsing to use bstrUoti Urpala2011-07-291-14/+4
| | | | | | 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-17/+10
| | | | | | | | 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: silence most of the clang warningsClément Bœsch2011-07-091-1/+1
|
* commands: change property mechanism to use talloc stringsUoti Urpala2011-07-031-1/+1
|
* cosmetics: reformat demux_lavf.c, m_option.[ch] and m_property.cUoti Urpala2011-07-031-305/+260
|
* cleanup: shut up more warningsClément Bœsch2011-05-061-3/+3
|
* options: support string list separators other than ','Uoti Urpala2011-04-201-0/+11
| | | | | | Allow specifying a custom separator character for options of string list type, and use that to define OPT_PATHLIST which takes a list of strings separated by ':' (or ';' on Windows).
* options: remove CONF_OLD option flagUoti Urpala2011-01-311-6/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* options: remove unused "func_full" option typeUoti Urpala2011-01-311-2/+0
| | | | | | vo_zr was the last user of the "func_full" option type. I think it's better if future features are implemented using more straightforward option functionality. Delete the func_full implementation.
* commands: add generic option -> property wrapperUoti Urpala2010-12-181-0/+6
| | | | | | | | | 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: add "choice" option type, use for -pts-association-modeUoti Urpala2010-12-181-0/+8
| | | | | | | | | | | | | Add a "choice" option type. Options of this type take a string as input and set an int option variable to the value corresponding to the string. The string->int mapping is option-specific and is given in the option definition. Strings not found in the mapping are rejected as invalid option values. Change the option -pts-association-mode to use this new option type and accept values "auto, decoder, sort" instead of "0, 1, 2". The change in accepted values shouldn't cause problems as this option is not appropriate to use in normal user config files.
* options: add OPT_MAKE_FLAGS macro, creates "opt/noopt" flag pairClément Bœsch2010-11-041-0/+1
|
* options: modify parse_timestring(), make publiccigaes2010-11-021-0/+11
| | | | | | | | Make the parse_timestring public, with a slightly extended API. As a consequence, "2 hours" is no longer recognized as a valid timestamp meaning "2 seconds". git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32514 b3059339-0415-0410-9bf9-f77b7e298cf2
* options: move audio_output_channels, audio_output_format to structUoti Urpala2010-11-021-0/+1
|
* options: move -chapter values to option structUoti Urpala2010-04-251-0/+2
| | | | | | | | | | | -chapter can optionally take a range with a start and an end. Add a new option type which supports such values and use that instead of a custom per-option function. This commit also fixes a build configuration bug: before the availability of the -chapter option depended on DVD functionality being enabled in the binary, even though the option works with other sources too.
* Merge svn changes up to r30748Uoti Urpala2010-03-101-9/+9
|\
| * Make more option-parsing related function arguments const.reimar2010-02-251-11/+11
| | | | | | | | | | | | | | 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
* | 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-11/+11
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Remove trailing whitespace from most filesUoti Urpala2009-07-071-11/+11
| |
* | Merge svn changes up to r28862Uoti Urpala2009-03-071-0/+2
|\|
| * Add a 64 bit integer type to the suboption parser.reimar2009-03-021-0/+2
| | | | | | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28794 b3059339-0415-0410-9bf9-f77b7e298cf2
* | Move input options to option structUoti Urpala2008-04-301-0/+1
| |
* | m_option.h: #include <stddef.h> for offsetofUoti Urpala2008-04-281-0/+1
| |
* | Move vf_settings to options structUoti Urpala2008-04-261-0/+1
| |
* | Move -lavdopts to options structUoti Urpala2008-04-251-0/+1
| |
* | Modify option helper macrosUoti Urpala2008-04-241-0/+7
| | | | | | | | | | | | | | Give them a OPT_ prefix, move them to m_option.h, move the "flags" parameter to third position (so all start with option name, field name, flags) and use "&m_option_type_x" in them instead of the indirect #define "CONF_TYPE_X".
* | Start of new option systemUoti Urpala2008-04-231-14/+4
|/ | | | | | | | 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/+6
| | | | | | | allowing all kind of options to be used. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26440 b3059339-0415-0410-9bf9-f77b7e298cf2
* Add necessary #includes to pass 'make checkheaders'.diego2008-03-041-0/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26163 b3059339-0415-0410-9bf9-f77b7e298cf2
* 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
* Option print functions may not and do not modify valuereimar2007-12-021-2/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25257 b3059339-0415-0410-9bf9-f77b7e298cf2
* correct const usage in the option handling code so that tables can berfelker2007-11-091-43/+43
| | | | | | | declared const and moved from .data to .text/rodata sections. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24994 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
* Move parsing of the -ss option to the option code.uau2007-02-241-0/+2
| | | | | | | Also fixes a memory leak of the parameter string. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22330 b3059339-0415-0410-9bf9-f77b7e298cf2
* after a long time, finally i could add -endpos option to mplayer executable.ptt2006-09-251-0/+10
| | | | | | | | as oded told me on 1006 02 24, i applied it, blame me if some problem occurs, i hope not, since i tried it for a while.... git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19979 b3059339-0415-0410-9bf9-f77b7e298cf2
* marks several string parameters as const, as they are not modified inside ↵reynaldo2006-07-131-1/+1
| | | | | | the function, Patch by Stefan Huehner, stefan AT huehner-org git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19058 b3059339-0415-0410-9bf9-f77b7e298cf2
* spelling/grammar/wording fixes in doxygen and non-doxygen commentsdiego2006-04-271-24/+24
| | | | 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-31/+31
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18284 b3059339-0415-0410-9bf9-f77b7e298cf2
* Doxygen attack!albeu2006-04-241-79/+295
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18259 b3059339-0415-0410-9bf9-f77b7e298cf2
* New option type to print help text with a function.albeu2006-01-241-0/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17471 b3059339-0415-0410-9bf9-f77b7e298cf2
* 100L m_option_copy should use the copy callback and not the set one.albeu2006-01-221-1/+1
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17457 b3059339-0415-0410-9bf9-f77b7e298cf2
* allow multiple help clauses on the command line, Patch by kiriuja " ↵gpoirier2005-09-021-0/+5
| | | | | | | | | | | | | | | | | mplayer-patches AH en-directo POUM net " This one makes mplayer -vo help -ao help -ac help -vc help -pphelp -af help -vfm help -vf help -afm help -fstype help produce the desired output. From the thread: Date: Jul 16, 2005 8:25 PM Subject: [MPlayer-dev-eng] [PATCH] allow multiple help clauses on the command line git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@16346 b3059339-0415-0410-9bf9-f77b7e298cf2
* CONF_TYPE_AFMT similar to CONF_TYPE_IMGFMTalex2004-12-271-0/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@14247 b3059339-0415-0410-9bf9-f77b7e298cf2
* m_option_type_doublemichael2004-02-101-0/+2
| | | | git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@11948 b3059339-0415-0410-9bf9-f77b7e298cf2
* 100l to albeu for his english grammar, and 10l to me becouse I noticed that ↵alex2003-08-131-1/+1
| | | | | | lately (my backward compatibilty macro uses M_OPT_UNKNOWN) git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10596 b3059339-0415-0410-9bf9-f77b7e298cf2
*