Commit Graph

33814 Commits

Author SHA1 Message Date
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
Uoti Urpala fd52cb65f4 subs, vo: do sub bitmap change detection by comparing IDs
vo_vdpau and vo_gl cache the last subtitle bitmaps uploaded to video
card in case they stay the same over multiple frames. Detecting
whether the bitmaps have changed and should be re-uploaded was
somewhat fragile. Change the VO API to provide a bitmap ID which can
be compared with what the VO has to determine whether a new upload of
the bitmaps is needed.

Conflicts:
	libvo/vo_gl.c

Note: the changes for vo_gl.c were not merged. Instead, eosd_packer is
modified to use the new way of detecting EOSD changes. This takes care
of vo_gl, vo_gl3 and vo_direct3d, which all render EOSD. They don't
need to be updated in turn.
2012-09-18 21:04:46 +02:00
Uoti Urpala 62ccf6c5cc vo_vdpau: split bitmap packing code into a separate file
Split the vo_vdpau code that calculates how to pack all subtitle
bitmaps into a larger surface into a separate file. This will allow
using it in other VOs.

Conflicts:
	Makefile
	libvo/vo_vdpau.c

Note: this commit does the same as an earlier commit by me
(4010dd0b1a). My commit added the vo_vdpau packer code as
eosd_packer.c, while this commit by uau uses bitmap_packer.c. Since
bitmap_packer.c has a different interface, and because there are more
commits changing OSD rendering coming, I will pick uau's version.
However, vo_gl, vo_gl3 and vo_direct3d are still using eosd_packer.c,
so to make the transition easier, don't delete eosd_packer.c yet.
2012-09-18 21:04:46 +02:00
wm4 6a5f00b875 cleanup: video_out: remove vo_subdevice global variable
This wasn't accessed anymore.

This is all what was left of mplayer2 commit c54fae82fd16
("vo: fix crash if all VO open fallback attempts fail").
2012-09-18 21:04:46 +02:00
Uoti Urpala 89a5714893 subs: always use sub decoder framework for libass rendering
Remove subtitle selection code setting osd->ass_track directly and
vf_ass/vf_vo code rendering the track directly with libass. Instead,
do track selection and rendering with dec_sub.c functions.

Before, mpctx->set_of_ass_tracks[] contained bare libass tracks
generated from external subtitle files. For use with dec_sub.c, it now
contains struct sh_sub instances with decoder already initialized.

This commit breaks the sub_step command ('g' and 'y' keys) for
libass-rendered subtitles. It could be fixed, but it's so useless -
especially as with the existing implementation there's no practical
way to get subtitle delay back to normal after using it - that I
didn't bother.

Conflicts:
	command.c
	mp_core.h
	mplayer.c
2012-09-18 21:04:46 +02:00
Uoti Urpala 9bb03b7db4 subs: libass: use a single persistent renderer for subtitles
To draw libass subtitles, the code used ASS_Renderer objects created
in vf_vo (VO rendering) or vf_ass. They were destroyed and recreated
together with the video filter  chain. Change the code to use a single
persistent renderer instance stored in the main osd_state struct.
Because libass seems to misbehave if fonts are changed while a
renderer exists (even if ass_set_fonts() is called on the renderer
afterwards), the renderer is recreated after adding embedded fonts.

The known benefits are simpler code and avoiding delays when switching
between timeline parts from different files (libass fontconfig
initialization, needed when creating a new renderer, can take a long
time in some cases; switching between files rebuilds the video filter
chain, and this required recreating the renderers). On the other hand,
I'm not sure whether this could cause inefficient bitmap caching in
libass; explicitly resetting the renderer in some cases could be
beneficial. The new code does not keep the distinction of separate
renderers for vsfilter munged aspect vs normal; this means that
changing subtitle tracks can lose cache for the previous track.

The new code always sets some libass parameters on each rendering
call, which were previously only set if they had potentially changed.
This should be harmless as libass itself has checks to see if the
values differ from previous ones.

Conflicts:
	command.c
	libmpcodecs/vf_ass.c
	libmpcodecs/vf_vo.c
	mplayer.c
	sub/ass_mp.c
2012-09-18 21:04:46 +02:00
Uoti Urpala 44d8ec9272 sd_lavc: use subtitle framework for former av_sub.c code
Change libavcodec subtitle decoding code (used for some bitmap
subtitle types) to use the same decoding framework as sd_ass. The
functionality that was previously in av_sub.c and was directly called
from mplayer.c is now in sd_lavc.c.

Conflicts:
	mplayer.c
	sub/av_sub.h
	sub/sd_lavc.c

Merged from mplayer2. The remaining use of is_av_sub() is replaced by
a check whether a subtitle decoder is active, which should give the
same results.
2012-09-18 21:04:46 +02:00
Uoti Urpala 435d7c97c9 cleanup: remove pointless #defines
Remove the following #defines, which should never change in practice:

CONFIG_FAKE_MONO, OUTBURST, FAST_OSD, FAST_OSD_TABLE
The configure script hardcoded these to particular values in config.h.
They could only be changed by manually editing it. I don't think
anyone would want to.

X11_FULLSCREEN
This once did something, but became meaningless years ago and was now
always set to true if the files using it were compiled at all.

Conflicts:
	configure
	libvo/osd.c
	libvo/vo_gl.c

Merged from mplayer2. The OSD defines were already removed in this fork.
2012-09-18 21:04:46 +02:00
wm4 d21b109bf7 core: fix DVD subtitle selection
Add all subtitle tracks as reported by libdvdread at playback start.
Display language for subtitle and audio tracks. This commit restores
these features to the state when demux_mpg was default for DVD playback,
and makes them work with demux_lavf and the recent changes to subtitle
selection in the frontend.

demux_mpg, which was the default demuxer for DVD playback, reordered
the subtitle streams according to the "logical" subtitle track number,
which conforms to the track layout reported by libdvdread, and is what
stream_dvd expects for the STREAM_CTRL_GET_LANG call. demux_lavf, on
the other hand, adds the streams in the order it encounters them in
the MPEG stream. It seems this order is essentially random, and can't
be mapped easily to what stream_dvd expects.

Solve this by making demux_lavf hand out the MPEG stream IDs (using the
demuxer_id field). The MPEG IDs are mapped by mplayer.c by special
casing DVD playback (map_id_from/to_demuxer() functions). This mapping
is essentially the same what demux_mpg did. Making demux_lavf reorder
the streams is out of the question, because its stream handling is
already messy enough.

(Note that demux_lavf doesn't export stream IDs for other formats,
because most time libavformat demuxers do not set AVStream.id, and we
don't know which demuxers do. But we know that MPEG is safe.)

Another major complication is that subtitle tracks are added lazily, as
soon as the demuxer encounters the first subtitle packet for a given
subtitle stream. Add the streams in advance. If a yet non-existent
stream is selected, demux_lavf must be made to auto-select that subtitle
stream as soon as it is added. Otherwise, the first subtitle packet
would be lost. This is done by DEMUXER_CTRL_PRESELECT_SUBTITLE.
demux_mpg didn't need this: the frontend code could just set ds->id to
the desired stream number. But demux_lavf's stream IDs don't map
directly to the stream number as used by libdvdread, which is why this
hack is needed.
2012-09-18 21:04:45 +02:00
wm4 fbc424ef35 demux_mkv: fix minor memory leak 2012-09-18 21:04:45 +02:00
wm4 5984d702c6 mplayer: don't clear OSD when new file is played
When switching editions, it would be nice to display an OSD message to
notify the user which edition is being played. This would be consistent
with visual feedback like on tracking switching, seeking, and so on.

Rather than introducing awkward hacks and special cases to determine
whether a file is being "restarted" (as it happens on edition switching)
to avoid clearing the OSD messages, simply never clear the OSD stack.

This is more consistent with handling of OSD bars too: they didn't
disappear when going to a new file (especially noticable when seeking
past the end of the file).
2012-09-18 21:04:45 +02:00
wm4 88728c6fad core: runtime Matroska edition switching
Add a new slave property which switches the current Matroska edition.
Since each edition can define an entirely new timeline, switching the
edition will simply restart playback at the beginning of the file with
the new edition selected.

Add 'E' as new keybinding to step the edition property.

DVD titles are still separate. Apparently they work similarly, but I
don't have any multi-title DVDs for testing. Also, cdda (for audio CDs)
uses the same mechanism as DVDs to report a number of titles, so there
seems to be confusion what exactly this mechanism is supposed to do.
That's why the edition code is completely separate for now.

Remove demuxer.num_titles. It was just a rather useless cache for the
return value of the DVD titles related STREAM_CTRL.

One rather obscure corner case isn't taken care of: if the ordered
chapters file has file local options set, they are reset on playback
restart. This is unexpected, because edition switching is meant to
behave like seeking back to the beginning of the file.
2012-09-18 21:04:45 +02:00
wm4 7236ad5ff2 video_out: free memory if initializing a VO fails
This was a minor memory leak with no real impact.
2012-09-18 21:04:45 +02:00
wm4 9194c81070 mplayer: do not cancel playback if VF/VO config fails
Usually failing to initialize the video chain does not stop playback,
and continues with audio-only. But when VF/VO config failed (the second
step in initializing them), playback was canceled and advanced to the
next file.

Make it more consistent and just switch off video if it fails.

Also, if no audio track is selected, go to next file anyway. The player
core goes into some sort of idle mode if no video and audio track is
selected, and we don't want to trigger it here. (It's unclear whether
that is a bug or feature: it's meant to work around some corner cases,
but maybe it shouldn't be triggered when switching off video & audio
tracks in normal playback.)
2012-09-18 21:04:45 +02:00
wm4 cde59e913f core: move implementation for -audiofile to the frontend
This should behave as before, with the same set of caveats.
2012-09-18 21:04:45 +02:00
wm4 0f155921b0 core: manage tracks in the frontend
Introduce a general track struct for every audio/video/subtitle track
known to the frontend. External files (subtitles) are now represented
as tracks too. This mainly serves to clean up the subtitle selection
code: now every subtitle is simply a track, instead of using a messy
numbering that goes by subtitle type (as it was stored in the
global_sub_pos field). The mplayer fontend will list external subtitle
files as additional tracks.

The timeline code now tries to match the exact demuxer IDs of all
tracks. This may cause problems when Matroska files with different
track numberings are used with EDL timelines. Change demux_lavf not
to set demuxer IDs, since most time they are not set.
2012-09-18 21:04:45 +02:00
wm4 13482fb397 core: refactor MPContext.demuxer field accesses
Whenever the demuxer is accessed to retrieve metadata, use the newly
introduced master_demuxer field instead. If a timeline is used, the
master_demuxer will still refer to the main file, instead to segments.
Instead of mpctx->demuxer->stream, access mpctx->stream; even though
they are the same, the code becomes shorter. For the TV code, introduce
a function get_tvh() to access the TV handle, instead of duplicating the
code all over the place. Often the demuxer field is checked to determine
whether something is currently played; prefer other methods over that.

Note that the code before always accessed the current timeline segment,
and would e.g. read file metadata of the current segment. Now it always
returns metadata for the master file. This may have various wanted and
unwanted effects.
2012-09-18 20:58:16 +02:00
wm4 1fb275b7de command: remove sub_remove command
This messes deeply with the subtitle bookkeeping data structures, and
would have to be reimplemented anyway.

It's not sure what this was even useful for. Possibly for slave mode.
2012-09-07 16:06:36 +02:00
wm4 330c90cbb8 command: remove sub_log command
Not very useful, and introduced special cases. Just get rid of it, can
be reintroduced if in a better way if someone misses this feature.
2012-09-07 16:06:36 +02:00
wm4 83f68f725d core, timeline: don't keep separate stream field
The timeline code kept pairs of stream and demuxer references around.
The reference to the stream is redundant, because it can be accessed
through the demuxer.

Simplify the code by removing the redundant stream reference.

Also, set mpctx->stream to the current segment when using timeline.
Fix a small memory leak in tl_matroska.c introduced earlier.
2012-09-07 16:06:36 +02:00
wm4 c5e2120e15 timer: remove timer_name
This was unreferenced and useless.
2012-09-07 16:06:36 +02:00
wm4 914c8dc577 osd: reset OSD progression display
The code for showing OSD progression ('P' key) set a flag in a
mp_osd_msg_t to do its work. OSD messages can be re-used for completely
unrelated purposes (it's unclear why), so this has to be reset if an
old OSD progression message is reused for something different.

Be sure to reset the full message. Remove the messy code for searching
the OSD stack. Use the existing rm_osd_msg() function to remove the old
message (if there was one), and always create a new message. The new
code should be functionally equivalent to the old code. The "started"
flag wasn't reset before, but since the time is always overwritten, this
might be actually more correct.
2012-09-07 16:06:32 +02:00
wm4 cafa00841f libaf: rename af_format.h to format.h
af_format.h declares some symbols which are defined in format.c. The
fact that af_format.c is a completely unrelated file is rather
confusing. Having the header and implementation file use the same base
name is more uniform. (af_format.c is the audio conversion filter, while
af_format.h and format.c are about audio formats and their properties.)

Also fix all source files which include this file.
2012-08-29 00:50:26 +02:00
wm4 7c45be712f options, libaf: unify audio format name handling
Remove the duplicated list of audio format names from m_option.c. Remove
"long" audio format names, and let af_fmt2str() print the usual short
format names. The long names were overly verbose, and were actually
rarely user visible. The only difference between af_fmt2str() and
af_fmt2str_short() is that the former prints unknown format values as
hexadecimal string as fallback.
2012-08-29 00:36:44 +02:00
wm4 7bb95cd8a5 options, codecs.conf, img_format: unify imgfmt name handling
Remove the duplication of image format name lists from codec-cfg.c
and img_format.c. Remove the list of "long" image format names from
img_format.c.

One user visible change is that now mplayer won't print "long" format
names anymore: e.g. instead of "Planar 420P 10-bit little-endian",
the name "420p10le" is used. This is consistent with the names used
by the option parser, and also less noisy.

Partially based on mplayer2 commit f98e47574de15, with some differences.
2012-08-29 00:14:11 +02:00
Uoti Urpala d5aa8dc88f cleanup: remove XvMC remains, reformat img_format.c
Remove remaining references to XvMC. It was already not supported;
remove references to the imgfmt too. Reformat img_format.c.
2012-08-28 23:26:16 +02:00
Stefano Pigozzi da374c40de cocoa_common: improve conditional dock hiding from 3259e4a7a
Make the conditional hiding logic introduced in commit 3259e4a7a2a938
("cocoa_common: make fullscreen menubar/dock hiding conditional") work
when mplayer is started with the `fs` and `xineramascreen` options.
2012-08-28 23:21:07 +02:00
Uoti Urpala 3972642cb8 OSD/commands: use osdlevel=3 for osd_show_progression command
The osd_show_progression command ('P' key) created text similar to
what --osdlevel=3 shows, and set that as an OSD message. This message
was static and wasn't updated while visible, even if video position
changed (very noticeable during fast forward, when real OSD position
changes rapidly). Instead of setting a static message, create a new
message type that makes the OSD update code behave as if osd level was
set to 3 for the duration of the message.

The OSD progress bar isn't updated while the message is active.

Based on mplayer2 commit 458001463b2252fc by uau.
2012-08-28 23:18:33 +02:00
wm4 413c6f5b30 af_scaletempo: fix crash on channel reconfiguration
This crash happened when audio channels were reconfigured from 6
channels to 2, and playback speed was set to 2.

The crash is caused by passing a negative size to memcpy. It appears
reinitialization doesn't clear the buffer. As the result, the buffer
can be larger as the maximum buffer size, i.e. the invariant
bytes_queued <= bytes_queue is violated.

Fix this by resetting the buffer length on reconfiguring (set the
bytes_queued vairable to 0). Also reset some other state for clarity
and robustness, although these changes aren't strictly needed for
avoiding the actual crash.

This may also get rid of some noise played right after reinitialization,
as the re-used buffer was in the wrong audio format.
2012-08-26 22:17:27 +02:00
wm4 424822b537 DOCS: add big picture overview over the code
Apparently this was useful for some. Isn't as detailed as general.txt
and others, but broader and less outdated.
2012-08-26 02:17:11 +02:00
wm4 53978d9bda DOCS: remove outdated/useless files 2012-08-25 21:48:34 +02:00
wm4 bac3b08765 Merge remote-tracking branch 'cantabile/manpage_fixes' 2012-08-25 21:40:22 +02:00
wm4 3a0f40afb4 configure: disable optimization if --enable-debug is used
Enabling optimization _still_ causes annoyances when using a debugger,
and it increaes compilation times too.

Now --enable-debug basically replaces the -O2 flag with -g.
2012-08-25 20:04:32 +02:00
wm4 6c13b694fb configure: minor improvement to summary output
Remove printing VO modules that were removed earlier, but were enabled
by configure tests that are still needed.

Print "libavcodecs" with the "Codecs: " output.
2012-08-25 20:03:25 +02:00