Commit Graph

17 Commits

Author SHA1 Message Date
wm4 42f06fb915 m_config: make m_profile struct non-public 2013-07-31 20:43:31 +02:00
wm4 0293eac84a m_config: try to print min/max values as integers in --list-options
This switched to exponential representation too soon, and large integer
values looked bad in the --list-options output.
2013-07-28 18:56:49 +02:00
wm4 a737308f73 m_config: hide no-* opts in --list-options, simplify positional subopts
All these --no-... options in --list-options made the output rather
unreadable, so hide them. Make the code for finding positional
parameters (which are supposed to skip these no-* options) slightly
simpler too.
2013-07-28 18:56:48 +02:00
wm4 85bee4f071 options: print default values in --list-options
Do this by recreating the m_config from scratch, which then must
contain the default values. This doesn't quite work with legacy options
using global variables: the default values get lost, so using
--list-options will print the value as set by the config file. This
also introduces a memory leak for string options backed by global
variables. All of these issues will be eventually fixed by moving all
options to structs.
2013-07-28 18:56:09 +02:00
wm4 c070fa865f m_config: refactor some things
Change how m_config is initialized. Make it more uniform; now all
m_config structs are intialized in exactly the same way. Make sure
there's only a single m_option[] array defining the options, and keep
around the pointer to the optstruct default value, and the optstruct
size as well. This will allow reconstructing the option default values
in the following commit.

In particular, stop pretending that the handling of some special options
(like --profile, --v, and some others) is in any way elegant, and make
them explicit hacks. This is really more readable and easier to
understand than what was before, and simplifies the code.
2013-07-28 18:44:21 +02:00
wm4 31c271f4ad m_config: don't override profile option if not required
The --profile top-level option is handled specially in m_config.c. But
this code also broke sub-options that happened to be named "profile"
(e.g. when trying to use "-af-add=bs2b=profile=cmoy"). Handle it
specially only if it's the top-level --profile option.
2013-07-24 19:44:10 +02:00
wm4 560738ddef m_config: improve option list output a bit
This is printed with --list-options or e.g. --vf=lavfi=help.

Note that in theory, the options should be able to print their own help,
and we shouldn't special case certain types (like m_option_type_choice
in the commit). But that is too hairy for now, so we don't do it.
2013-07-21 23:27:31 +02:00
wm4 6629a95b92 options: use m_config for options instead of m_struct
For some reason, both m_config and m_struct are somewhat similar, except
that m_config is much more powerful. m_config is used for VOs and some
other things, so to unify them. We plan to kick out m_struct and use
m_config for everything. (Unfortunately, m_config is also a bit more
bloated, so this commit isn't all that great, but it will allow to
reduce the option parser mess somewhat.)

This commit also switches all video filters to use the option macros.
One reason is that m_struct and m_config, even though they both use
m_option, store the offsets of the option fields differently (sigh...),
meaning the options defined for either are incompatible. It's easier to
switch everything in one go.

This commit will allow using the -vf option parser for other things,
like VOs and AOs.
2013-07-21 23:27:31 +02:00
wm4 759b3bdc47 options: use case-sensitive comparsion for options
This is better for consistency, and also allows using -V as alias
for --version.
2013-05-15 15:30:06 +02:00
wm4 9fd2e449de m_option: add function to check whether parameters are required
To avoid that it will be duplicated with m_option.c and m_config.c.
2013-04-21 03:48:30 +02:00
wm4 9df2260506 core: add --reset-on-next-file option
This option can be used to selectively reset settings when playing the
next file in the playlist (i.e. restore mplayer and mplayer2 behavior).

Might remove this option again should it turn out that nobody uses it.
2013-04-10 21:32:46 +02:00
wm4 9b7fb867f7 options: drop --opt:subopt option names
For all suboptions, "flat" options were available by separating the
parent option and the sub option with ":", e.g. "--rawvideo:w=123". Drop
this syntax and use "-" as separator. This means even suboptions are
available as normal options now, e.g. "--rawvideo-w=123". The old syntax
doesn't work anymore.

Note that this is completely separate from actual suboptions. For
example, "-rawvideo w=123:h=123" still works. (Not that this syntax is
worth supporting, but it's needed anyway, for for other things like vf
and vo suboptions.)

As a consequence of this change, we also have to add new "no-" prefixed
options for flag suboptions, so that "--no-input-default-bindings"
works. ("--input-no-default-bindings" also works as a consequence of
allowing "-input no-default-bindings" - they are handled by the same
underlying option.)

For --input, always use the full syntax in the manpage. There exist
suboptions other than --input (like --tv, --rawvideo, etc.), but since
they might be handled differently in the future, don't touch these yet.

M_OPT_PREFIXED becomes the default, so remove it. As a minor unrelated
cleanup, get rid of M_OPT_MERGE too and use the OPT_SUBSTRUCT() macro in
some places.

Unrelated: remove the duplicated --tv:buffersize option, fix a typo in
changes.rst.
2013-02-23 00:07:11 +01:00
wm4 57879a2200 options: change handling of "no-" options yet again
Commit 4a40eed "options: change handling of "no-" options" generally
improved the handling of automatically added negation options
(recognizing "--no-opt", even though only "--opt" is declared in the
option list).

Unfortunately, one corner case was missed, which broke the option
"--input=no-default-bindings" (other suboptions, e.g. VO suboptions,
were not affected, and this is the only option where this mattered).

Instead of increasing the complexity further, use a completely different
approach: add the "--no-" options at runtime, and make them behave like
real options. This approach could be considered slightly less elegant,
because the code now has to worry about some option implementation
details rather than leaving it to the parser, but all in all the new
code is simpler and there are less weird corner cases to worry about.
2013-02-16 19:57:57 +01:00
wm4 267a889cc2 options: unify single dash and double dash options
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.)
2013-02-09 00:21:17 +01:00
wm4 830560979c options: change handling of "no-" options
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.
2013-02-09 00:21:16 +01:00
wm4 4873b32c59 Rename directories, move files (step 2 of 2)
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.)
2012-11-12 20:08:18 +01:00
wm4 d4bdd0473d Rename directories, move files (step 1 of 2) (does not compile)
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.
2012-11-12 20:06:14 +01:00