Commit Graph

40779 Commits

Author SHA1 Message Date
wm4 aedea2a79f vo_opengl: don't test for arrays
Even the lowest supported GL versions have arrays. This test was for
returning arrays from functions, which didn't work in lower GL versions,
but we don't need it anymore.
2015-03-13 11:55:31 +01:00
wm4 b2ad2e2fd1 vo_opengl: minor fix to a comment 2015-03-13 11:53:54 +01:00
James Ross-Gowan acbac01a73 w32_common: don't hide cursor when the menu is open
Previously, mpv would hide the cursor when the autohide timer expired,
even if the window menu was open. This made it difficult to use the menu
with the mouse.

When handling VOCTRL_SET_CURSOR_VISIBILITY, instead of determining
whether to call SetCursor by checking if the cursor is in the client
area, call it based on the parameters to the last WM_SETCURSOR message.
When the window enters "menu mode," it gets a WM_SETCURSOR message with
HIWORD(lParam) set to 0 to indicate that the cursor shouldn't be set.
2015-03-13 21:31:58 +11:00
Niklas Haas ea680d2677
manpage: update cscale
Had some outdated information.
2015-03-13 01:59:10 +01:00
Niklas Haas 3ee9d7c416
vo_opengl: sample from the right tex for separated scalers
These were still hard-coded to texture0, rather than respecting src_tex
like they should. A simple oversight.
2015-03-13 00:37:16 +01:00
wm4 9b77666783 options: introduce --cache=yes choice
I think this is what I alwass missed ever since I found the MPlayer
cache options: a way to enable the cache on local files with the default
settings, whatever they are.
2015-03-12 23:51:41 +01:00
wm4 1eeeab2e14 cache: bump default size to 150MB
(Well, almost 150MB.)
2015-03-12 23:43:45 +01:00
wm4 9a7fc55607 command: display-fps is the display FPS as assumed by the VO
Requested change in behavior.

Note that we set the assumed "infinite" display_fps to 1e6, which
conveniently lets vo_get_vsync_interval() return a dummy value of 1,
which can be easily checked against, and still avoids doing math with
float INFs.
2015-03-12 23:41:25 +01:00
wm4 209f8225ed vo: update FPS only on state changes
I'm not comfortable with VOCTRL_GET_DISPLAY_FPS being called every
frame.

This requires the VO to set VO_EVENT_WIN_STATE if the FPS could have
changed. At least the X11 backend does this.
2015-03-12 23:35:38 +01:00
wm4 73cf615555 Merge branch 'gl_rework' 2015-03-12 23:21:21 +01:00
Niklas Haas 3974a5ca5e vo_opengl: refactor shader generation (part 2)
This adds stuff related to gamma, linear light, sigmoid, BT.2020-CL,
etc, as well as color management. Also adds a new gamma function (gamma22).

This adds new parameters to configure the CMS settings, in particular
letting us target simple colorspaces without requiring usage of a 3DLUT.

This adds smoothmotion. Mostly working, but it's still sensitive to
timing issues. It's based on an actual queue now, but the queue size
is kept small to avoid larger amounts of latency.

Also makes “upscale before blending” the default strategy.
This is justified because the "render after blending" thing doesn't seme
to work consistently any way (introduces stutter due to the way vsync
timing works, or something), so this behavior is a bit closer to master
and makes pausing/unpausing less weird/jumpy.

This adds the remaining scalers, including bicubic_fast, sharpen3,
sharpen5, polar filters and antiringing. Apparently, sharpen3/5 also
consult scale-param1, which was undocumented in master.

This also implements cropping and chroma transformation, plus
rotation/flipping. These are inherently part of the same logic, although
it's a bit rough around the edges in some case, mainly due to the fallback
code paths (for bilinear scaling without indirection).
2015-03-12 23:20:21 +01:00
wm4 e74a4d5bc0 vo_opengl: refactor shader generation (part 1)
The basic idea is to use dynamically generated shaders instead of a
single monolithic file + a ton of ifdefs. Instead of having to setup
every aspect of it separately (like compiling shaders, setting uniforms,
perfoming the actual rendering steps, the GLSL parts), we generate the
GLSL on the fly, and perform the rendering at the same time. The GLSL
is regenerated every frame, but the actual compiled OpenGL-level shaders
are cached, which makes it fast again. Almost all logic can be in a
single place.

The new code is significantly more flexible, which allows us to improve
the code clarity, performance and add more features easily.

This commit is incomplete. It drops almost all previous code, and
readds only the most important things (some of them actually buggy).
The next commit will complete it - it's separate to preserve authorship
information.
2015-03-12 23:20:20 +01:00
wm4 ae6019cbc9 build: simplify windows checks
There's no reason to do finegrained checks for libraries which always
must be present. It also reduces the number of extra dependencies.
2015-03-11 23:44:34 +01:00
wm4 8a4239e0c2 player: dump list of satisfied deps instead of config.h with -v
Starting to get tired of seeing the full config.h in verbose output
every time. Make it slightly more elegant by outputting the list of
satisfied dependencies instead.
2015-03-11 23:33:05 +01:00
wm4 7e9c441d41 demux_mkv: make matroska.pl script output deterministic
Work around the randomized Perl hashtables by sorting the elements.

Fixes #1673.
2015-03-11 22:17:23 +01:00
wm4 e9841630ad command: allow changing some VO options even if VO wasn't created yet
Instead of refusing to set properties like "fullscreen" if no VO was
created, always allow it. So if no VO is created, setting the property
merely changes the options (and will be applied once the VO is created).
This is consistent with similar behavior changes to some other
properties.

Improves the behavior reported in #1676.

Also, we shouldn't check the config_ok variable - the VO should do this.
2015-03-11 12:10:04 +01:00
wm4 ca474d22c9 player: fix crash when taking screenshots in idle mode
mpctx->filename is obviously not set if no file is playing.

When this code was written, it probably couldn't happen, because the
normal screenshot path fails much earlier in idle mode. But you can
still take screenshots in "full window" mode, and recently the
screenshot code was changed to use the "full window" mode if the normal
path does not work.
2015-03-11 12:02:31 +01:00
wm4 30860f7b10 x11: ignore mouse enter/leave events due to pointer grab
If you click on a window that doesn't have a focus, a LeaveNotify
followed by a EnterNotify event can be generated. The former will have
mode set to NotifyGrab, the latter to NotifyUngrab. This will make the
player think the mouse left the window, even though this is not the
case. Ignore these and only react to those with mode set to
NotifyNormal.

Probably fixes #1672, and some other strange issues on some WMs.
2015-03-11 11:52:33 +01:00
Stefano Pigozzi ca0b33e9b1 build: disable tests by default
Having them autodetect is a bad idea since it would link cmocka in the main
mpv binary (which users don't want).
2015-03-10 18:22:16 +01:00
wm4 c7790b4526 vo: hide opengl-cb in --vo=help
Avoids stupid questions.
2015-03-10 17:17:15 +01:00
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