1
mirror of https://github.com/mpv-player/mpv synced 2024-07-11 23:47:56 +02:00
Commit Graph

63 Commits

Author SHA1 Message Date
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
08caadb9c0 bstr: rename bstr() function to bstr0(), and typedef bstr to struct bstr
Replace all uses of bstr() with bstr0().
Also remove the ridiculous C++ workaround.
2012-07-28 23:47:42 +02:00
Uoti Urpala
adfa7bdfb2 options: support "no-foo" syntax for flag suboptions
Allow using "no-foo" as an alternative to "foo=no" for flag
suboptions, similarly to what top-level flag options already support.
This means things like "--lavdopts=no-fast" or
"--vo=vdpau:no-chroma-deint" are now supported.
2012-07-27 03:34:17 +03:00
Uoti Urpala
48f0692ab9 options: make option struct the talloc parent of options
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.
2012-07-16 21:08:42 +03:00
Uoti Urpala
dc2a4863af options: support parsing values into substructs
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).
2012-07-16 21:08:42 +03:00
Uoti Urpala
1e90a8657d options: simplify option parsing/setting machinery
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.
2012-05-08 20:19:32 +03:00
Uoti Urpala
89b37a32da options: add "disabled option" functionality
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.
2011-09-04 14:36:09 +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
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
9298acdd60 options: free option defaults when freeing config
Possibly read-only default values of option variables are replaced
with dynamically allocated defaults when registering options. Free
these when freeing the overall config object on exit to clean up leak
report results.
2011-07-06 06:47:38 +03:00
Uoti Urpala
39e373aa8d options: allocate dynamic options with talloc
Allocate data structures for dynamic option values with talloc.
Hopefully there's no code left that tries to modify those dynamic
option values outside the option parser and relies on them being
malloc-allocated. Currently talloc functionality isn't used much and
the allocations are not hierarchical, so the main practical use for
now is just to allow very easy checking for memory leaks.
2011-07-06 06:47:26 +03:00
Uoti Urpala
1f6970b855 cleanup: reformat and clean up m_config.[ch]
m_config.c changes include removal of "#ifdef MP_DEBUG" from around
some assert lines.
2011-07-06 06:25:16 +03:00
Clément Bœsch
6506d4ad84 cleanup: remove more warnings 2011-05-02 00:46:48 +03:00
Uoti Urpala
fad3585ef4 options: remove CONF_OLD option flag
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.
2011-01-31 21:53:05 +02:00
Uoti Urpala
b9a3579ec9 commands: add generic option -> property wrapper
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).
2010-12-18 11:59:09 +02:00
Uoti Urpala
9c1bafb93a options: fix autoloaded profile handling of flag options
When loading automatically enabled profiles (like "[extension.avi]")
flag options were handled as on the command line; for example "fs=no"
was interpreted like "-fs" on command line, ignoring the "no" part.
Fix the parsing to treat them the same as other config file entries.
2010-11-15 23:41:59 +02:00
diego
12d3e0df99 cleanup: don't check for NULL before free()
patch by Clément Bœsch, ubitux gmail com

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32598 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-08 18:05:12 +02:00
diego
b4c7efdfe1 m_config.c: cosmetics: Move functions to avoid forward declarations
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32387 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:18:08 +02:00
diego
cce06f6f21 m_config.[ch]: mark some function parameters const
patch by Clément Bœsch, ubitux gmail com

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@32386 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-11-02 04:18:08 +02:00
Uoti Urpala
00323c06e2 Delete things related to old translation system
Remove the help/ subdirectory, configure code to create toplevel
help_mp.h, and all the '#include "help_mp.h"' lines from .c files.
2010-03-10 03:47:14 +02:00
Uoti Urpala
e74708f619 Merge svn changes up to r30748 2010-03-10 01:50:55 +02:00
Uoti Urpala
12d3caebc7 Merge svn changes up to r30475 2010-03-09 19:18:43 +02:00
Uoti Urpala
5234c72e28 Restore collapsed whitespace in output messages
For some reason commit e306174952, which
replaced translation macro names with the corresponding English
strings, also collapsed multiple consecutive space characters into
one. Change most of these back. In a couple of cases the amount of
whitespace is important for alignment, and for the rest it at least
keeps the strings closer to the existing translations.
2010-03-07 21:34:54 +02:00
reimar
42096a34d5 Make more option-parsing related function arguments const.
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
2010-02-25 22:32:28 +00:00
diego
b9ac9f87f7 Mark m_config_get_option_ptr() as static, it is only used within the file.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@30673 b3059339-0415-0410-9bf9-f77b7e298cf2
2010-02-20 20:01:56 +00: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
Uoti Urpala
0eb321bf2c Remove trailing whitespace from most files 2009-07-07 02:34:35 +03:00
Amar Takhar
e306174952 Translation system changes part 2: replace macros by strings
Replace all MSGTR_ macros in the source by the corresponding English
string.
2009-07-07 01:38:20 +03:00
Amar Takhar
b5972d6f14 Translation system changes part 1: wrap translated strings
Replace mp_msg() calls which have a translated string as the format
argument with mp_tmsg and add _() around all other translated strings.
2009-07-07 01:28:07 +03: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
Uoti Urpala
1ade57af4b m_config.c: Remove unused function m_config_get_option_ptr 2008-08-12 14:57:18 +03:00
Uoti Urpala
bb12a33f9a options: Make dynamic dup hack work with new options
The option system has a hack that converts default values (potentially
constants) of dynamically allocated options to allocated ones when the
options are first added to the config system, so that all values can
be equally freed later. Make this work with new-style options in the
option struct too.
2008-04-30 19:34:48 +03:00
Uoti Urpala
e61ac5e9cb m_config.c: Cosmetics: fix nested block lacking indentation 2008-04-30 19:34:47 +03:00
Uoti Urpala
05ad815133 Mark some constant symbols as such 2008-04-26 16:35:40 +03:00
Uoti Urpala
fb33e286b5 Move global mconfig to mpctx
The global was used in the function cfg_include which handles the
-include option. Make the address available in that function by
creating a new dynamically allocated option in m_config_new that has
the address in the option's private data.

asxparser.c also used the global. Making it available through all ways
the code could get called required a number of relatively straightforward
changes to playtree and menu code.
2008-04-26 10:44:59 +03:00
Uoti Urpala
2993acdc31 Convert m_config.c to use talloc 2008-04-26 09:37:29 +03:00
Uoti Urpala
9db0c118d3 Start of new option system
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.
2008-04-23 13:41:05 +03: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
12ff2d2644 Add some const qualifiers to reduce warnings
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@26320 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-04-02 01:01:22 +00:00
diego
835c654bb0 typo fix: inited --> initialized
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25994 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-02-14 14:23:55 +00:00
ben
7a4efd3ce7 export m_config_set_profile()
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25662 b3059339-0415-0410-9bf9-f77b7e298cf2
2008-01-10 18:41:21 +00:00
reimar
e42550302c First try to mark some things in m_config correctly as const
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@25253 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-12-02 15:35:58 +00:00
reimar
2f7192222a Fix some typos in comments
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@23888 b3059339-0415-0410-9bf9-f77b7e298cf2
2007-07-28 10:14:42 +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
reimar
b05b201a49 Fix obvious typo, although the exact effect is still unclear to me, see also bug #593.
Patch by jose nazario [jose <at> monkey org].


git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@21070 b3059339-0415-0410-9bf9-f77b7e298cf2
2006-11-19 17:41:31 +00:00
reynaldo
3afd65b3af rm unnecesary casts from void* - part 3
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18884 b3059339-0415-0410-9bf9-f77b7e298cf2
2006-07-02 08:17:07 +00:00
diego
3f62423f42 Rename some misspelled and misnamed messages.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18336 b3059339-0415-0410-9bf9-f77b7e298cf2
2006-04-28 23:06:42 +00:00
albeu
f0f01dd903 Doxygen attack!
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@18259 b3059339-0415-0410-9bf9-f77b7e298cf2
2006-04-24 19:20:04 +00:00
albeu
4e1950bd8a 10L fix missing return statement.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17857 b3059339-0415-0410-9bf9-f77b7e298cf2
2006-03-13 21:18:27 +00:00
albeu
f3ce1dc108 Fix the MSG?_FIXME and make the profiles help translatable.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@17482 b3059339-0415-0410-9bf9-f77b7e298cf2
2006-01-25 11:28:19 +00:00