Commit Graph

42 Commits

Author SHA1 Message Date
wm4 53bfaecd40 core: remove duplicated format_time() functions
This was an on-going transition to make mplayer format all times in the
same format.
2012-09-18 21:04:47 +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 89a17bcda6 mplayer: turn playtree into a list, and change per-file option handling
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.
2012-07-31 21:33:26 +02:00
wm4 25417a626d windows: fix format string attributes on MinGW
MinGW maps the "printf" format string archetype to the non-standard
MSVCRT functions, even if __USE_MINGW_ANSI_STDIO is defined and set
to 1. We need to use "gnu_printf" to use the format strings as provided
by vsnprintf and similar functions to get correct warnings.

Since "gnu_printf" isn't necessarily available on other GCC compatible
compilers (such as clang), do this only on MinGW.
2012-03-01 00:22:29 +02:00
Uoti Urpala bdfdece245 subs: move vobsub loading logic down to find_subfiles.c
Analogously to the previous commit, move path handling logic for
loading external vobsub files from mplayer.c to find_subfiles.c.

Based on a commit from Clément Bœsch but fixed and simplified.
2011-04-20 04:22:52 +03:00
Uoti Urpala 5e0a163886 tl_matroska.c: move the find_files() function here
Move the find_files() function from findfiles.c to tl_matroska.c.
Delete the findfiles.c file. Add a check against opendir() failure in
find_files().
2011-03-03 21:38:52 +02:00
cboesch 74c285e090 cleanup: define ROUND() macro in mpcommon.h
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32751 b3059339-0415-0410-9bf9-f77b7e298cf2
2011-01-31 16:03:10 +02:00
Uoti Urpala e9022ec470 cleanup: move MP_NOPTS_VALUE definition to mpcommon.h 2011-01-15 18:45:43 +02:00
Uoti Urpala adedee4285 subtitles: move global ass_track to struct osd_state 2011-01-15 18:45:43 +02:00
Uoti Urpala 43b1de1dd7 core: move most mpcommon.c contents to mplayer.c
The contents of mpcommon.c were quite arbitrary; the most common
reason to place some functions in this file had been "MEncoder happens
to need similar code as MPlayer and we want to share some parts, but
we have no clue whatsoever how to organize things in a sensible way,
so we'll just dump those parts we want to share in mpcommon.c". As a
result of containing an essentially random subset of top-level player
functionality the mpcommon.h header required access to central structs
and was unsuitable for inclusion in lower-level code, but was
nonetheless included there for the mplayer_version symbol.

Move almost all contents from mpcommon.c to mplayer.c. mplayer.c is
already big and should perhaps be split further, but keeping a few
random functions in mpcommon.c would not be an improvement.
2011-01-15 18:45:43 +02:00
Uoti Urpala a1692437d0 core: move global "subdata" and "vo_sub_last" to mpctx 2011-01-11 17:55:05 +02:00
Uoti Urpala f95674fb6c subtitles: remove sub_last_pts hack
This code was probably added because of bad pts handling in old timing
code, and should not be needed any more.
2011-01-11 17:38:15 +02:00
Uoti Urpala b26fbeddd8 options: move -noconfig to option struct, simplify 2011-01-11 17:28:10 +02:00
Uoti Urpala 24dfc70a08 mpcommon.h: reduce header dependencies on other headers
Use "struct foo *ptr" without full definition of the struct, instead
of using typedef names and including other headers for them.
2010-11-02 04:16:46 +02:00
diego b87c4e15b8 cosmetics: mpcommon.h: Group all extern variable declarations together
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32113 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:16:45 +02:00
diego a1b8092c87 Factorize MPlayer/MEncoder version string handling.
The string now resides in a central object file instead of
being duplicated in every file that requires a version string.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@31577 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:11:43 +02:00
Grigori Goronzy b784346e78 libass: match font attachments based on extension
Instead of only relying on the MIME type, use the file extension as a
fallback for deciding which attachments are fonts and should be fed to
libass.
This also refactors the check into a separate function in mpcommon.
2010-06-01 23:15:41 +02:00
Uoti Urpala 4785c2617e Merge svn changes up to r30967 2010-04-26 17:42:20 +03:00
Uoti Urpala 95fba94860 Merge svn changes up to r30917 2010-04-26 17:11:04 +03:00
diego 5e480c7b81 Get rid of pointless def_path variable; use codec_path directly instead.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30949 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-23 18:01:00 +00:00
attila a1f7ee1a4b Make all instances of codec_patch unconditional, otherwise
compilation will break on systems that do not have win32 dlls
enabled. Fixes compilation bug introduced by r30942

10l to the anonymous guy who explains the importance of commit messages
and would like to have romance novels in these very messages.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30945 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-21 10:13:00 +00:00
komh 11eeaf5005 Follow a more proper way to support -codecpath.
1. Include loader/drv.h for SetCodecPath() instead of a declaration of it.

    2. Move codec_path from get_path.h to mpcommon.h and mpcommon.c.



git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30914 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-03-17 09:12:51 +00:00
Uoti Urpala 12d3caebc7 Merge svn changes up to r30475 2010-03-09 19:18:43 +02: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 6023874828 Some ugly hacks to make compiling against a newer external version of libass work.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30107 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-12-24 10:51:24 +00:00
Uoti Urpala 7fd3eb0f74 Merge svn changes up to r29752
As part of merging subtitle-in-terminal changes make
update_subtitles() only clear existing subtitles if called with the
reset argument, and not try to set new ones. Later calls should set
the needed new subtitles, and this change avoids some problems with
trying to set subtitles when mp_property_sub() in command.c gets
called from initialization code before full initialization.
2009-10-06 04:48:00 +03:00
reimar 4b182ff652 Add support for displaying subtitles on the command-line when playing
audio-only files.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29712 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-23 21:48:48 +00:00
reimar 1b92715364 Make function argument name in header match name in .c file.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29711 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-23 21:27:36 +00:00
reimar bf16f6f4f3 Make update_subtitles work without sh_video for text subtitles.
This fixes a crash with e.g. auto-enabled subtitles and -novideo due to
command.c calling update_subtitles even without video and is a step
toward subtitle support for audio-only files.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@29710 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-09-23 21:21:58 +00:00
Uoti Urpala c73217c07a Change libass type names to match upstream renames 2009-07-29 01:11:33 +03:00
Uoti Urpala 58497380e5 Initial ordered chapters support
Add basic support for Matroska ordered chapters. The switching between
segments is implemented as a general edit timeline that could also be
used for other purposes.

Some things still need improvement. In particular the current code
does not try to do any proper mapping between audio/video/subtitle
streams of different files and there should be options for better
control of how MPlayer searches other files for the required content.
2009-04-02 06:51:25 +03:00
diego 2067a1f750 Factorize print_version().
Print CPU information in verbose mode instead of by default.


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@28360 b3059339-0415-0410-9bf9-f77b7e298cf2
2009-01-25 20:35:58 +00:00
albeu 6e62b3a85f Add options to disable some or all config files.
Patch by Andrew Savchenko (Bircoph -at- list -dot- ru).


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26448 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-04-14 11:21:29 +00:00
diego b5ed673f32 Add necessary #includes to pass 'make checkheaders'.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26163 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-03-04 23:35:24 +00:00
eugeni 22465e56cc Select audio stream in mplayer and mencoder, overriding demuxer decision.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26122 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-29 17:25:50 +00:00
diego 8efb2fa21c Add MPLAYER_ prefix to multiple inclusion guards.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26061 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-22 09:09:46 +00:00
reimar c767c782c0 Fix compilation with ASS disabled
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26040 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-20 19:03:16 +00:00
diego 77eb726c3d Remove pointless #ifdefs around extern declarations.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26039 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-20 08:51:53 +00:00
diego 2b6af2000b Add multiple inclusion guards to all header files that lack them.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25581 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-01-01 21:35:58 +00:00
diego b0ae2fdd7a Fix warning:
mplayer.c: In function 'generate_video_frame':
mplayer.c:1631: warning: implicit declaration of function 'update_teletext'


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24185 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-08-25 16:24:17 +00:00
diego a54c7c3ca4 Fix warnings:
In file included from mplayer.c:380:
mpcommon.h:5: warning: redundant redeclaration of 'subdata'
libvo/sub.h:63: warning: previous declaration of 'subdata' was here
In file included from command.c:26:
mpcommon.h:5: warning: redundant redeclaration of 'subdata'
libvo/sub.h:63: warning: previous declaration of 'subdata' was here
In file included from mencoder.c:239:
mpcommon.h:5: warning: redundant redeclaration of 'subdata'
libvo/sub.h:63: warning: previous declaration of 'subdata' was here


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24177 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-08-25 13:23:40 +00:00
reimar 4b774aacd1 Move some subtitle handling from mplayer.c to mpcommon.c and share it with mencoder.c
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@22251 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-02-17 21:04:46 +00:00