Commit Graph

27 Commits

Author SHA1 Message Date
cantabile fa0ea3bd0d parser-cfg: specify which config file contains the unknown option
Also add some punctuation to the warning message.
2012-08-20 15:36:05 +02:00
wm4 94782e464d options: get rid of ambiguous option parsing
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.)
2012-08-05 23:51:49 +02:00
wm4 9a2f4e10e7 mplayer: never exit mplayer from within the play loop
The only place exit_player() should be called is the main() function.
exit_player() should be the only function allowed to call exit(). This
makes it easier to guarantee proper deinitialization, and allows using
the --leak-report flag without showing false positives.

The quit slave command now sets a flag only. It uses the same mechanism
that's normally used to advance to the next file on the playlist, so the
rest of the playback path should be able to react to the quit command
quickly enough. That is, the player should react just as fast to quit
requests in practice as before this commit.

In reinit_audio_chain(), the player was actually exited if
init_audio_filters() failed. Reuse the normal error handling path to
handle this condition.
2012-08-04 19:59:56 +02:00
wm4 a1244111a7 windows support: unicode filenames
Windows uses a legacy codepage for char* / runtime functions accepting
char *. Using UTF-8 as the codepage with setlocale() is explicitly
forbidden.

Work this around by overriding the MSVCRT functions with wrapper
macros, that assume UTF-8 and use "proper" API calls like _wopen etc.
to deal with unicode filenames. All code that uses standard functions
that take or return filenames must now include osdep/io.h. stat()
can't be overridden, because MinGW-w64 itself defines "stat" as a
macro. Change code to use use mp_stat() instead.

This is not perfectly clean, but still somewhat sane, and much better
than littering the rest of the mplayer code with MinGW specific hacks.
It's also a bit fragile, but that's actually little different from the
previous situation. Also, MinGW is unlikely to ever include a nice way
of dealing with this.
2012-03-09 20:48:54 +02:00
Uoti Urpala b33bb28ea3 build: fix --enable-debug, remove some "#ifdef MP_DEBUG"
Recent commit 5d5ca22a6d ("options: commandline: accept --foo=xyz
style options") left some bad code under "#ifdef MP_DEBUG" in
playtree.c, which caused a compilation failure if configured with
"--enable-debug". Fix this. Having the "#ifdef MP_DEBUG" there was
completely unnecessary; it only increased the risk for this kind of
problems for no real benefit - executing the asserts under it would
have no noticeable performance or other penalty in default builds
either. Remove several cases of such harmful "#ifdef MP_DEBUG".
2011-07-30 19:03:20 +03:00
Uoti Urpala e873d703e9 options: change option parsing to use bstr
Using bstr allows simpler parsing code, especially because it avoids
the need to modify or copy strings just to terminate extracted
substrings.
2011-07-29 05:50:38 +03:00
Uoti Urpala d8374376c0 cosmetics: parser-cfg.c: reformat 2011-07-29 05:23:43 +03:00
Uoti Urpala 507fa7e2c2 options: indicate ambiguous option parameters explicitly
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.
2011-07-29 05:02:05 +03:00
Uoti Urpala ea4cc89f36 options: move command line preparse together with parse 2011-07-26 06:02:03 +03:00
diego 99c1bbca2a Add license header to all top-level files missing them.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30471 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-01-30 23:24:23 +00:00
reimar 1cd2feed03 Move variable declaration into block where it is used and make it const.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29602 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-08-31 09:41:27 +00:00
reimar 7d0270087d Make m_config_parse_config_file file name argument const
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29601 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-08-31 09:40:04 +00:00
diego 6e9cbdc104 whitespace cosmetics: Remove all trailing whitespace.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29305 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-05-13 02:58:57 +00:00
albeu e4dc453ea0 Replace the trivial command line preparser with a more robust version
allowing all kind of options to be used.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26440 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-04-13 19:18:51 +00:00
uau 03bb309e4e Include some .h files in corresponding .c files
Include the corresponding .h file in command.c, parser-cfg.c and
parser-mpcmd.c. This allows the compiler to check that the
declarations in the .h file match the actual defition.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26295 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-03-28 01:07:59 +00:00
reimar e607c7289f Remove some more useless *alloc casts
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23826 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-07-19 13:52:39 +00:00
ben c179597c82 increased a bit max param length as it can be too short to declare tv channels when you have a long list of
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21817 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-01-04 16:06:01 +00:00
diego af8b8d2fa4 Fix stray newline that should only be printed in verbose mode.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@19468 b3059339-0415-0410-9bf9-f77b7e298cf2
2006-08-20 21:41:44 +00:00
albeu 400a9fab2e Doxygen Attack! - Chapter 3
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18266 b3059339-0415-0410-9bf9-f77b7e298cf2
2006-04-25 01:26:10 +00:00
albeu d4d62bbc65 Profiles support.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17472 b3059339-0415-0410-9bf9-f77b7e298cf2
2006-01-24 11:16:13 +00:00
diego 3ebf6f0135 Reduce excessive verbosity.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@13947 b3059339-0415-0410-9bf9-f77b7e298cf2
2004-11-15 09:09:29 +00:00
alex 1c4586e8f9 100l to albeu for his english grammar, and 10l to me becouse I noticed that lately (my backward compatibilty macro uses M_OPT_UNKNOWN)
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10596 b3059339-0415-0410-9bf9-f77b7e298cf2
2003-08-13 16:45:02 +00:00
alex 2283b6305f Removed the historic cfgparser and switched full to the new config parser (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
2003-08-13 16:29:32 +00:00
rfelker 3e4aa8b0bd 1000l! crashing on broken config files finally fixed!
Patch by Alex Sisson (alex_sisson at yahoo.co.uk):

a missing parameter on mp_msg meant it crashed instead
of printing a nice message if you put entries in the
config with no parameter.

also did a few english-tidies on error messages in
there.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@10246 b3059339-0415-0410-9bf9-f77b7e298cf2
2003-06-04 22:06:44 +00:00
henry f67abcab73 longer option buffers, needed for tv options
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9814 b3059339-0415-0410-9bf9-f77b7e298cf2
2003-04-03 12:41:31 +00:00
albeu 5c2cc17c3a Better error messages (with line number now) and make unknow option
non-fatal for ppl wich compile many different versions


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@9579 b3059339-0415-0410-9bf9-f77b7e298cf2
2003-03-13 14:09:49 +00:00
albeu 126725660d New config system + cleanup of header inter dependency
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@8165 b3059339-0415-0410-9bf9-f77b7e298cf2
2002-11-12 01:56:42 +00:00