Commit Graph

2057 Commits

Author SHA1 Message Date
wm4 a7794d6fc1 x11: never forcefully terminate xdg-screensaver process
It sometimes happens on exit, and it's probably a bad idea. If the
process hangs on exit (possibly due to stupid hardcoded timeouts it's
doing), mpv will also hang now, unfortunately.

(cherry picked from commit be9bf4cc7c)
2015-05-19 11:12:47 +09:00
wm4 8f9cb82f4f x11: attempt to make initial fullscreening more reliable
It appears some WMs have a problem with out method of setting initial
fullscreen mode. We assume that if the window's _NET_WM_STATE includes
_NET_WM_STATE_FULLSCREEN before mapping the window, the WM will show it
as fullscreen at mapped. EWMH doesn't say anything that this should
work, although one could argue that it's implied.

In any case, since it's not standard behavior without at least some
doubt, it's probably a good idea to try the "old" method as well.
Fortunately, it should be idempotent.

See #1937, #1920.

(cherry picked from commit a4f3df5970)
2015-05-19 11:11:38 +09:00
wm4 b4fdb25611 vf_vapoursynth: reject unaligned video sizes
Leads to some nice memory corruption otherwise.

(cherry picked from commit 06bfa9309d)
2015-05-19 11:11:24 +09:00
wm4 a9cac8ade0 vo: remove suspicious line
pts can never be 0 or negative. If there is no frame, some code below
catches this case by checking hasframe.

(cherry picked from commit 372b85b9d2)
2015-05-19 11:11:19 +09:00
Michael Vetter 6eab622e7b Remove trailing whitespaces
(cherry picked from commit 9251fa125f)
2015-05-15 19:16:47 +09:00
wm4 42fc0d96fc vo: avoid burning CPU when paused
Some code always calls vo_event(), even with event==0, which leads to
immediate wakeup, which in turn causes the function to be called again.
This would burn CPU, which was especially noticeable when paused.

(cherry picked from commit 0bdef9979f)
2015-05-15 19:15:05 +09:00
wm4 bbbedddddc vo_opengl_cb: actually set requested options
Quite an oversight.

(cherry picked from commit 4d9255a5e1)
2015-05-15 10:30:49 +09:00
wm4 e34c02981f vo: always call draw_image_timed() if available
Gives the VOs more flexibility.

gl_video.c already ignores the timing info if no interpolation is
active, so this requires no further changes.

(cherry picked from commit af157db7e5)
2015-05-15 10:30:32 +09:00
wm4 37ad3e79dd threads: use utility+POSIX functions instead of weird wrappers
There is not much of a reason to have these wrappers around. Use POSIX
standard functions directly, and use a separate utility function to take
care of the timespec calculations. (Course POSIX for using this weird
format for time values.)

(cherry picked from commit 92b9d75d72)
2015-05-15 10:30:15 +09:00
wm4 a7e35fadb1 cocoa: add missing break statements in switch
The first one (for VOCTRL_GET_DISPLAY_FPS) could have led to undefined
behavior if the FPS was unknown. The second is for general symmetry.

(cherry picked from commit 10149f68a5)
2015-05-15 10:29:40 +09:00
wm4 0d9275b931 vo_drm: allow changing video rectangle settings
Now among other things panscan can be changed during playback.

Unfortunately, it flickers. The issue is that reconfig() clears the
framebuffer. Removing the clearing shows that the "unused" parts of
the picture are not cleared - even though OSD could render there. As
such, this is a separate issue.

(cherry picked from commit 5631060569)
2015-05-09 21:15:26 +09:00
wm4 b2f44f131f vo_drm: don't mutate the current frame when clamping for panscan
When running with --panscan=1, this could crash - because the current
frame was reduced in size each time the image was redrawn, which would
result in a failed assertion the second time it's drawn.

(cherry picked from commit 859ddc9906)
2015-05-09 21:15:15 +09:00
Diogo Franco (Kovensky) 63b92944d0 Revert "csputils: apply contrast equalizer in RGB"
This reverts commit af930e2a2e.

Better avoid big behavior changes within a release series.
2015-05-08 16:40:01 +09:00
wm4 d7cfe38f06 cocoa: remove an unused parameter
(cherry picked from commit f58d3591d9)
2015-05-07 10:53:55 +09:00
wm4 9b41d17dc0 cocoa: lock cocoa main thread on uninit
This should fix some crashes due to dangling pointers.

The problem was that with_cocoa_lock_on_main_thread() is asynchronous.
It will not wait until it is finished. In the uninit case, this means
the VO could be deallocated and destroyed while cocoa was still running
uninit code.

So simply wait until it is done by using dispatch_sync(). There were
concerns that this could introduce a deadlock by the main thread trying
to wait for something on the VO thread. But from what I can see, this
never happens, and even if it does, it would crash anyway since the VO
is already gone.

One remaining worry is the video_resize_redraw_callback. From what I can
see, it still can mess things up, and will need a more elaborate fix.

(cherry picked from commit e777756301)
2015-05-07 10:52:39 +09:00
wm4 bdbbf4ae48 vo_opengl: change default FBO format
Reduces (but likely does not remove) the danger of rounding intermediate
values down to 8 bit. This is important for cscale, or any other
processing that might store raw YUV values in framebuffers.

Fixes #1918.

(cherry picked from commit cf210c4ffc)
2015-05-07 10:47:51 +09:00
Niklas Haas 052b6d406d sws_utils: re-use avcolorspace for sws colorspaces
This lets us avoid having to maintain two separate copies of the
colorspace mapping functions.

(cherry picked from commit 08d3ef3d9e)
2015-05-07 10:46:23 +09:00
wm4 fe19db9cc0 cocoa: always compile OSX application code with cocoa
This unbreaks compiling command line player and libmpv at the same
time. The problem was that doing so silently disabled the OSX
application thing - but the command line player can not use the
vo_opengl Cocoa backend without it.

The OSX application code is basically dead in libmpv, but it's not
that much code anyway.

If you want a mpv binary that does not create an OSX application
singleton (and creates a menu etc.), you must disable cocoa
completely, as cocoa can't be used anyway in this case.

(cherry picked from commit 19a5b20752)
2015-05-07 10:45:20 +09:00
wm4 99e9294fc9 vo_opengl: gl_lcms: make sure win32 unicode fopen() wrapper is enabled
(cherry picked from commit dce941b99c)
2015-05-07 10:45:05 +09:00
wm4 527550dfe6 vo_rpi: update renderer size on display size changes too
(Not sure why it worked without this when I tested the previous
changes.)

Untested, but should be fine. This is equivalent what is done on e.g.
panscan changes.

(cherry picked from commit 94a3a76ee3)
2015-05-07 10:42:30 +09:00
wm4 275694a002 video/out: remove VOFLAG_FLIPPING
I think this used to be quite important, because the ancient VfW support
in MPlayer used to output flipped frames. This code has been dead in mpv
for quite some time (because VfW decoders were removed, and the --flip
option was dropped too), so get rid of it.

(cherry picked from commit e185887ba0)
2015-05-07 10:42:16 +09:00
wm4 8c3a92d6cb vo_opengl: refactor wayland frame skipping
Currently, the wayland backend needs extra work to avoid drawing more
often than the wayland frame callback allows. (This is not ideal, but
will be fixed at a later time.)

Unify this with the start_frame callback added for cocoa. Some details
change for the better. For example, if a frame is dropped, and a redraw
is done afterwards, the actually correct frame is redrawn, instead
whatever was in the textures from before the dropped frame.

(cherry picked from commit 0a7abbda6b)
2015-05-07 10:42:10 +09:00
wm4 488b5e3ac3 cocoa: don't accidentally drop initial screen drawing
With --idle --force-window, or when started from the bundle, the cocoa
code dropped the first frame. This resulted in a black frame on start
sometimes.

The reason was that the live resizing/redrawing code was invoked, which
simply set skip_swap_buffer to false, blocking redrawing whatever was
going to be rendered next. Normally this is done so that the following
works:

1. vo_opengl draw a frame, releases GL lock
2. live resizing kicks in, redraw the frame
3. vo_opengl wants to call SwapBuffers, drawing a stale buffer
   overwritten by the live resizing code

This is solved by setting skip_swap_buffer in 2., and querying it in 3.

Fix this by resetting the skip_swap_buffer at a known good point: when
vo_opengl starts drawing a new frame.

The start_frame function returns bool, so that it can be merged with
is_active in a following commit.

(cherry picked from commit e23e4c7c60)
2015-05-07 10:41:57 +09:00
Avi Halachmi (:avih) afb97c517d vo: improve frame drop logic on high playback rate
Commit f1746741de changed the drop
logic to have more slack (drop more frames but less frequent) to prevent
drops due to timing jitter when the clip and screen have similar rates.

However, if the clip has higher rate than the screen (or just higher
playback rate), then that policy hurts smoothness since these "chunked
drops" look worse than one frame drop at a time.

This patch restores the old drop logic when the playback frame rate is
higher than ~5% above the screen refresh rate, and solves this issue.

Fixes #1897

(cherry picked from commit ffcad1a72b)
2015-05-07 10:41:50 +09:00
wm4 a4ba496539 vo_rpi: update display size on display mode switches
(cherry picked from commit 8c7f3adb41)
2015-05-07 10:41:38 +09:00
wm4 73fc12c4e2 vo_rpi: actually draw a black background
Also factor the display size initialization into a separate function.

For some reason this seems to work, although setting the background
color using this 1x1 pixel bitmap does not work. I blame the RPI
beign a terrible piece of hardware with even worse drivers.

(cherry picked from commit 6ae66e717f)
2015-05-07 10:41:33 +09:00
Niklas Haas 99389eb174 csputils: improve contrast semantics for limited range output
The previous version of this logic resulted in black crush and incorrect
brightness scaling when combined with limited range (TV) output.

(cherry picked from commit 99439f11ea)
2015-05-07 10:40:44 +09:00
wm4 af930e2a2e csputils: apply contrast equalizer in RGB
It's weird that this basically adjusts the contrast between luma and
chroma, and not blackness.

This is more in line with the behavior of libswscale, the vdpau
"procamp" (which mpv doesn't use), and Xv.

(cherry picked from commit 0600d378f9)
2015-05-07 10:40:35 +09:00
Niklas Haas 4a6fdb7361 x11: query ICC profile based on center of window
Right now, the default behavior is to pick the numerically lowest screen
ID that overlaps the window in any way - but this means that mpv will
decide to pick an ICC profile in a pretty arbitrary way even if the
window only overlaps another screen by a single pixel.

The new behavior is to query it based on the center of the window
instead.

(cherry picked from commit daf4334697)
2015-05-07 10:39:40 +09:00
akemi-san e8f8d3462e vo_drm: zero screen buffers in reconfig function.
(cherry picked from commit 1e2e504349)
2015-04-28 08:33:36 +09:00
Marcin Kurczewski 7669fe39f6 vo_drm: add window screenshots support
(cherry picked from commit 5f21a68ce9)
2015-04-28 08:33:28 +09:00
wm4 192af725e6 vdpau: always render to cropped size at most
vo_opengl (or gl_hwdec_vdpau.c to be specific) calls
mp_vdpau_mixer_render() with video_rect=NULL, which means to use the
full surface. This is incorrect if the surface is actually cropped, as
it can happen with h264. In this case, it was rendering the parts
outside of the image.

Fix it by making this case use the cropped size instead.

Alternative fix for PR #1863.

(cherry picked from commit a5ed6e49bf)
2015-04-28 08:32:45 +09:00
wm4 72e505a944 player: add --window-scale option
Requested. Works similar to the property with the same name.
2015-04-24 23:27:12 +02:00
James Ross-Gowan ad11d877a5 w32_common: add more rounded-down frame rates
Suggested by avih. This handles x/1.001 frame rates for all multiples of
24 and 30 under 144.
2015-04-25 02:11:00 +10:00
James Ross-Gowan 138c4e50df w32_common: use the current monitor's refresh rate 2015-04-25 02:10:59 +10:00
Avi Halachmi (:avih) e2326bda82 dxva2: fix broken build with gcc 5.1
gpu_mempcy should to be called from code which targets SSE

Signed-off-by: wm4 <wm4@nowhere>
2015-04-24 17:40:39 +02:00
wm4 1419aac22a mp_image: remove some unused interlacing flags
MP_IMGFIELD_TOP/MP_IMGFIELD_BOTTOM were completely unused, and
MP_IMGFIELD_ORDERED was always set (even though vf_vdpaupp.c strangely
checked for the latter).
2015-04-23 22:06:14 +02:00
wm4 994438dee5 vf_vapoursynth: update _FieldBased semantics
These changed in VapourSynth. Also, "_Field" is now unused.
2015-04-23 22:02:40 +02:00
wm4 777273c064 image_writer: fix writing screenshots
It passed the unconverted image to the writer function. Broken since
2469cb5d.
2015-04-22 16:28:31 +02:00
Marcin Kurczewski 445527d45c vo_drm: fix return value for void function 2015-04-21 12:04:35 +02:00
Marcin Kurczewski dedb15a429 vo_drm: fix coding style to adhere to guidelines 2015-04-21 11:54:14 +02:00
Marcin Kurczewski 7f29172baf vo_drm: fix releasing VT if received signal twice
If user switched terminals frantically, mpv could get SIGUSR1 twice in a
row, which, up until now, resulted in destroying CRTC twice. This caused
it to segfault. After this fix, double SIGUSR1 should be ignored.
2015-04-21 11:45:55 +02:00
Marcin Kurczewski a7cf35c1ca vo_drm: add vertical sync 2015-04-21 11:45:53 +02:00
wm4 74ae74db0c video: cleanup some old log messages
These are basically MPlayer leftovers, and barely useful due to being
redundant with other messages. The FPS message is used somewhere else.
2015-04-20 23:19:19 +02:00
wm4 2469cb5d1f image_writer: factor image conversion into a separate function
Needed for a later commit.
2015-04-20 23:04:34 +02:00
wm4 07678423fb image_writer: minor cleanup
Instead of using int like bool, use bool directly.
2015-04-20 23:03:32 +02:00
wm4 a1e410e43a vf_vapoursynth: stupid hack to unbreak with recent API change
Vapoursynth made an incompatible API change: clips with unknown length
are not supported anymore. In fact, Vapoursynth abort()s the program
(which by the way invalidate all of its claims of API/ABI stability).

So add some nonsense to make it work again.
2015-04-20 21:05:42 +02:00
wm4 c6d046414b player: change video-bitrate and audio-bitrate properties
Remove the old implementation for these properties. It was never very
good, often returned very innaccurate values or just 0, and was static
even if the source was variable bitrate. Replace it with the
implementation of "packet-video-bitrate". Mark the "packet-..."
properties as deprecated. (The effective difference is different
formatting, and returning the raw value in bits instead of kilobits.)

Also extend the documentation a little.

It appears at least some decoders (sipr?) need the
AVCodecContext.bit_rate field set, so this one is still passed through.
2015-04-20 20:52:16 +02:00
xylosper ebe2c2b6d1 build: fix libavfilter dependency for vf_mirror
Since e207c24b32, vf_mirror requires
libavfilter.

Signed-off-by: wm4 <wm4@nowhere>
2015-04-20 17:08:29 +02:00
James Ross-Gowan 88d3058681 w32_common: prevent system sleep
This prevents the machine from going to sleep while a video-only stream
is playing. When audio is playing, the audio stack should make this
request for us.
2015-04-20 20:24:19 +10:00