Commit Graph

33847 Commits

Author SHA1 Message Date
wm4 86ed6efd8a commands: handle property clamping in m_option
Instead of clamping property values to the valid range in each property
implementation, handle it in the property layer. The functionality to
handle clamping for each type is in m_option.c.

It's not really clear whether this is really needed. Normally, the raw
values for M_PROPERTY_SET come only from m_option_type.parse (setting
properties as string) or from m_option_parse.add (using the "switch"
input command). However, since this was already done before, and since
we _really_ want to be sure only to write valid values, add this code
anyway. The newly added warnings/error messages should never actually
be printed during normal operation and are for debugging (if they
happen, we definitely want to see them).
2012-10-12 10:10:31 +02:00
wm4 426640204b options: simplify somewhat by introducing a union for option values
The m_option_value union is supposed to contain a field for each
possible option type (as long as it actually stores data). This helps
avoiding silly temporary memory alocations. Using a pointer to an union
and to a field of the union interchangeably should be allowed by
standard C.
2012-10-12 10:10:31 +02:00
wm4 1a5a7a4929 options: accept "yes" and "no" only for flags
This removes the alternative values like "off", "0", "false" etc., and
also the non-English versions of these.

This is done for general consistency. It's better to have a single way
of doing things when multiple ways don't add singificant value.

Also update some choices for consistency.
2012-10-12 10:10:31 +02:00
wm4 69ce4591d0 commands: generally handle property formatting with m_option
Use the m_option code by default to format property values, instead of
having separate code in m_property.

To facilitate that, add a pretty_print callback to option types. These
format values in a more human readable and user friendly way, as opposed
to the print callback, which produces parseable values.

This also changes the strings used with flags. Instead of "enabled" and
"disabled", flags are formatted as "yes" and "no". (We could use the
pretty_print callback to deal with this, but we don't for consistency.)
2012-10-12 10:10:31 +02:00
wm4 f607d104b6 commands: remove pointless NULL checks
Most property implementations checked whether the "arg" parameter was
NULL. This is entirely pointless, because NULL is actually never pased.
It was inconsistently done, too. Remove the checks.
2012-10-12 10:10:31 +02:00
wm4 cac7702565 commands: handle property stepping in a generic way
Instead of forcing each property implementation implement its own logic
for M_PROPERTY_STEP_UP/M_PROPERTY_STEP_DOWN, handle it in the generic
property code.

Rename the M_PROPERTY_STEP_UP command to M_PROPERTY_SWITCH (the other
property command, M_PROPERTY_STEP_DOWN, isn't needed anymore: stepping
downwards is done by passing a negative argument). Always use double as
argument type; it makes the code easier, and covers all property types.
Move the code which does the actual type-specific value stepping to
m_option.c (the idea is that m_option handles types).

Some properties still have custom handlers implemented with
M_PROPERTY_SWITCH. They can't be mapped to the generic mechanism,
because their value range is dynamic or entirely unknown.

For some properties, the default step stride is changed to 1. This is no
issue, because the default bindings in input.conf all use an explicit
stride in the affected cases.
2012-10-12 10:10:31 +02:00
wm4 3d67041089 options: remove CONF_TYPE_POSITION
This was the option parser for the off_t C type. These days, off_t is
always int64_t, so replace all its uses by int64_t and CONF_TYPE_INT64.

Fix the --sstep option. It used CONF_TYPE_INT with an off_t variable,
which will result in invalid memory accesses. Make it use type double
instead, which seems to make more sense for this option.
2012-10-12 10:10:30 +02:00
wm4 10437c35df commands: rename "osdlevel" option and property, make it a choice
Rename both the option and property to "osd-level", which fits a bit
better with the general naming scheme. Make it a choice instead of an
integer range. I failed to come up with good names for the various
levels, so leave them as-is.

Remove the useless property handler for the "loop" property too.
2012-10-12 10:10:30 +02:00
wm4 6f1486b397 commands: replace --hardframedrop, change framedropping property
Replace --hardframedrop with --framedrop=hard. Rename the framedrop
property from "framedropping" to "framedrop" for the sake of making
command line options have the same name as their corresponding
property. Change the property to accept choice values instead of
numeric values.

Remove unused/forgotten auto_quality variable.
2012-10-12 10:10:30 +02:00
wm4 a59eee4893 commands: remove third parameter for "switch"
This could change the direction (i.e. invoke STEP_PROPERTY_DOWN), but
you can just pass a negative value as second argument instead.
2012-10-12 10:10:30 +02:00
wm4 a749c61437 commands: rename osd_show_[property_]text and osd_show_progression
osd_show_[property_]text => show_text
osd_show_progression => show_progress

show_text, osd_show_property_text and osd_show_text both map to the
code for the previous osd_show_property_text. The only special thing
about osd_show_text is that you don't need to escape "$". Also,
unfortunately osd_show_property_text requires escaping things twice,
one time for the command parser, and the other time for the property
formatting code, while osd_show_text needed only one level of escaping.
2012-10-12 10:10:30 +02:00
wm4 950999dd7b commands: remove speed_set/speed_incr commands
Redundant with set/switch commands.
2012-10-12 10:10:30 +02:00
wm4 4e2fab5846 commands: rename properties, update input.conf
Use "-" instead of "_" in property names. The intent is that property
names and options names should be the same (if they refer to the same
thing), and options use "-" as word separator.

Rename some other properties too, e.g. "switch_audio" -> "audio".

Add a way to translate the old property names to the new ones, similar
to the input command legacy bridge.

Update input.conf. Use the new property names, and don't use legacy
commands.
2012-10-12 10:10:30 +02:00
wm4 cd25a671b5 commands: remove unimplemented "use_master" command
The implementation for this command was removed in 2002.
2012-10-12 10:10:30 +02:00
wm4 a668ae0ff9 commands: change input commands to make OSD usage explicit
Most input commands had their own policy whether to display an OSD
message for user feedback or not. Some commands had two variants, one
that showed an OSD message and one that didn't (e.g. step_property_osd
and step_property).

Change it such that all commands show a message on the OSD. Add a
"no-osd" modifier that disables OSD for that command. Rename the
"step_property" and "step_property_osd" command to "switch", and rename
"set_property" and "set_property_osd" to "set".

Note that commands which haven't used OSD before still don't use OSD.
That will possibly be fixed later. (E.g. "screenshot" could display an
OSD message instead of just printing a message on the terminal.)

The chapter and edition properties still produce OSD messages even with
"no-osd", because they don't map so well to the property_osd_display[]
mechanism.
2012-10-12 10:10:30 +02:00
wm4 6096966dee commands: minor cleanup for property_osd_display array
Make the definition more compact and less confusing by omitting rarely
used fields. Avoid having to initialize osd_id with -1 in every entry
by making 0 an unused OSD ID instead.
2012-10-12 10:10:30 +02:00
wm4 e41378ea71 commands: simplify legacy command-to-property bridge
There are many input commands which are redundant to properties. They
were parsed like normal commands, but set_property_command() in
command.c handled them automatically using the property mechanism. This
still required having the command specifications around, and the code in
command.c was quite messy.

Replace this with a text based replacement mechanism. Some corner cases
are not handled: commands of form "seek_chapter 3 1" are supposed to set
the "chapter" property to 3. This use is probably rare, and doesn't show
up in the default input.conf.

The reason compatibility is kept is because breaking input.conf is quite
annoying, so a minimal effort is made to avoid this. Currently we print
an annoying warning every time a legacy command is used, though.

Also add a compatibility entry for "pt_step", which was removed some
time ago. Variations in whitespace are not handled, but it's good enough
to deal with old input.conf entries.
2012-10-12 10:10:30 +02:00
wm4 0a54f5e741 commands: remove legacy slave mode get commands
These have been replaced by properties. Also remove some other slave-
mode specific get commands that can be replaced by property uses.

The get_metadata() function didn't actually contain anything useful,
and just replicated code from other parts of mplayer.
2012-10-12 10:10:28 +02:00
wm4 65adad50ab mplayer: unbreak OSD with CONFIG_ENCODING undefined
Basically, the encoding code path wanted to set osdlevel=0 as default,
while normal playback needs osdlevel=1. For this purpose, osdlevel was
set to -1 (i.e. invalid) initially to detect whether the --osdlevel
option was explicitly set. When encoding was not configured
(CONFIG_ENCODING undefined), the osdlevel value was not set from
-1 to 1 properly, and the OSD remained invisible by default.

Fix this by getting rid of this logic. It shouldn't be needed, since
osdlevel=1 never shows any OSD messages without user interaction.
Should this ever change, we could still check whether encoding is in
progress, or add another option to allow OSD rendering during encoding.
2012-09-18 21:08:20 +02:00
wm4 f5f0c66d1f options: rename noconfig to no-config, nocache to no-cache
This how it's supposed to be. The manpage has the correct names.
2012-09-18 21:08:20 +02:00
Stefano Pigozzi 09c5324314 cocoa_common: make fullscreen menubar/dock hiding conditional
cocoa_common was hiding the dock and menubar unconditionally when
going fullscreen. This means they were hidden even if they weren't on
the screen mplayer2 was going fullscreen on, resulting in poor user
experience.

Change the fullscreen function in the cocoa backend to check that
mplayer2 is on the same screen as the menubar/dock before hiding them.
2012-09-18 21:08:20 +02:00
Rudolf Polzer f5b8b6ac12 encode: video encoding now supported using mencoder-like options 2012-09-18 21:08:20 +02:00
Rudolf Polzer 5617bf483e TOOLS: add a new file identifier tool
It can provide properties of a file to the user on stdout, or when sourced by a
script, put them into its variables.
2012-09-18 21:08:20 +02:00
wm4 b248692034 commands: allow printing raw properties
Extend m_properties_expand_string() so that it can print properties as
unformatted string. Normally, properties will be pretty-printed
(intended for OSD and user interface purposes). Add the '=' modifier to
the format string syntax that disables pretty-printing and returns them
"raw".

For example, "${=switch_audio}" will print the track number, instead of
returning an OSD friendly string containing additional information like
track title and language.
2012-09-18 21:08:20 +02:00
Rudolf Polzer 416c03417e vf_rectangle: remove as it is very dirty and we have a replacement now 2012-09-18 21:08:20 +02:00
Rudolf Polzer 6371787b89 vf_dlopen: vf_rectangle filter moved to dlopen (unix only)
It is unix only, because vf_dlopen filters have no way to receive input (yet)
2012-09-18 21:08:20 +02:00
Rudolf Polzer 9343c1d3ab vf_dlopen: improve performance for 1-frame-for-1-frame filters
This is done by requesting a buffer from the next filter in the chain, instead
of always allocating our own. This allows the next filter to e.g. ensure its
own preferred memory layout.
2012-09-18 21:08:20 +02:00
wm4 c32082a1a7 mplayer: selectively reset track selection when playing multiple files
Normally, video/audio/sub track selection is persistent across files
played in the same mplayer instance. This is wanted, because settings
should not be reset across files in general. However, if the track
layout of a file is completely different from the previous, this will
essentially select random tracks. In this case, keeping the track
selection is confusing and unwanted.

Reset the track selection to default if the track layout changes. The
track layout is determined by number of tracks, track order, default
flag, whether the track is an external subtitle, and track language.
If a track layout change is detected when playing a new file, the -sid,
-aid and -vid options are reset to "auto".

This behavior is enabled only if the user selects tracks manually (via
keybinds and the "switch_audio" slave properties etc.). If no user
interactions take place, options specified on the command line will
follow the old behavior.
2012-09-18 21:08:20 +02:00
wm4 c8154630bf ad_dvdpcm: add back PCM decoder for DVD
This is needed by demux_mpg (and possibly by demux_ts) for PCM playback.
The decoder does the mapping from MPEG headers to the actual PCM format,
and also unpacks sample data for 20/24 bit formats.
2012-09-18 21:08:14 +02:00
Stefano Pigozzi 70e7d63ba0 core, timeline: cache external ordered chapter files too
Previously, Matroska source files other than the initially opened one
were always accessed without caching. Enable cache for extra files
too. A separate cache process/thread is started for each file, which
is less than optimal but probably better than no caching if the user
explicitly enabled cache. This commit only implements caching for
Matroska ordered chapters (not for EDL timeline).

To build the timeline we need to demux the files in the current
directory to look for segments with matching uuid. This first demux is
done with no cache since we don't need to read a lot of the stream. If
the file is recognized as one of the needed sources it's reopened with
cache enabled.

Also move the stream_cache_size global variable to the options struct.

Conflicts:
	cfg-mplayer.h
	mplayer.c
	stream/stream.h
	timeline/tl_matroska.c
2012-09-18 21:07:30 +02:00
Uoti Urpala 1959ba006c subs, vo_vdpau: support RGBA color for PGS subtitles
Support passing bitmap subtitles to VOs in full RGBA color, and
implement this for libavcodec-decoded subtitle formats on decoding
side and vo_vdpau on display side. Currently this is enabled for PGS
(blu-ray) and DVB subtitles.

VDPAU seems to have sampling issues similar to known GL ones when
drawing a sub-rectangle from a larger texture with scaling, where
adjacent pixels outside the specified source rectangle affect the
result. As the bitmap subtitles may be scaled, add padding support to
the bitmap packer code.

In principle, this could be used for colored DVD subtitles too.
However, the libavcodec DVD decoder lacks parts of the resolution and
palette handling that are present in spudec.c.

Conflicts:
	libvo/vo_gl.c
	sub/dec_sub.h
	sub/sd_lavc.c
2012-09-18 21:07:30 +02:00
wm4 ae9c3d530c libmpdemux: add back demux_ts
Someone wanted this. Apparently both libavformat's TS demuxer and
demux_ts are crap, and work/fail in different cases.

This demuxer has been removed in 1fde09db6f. All code added comes
from the revision before that. Some required bits have been added in
the commit before this one (re-adding demux_mpg), in particular the
changes to video.c.

stream_dvb will use this demuxer by default, otherwise demux_lavf is
preferred (as it has been before).

Some TS related command line options are not re-added.

Closed captions might not work.
2012-09-18 21:07:30 +02:00
wm4 c323592c3a libmpdemux: add back demux_mpg
Apparently this was needed for good DVD playback.

This demuxer has been removed in 1fde09db6f. All code added comes
from the revision before that. Some other bits have been removed in
later commits, and are added back as well.

Usage of memalign() is replaced by av_malloc(). As far as I can tell,
this memory is never free'd or reallocated, so no calls to av_free()
have been added.

The code re-added to video.c is plain horrible, full of code
duplication, full of demuxer/codecs specifics, but apparently needed.

Unrelated to re-adding the demuxer, re-add one codepath for
DEMUXER_TYPE_TV, which was accidentally removed in the same commit
demux_mpg was removed.

The closed captions decoder is not re-added.
2012-09-18 21:07:30 +02:00
wm4 b94cdc4baf options: change --vid, --aid, --sid options
The --vid, --aid, --sid options now accept the values 'off' and 'auto',
instead of having the user deal with the numeric values -2 and -1. The
numeric values are not allowed anymore.

Remove the --audio option. It was probably meant as compensation option
for --no-audio. There are no such options for sub/video, and it was not
documented, so just remove it. The replacement is "--aid=auto".

Also do some updates to the manpage.
2012-09-18 21:07:30 +02:00
wm4 c955549204 options: change --loop option, and extend choice option type
The --loop option takes slightly different parameters now. --loop=0
used to mean looping forever. Now it means looping is disabled (this is
more logical: 2 means playing 2 more times, 1 means playing 1 more time,
and 0 should mean playing not again).

Now --loop=inf must be used to enable looping forever.

Extend choice types to allow an optional range of integers as values.
If CONF_RANGE is added to the flags of a m_option_type_choice option,
m_option.min/max specify a range of allowed integer values. This can be
used to remove "special" values from make integer range options. These
special values are unintuitive, and sometimes expose mplayer internals
to the user. The (internal) choice values can be freely mixed with the
specified integer value range. If there are overlaps, the choice values
are preferred for conversion to/from strings.

Also make sure the extension to choice options works with properties.
Add the ability to step choice properties downwards, instead of just
upwards.
2012-09-18 21:07:29 +02:00
wm4 d29d4df634 options: remove M_OPT_IMPLICIT_DEFAULT
This was to make an option without value use the option's default value
(e.g. --term-osd is the same as --term-osd=auto). Make it simpler by
handling this case as an empty choice.

The flag was probably needed when option handling still did ambiguous
argument parsing.
2012-09-18 21:07:29 +02:00
wm4 f97a85595b options: remove -subalign
It can't be re-implemented, because this isn't supported by libass. The
-subalign option and the associated sub-align slave property did
nothing. Remove them.
2012-09-18 21:07:29 +02:00
wm4 130beda407 configure: add version check for libquvi
I do not know what exactly is the minimum working version. Require the
latest version currently released, which is about half a year old.
2012-09-18 21:07:29 +02:00
wm4 b28c6d0ba5 options: fix "--"
Handling this was accidentally forgotten when command line parsing was
refactored. The added recursive call should be a tail recursion with
all reasonable compilers, and it shouldn't be possible to provoke a
stack overflow.
2012-09-18 21:07:29 +02:00
wm4 1ba5a8f283 rawaudio: use mplayer audio format for format option
The rawaudio demuxer had a rather hard to use way to set the audio
format with the --rawaudio=format=value option. The user had to pass a
numeric value, which then was set as wFormatTag member in the
WAVEFORMATEX header.

Make it use the mplayer audio format (the same as --af=format=value).
Add a new internal pseudo audio codec tag, which is hopefully unused,
which makes ad_pcm use the value in wFormatTag as internal mplayer
audio format.

Playing non-PCM formats is disabled. (At least AC3 can be played
directly.)
2012-09-18 21:07:29 +02:00
wm4 1f5635d02c dec_audio: do not overwrite sh_audio->wf->wFormatTag
No decoder actually used this value (except ad_acm, which was removed a
while ago), so this change shouldn't have any bad consequences.
ad_ffmpeg passes wf to libavcodec decoders, but only the extra data
portion.

This change is needed by the next commit.
2012-09-18 21:06:40 +02:00
wm4 ee65b39cbe ad_pcm: add back raw decoder
This was removed in commit 6a26b4a665. Add it back, because it was
needed by demuxer_rawaudio and for PCM audio with demuxers other than
demux_lavf. (In practice, this broke rawaudio and PCM-in-Matroska only.)

Unlike with raw video, there is no single raw audio "decoder" in
libavcodec. Instead of trying to mess raw audio input into ad_ffmpeg
using a table to map audio formats to the respective libavcodec
decoders, it seems advantageous to simply add back ad_pcm.
2012-09-18 21:04:47 +02:00
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 5a13f5a5e8 build: move mpcommon.c to version.c
mpcommon.c used to be the only file to include version.h. version.h is
generated by the build system, and contains the git revision. Any time
a commit is made (or the tree is rebased etc.), the file is rewritten,
and mpcommon.c rebuilt. To make rebuilding less annoying, the definition
of the version string is the only thing in mpcommon.c.

Since I want to add other things to mpcommon.c, add a new file named
version.c, that takes over mpcommon.c's role as described above.
mpcommon.c doesn't include version.h anymore, and will be used to park
code that doesn't really belong anywhere else.
2012-09-18 21:04:47 +02:00
wm4 e47b779bfc bluray: add bd:// as stream prefix
The existing short prefix, br://, was not very intuitive.
2012-09-18 21:04:46 +02:00
wm4 2b80f516fd manpage: remove references to bitmap fonts
Support for bitmap fonts was removed a while ago.
2012-09-18 21:04:46 +02:00
wm4 dd3e1217eb demuxer: remove ImageDesc field
This was needed by the now-removed mov demuxer for QuickTime video, or
to be more specific, the Sorenson 3 video codec. QuickTime can
(probably) still decoded by libavcodec, but this field is not needed
for this.

The reference in demux_mkv was apparently for decoding QuickTime in
Matroska, using binary QuickTime codecs (QTX stuff). It's possible that
this has been broken with the binary codecs removal (see commit
aebfbbf2bd), because it removed related code from demux_mkv.  On the
other hand, the code section in question was enabled only if binary
win32 codecs were enabled. The win32 codec loader worked on 32 bit x86
only. This means QuickTime-in-Matroska was broken on all other
architectures, including 64 bit x86. Despite being possibly broken on a
major platform, nobody has complained about it yet, and since I couldn't
find a sample of such a mkv file, so don't bother with it.
2012-09-18 21:04:46 +02:00
wm4 f0b2c3dcd7 demuxer: do not set sub_utf8 option
demux_lavf and demux_mkv, which both support demuxing subtitles, set
the global variable sub_utf8. This variable is connected with the -utf8
option, and should not be reset by code. Since demuxer subtitles are not
influenced by this option (anymore?), this is unnecessary. Remove the
code setting this variable from the demuxers.
2012-09-18 21:04:46 +02:00
wm4 128bc6a21e Remove VESA/FBDEV remains, clean up example.conf
Remove VESA and FBDEV specific code that was forgotten when the
respective VOs were removed. Remove references to old or broken
stuff from example.conf.
2012-09-18 21:04:46 +02:00
wm4 b554a59b58 subs: restore support for sub_step command with libass
This was destroyed by Uoti Urpala in commit "subs: always use sub...".
Features should be either kept working or completely removed, but not
just crippled, which only inflates the code and frustrates users.
2012-09-18 21:04:46 +02:00