Commit Graph

40759 Commits

Author SHA1 Message Date
wm4 eb482140d9 audio: fix spdif packet size unit
In commit 5f8b060e I blindly assumed that the packet sizes were in
pseudo-samples, but they were actually in bytes. Oops.

(The effect was that cutting the audio was a bit less precise than it
can be.)

Also remove the packet size from ad_spdif.c; it didn't actually use it,
and simply takes what the spdif "muxer" returns.
2015-03-10 17:11:38 +01:00
wm4 69c61a882d audio: fix spdif DTS packet size
Broken in one of the previous commits.
2015-03-10 15:33:01 +01:00
wm4 da46a13c6b audio: cut audio with spdif too on playback restart
When playback is started after seeking or opening a file, we need to
make sure audio and video line up exactly. This is done by cutting or
padding the audio stream to start on the video PTS.

This does not quite work with spdif: audio is compressed data, within a
spdif frame. There is no way to cut the audio "in between" the frames.
Cutting between the frames would just produce broken spdif packets, and
who knows how receivers will react to this (play noise?). But we still
can cut it in frame boundaries.

Unfortunately, we also insert 0 data for "silence" - we probably
shouldn't do this. Chances are the receiver will switch to PCM or so.
But for now this will have to do.

Note that this could be simplified somewhat, as soon as we work with
frames. See previous commit.
2015-03-10 15:17:57 +01:00
wm4 5f8b060ec2 ad_spdif: move frame sizes to a general function
Needed for the next commit. This commit should probably be reverted as
soon as we're working with full audio frames internally, instead of
"flat" FIFOs.
2015-03-10 15:12:52 +01:00
wm4 574bd127ec command: add display-fps property
Requested. Untested; leaving that to the users.
2015-03-10 14:50:56 +01:00
wm4 eff265c140 vo_opengl_cb: clear last video frame on uninit()
mpv_opengl_cb_render() is supposed to clear the screen with the
background color if there's no video... I think.

It didn't do this, because although uninit() requested gl_video_config()
to be called, this didn't happen, because this function checks whether
the VO is set - and it's unsert after uninit() releases the lock.

Also call the user wakeup callback in this situation, so the user
actually redraws immediately.
2015-03-10 14:16:07 +01:00
wm4 2f5e31cf47 ao_coreaudio_exclusive: port to pull API, fix latency calculations
Instead of maintaining a private ring buffer, use the generic support
for audio APIs with pull callbacks (internally called AO pull API). This
also fixes latency calculations: instead of just returning the
ringbuffer status, the audio playback state is calculated better and
includes interpolation.

The main reason this wasn't done earlier was mid-stream format
switching. The pull API can now handle it (in a way) by destroying and
recreating the AO. This is a bit brutal, but quite simple. It's untested
in this new AO, though. Some details might not be right, like how ot
restores the old format when reloading.
2015-03-10 10:37:05 +01:00
wm4 fa75a7b6d7 ao_coreaudio: move some helpers to utils
Needed by ao_coreaudio_exclusive.c in the next commit.
2015-03-10 10:13:23 +01:00
wm4 ee14da2988 ao_coreaudio_exclusive: rip out pseudo volume control
This could mute a digital passthrough stream by writing zeros. All other
volume values did nothing.

The comment about MPlayer dying hasn't been true in mpv for quite a
while. It's even possible that it's fixed in upstream MPlayer. mpv will
print a scary error message when trying to change volume with spdif, and
continue normally.

If we really want to mute by writing zeros, we should do it in a
separate filter. But I'm not overly fascinated by this approach; is it
even guaranteed receivers will not be confused by a stream of zeros?

The main reason to remove this is that it's in the way of further
cleanups.
2015-03-10 10:08:15 +01:00
wm4 30b0a5b98a player: restore --dump-stats
Since the recent refactoring, it was initialized _before_ the command
line player options were set, and consequently could not be enabled.
2015-03-10 09:50:32 +01:00
wm4 90adf2904e client API: clarify mpv_opengl_cb_render() viewport parameter
Basically, the idea behind the vp parameter is broken - I guess the
intention was to enable rendering to a specific subrectangle of the
target framebuffer, but there's nothing to specify the actual target
rectangle (the VO will still clear e.g. the borders between video and
framebuffer borders).

We're not going to keep the current semantics either with the upcoming
rework of vo_opengl, so declare this for broken. Maybe we can introduce
a function later which does this properly.
2015-03-09 22:51:28 +01:00
wm4 cfa44f4e90 vo_opengl: move minor helper to common code
The generic image format code should cary most of the "knowledge" about
image formats.
2015-03-09 22:47:33 +01:00
wm4 b9307b7175 stream: use relaxed atomic loads for checking playback aborts
Seems appropriate, and will probably avoid performance surprises with
scary architectures which don't have trivial implementations for atomic
loads. (Consider that demux_mkv calls this very often now, and
libavformat demuxers and streams did this for a while now.)
2015-03-09 22:36:17 +01:00
wm4 112d9aeda1 demux_mkv: never warn when trying to resync on EOF
If this happens, the file is actually broken, but the assumption is
simply that the file was truncated, and printing a warning would be
strange.
2015-03-09 22:33:53 +01:00
wm4 39fa05d374 demux_mkv: check for playback aborts
Check async abort notification. libavformat already do something
equivalent.

Before this commit, the demuxer could enter resync mode (and print silly
warning messages) when the stream stopped returning data because of an
abort.
2015-03-09 22:32:04 +01:00
James Ross-Gowan 5f0eda7b94 w32_common: remove redundant is_maximized function
This already exists as IsMaximized in the Windows API.
2015-03-09 22:16:26 +11:00
Stefano Pigozzi 735bf48496 cocoa: fix minimized state getter 2015-03-09 12:01:55 +01:00
wm4 b7f242dfcf x11: fix VOCTRL_GET_WIN_STATE
Do not rely on the pointed-to argument to be initialized; VOCTRLs are
supposed to completely overwrite them on success (or not to touch them
on failure).

The currently only caller of VOCTRL_GET_WIN_STATE initializes the value
before calling this, so this is merely about correctness and didn't lead
to any actual bugs.
2015-03-09 11:46:16 +01:00
James Ross-Gowan a26ea50694 w32_common: support the "window-minimized" property 2015-03-09 11:46:06 +01:00
Kevin Mitchell 3efbc1a9a3 stream/smb: mark as network stream for --cache=auto
This causes the cache to be enabled with --cache=auto. It was not done
previously because the small cache size 320k actually led to worse
performance. However, with the current default cache size of 25000kb,
caching notably improves performance.
2015-03-09 03:38:01 -07:00
Niklas Haas 6983430c35
manpage: document swapinterval default 2015-03-09 00:19:50 +01:00
Jaime Marquínez Ferrándiz d7f04e2085 cocoa: support the "window-minimized" property
Signed-off-by: Stefano Pigozzi <stefano.pigozzi@gmail.com>
2015-03-08 22:00:47 +01:00
Filip Milivojevic 5c3a6ca96e vf_vavpp: fix deinterlacing
Add filter parameters to VAAPI deinterlacing filter to actually process
bottom fields instead of deinterlacing top field twice.

Signed-off-by: wm4 <wm4@nowhere>
2015-03-08 21:44:18 +01:00
wm4 4d0aa01637 input.conf: add key binding to override ASS subtitle styles 2015-03-08 15:57:46 +01:00
wm4 6f507d14c1 DOCS: minor update to coding style 2015-03-08 15:57:46 +01:00
Stefano Pigozzi 8ec9bce2d3 cocoa: fix autohide in fullscreen 2015-03-08 15:19:17 +01:00
Stefano Pigozzi ce239f1577 cocoa: fix mouse hiding with launchpad and dock folders
Some UI elements in OS X – like Launchpad and Dock folders – are implemented
using borderless windows in background demonized applications.
When we use these elements, mpv doesn't stop to be the active application, but
the mpv window leaves keyWindow state while we use the OS controls.

This commit just keeps track of window state to update the cursor visibility
accordingly.

Fixes #513
2015-03-08 11:56:56 +01:00
Philip Sequeira 6172e843cd options: add M_OPT_FILE to new options that are missing it
Fixes shell completion.
2015-03-07 22:19:38 +01:00
wm4 89db92398e audio: refuse to change playback speed with spdif
Handle the failure gracefully, instead of exploding and disabling audio.
Just set the speed back to 1.0.

Also remove the AF_DETACH from af_scaletempo. This actually created a
dangling pointer in af_add(), a tricky consequence of af_add()
reconfiguring the filter chain and the newly added filter using
AF_DETACH. Fortunately the AF_DETACH is not needed (and probably never
worked - it comes from MPlayer times, and MPlayer also disables audio
when trying to change speed with spdif).
2015-03-07 20:34:05 +01:00
wm4 b2099f55d2 audio: make changing playback speed slightly more robust
Always use af_scaletempo if it's inserted, even if the option
--audio-pitch-correction=no is set.

Make sure all filters are reset on speed change. It's conceivable that
dynamic changes to the filter chain at runtime leave filters around
without resetting their speed parameters.

Also move the code to a separate function.
2015-03-07 20:27:13 +01:00
torque 39537f6474 cocoa: clamp mouse position to window.
Prevents out-of-window coordinates being reported for mouse coordinates.
Previously they could be out-of-window coordinates on init or on resize.
2015-03-07 19:32:02 +01:00
torque bce753060e cocoa: update mouse coordinates when window is initialized.
Make MpvEventsView -signalMousePosition a public method so it can be
called without a compiler warning. Previously, the mouse position would
be reported as (0,0) until the cursor was moved.
2015-03-07 19:31:52 +01:00
Stefano Pigozzi 678cd30904 cocoa: don't uninit light sensor if not present 2015-03-07 19:28:00 +01:00
Martin Herkt 1bab7f69ae vo_opengl/x11: fix automatic ICC profile loading
mpv would attempt to load ICC profiles several times during VO init
even if no window is displayed. This potentially causes it to load
a profile for a different screen than it is going to be displayed
on, thereby invalidating the profile cache and rebuilding the LUT
every single time.
It would not unload a previously loaded profile when the video
window is moved to a display without an installed profile.

Fix these issues and tweak the log messages a little.
2015-03-07 13:00:06 +01:00
Stefano Pigozzi 5cddd4ccca cocoa: remove possible use after free 2015-03-07 09:13:05 +01:00
Stefano Pigozzi c66b51dab0 cocoa: fix some crashes caused by async uninit
Always keep around our private state and destroy it when we are really done in
the async uninit callback.

Fixes #1657
2015-03-07 08:54:05 +01:00
wm4 ddbecd09b0 af_scaletempo: minor simplification 2015-03-06 21:51:18 +01:00
wm4 c30d5f79b5 af_scaletempo: restore confusing mplayer behavior
This matters only when setting obscure scaletempo suboptions.

See #1653.

(But what we really should do is figuring out how to do this in a sane
way.)
2015-03-06 21:48:41 +01:00
wm4 f0ab1f2048 demux_mkv: actually skip elements out of reach
This is missing from the previous commit. Not that harmful, but also
slightly un-nice since even a failed seek will reset the cache.
2015-03-06 20:31:54 +01:00
wm4 12dcc5eaac demux_mkv: fix issues with unseekable streams
A user reported a webm stream that couldn't be played. The issue was
that this stream 1. was on an unseekable HTTP connection, and 2. had a
SeekHead element (wtf?). The code reading the SeekHead marked the
element as unreadable too early: although you can't seek in the stream,
reading the header elements after the SeekHead read them anyway. Marking
them as unreadable only after the normal header reading fixes this.

(The way the failing stream was setup was pretty retarded: inserting
these SeekHead elements makes absolutely no sense for a stream that
cannot be seeked.)

Fixes #1656.
2015-03-06 15:06:59 +01:00
torque 4ff29f33b0 Lua: add unpack shim for Lua 5.2/5.3 compatibility.
The global unpack function got moved to table.unpack in Lua 5.2, and
it's only available as the global if 5.2 is built with compatibility
enabled (the default). Lua 5.3 does not build with 5.1 compatibility by
default.

Fixes #1648.
2015-03-06 12:28:20 +01:00
wm4 fc571e0adb vo_vaapi: fix video equalizer (second try)
The vaapi equalizer have a custom range, and can have a smaller range
than mpv's normalized video equalizer values. The result is that a vaapi
equalizer value can map to multiple mpv values, so changing a mpv value
by 1 can get "stuck". Fix by remember the mpv value, and returning it if
it still corresponds to the vaapi value.

Really fixes #1647.

(Why am I even bothering with this irredeemable crap?)
2015-03-06 12:15:03 +01:00
wm4 720d4a5a1a player: allow changing playback speed in early audio init stages
If the audio decoder was created, but no audio filter chain created yet
(still trying to decode a first audio frame), setting the "speed"
property could explode. It tried to recreate the filter chain, even
though no format was set yet.

This is inconvenient and should not happen.
2015-03-06 12:15:03 +01:00
wm4 3fe61ada84 DOCS/compile-window.md: add Lua package to MXE instructions
The MSYS2 ones already mention Lua.
2015-03-06 11:31:06 +01:00
wm4 dfa562b5db build: make vdpau and dxva2 checks nicer
Using check_statement() with an empty statement just to check for the
header is quite a hack. Fix check_headers() (so it takes a "use"
parameter), and use it for the checks instead.
2015-03-06 11:31:06 +01:00
wm4 90496f3088 player: fix operation if command line is empty
main() being called with argc==0 is probably possible. Fix by skipping
the program name early. (I already changed and reverted this once, but
this time we make sure that it's less likely to confuse the skipped argv
with main()'s argv by naming it "options".)
2015-03-06 11:31:05 +01:00
wm4 4dd7104af8 osx: terminate argv properly when arguments are removed
The player now relies on the (slightly obscure) requirement that argv is
NULL-terminated.

Might fix #1652.
2015-03-06 11:31:05 +01:00
ChrisK2 e9ff136dd3 DOCS, options: fix example 2015-03-05 19:05:58 +01:00
wm4 baa354c64c build: check whether hwaccels are enabled in FFmpeg
FFmpeg can be compiled with them disabled, and then it won't provide the
public headers specific to these APIs, causing mpv compilation failure.
2015-03-05 17:10:00 +01:00
Niklas Haas 05bb2a9e8a
vo_opengl: make smoothmotion-threshold inclusive
This behavior makes more sense near the borders, eg.
smoothmotion-threshold=0 and smoothmotion-threshold=0.5.
2015-03-05 16:39:22 +01:00