Commit Graph

34535 Commits

Author SHA1 Message Date
wm4 88d843f909 cleanup: replace OPT_FLAG_ON and OPT_MAKE_FLAGS with OPT_FLAG
OPT_MAKE_FLAGS() used to emit two options (one with "no" prefixed),
but that has been long removed by special casing flag options in the
option parser. OPT_FLAG_ON() used to imply that there's no "no-"
prefixed option, but this hasn't been the case for a while either.
(Conceptually, it has been replaced by OPT_FLAG_STORE().)

Remove OPT_FLAG_OFF, which was unused.
2013-02-09 00:21:17 +01:00
wm4 267a889cc2 options: unify single dash and double dash options
There were two option syntax variations:

    "old":  -opt value
    "new": --opt=value

"-opt=value" was invalid, and "--opt value" meant "--opt=" followed by
a separate option "value" (i.e. interpreted as filename). There isn't
really any reason to do this. The "old" syntax used to be ambiguous
(you had to call the option parser to know whether the following
argument is an option value or a new option), but that has been removed.
Further, using "=" in the option string is always unambiguous.

Since the distinction between the two option variants is confusing,
just remove the difference and allow "--opt value" and "-opt=value".

To make this easier, do some other cleanups as well (e.g. avoid having
to do a manual lookup of the option just to check for M_OPT_PRE_PARSE,
which somehow ended up with finally getting rid of the m_config.mode
member).

Error reporting is still a mess, and we opt for reporting too many
rather than too few errors to the user.

There shouldn't be many user-visible changes. The --framedrop and
--term-osd options now always require parameters.

The --mute option is intentionally made ambiguous: it works like a flag
option, but a value can be passed to it explicitly ("--mute=auto"). If
the interpretation of the option is ambiguous (like "--mute auto"), the
second string is interpreted as separate option or filename. (Normal
flag options are actually ambiguous in this way too.)
2013-02-09 00:21:17 +01:00
wm4 5412993724 config: do not require option value
Now setting a value with "=" is not required anymore in config files.
This should work analogous to command line arguments. Putting an entry
"opt=value" into the config file is like "--opt=value" on the command
line, and "opt" is like "--opt=" and "--opt".
2013-02-09 00:21:17 +01:00
wm4 830560979c options: change handling of "no-" options
Normally, all flag options can be negated by prepending a "no-", for
example "--no-opt" becomes "--opt=no". Some flag options can't actually
be negated, so add a CONF_TYPE_STORE option type to disallow the "no-"
fallback.

Do the same for choice options. Remove the explicit "no-" prefixed
options, add "no" as choice.

Move the handling of automatic "no-" options from parser-mpcmd.c to
m_config.c, and use it in m_config_set_option/m_config_parse_option.
This makes these options available in the config file. It also
simplifies sub-option parsing, because it doesn't need to handle "no-"
anymore.
2013-02-09 00:21:16 +01:00
wm4 ae070a6f1e audio/out, video/out: hide encoding VO/AO
mpv -ao help and mpv -vo help shouldn't show the encoding outputs (named
"lavc" on both cases). Also make it impossible to select these manually
when not encoding.
2013-02-06 23:04:18 +01:00
wm4 4628ea3c46 video/out: change autoprobe order
Basically, move vo_opengl above the other VOs (except vo_vdpau). This
changes preferences on Windows and Linux.

Move vo_opengl_old further down and make it the last fallback (before
vo_x11).

vo_caca is crap (no pun intended), and should never be autoprobed.
2013-02-06 23:04:18 +01:00
wm4 13d97077ec audio/out: prefer ao_dsound over ao_portaudio
On Linux, ao_portaudio has weird freezing issues (possibly specific to
the ALSA backend, though). Also ao_dsound is more likely to get multi-
channel audio output right, and ao_portaudio probably mangles these.
2013-02-06 23:04:18 +01:00
wm4 7a6d26370c mixer: prefer AO softvol control over volume filter
This partially reverts earlier decisions, when I thought it would
always be better to prefer the audio volume filter over the AO's,
because the AO's relies on the underlying audio-API, which could
be broken or exhibit unusual behavior (like it happened with ao_dsound).

However, since the audio buffer can be quite large (500 ms), and we
don't attempt to flush & refilter the audio on volume changes, always
prefer AO volume control (as long as the AO mixer doesn't control the
system mixer).

Also document what the mixer.c related AO fields mean (hopefully not
too brief).
2013-02-06 23:04:18 +01:00
wm4 94f72b1e59 ao_dsound: support 6.1 and 7.1 channel configurations
Instead of doing the channel reordering manually, use the existing
support in reorder_ch.c.

Untested.
2013-02-06 23:04:12 +01:00
wm4 37c5c114af Remove BSD legacy TV/radio support (BT848 stuff)
FreeBSD actually supports V4L2, and V4L2 supports this chip. Also,
this chip is from 1997. Farewell.
2013-02-06 23:03:39 +01:00
wm4 c5340512dd core: remove --edlout functionality
This could write .edl files in MPlayer's format. Support for playing
these files has been removed from mplayer2 quite a while ago. (mplayer2
can play its own, "new" .edl format, but does not support writing it.)

Since this is a rather obscure functionality, and it's not really clear
how it should behave (e.g. what should it do if a new file is played),
and wasn't all that great to begin with (what if you made a mistake?
the "edl_mark" command sucks for editing), get rid of it.

Suggestions how to reimplement this in a nicer way are welcome. If it's
just about retrieving timecodes, this in input.conf will do:

    KEY print_text "position: ${=time-pos}"
2013-02-06 23:03:39 +01:00
wm4 74817a77d4 command: add command to show playlist on OSD 2013-02-06 23:03:39 +01:00
wm4 314a07e787 version.sh: fix git rev. generation (.git is not always a directory)
It appears git submodule handling recently changed, changing the .git
directory to a regular file containing submodule specific information.
This means that version.sh would generate "#define VERSION "git-UNKNOWN""
if the checkout is a submodule, because it explicitly checks for a .git
directory using test -d. Change it to -e so that this case is handled
correctly.
2013-02-06 23:03:37 +01:00
wm4 630a2b195a mplayer: don't show bogus audio PTS during hr-seek
This fixes a problem that happened with syncplay.pl [1] when ad_mpg123
was in use, and get_current_time() returning a bogus time position.
This only happens during seeking; the reported time is correct after the
seek is done.

The audio PTS as returned by playing_audio_pts() is simply bogus during
hr-seek. With ad_ffmpeg, it was actually set to MP_NOPTS_VALUE during
seeking, so get_current_time() did a fallback to the video PTS. However,
ad_mpg123 is different and explicitly decodes some audio when resetting
on seek (reasons why it does this unknown and uninvestigated; apparently
it's to reinit libmpg123). As a result, the audio PTS was set to the
start position of the seek (or something similar), which could be very
different from the seek target time.

This confused syncplay. It got the bogus time because it spams the
player with read commands to the "time-pos" property, so this corner
case was hit.

Fix this by making get_current_time() return the seek target time if
hr-seek is active. This should make behavior the same as before commit
3f949cf "mplayer: prefer audio PTS over video PTS for status line".

[1] http://syncplay.pl
2013-02-05 18:32:26 +01:00
wm4 cd08785aab mplayer: properly handle framestep when showing last video frame
When doing a framestep while there is no more video, nothing happened,
and audio continued to play. When advancing to the next file, the player
was paused. Fix it so that it always pauses (except on very low frame
rate video, which is yet another corner case).

We also change the meaning of framestepping a bit: in audio only mode,
framstepping unpauses for a single playloop iteration. This is probably
not useful at all, but makes the code a bit more simpler/uniform.

Just like the previous commit, this matters most for audio files with
cover art, for which this special case is the normal case.
2013-02-03 21:08:26 +01:00
wm4 d302ac285f mplayer: reset audio/video delay if there's no next video frame
mpctx->delay is used to control audio/video sync. If more audio than
video has been played, it grows larger, meaning A/V desync is happening.

This logic is a bit broken when video has ended, and audio is still
playing. In that case, it tries to read additional video frames from the
video decoder (because even if you don't feed new packets to the
decoder, it could still return delayed frames). For that, the code to
determine whether frames should be dropped is invoked
(check_framedrop()). This function detects that video is behind audio (mpctx-
>delay growing big),
and attempts to issue a framedrop.

Reset mpctx->delay if there's no more video.

This fixes the the frame drop display "counting up" on each playloop
iteration when playing audio files with cover art. These files are
basically audio+video files with a single video frame. When playing
these files the the corner case of having run out of video while audio
is still playing is the normal case.

Also reset mpctx->last_av_difference. This is not updated anymore if
video ends (since update_avsync() sets it, but it's not called if
video_left is false). This removes the "stuck" A/V sync value when video
ends. With audio files containing cover art we would display a
meaningless value over the duration of the whole file otherwise.
2013-02-03 21:08:26 +01:00
wm4 cc5cf98348 input: free all queued/allocated commands on exit
These were memory leaks in theory, though not in practice (all memory is
free'd on exit anyway). However, it was still annoying when leak
reporting is enabled.

I'm not sure if there was an actual leak in check_autorepeat(), maybe
not.
2013-02-03 21:08:26 +01:00
cehoyos 738a5af586 vf_stereo3d: add support for green-magenta and yellow-blue dubois
Add more vf_stereo3d output formats.

Adds high quality green-magenta and yellow-blue dubois
anaglyph 3D output support.

Patch by thomas schorpp, thomas.schorpp gmail

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@35906 b3059339-0415-0410-9bf9-f77b7e298cf2

Conflicts:
	video/filter/vf_stereo3d.c
2013-02-03 21:08:25 +01:00
wm4 8b2c27f6c8 manpage: document option syntax variations better 2013-02-03 16:53:49 +01:00
wm4 0d3258fc1e demux_lavf: default PTS to 0 for attached pictures
The ffmpeg/libav attached picture hack usually set the PTS of video
packets to AV_NOPTS_VALUE. Set it to 0 to avoid printing a warning by
the filter code.
2013-02-03 16:53:49 +01:00
wm4 799bbae4f8 vf_dlopen: fix external pixel format names
"yv12" stopped working a while ago, and so did other FourCC-like names.
Make "yv12" work again, so that the examples in TOOLS/vf_dlopen/ work.
2013-02-03 16:53:49 +01:00
wm4 19ed132c8a DOCS: remove files documenting removed/rewritten functionality
Most of these are a waste of time. Some (like slave.txt) have been
rewritten in rst.

The remaining files aren't that useful, but probably do no harm.
2013-02-03 16:53:49 +01:00
wm4 df0312b694 Copyright: cleanup entries for removed code 2013-02-03 16:53:49 +01:00
wm4 5f28c34962 mplayer: make advancing the playlist respect looping
Explicitly advancing the playlist with input commands ("playlist_next")
didn't jump back to the first file, if the current file was the last on
the playlist and looping was enabled.

Fix this and make the behavior with explicit input and playback EOF the
same.

Also add a minor feature: if looping is enabled, and the current file is
the first on the playlist, going back one entry jumps to the last
playlist entry (without changing loop count).

Fixes #22.
2013-02-03 16:52:48 +01:00
wm4 3b37fadc5d demux_lavf: remove weird stream auto-selection
Should be dead code. Stream selection is handled either during
demuxer initialization, or via DEMUXER_CTRL_SWITCH_*.
(If there were actually situations where this code did something, it
was probably broken anyway.)
2013-02-03 16:51:13 +01:00
wm4 d61408f0da demux_lavf: remove "internet radio hack"
It appears this is not needed anymore. ffmpeg can handle "chained" ogg
files fine. These can be created with "cat file1.ogg file2.ogg > chained.ogg",
and are similar (or equal) to some internet radio streams. Apparently
ffmpeg used to add new tracks when crossing boundaries in chained files,
and the hack in demux_lavf.c handled this. At some later point, ffmpeg's
ogg demuxer was improved, and stopped adding new tracks as long as the
codec doesn't change.

Since the hack in demux_lavf.c was hardcoded to Vorbis (i.e. only active
if the new and old track were both Vorbis), it's dead code, and we can
remove it. I couldn't find any stream that triggered this hack, or fails
without it.

Firefox had a similar issue, and its bug tracker makes a good reference:

    https://bugzilla.mozilla.org/show_bug.cgi?id=455165

NOTE: this doesn't update metadata on track changes anymore.
2013-02-03 16:44:41 +01:00
wm4 74b66862d7 mp_common: improve OSD/status time formatting
Allow negative times. Timestamps can be negative, and we actually
display negative time for other reasons too, such as when waiting for
the old audio to drain with gapless audio.)

Avoid overflows with relatively large time values. (We still don't
handle values too large for int64_t.)
2013-02-03 15:41:18 +01:00
Stefano Pigozzi 37c83abe61 cocoa_common: fix `--ontop` behaviour when windowed
Apply setLevel hacks for fullscreen switching with ontop active only in
fullscreen. This keeps the window correctly on top even when losing focus.

Fixes #21

I also reverted NSScreenSaverWindowLevel to NSNormalWindowLevel + 1, so that
the cmd-tab UI is visible
2013-02-03 14:04:13 +01:00
Stefano Pigozzi 530036e5b3 cocoa_common: fix focus with --ontop and space switching
The main problem this commit addresses is when you switched spaced back and
forth with `--ontop` active the video window didn't recive focus again.

Turns out that setting a normal window level just before conceding focus to
other apps / spaces fixes the problem. I think Cocoa is misbehaving here, and
should probably file a radar.

I found 3 related improvements while fixing this:
 *  fullscreen_window_level is a dead body from an older implementation.
 *  Use NSScreenSaverWindowLevel for ontop. This should be a really high window
    level. Definitely higher than NSNormalWindowLevel + 1.
 *  The window level was set correctly only when out of fullscreen.
2013-02-03 11:39:30 +01:00
Stefano Pigozzi ce29e58fe3 cocoa_common: make the resize window menu items use video size
Make the window resizing menu items calculate the new window size based on the
video size and not the current window size.

This only makes a difference when using `--autofit`.
2013-02-03 10:18:55 +01:00
Stefano Pigozzi 68fa3c49db cocoa_events: remove this functionality
This functionality looked smart but created problems with some kinds of
multi touch events. Moreover some events coming from the windows server – like
hovering a corner for window resize – didn't cause the player to wake up
immediately.

The "correct" non hacky way to implement async event polling with cocoa would
be having the vanilla cocoa event loop driving the player and setting up mpv's
terminal FDs as event sources for the cocoa event loop.

Fixes #20
2013-02-02 14:36:05 +01:00
Stefano Pigozzi 6e4a45476f DOCS: update encoding profiles installation instructions
Simply removed the assumption that the user is using `mpv-build`. Now provide 3
lines of shell that can be copy-pasted by the user for instant gratification
(and independent from $PWD).
2013-02-01 22:35:05 +01:00
wm4 4a2e4b684a build: make it work on somewhat older ffmpeg versions
Tested with n0.10.4. All these version checks are rather tricky,
because Libav and FFmpeg change the same thing at slightly different
versions.
2013-01-31 17:42:21 +01:00
wm4 d4246353df stream: set default HTTP user agent to "Mozilla/5.0"
Playing vimeo links using quvi support didn't work, even though clive
could. clive is using quvi and curl to download videos from streaming
sites, so if clive works mpv should always work as well. It didn't, and
it turned out that it was due to the user agent. Change the default
from whatever Lavf sends to what clive and cclive use. This will
probably always work, as c(c)live are by the same author as libquvi,
and there's a high chance it has been tested with all the supported
sites.
2013-01-31 02:01:25 +01:00
wm4 6469322c5a manpage: fixes
Add missing documentation for --quvi-format switch.

Fix description how hw decoding is enabled. The old way currently still
works, but is deprecated.
2013-01-31 01:58:58 +01:00
wm4 fd5637888a screenshot: minor simplification, prefer VF over VO
Remove screenshot_force and associated logic. Always try to use the
screenshot video filter before trying taking screenshots with the VO,
which means that --vf=screenshot now takes the role of --vf=screenshot_force.
(To make this clear, not adding a video filter is still the recommended
way to take screenshots; we just change how VF screenshots are forced.)

Preferring VO over VF and having --vf=screenshot_force used to make
sense when not all VOs supported screenshots, and some VOs had somewhat
broken screenshots (like vo_xv taking screenshots with OSD in it). But
all these issues are fixed now, so just get rid of the cruft.
2013-01-30 23:41:22 +01:00
wm4 cfc3f10bda mplayer: add newline for --print-msg 2013-01-30 01:04:25 +01:00
wm4 0421e17c2b demux_mkv: support more formats with V_UNCOMPRESSED
Select the generic raw video decoder in codecs.cfg ("MPrv" FourCC),
which forces the generic lavc raw video decoder "rawvideo". This means
all FourCCs understood by lavc rawvideo are supported, not just whatever
has codecs.cfg entries.
2013-01-30 00:57:07 +01:00
wm4 237b7491e2 demux: don't use codec_tag for raw PCM formats
In commit 2dd2d9b, raw PCM was switched to always go through ad_lavc,
and mapping codec IDs to mplayer internal codec tags was removed, as it
was not needed anymore. However, some uncompressed audio lavf demuxers
export  their own codec tags, which collide with the existing internal
mplayer codec tags, leading to incorrect raw PCM codec selection based
on the misinterpreted audio tag. Re-add the mapped codec IDs from
2dd2d9b. Map them to an invalid codec tag, so that the generic lavc
decoder is selected (assumes ad_lavc is the decoder for raw PCM).
2013-01-30 00:54:18 +01:00
Stefano Pigozzi a3322cb171 osx_common: cache OSX version number
This commit makes `is_osx_version_at_least` cache the result of reading
`/System/Library/CoreServices/SystemVersion.plist`. Since that is a file
read operation it was bad to use this function frequently (i.e.: when
processing user events).

Remove `is_lion_or_above` (introduced in c9396c0a) as that was a more
specialized wrapper which had the only advantage of adding it's own cache.
2013-01-27 18:38:25 +01:00
wm4 fddba2d529 vo_x11: fix redrawing on expose events
This part wasn't converted when changing to the new OSD redrawing way.
2013-01-27 13:32:39 +01:00
wm4 df80cd379a x11: simplify handling of X Visuals and Colormaps in VOs
Don't force VOs to pick an arbitrary default Visual and Colormap. They
still can override them if needed. This simplifies the X11 VO interface.

Always create a Colormap for simplicity. Using CopyFromParent fails if
the selected visual is not the same of that of the parent window, which
happens for me with vo_opengl.

vo_vdpau and vo_xv explicitly set CWBorderPixel, do that in x11_common
instead (it was already done for native windows, but not for slave mode
windows).

What gl_common did was incorrect in theory: freeing a colormap while a
window uses it will change the colormap of the window to "None", and
the color mapping for such windows is "undefined".
2013-01-27 13:32:27 +01:00
wm4 75164a0e0a x11: fix some obvious video mode switching bugs
The original video mode wasn't reliably restored, so just store the
mode separately.

For some reason, window decorations got into the picture, possibly due
to an incorrect initial window position or something like this.
Normally, the window is positioned and sized such that it covers the
screen entirely, even though the window still has decorations and is
not in fullscreen mode (fullscreen wouldn't be correct, because the
virtual desktop size is not screen size). Hack-fix by forcing window
decorations off when VM-switching.

All in all, VM switching is still buggy and useless.
2013-01-27 13:30:54 +01:00
wm4 0535a14505 x11: reduce VO mode switching code duplication
Some parts for initiating mode switches were duplicated in every VO
supporting X11 (except vo_opengl/gl_common, which didn't support mode
switching). Move this to x11_common.c.

Note that this might be slightly risky: is it really guaranteed that no
VO needed to do "special" setup that depends on X parameters changing
after a mode switch, such as bit depth, visuals etc.? From what I can
see, this shouldn't be the case (X probably can't even change depth on
the fly). Even if this should be a one-way road, VM switching is in
general very useless, and its implementation buggy, so it can just be
removed should unfixable problems arise.
2013-01-27 13:30:54 +01:00
wm4 e4943165c1 x11_common: do not set custom error handler when calling XSelectInput
Do this because we want to remove the global variables required with the
old code. In particular, there doesn't seem any way to set a secure user
data pointer with xlib.

XSelectInput() causes a BadAccess error when some of the requested event
flags are reserved (for exclusive flags like ButtonPress). The custom
error handler caught this and set a global variable, so that the code
could retry the XSelectInput() call without the conflicting flags. Use a
different approach that doesn't need a custom error handler. (Although
we still assume that the error handler doesn't terminate the program.)
2013-01-27 13:30:54 +01:00
wm4 a243acb1de x11: cleanup, refactor
Move things that are used by vo_xv only into vo_xv, same for vo_x11.

Rename some functions exported by x11_common, like vo_init to
vo_x11_common. Make functions not used outsode of x11_common.c private
to that file. Eliminate all global variables defined by x11_common
(except error handler and colormap stuff).

There shouldn't be any functional changes, and only code is moved
around. There are some minor simplifications in the X11 init code, as
we completely remove the ability to initialize X11 and X11+VO
separately (see commit b4d9647 "mplayer: do not create X11 state in player frontend"),
and the respective functions are conflated into vo_x11_init() and
vo_x11_uninit().
2013-01-27 13:30:53 +01:00
Uoti Urpala 9747227e47 windows support: support 64-bit MS Windows in EXTERN_PREFIX definition
The EXTERN_PREFIX definition changed in 94b7db2 needs a separate case
for _WIN64, as MinGW defines both that and _WIN32 but there is no prefix
unlike 32-bit case.

Patch by redxii on http://devel.mplayer2.org/ticket/226
2013-01-27 13:30:53 +01:00
wm4 83c56799cf vf_scale: fix warning 2013-01-27 13:30:53 +01:00
wm4 15ccb8ef1c sws_utils: use libswscale for GBRP output if available
libswscale added support for this recently.
2013-01-27 13:30:53 +01:00
Wessel Dankers d84b572b8c vo_opengl: always dither
Dithering was disabled if the input bit depth was not larger than the
output bit depth of the screen framebuffer. But since scaling, RGB
conversion, and other filters change the number of significant bits
anyway, dithering could still benefit image quality even in these
cases. Always do dithering, unless dithering is completely disabled.

The original intention of this mechanism was not to change the image
needlessly when playing video that matches the native bit depth of the
screen.
2013-01-27 13:27:32 +01:00