summaryrefslogtreecommitdiffstats
path: root/core/m_option.c
Commit message (Collapse)AuthorAgeFilesLines
* Fix commit d1b37afwm42013-05-181-1/+1
| | | | Yeah, it doesn't work this way... Please look away.
* m_option: allow -vf ""wm42013-05-181-5/+3
| | | | | | | With the current semantics, there's no reason to disallow this. (Although in my opinion, -vf should rather map to -vf-add than -vf-set, however that is an independent issue from this change.)
* m_option: add -vf-togglewm42013-05-181-52/+80
| | | | | | | | Works like -vf-add, except if a filter already exists and has the same parameters, it's removed instead of added. Not really useful on the command line itself, but will make sense for runtime filter changing in the following commit.
* m_option: allow using -vf-del with a namewm42013-05-181-51/+70
| | | | | | Until now, -vf-del required a list of indexes. This was a bit inconvenient, so add support for using filter names too. Also simplify the code a bit, doing the change would have been too painful otherwise.
* options: use case-sensitive comparsion for optionswm42013-05-151-15/+15
| | | | | This is better for consistency, and also allows using -V as alias for --version.
* m_option: fix segfault in parse_chmapRudolf Polzer2013-05-141-1/+2
|
* Merge branch 'audio_changes'wm42013-05-121-0/+42
|\ | | | | | | | | Conflicts: audio/out/ao_lavc.c
| * audio: add channel map APIwm42013-05-121-0/+42
| | | | | | | | | | | | | | Unused, will be used in the following commits. Let chmap.h define the number of maximum channels, because that is most convenient.
* | options: allow using [ ] for quoting in sub-optionswm42013-04-261-1/+8
| | | | | | | | | | | | This is an attempt to make quoting of sub-option values less awkward, even if it works only with some shells. This is needed mainly for vf_lavfi. Also update the vf_lavfi manpage section.
* | m_option: fix positional sub-option skippingwm42013-04-231-2/+2
| | | | | | | | | | | | Empty sub-option parameters mean the sub-option should be skipped, e.g. -vf gradfun=:10 sets the second option (by position) to 10. This was broken in commit 04f1e2d.
* | m_option: allow quoted positional parameters for -vfwm42013-04-231-36/+53
| | | | | | | | | | | | | | | | | | This allows things like: '--vf=lavfi="gradfun=20:30"' Adjust the documentation for vf_lavfi to make the example less verbose. As an unrelated change, add a general description to vf_lavfi.
* | m_option: redo code for parsing -vf to accept quoteswm42013-04-211-130/+123
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Parsing sub-configs (like --rawvideo=subopts or the suboptions for --vo=opengl:subopts) was completely different from the -vf parsing code for a variety of reasons. This change at least makes -vf use the same splitter code as sub-config options. The main improvement is that -vf now accepts quotes, so you can write things like: -vf 'lavfi=graph="gradfun=10:20"' (The '' quotes are for shell escaping.) This is a rather big and intrusive change. Trying some -vf lines from etc/encoding-example-profiles.conf seems to confirm it still works. This also attempts to unify one subtle difference in handling of positional arguments. One consequence is that a minor detail changes. Sub-configs don't know positional arguments, and something like "-- opt=sub1=val1:sub2" means that sub2 has to be a flag option. In -vf parsing, sub2 would be a positional option value. To remove this conflict and to facilitate actual unification of the parsers in the future, the sub2 will be considered a flag option if and only if such a flag option exists. Otherwise, it's considered a value for a positional option. E.g. if there's a filter "foo" with a string option "sopt" and a flag option "fopt", the behavior of the following changes: -vf foo=fopt Before this commit, this would set "sopt=fopt" in the filter. Now, it enables the fopt flag, and the sopt option remains unset. This is not an actual problem to my knowledge.
* | m_option: add function to check whether parameters are requiredwm42013-04-211-0/+8
| | | | | | | | To avoid that it will be duplicated with m_option.c and m_config.c.
* | options: untangle track range parsing for stream_cddawm42013-04-211-56/+0
| | | | | | | | | | | | | | | | | | Remove the "object settings" based track range parsing (needed by stream_cdda only), and make stream_cdda use CONF_TYPE_INT_PAIR. This makes the -vf parsing code completely independent from other options. A bit of that code was used by the mechanism removed with this commit.
* | m_option: split out sub-config parsingwm42013-04-211-37/+54
|/
* m_option: pretty-print floats with 3 pre-decimal digits instead of 2wm42013-03-261-6/+6
| | | | | | There were complaints that ${fps} was printed as e.g. "23.98" instead of "23.976". Since there's no way to format floats exactly _and_ in a user- friendly way, just change the default precision for printing floats.
* m_options: more typesafetywm42013-03-011-0/+28
| | | | | | | | | | | | | Change the option definition macros so that they cause compiler warnings if the type of the referenced option struct member doesn't match the type implied by the macro. The compiler warning printed isn't very telling, but it's better than silently invoking undefined behavior by violating the C strict aliasing rules. Also fix some minor cases that violate the type rules. For the option "no-aspect" we have to add a new option type to handle it properly. Some option types are hard to check, so we don't in these cases.
* options: reject nan, inf, 0:0, etc. for float optionswm42013-02-261-0/+13
| | | | Same for time values.
* options: remove parsing of "," as decimal pointwm42013-02-261-17/+2
| | | | | | Apparently the intention was parsing numbers reliably in presence of non-C locales. mpv is always in C locale, and not being in C locale would probably break even more things, so remove this code.
* m_option: remove preset mechanismwm42013-02-231-76/+0
| | | | | | | | | | Was very complicated to use, and its uses have been removed in the previous commits. (While this feature sounded kind of useful, it could be rewritten in a much simpler way, like storing presets as strings, and then using the option parser to apply a preset. The removed code did some major pointer juggling to handle raw values, which made it hard to use.)
* options: parse C-style escapes for some optionswm42013-02-201-7/+62
| | | | | | | | | | Being able to insert newline characters ("\n") is useful for --osd-status-msg, and possibly also for anything that prints to the terminal. Espcially --term-osd-esc looks relatively useless without being able to specify escapes. Maybe parsing escapes should happen during command line / config parsing instead (for all options).
* options: unify single dash and double dash optionswm42013-02-091-11/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There were two option syntax variations: "old": -opt value "new": --opt=value "-opt=value" was invalid, and "--opt value" meant "--opt=" followed by a separate option "value" (i.e. interpreted as filename). There isn't really any reason to do this. The "old" syntax used to be ambiguous (you had to call the option parser to know whether the following argument is an option value or a new option), but that has been removed. Further, using "=" in the option string is always unambiguous. Since the distinction between the two option variants is confusing, just remove the difference and allow "--opt value" and "-opt=value". To make this easier, do some other cleanups as well (e.g. avoid having to do a manual lookup of the option just to check for M_OPT_PRE_PARSE, which somehow ended up with finally getting rid of the m_config.mode member). Error reporting is still a mess, and we opt for reporting too many rather than too few errors to the user. There shouldn't be many user-visible changes. The --framedrop and --term-osd options now always require parameters. The --mute option is intentionally made ambiguous: it works like a flag option, but a value can be passed to it explicitly ("--mute=auto"). If the interpretation of the option is ambiguous (like "--mute auto"), the second string is interpreted as separate option or filename. (Normal flag options are actually ambiguous in this way too.)
* options: change handling of "no-" optionswm42013-02-091-0/+25
| | | | | | | | | | | | | | | | Normally, all flag options can be negated by prepending a "no-", for example "--no-opt" becomes "--opt=no". Some flag options can't actually be negated, so add a CONF_TYPE_STORE option type to disallow the "no-" fallback. Do the same for choice options. Remove the explicit "no-" prefixed options, add "no" as choice. Move the handling of automatic "no-" options from parser-mpcmd.c to m_config.c, and use it in m_config_set_option/m_config_parse_option. This makes these options available in the config file. It also simplifies sub-option parsing, because it doesn't need to handle "no-" anymore.
* video: add --autofit and --autofit-larger optionswm42013-01-231-0/+27
| | | | | | | | | --autofit=WxH sets the window size to a maximum width and/or height, without changing the window's aspect ratio. --autofit-larger=WxH does the same, but only if the video size is actually larger than the window size that would result when using the --autofit=WxH option with the same arguments.
* options: allow using % for width and height in --geometrywm42013-01-231-63/+82
| | | | | | | | | | | | | | | | | | | | Now all numbers in the --geometry specification can take percentages. Rewrite the parsing of --geometry, because adjusting the sscanf() mess would require adding all the combinations of using and not using %. As a side effect, using % and pixel values can be freely mixed. Keep the aspect if only one of width or height is set. This is more useful in general. Note: there is one semantic change: --geometry=num used to mean setting the window X position, but now it means setting the window width. Apparently this was a mplayer-specific feature (not part of standard X geometry specifications), and it doesn't look like an overly useful feature, so we are fine with breaking it. In general, the new parsing should still adhere to standard X geometry specification (as used by XParseGeometry()).
* options: move -geometry parsing to m_option.cwm42013-01-231-0/+128
| | | | | | | | | This also means the option is verified on program start, not when the VO is created. The actual code becomes a bit more complex, because the screen width/height is not available at program start. The actual parsing code is still the same, with its unusual sscanf() usage.
* video: decouple internal pixel formats from FourCCswm42013-01-131-0/+35
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | mplayer's video chain traditionally used FourCCs for pixel formats. For example, it used IMGFMT_YV12 for 4:2:0 YUV, which was defined to the string 'YV12' interpreted as unsigned int. Additionally, it used to encode information into the numeric values of some formats. The RGB formats had their bit depth and endian encoded into the least significant byte. Extended planar formats (420P10 etc.) had chroma shift, endian, and component bit depth encoded. (This has been removed in recent commits.) Replace the FourCC mess with a simple enum. Remove all the redundant formats like YV12/I420/IYUV. Replace some image format names by something more intuitive, most importantly IMGFMT_YV12 -> IMGFMT_420P. Add img_fourcc.h, which contains the old IDs for code that actually uses FourCCs. Change the way demuxers, that output raw video, identify the video format: they set either MP_FOURCC_RAWVIDEO or MP_FOURCC_IMGFMT to request the rawvideo decoder, and sh_video->imgfmt specifies the pixel format. Like the previous hack, this is supposed to avoid the need for a complete codecs.cfg entry per format, or other lookup tables. (Note that the RGB raw video FourCCs mostly rely on ffmpeg's mappings for NUT raw video, but this is still considered better than adding a raw video decoder - even if trivial, it would be full of annoying lookup tables.) The TV code has not been tested. Some corrective changes regarding endian and other image format flags creep in.
* m_option: print valid integer range for choices on parsing errorswm42012-11-201-0/+2
| | | | | | | | | Only some choices have an additional integer range. For those which do, printing the choices only would be confusing. E.g. --cursor-autohide accepts the choices "always", "no", or an integer value. The help text printed on option parse errors should print the accepted integer range additional to "always" and "no".
* m_option: add color option typewm42012-11-201-0/+47
| | | | | | | | | | | This accepts HTML-style hex colors in the form #RRGGBB. It's also possible to provide an alpha component with #AARRGGBB. Each 2-digit group is a hex number, which gives the color value from 0-255 (e.g. There is existing code in subassconvert.c, which parses HTML-style color values in SRT subs. This is not used: it's probably better if option parsing is completely separate from code specific to certain subtitle formats, even if a little code is duplicated.
* options: support chapters for --start and --endwm42012-11-201-1/+11
| | | | | | | | | | | | | The --start and --end switch now accept a chapter number. The chapter number is prefixed with '#', e.g. "--start=#2" jumps to chapter 2. The chapter support might be able to replace --chapter completely, but for now I am not sure how well this works out with e.g. DVDs and BDs, and a separate --chapter option is useful interface-wise. (This was supposed to be added in 51503a, but apparently the fixup commit adding it was lost in a rebase. This might also be the reason for the mess-up fixed in 394285.)
* m_option: fix braindead --start, --length, --end option parsing bugswm42012-11-181-4/+4
| | | | | | | | | | | | | The option type m_option_type_rel_time was completely broken. It interpreted everything starting with a number as percent position. This is because sscanf() semantics are idiotic (trailing string doesn't need to be matched), and due to my own idiocy this was overlooked when testing. Fix by considering sscanf() evil and not using it. (bstr_sscanf() is a straight wrapper around sscanf()). Even if the percent code was fixed, there was another bug: it always interpreted times as negative (starting from end for --start). Fix the basic logic.
* options: rename -ss and -endpos, allow relative timeswm42012-11-161-37/+26
| | | | | | | | | | | | | | | | Rename the -ss option to -start, and -endpos to -length. Add a -end option. The -end option always specifies an absolute end time, as opposed to -endpos/-length. All these options (--start, --end, --length) now accept relative times. Percent positions (e.g. "--start=30%") are interpreted as fractions of the file duration. Negative times (e.g. "--start=-1:00) are interpreted relative to the end of the file. Chapters (e.g. "--start=#3") yield the chapter's time position. The chapter support might be able to replace --chapter completely, but for now I am not sure how well this works out with e.g. DVDs and BDs, and a separate --chapter option is useful interface-wise.
* Rename directories, move files (step 2 of 2)wm42012-11-121-5/+5
| | | | | | | | | | | | Finish renaming directories and moving files. Adjust all include statements to make the previous commit compile. The two commits are separate, because git is bad at tracking renames and content changes at the same time. Also take this as an opportunity to remove the separation between "common" and "mplayer" sources in the Makefile. ("common" used to be shared between mplayer and mencoder.)
* Rename directories, move files (step 1 of 2) (does not compile)wm42012-11-121-0/+2117
Tis drops the silly lib prefixes, and attempts to organize the tree in a more logical way. Make the top-level directory less cluttered as well. Renames the following directories: libaf -> audio/filter libao2 -> audio/out libvo -> video/out libmpdemux -> demux Split libmpcodecs: vf* -> video/filter vd*, dec_video.* -> video/decode mp_image*, img_format*, ... -> video/ ad*, dec_audio.* -> audio/decode libaf/format.* is moved to audio/ - this is similar to how mp_image.* is located in video/. Move most top-level .c/.h files to core. (talloc.c/.h is left on top- level, because it's external.) Park some of the more annoying files in compat/. Some of these are relicts from the time mplayer used ffmpeg internals. sub/ is not split, because it's too much of a mess (subtitle code is mixed with OSD display and rendering). Maybe the organization of core is not ideal: it mixes playback core (like mplayer.c) and utility helpers (like bstr.c/h). Should the need arise, the playback core will be moved somewhere else, while core contains all helper and common code.