Commit Graph

44534 Commits

Author SHA1 Message Date
wm4 eacf4a7d9b client: call certain external functions outside of client lock
Fixes theoretical lock-order issues found by Coverity. Calling these
inside the log is unnecessary anyway, because they have their own
locking, and because mpv_detach_destroy() needs to be called by someone
who has exclusive access to the mpv_handle (it's basically a destructor
function). The lock order issues comes from the fact that they call back
into the client API implementation to broadcast events and such.
2017-02-24 08:54:52 +01:00
wm4 6f8c953042 demux_lavf: skip avformat_find_stream_info() for some formats
Includes hls, mp4, mkv by default. This also avoids stupid things like
decoding at least 1 video frame per stream in the demuxer.

This also add --demuxer-lavf-probe-info to give finer control over what
happens.
2017-02-23 18:18:22 +01:00
wm4 992e582488 lavfi: temporary workaround for FFmpeg av_buffersrc_parameters_set() bug
The function ignores AVBufferSrcParameters.channel_layout. Set it
manually using the API.
2017-02-22 10:43:35 +01:00
Akemi c824a023c4 cocoa: fix dragging out of focus window
fffab30 introduced a small regression where the cursor couldn't be
unhidden after refocusing. the problem is that no mouseUp event was
reported in our events_view. work around this with a separate event
monitor. this also fixes another regression when the window is being
dragged from the title bar.

#4174
2017-02-21 19:26:33 +01:00
wm4 aeddc499d8 player: don't block playback stop when seeking
This was added for A-B loops, but it looks like commit a1dec6f5 made
this code unnecessary. Remove it, because it has the annoying
side-effect of blocking playback stop when seeking past the end.
2017-02-21 15:39:44 +01:00
wm4 13d2eb8eb9 player: fix stats-logging of sleep state 2017-02-21 15:39:44 +01:00
wm4 7dd81c3f96 player: remove unnecessary wakeup
I can't find any actual need for it.
2017-02-21 15:39:44 +01:00
wm4 eae12bf963 vo: fix subtleties in the redrawing logic
This fixes a race condition created by the previous commit, and possibly
others. Sometimes interpolated frames weren't redrawn as uninterpolated
ones.

The problem is that redrawing/drawing a frame can't reset the VO
want_redraw flags, because logically these have to happen after the core
acknowledged and explicitly reissued a redraw. The core needs to be
involved because the OSD text and drawings could depend on the playback
or window state.

Change it such that it always goes through the core.

Also, VOs inconsistently called vo_wakeup() when setting want_redraw,
which is also taken care of by this commit.
2017-02-21 15:39:44 +01:00
wm4 3cd29ca031 player: reduce blocking on VO when switching pause
When pausing, we sent BOCTRL_PAUSE and VOCTRL_RESTORE_SCREENSAVER. These
essentially wait until the video frame has been rendered. This is a
problem with the opengl-cb, if GL rendering is done in the same thread
as libmpv uses. Unfortunately, it's allowed to use opengl-cb this way.

Logically speaking, it's a deadlock situation, which is resolved with a
timeout. This can lead to quite ugly effects, like the on-pause frame
not being rendered until the timeout has passed. It has been interpreted
as video continuing to play.

Resolve this by simply not blocking on pause. Make the screensaver
controls async, and handle sending VOCTRL_PAUSE in the VO thread.

(All this could be avoided by redoing the internal VO API.)

Also see #4152.
2017-02-21 15:39:40 +01:00
wm4 e85d06baad img_format: stop setting some fields to dummy values for hwaccel formats
Flags like MP_IMGFLAG_YUV were meaningless for hwaccel formats, and
setting fields like component_bits made even less sense.
2017-02-21 10:35:38 +01:00
wm4 b258327210 mp_image: for hwaccel, use underlying fmt in mp_image_params_guess_csp()
If imgfmt is a hwaccel format, hw_subfmt will contain the CPU equivalent
of the data stored in the hw frames.

Strictly speaking, not doing this was a bug, but since hwaccel formats
were tagged with MP_IMGFLAG_YUV, it didn't have much of an impact.
2017-02-21 10:34:26 +01:00
Kevin Mitchell df30b217d9 ao: never set ao->device = ""
For example, previously, --audio-device='alsa/' would provide ao->device="" to
the alsa driver in spite of the fact that this is an already parsed option. To
avoid requiring a check of ao->device[0] in every driver, make sure this never
happens.
2017-02-20 22:56:30 -08:00
Akemi fffab30a3e cocoa: only report mouse movements when window is not being dragged
even though the mouse doesn’t move relative to the window itself, when
the window is being dragged, some outliers are still reported and
trigger the OSC.
2017-02-20 17:26:56 +01:00
Akemi bdd096db9a cocoa: make window draggable on init
fixes the case when mpv is opened and the cursor is within the window
bounds without moving the mouse. previously the window could only be
dragged around after the first mouse movement.
2017-02-20 17:25:42 +01:00
wm4 5519d0dde4 stream_cb: remove leftover doxygen line 2017-02-20 15:32:31 +01:00
rr- 326920a9bf vo_tct: check ioctl result 2017-02-20 14:19:57 +01:00
wm4 8c701587c8 image_writer: check a return value
Doesn't matter, since it's the flush call, but be nice. In particular,
don't upset coverity.
2017-02-20 14:05:14 +01:00
wm4 cabf6468ff command: add a redundant NULL check
Currently, tracks have always associated streams, so there can't be a
NULL dereference on the next line. But all the code is written with the
possibility in mind that we might want tracks without streams, so make
it consistent.

Found by coverity.
2017-02-20 14:02:10 +01:00
wm4 e50e9b6120 dec_video, dec_audio: remove redundant NULL-checks
OK, they're redundant. Now stop wasting my time, coverity.
2017-02-20 13:58:18 +01:00
wm4 06619f53a8 ao: fix potential NULL deref in ao_device_list_add()
Probably didn't happen in practice, but anyway.

Found by coverity.
2017-02-20 13:50:37 +01:00
wm4 64b1a656c7 command: fix wrong sizeof() argument
Found by coverity.

All of these cases happened to work, probably even in 32 bit (when the
name pointer allowed it to use only 4 bytes of space).
2017-02-20 13:47:35 +01:00
wm4 e5df57c755 lavfi: support hwdec filters for --lavfi-complex
Not so important by itself, but important for when we replace the vf
libavfilter wrapper with the common implementation. (Which will
hopefully happen, but not too soon.)
2017-02-20 13:42:08 +01:00
wm4 134c9d9df5 lavfi: use AVBufferSrcParameters
It's nice that you don't have to create a parameter string anymore, but
the rest sure is complicated as hell.
2017-02-20 13:32:37 +01:00
wm4 fefc5a8f73 lavfi: use mp_image to store the filter pad format
Preparation for enabling hw filters. mp_image_params can't have an
AVHWFramesContext reference (because it can't hold any allocations, and
isn't meant to hold "active" data in the first place.

So just use a mp_image. It has all real data removed, because that would
essentially leak 1 frame once the decoder or renderer don't need it
anymore.
2017-02-20 13:15:50 +01:00
wm4 79272e1469 Fix two typos
They're unrelated. Sue me.
2017-02-20 08:47:17 +01:00
wm4 c0cbe74912 wscript: drop pointless libavcodec vaapi.h/dxva2.h/d3d11va.h checks
Not needed under any circumstances. While the Windows ones export
functions to which we must link, these functions are always available,
even if libavcodec was compiled with D3D disabled.
2017-02-20 08:46:05 +01:00
wm4 cda9fdcfc7 vd_lavc: increase verbosity if requested hwaccel is not compiled
Well, not like we can detect whether it's missing from libavcodec, but
it's still slightly better.
2017-02-20 08:41:23 +01:00
wm4 6aa4efd1e3 vd_lavc, vaapi: move hw device creation to generic code
hw_vaapi.c didn't do much interesting anymore. Other than the function
to create a device for decoding with vaapi-copy, everything can be done
by generic code. Other libavcodec hwaccels are planned to provide the
same API as vaapi. It will be possible to drop the other hw_ files in
the future. They will use this generic code instead.
2017-02-20 08:39:55 +01:00
wm4 6e2d3d9919 vo_opengl: remove dxva2 dummy hwdec backend
This was a hack to let libmpv API users pass a d3d device to mpv. It's
not needed anymore for 2 reasons:

1. ANGLE does not have this problem
2. Even native GL via nVidia (where this failed) seems to not require
   this anymore
2017-02-20 08:39:08 +01:00
Akemi 4f74b93546 cocoa: fix cursor hiding at the top of the screen in fullscreen
even before the recent refactor the cursor was hidden when moving it to
the top of the screen in fullscreen and placing it on top of the now
visible menu bar.

we need to know when the menu bar is hidden so we don’t create a
‘dead zone’ at the top of the screen where the cursor can’t be hidden.
to determine when the menu bar is visible, and with that the title bar,
we get the height of the menu bar. the height is always 0 when hidden.

furthermore there is no way to get the title bar directly and with that
its height. so we calculate the frame rect of a NSWindowStyleMaskTitled
window from a CGRectZero content frame. the resulting height is the
height of a title bar.

with that we can exclude the top area for the cursor hiding and can be
certain when the menu bar is not hidden.
2017-02-19 17:54:06 +01:00
Akemi d45074455a cocoa: fix cursor hiding in the Dock area of the screen
the cursor couldn’t be hidden when the cursor was at the same position
as the Dock, even if the cursor was next to it. this is especially
annoying in fullscreen since the Dock isn’t actually hidden but is still
reported as being visible. this basically made the part of the screen,
where the Dock resides, a ‘dead zone’. so instead of using the
visibleFrame we will just use the normal frame. there is no problem at
the top area of the screen, since a window can’t be placed above the
menu bar and in fullscreen the menu bar is always reported as not being
on screen.

i suspect this was done so the cursor wasn’t hidden when the it was
placed above the Dock when windowed. with the recent refactor this is
not needed any more.
2017-02-19 17:54:06 +01:00
Akemi 72d90f911a cocoa: simplify the cursor hiding code
we can simplify the code because we don't need to change the bool
pointer we were given by the VOCTRL_SET_CURSOR_VISIBILITY event. i
assume this was done to work around some bugs previously to the recent
cursor refactor. i kept that because i thought it was necessary, which
wasn't in the end. after the refactor it only caused some weirdnesses i
tried to work around. without it we can get rid of some special cases
and simplify the code quite a bit.
2017-02-19 17:54:06 +01:00
Akemi 3064bbe1dd cocoa: fix scroll wheel input with Shift modifier
holding shift swaps the scroll wheel axes and deltaY returned zero.
summing up deltaX and deltaY will always give us the right button.

Fixes #3506
2017-02-19 17:54:06 +01:00
James Ross-Gowan f9369750b1 wscript: fix --egl-angle-lib for waf 1.9 2017-02-19 23:49:16 +11:00
Ricardo Constantino e69b69add3
waf: fix linking of win32 console wrapper
Broken with waf 1.9.8 update.
Not noticed right away if previous waf version was present.
2017-02-19 03:34:27 +00:00
wm4 55834d70e6 travis: disable OSX
Travis being a POS again.

Why does the travis config even have tol be part of the source code
repo? This makes no sense.
2017-02-18 13:21:34 +01:00
Aman Gupta 4d33b622ce lavc_conv: pass pkt_timebase to ffmpeg
Similar to code used everywhere else we create a lavc context.
2017-02-18 12:53:11 +01:00
wm4 48f601ae9e manpage: discourage vo_vaapi further
I don't know what's this comment about hardware decoding. Possibly it
was written before vo_opengl had vaapi decoding support.
2017-02-17 21:01:59 +01:00
Aman Gupta 53fab20c6d vo_opengl: implement videotoolbox hwdec on iOS
Implements --hwdec=videotoolbox on iOS. Similar to hwdec_osx.c, but
using CVPixelBuffer APIs available on iOS instead of the equivalent
IOSurface APIs in macOS.
2017-02-17 11:43:24 -08:00
wm4 f02752c0d5 vo_opengl: don't crash on unsupported formats
Regression from recent refactor.
2017-02-17 19:48:29 +01:00
wm4 b3488822fd build: update waf
Seems like it has been long enough since we last updated.
2017-02-17 18:54:21 +01:00
wm4 d8bf000d29 vo_opengl: hwdec_vaegl: use new format setup function
Plus add a helper.
2017-02-17 17:26:01 +01:00
wm4 e59e917e71 vo_opengl: hwdec_osx: use new format setup function
We can drop the custom table.

For some reason, the interop does not accept GL_RGB_RAW_422_APPLE as
internal format for GL_RGB_422_APPLE, so switch the format table to use
GL_RGB (this way both interop and real textures work the same).

Another victim of the apparent requirement of exactly matching texture
formats is kCVPixelFormatType_32BGRA. vo_opengl wants to handle this as
normal RGBA texture, with a swizzle applied in the shader.
CGLTexImageIOSurface2D() rejects this, because it wants the exact
internal format. Just drop the format, because it's useless anyway.

(Maybe this is a bit too fragile...)
2017-02-17 17:08:37 +01:00
wm4 91a2ddfdd7 vo_opengl: hwdec_cuda: use new format setup function
Gives us automatically support for all formats vo_opengl supports.
2017-02-17 16:39:10 +01:00
wm4 eda69f5333 vo_opengl: move texture mapping of pixel formats to helper function
All supported pixel formats have a specific "mapping" of CPU data to
textures. This function determines the number and the formats of these
textures. Moving it to a helper will be useful for some hardware decode
interop backends, since they all need similar things.
2017-02-17 16:28:31 +01:00
wm4 9c54b224d8 vo_opengl: handle GL_LUMINANCE_ALPHA and integer textures differently
GL_LUMINANCE_ALPHA is the only reason why per-plane swizzles exist.
Remove per-plane swizzles (again), and regrettably handle them as
special cases (again). Carry along the logical texture format (called
gl_format in some parts of the code, including the new one).

We also don't need a use_integer flag, since the new gl_format member
implies whether it's an integer texture. (Yes, the there are separate
logical GL formats for integer textures. This aspect of the OpenGL API
is hysteric at best.)

This should change nothing about actual rendering logic and GL API
usage.
2017-02-17 16:28:31 +01:00
wm4 b5eb326dcb videotoolbox: fix RGB format
Wrong colors. This didn't matter for the OpenGL interop code, because
the CV format was mapped to the correct texture format.
2017-02-17 14:14:58 +01:00
wm4 2b5577901d videotoolbox: remove weird format-negotiation between VO and decoder
Originally, there was probably some sort of intention to restrict it to
formats supported by the interop, or something. But in the end it was
overcomplicated nonsense.

In the future, we could use mp_hwdec_ctx.supported_formats or other
mechanisms to handle this in a better way.

mp_hwdec_ctx.ctx is not set to a dummy pointer - hwdec_devices_load() is
only used to detect whether to vo_opengl interop is present, and the
common hwdec code expects that the .ctx field is not NULL.

This also changes videotoolbox-copy to use --videotoolbox-format,
instead of the FFmpeg-set default.
2017-02-17 14:14:22 +01:00
wm4 b5bbcc9f93 videotoolbox: add reverse format mapping function
Introduce mp_imgfmt_to_cvpixelformat(), and change the existing
mp_imgfmt_from_cvpixelformat() to a table to avoid duplication.
2017-02-17 13:51:03 +01:00
wm4 1e4fd996bb videotoolbox: factor some duplicated code
The code for copying a videotoolbox surface to mp_image was duplicated
(with some minor differences - I picked the hw_videotoolbox.c version,
because it was "better"). mp_imgfmt_from_cvpixelformat() is somewhat
duplicated with the vt_formats[] table, but this will be fixed in a
later commit, and moving the function to shared code is preparation.
2017-02-17 13:32:27 +01:00