Commit Graph

47479 Commits

Author SHA1 Message Date
wm4 45cab1562c vf: improve vf_vapoursynth description
In particular describe dataflow issues (see #7020).

Insert complaint that I'm wasting time on this crap instead of things
that benefit me.
2019-10-23 22:27:07 +02:00
Stefano Pigozzi 899e0bd16b input: add gamepad support through SDL2
The code is very basic:

- only handles gamepads, could be extended for generic joysticks in the
  future.
- only has button mappings for controllers natively supported by SDL2.
  I heard more can be added through env vars, there's also ways to load
  mappings from text files, but I'd rather not go there yet. Common ones
  like Dualshock are supported natively.
- analog buttons (TRIGGER and AXIS) are mapped to discrete buttons using an
  activation threshold.
- only supports one gamepad at a time. the feature is intented to use
  gamepads as evolved remote controls, not play multiplayer games in mpv :)
2019-10-23 09:40:30 +02:00
sfan5 79b15f50e3
DOCS/client-api-changes.rst: fix formatting 2019-10-22 15:48:34 +02:00
dudemanguy f7881ea573 wayland: don't get data device if wl_seat is null 2019-10-22 02:29:53 +00:00
wm4 e82bf5f91d manpage: finish an unfinished sentence 2019-10-21 16:54:13 +02:00
wm4 9565ff522b build: add --enable-ffmpeg-strict-abi option
This can be used by distros to disable all known FFmpeg ABI violations.

Currently only 1 is known, in demux_lavf.c. In addition to if-defing out
the access to the private FFmpeg field, this disables the possibly
fragile nested open callbacks, which make sense only if the
aforementioned field can be accessed.
2019-10-21 01:38:25 +02:00
wm4 5dba244c22 filters: extend vf_format so that it can convert color parameters
Form some reason (and because of my fault), vf_format converts image
formats, but nothing else. For example, setting the "colormatrix"
sub-parameter would not convert it to the new value, but instead
overwrite the metadata (basically "reinterpreting" the image data
without changing it).

Make the historical mistake worse, and go all the way and extend it such
that it can perform a conversion. For compatibility reasons, this needs
to be requested explicitly. (Maybe this would deserve a separate filter
to begin with, but things are messed up anyway. Feel free to suggest an
elegant and simple solution.)

This demonstrates how zimg can properly perform some conversions which
swscale cannot (see examples added to vf.rst).

Stupidly this requires 2 code paths, one for conversion, and one for
overriding the parameters.

Due to the filter bullshit (what was I thinking), this requires quite
some acrobatics that would not be necessary without these abstractions.
On the other hand, it'd definitely be more of a mess without it. Oh
whatever.
2019-10-21 01:38:25 +02:00
wm4 8a4e9d5c18 sws_utils: improve zimg fallback messages
This could log:

  [swscale] falling back to swscale

And that's a WTF, even if you're aware of the fucky way zimg was hacked
into the filter chain.
2019-10-21 01:38:25 +02:00
wm4 579b9eb8de vf_fingerprint: don't print fallback warning on each frame
f_reset, which is called on seeks, was a good place for resetting the
warning flag (so the warning would be print again). Except some other
code abused f_reset when all metadata was read (in both cases you want
to clear the metadata). Instead of spending more time on getting this
flag reset correctly, just never reset it.
2019-10-21 01:38:25 +02:00
wm4 43e903980b zimg: minor name consistency improvement
Now these are like x2ccc10_pack: MSB to LSB, with bit width following
each component (except for components with the same bit width).
2019-10-21 01:38:25 +02:00
wm4 1c96152db3 f_swscale: enable use of zimg
The usual opt-in mechanism.
2019-10-21 01:38:25 +02:00
Dudemanguy911 9dead2b932 wayland: fix presentation time
There's 2 stupid things here that need to be fixed. First of all,
vulkan wasn't actually using presentation time because somehow the
get_vsync function in context.c disappeared. Secondly, if the mpv window
was hidden it was updating the ust time based on the refresh_usec but
really it should simply just not feed any information to the vsync info
structure. So this adds some logic to assume whether or not a window is
hidden.
2019-10-20 19:50:10 +00:00
wm4 525e712757 zimg: support RGB30 output
This may be used later elsewhere.
2019-10-20 19:41:18 +02:00
wm4 631379bea9 zimg: move component order arrays to top of file 2019-10-20 19:41:18 +02:00
wm4 8f5979c5d8 img_format: add RGB30 format
FFmpeg does not support this from what I can see. This makes supporting
it a bit awkward.

Later commits use this format.
2019-10-20 19:41:18 +02:00
wm4 62bd8da490 sws_utils: provide function to check whether a format pair is supported
Normally, input and output are orthogonal. But zimg may gain image
formats not supported by FFmpeg, which means the conversion will only
work if zimg is used at all. This on the other hand, depends on whether
the other format is also supported by zimg. (For example, a later commit
adds RGB30 output to zimg. libswscale does not support this format. But
if you have P010 as input, which the zimg wrapper does not support at
all, the conversion won't work.)

This makes such a function needed; so add it.
2019-10-20 19:41:18 +02:00
wm4 a495bfe373 manpage: describe stride parameter in screenshot-raw command
This is mentioned and called "obvious", but it's conceivable users don't
necessarily know about the concept. Just explain it.
2019-10-20 19:41:18 +02:00
wm4 ff67fbf328 build: lower required FFmpeg version
The FFmpeg version was last bumped a long time ago, except in commit
1638fa7b46, where it was used for some obscure pixel
format.

This is pretty annoying, so make it optional.
2019-10-20 19:41:18 +02:00
dudemanguy 027ca4fb85 wayland: add various render-related options
The newest wayland changes have some new logic that make sense to expose
to users as configurable options.
2019-10-20 15:34:57 +00:00
dudemanguy bedca07a02 wayland: add presentation time
Use ust/msc/refresh values from wayland's presentation time in mpv's
ra_swapchain_fns.get_vsync for the wayland contexts.
2019-10-20 15:34:57 +00:00
wm4 3568aed164 sws_utils: make libswscale fallback a warning
Surely a user passing --sws-allow-zimg wants to know if zimg is actually
used.
2019-10-20 16:16:28 +02:00
wm4 f23e663a21 zimg: support 3 component 16 bit pixel unpacking
Works for RGB (e.g. rgb48le) and XYZ.

It's unsure whether XYZ is really correctly converted.
2019-10-20 16:16:28 +02:00
wm4 577c00510b zimg: avoid theoretical FFmpeg planar RGB/YUV mixup
The RGB pack/unpack code in theory supports packed, non-subsampled YUV,
although in practice FFmpeg defines no such formats. (Only one with
alpha, but all alpha input is rejected by the current code.)

This would in theory have failed, because we would have selected a GBRP
format (instead of YUV), which makes no sense and would either have been
rejected by zimg (inconsistent parameters), or lead to broken output
(wrong permutation of planes).

Select the correct format and don't permute the planes in the YUV case.
2019-10-20 16:16:28 +02:00
wm4 c9d217979e zimg: add some more colorspace mappings
As suggested by the zimg author. This is mostly related to XYZ support.

It's unclear whether this works. Using the only XYZ test sample we know,
and the next commits to consume the pixfmt, it looks wrong.
2019-10-20 16:16:28 +02:00
wm4 5dc78b61f5 vf_fingerprint: remove single-plane optimization
According to the zimg author, YUV->GREY conversion does not even read
the chroma planes, as long as no matrix conversion is involved. Since we
try to avoid the latter anyway by forcing the source parameters on the
target image, passing only the Y plane will not help with anything.

An unscientific test seems to confirm this, so remove this.

This would probably help with libswscale (I didn't test this), but on
the other hand, libswscale will rarely be used in cases where we can
extract the Y plane. (Except nv12, which should probably be added to the
zimg wrapper's unpacking.)
2019-10-20 16:16:28 +02:00
wm4 64c8dd5964 vf_fingerprint: use generic zimg wrapper
Don't duplicate the API usage. The result should be approximately the
same.
2019-10-20 16:16:28 +02:00
Niklas Haas c2ed79247f mp_image: infer XYZ as BT.2020 instead of BT.709
And update the comment both explaining why this defaulting matters and
why we use BT.2020 instead.

tl;dr BT.709 clips even the one test file we *do* have, so if we don't
handle XYZ "natively" in vo_gpu we might as well at least handle it in a
way that runs less risk of clipping
2019-10-20 16:07:21 +02:00
Niklas Haas ac906fb288 csputils: fix outdated comment
This no longer hard-codes BT.709, it converts to whatever primaries are
tagged in the same metadata struct. The actual BT.709 defaulting comes
from `mp_image_params_guess_csp`.
2019-10-20 16:00:32 +02:00
wm4 d9eac493b5 vo_x11: enable use of zimg
This will perform conversion and scaling of video with zimg, if
--sws-allow-zimg is used.

The performance probably depends on how well the compiler optimizes the
RGB pack code in zimg.c, which is written in C.
2019-10-20 02:17:31 +02:00
wm4 51e141f7ba sws_utils: hack in zimg redirection support
Awful shit. I probably wouldn't accept this code from someone else, just
so you know.

The idea is that a sws_utils user can automatically use zimg without
large code changes. Basically, laziness. Since zimg support is still
very new, and I don't want that anything breaks just because zimg was
enabled at build time, an option needs to be set to enable it. (I have
especially especially obscure stuff in mind, which is all what
libswscale is used in mpv.)

This _still_ doesn't cause zimg to be used anywhere, because the
sws_utils user has to opt-in by setting allow_zimg. This is because some
users depend on certain libswscale features.
2019-10-20 02:17:31 +02:00
wm4 07aa29ed8e video: add zimg wrapper
This provides a very similar API to sws_utils.h, which can be used to
convert and scale from one mp_image to another.

This commit adds only the code, but does not use it anywhere.

The code is quite preliminary and barely tested. It supports only a few
pixel formats, and will return failure for many others. (Unlike
libswscale, which tries to support anything that FFmpeg knows.)

zimg itself accepts only planar formats. Supporting other formats
requires manual packing/unpacking. (Compared to libswscale, the zimg API
is generally lower level, but allows for more flexibility.) Only BGR0
output was actually tested. It appears to work.
2019-10-20 02:17:31 +02:00
wm4 fd539a542f mp_image: remove old acrobatics in frame copy code
This used to be needed for the "GPU memcpy" (shitty Intel methods to
deal with certain uncached memory types). This is now done in FFmpeg,
and the code in mp_image.c was just unnecessarily convoluted.
2019-10-20 01:44:22 +02:00
wm4 df8a0ecbf3 img_format: update test program
The plane pointer checking assert() triggered at least on gray8, because
that has a "pseudo palettes" in ffmpeg, which mpv refuses to allocate.

Remove a strange duplicated printf().

Log the component type where available.

(Why is this even here, I hate it when there are commented test programs
in source files.)
2019-10-20 01:44:22 +02:00
wm4 986daac45e img_format: document a minor guarantee for certain imgfmt metadata 2019-10-20 01:44:22 +02:00
wm4 e6fb8b3c97 manpage: docoument stream-open-filename property 2019-10-20 01:44:22 +02:00
wm4 09b916965b vaapi: remove hacks for pre-libva2 log callbacks
Instead, you ancient libva will do default logging, which means printing
to stderr. Not a loss, just update your libva.
2019-10-18 15:37:16 +02:00
wm4 ad97a74940 manpage: fix a typo 2019-10-18 15:36:31 +02:00
Stephan Hilb acba87e53f player: avoid duplicate track auto selection
Since a track may not be selected twice, it makes sense e.g. for
secondary subtitles to select the next best match and avoid the
duplicate selection.
This allows for example `--slang=en,ja --secondary-sid=auto` to select
'en' as primary and 'ja' as secondary without needing to know the actual
sid for 'ja'.
2019-10-18 12:11:11 +02:00
wm4 60ab82df32 video, demux: rip out unused spherical metadata code
This was preparation into something that never happened.

Spherical video is a shit idea anyway.
2019-10-17 22:49:26 +02:00
wm4 c75e0320f6 vo_gpu: hwdec_d3d11egl: add missing P010 format to supported list
This was obviously missing from the recent commit, which probably broke
10 bit decoding. The original commit didn't test this for lack of
working hardware; this commit isn't tested either.

Fixes: a1c7d61393
2019-10-17 22:45:05 +02:00
wm4 77fd4dd681 video: remove mp_image_params.hw_flags field
This was speculatively added 2 years ago in preparation for something
that apparently never happened. The D3D code was added as an "example",
but this too was never used/finished.

No reason to keep this.
2019-10-17 22:43:14 +02:00
Emmanuel Gil Peyrot a6000d3114 vo_wlshm: use memfd_create() instead of shm_open()
This syscall avoids the need to guess an unused filename in /dev/shm and
allows seals to be placed on it.  We immediately return if no fd got
returned, as there isn’t anything we can do otherwise.

Seals especially allow the compositor to drop the SIGBUS protections,
since the kernel promises the fd won’t ever shrink.

This removes support for any platform but Linux from this vo.
2019-10-17 19:38:04 +02:00
wm4 273cc3055c video: do not disable display-sync on A/V desync
On a audio/video desync by more than 0.5 seconds, display-sync mode was
disabled, and not enabled again (until playback restart, e.g. a seek).

The idea was that it this only happens when this playback mode is broken
and can't perform well anyway (A/V desync is a clear indication that
something is very wrong). Instead of behaving like a god damn POS, it
should revert to the more robust audio-sync mode.

Unfortunately, this could happen sporadically due to temporary system
performance problems, such as toggling fullscreen. Users didn't like
this, and asked for a function to disable it, or to recover in some
other way.

This mechanism is questionable anyway. If an ignorant user enables
display-sync, and encounters problems with it (without being able to
determine that display-sync is messing up), the player will still behave
like a POS on every playback, and even after every seek. It might
actually be helpful to fail more consistently. Also, I've found that
it's sill relatively reliable anyway even without this mechanism.

So just remove the fallback.

Fixes: #7048
2019-10-17 19:23:35 +02:00
Michael Forney 2fcd5271eb Reintroduce vo_wayland as vo_wlshm
vo_wayland was removed during the wayland rewrite done in 0.28. However,
it is still useful for systems that do not have OpenGL.

The new wayland_common code makes vo_wayland much simpler, and
eliminates many of the issues the previous vo_wayland had.
2019-10-17 12:26:22 +02:00
wm4 e49db40382 manpage: update --hwdec description
vdpaurb, vaapi-glx, and ANGLE's NV12-restriction are gone, making things
much simpler.
2019-10-17 11:10:40 +02:00
wm4 bd0af9a761 vf_d3d11vpp: remove RGB conversion hack
With the previous commit, this is dead code.

This also makes the f_autoconvert.c code for this dead code
(fortunately). Will probably remove this later.
2019-10-16 23:41:06 +02:00
wm4 b7eae31834 vo_gpu: hwdec_d3d11eglrgb: remove this
Finally. Since with the previous commit we can (probably) handle
P010 directly, this hack isn't needed anymore.
2019-10-16 23:41:06 +02:00
wm4 a1c7d61393 vo_gpu: hwdec_d3d11egl: adapt to newer ANGLE API
2 years ago, ANGLE removed the old NV12-specific extension, and added
a new one that supports a number of formats, including P010. Actually
they just renamed it and removed their initial annoying and obvious
design error (bravo, Google).

Since it broke 2 years ago, nobody should give a shit about this code,
and it should just be removed. But for some reason I still dived the
shit-tank (Windows development).

I guess Intel code monkeys can't write drivers (or maybe the issue is
because we're doing zero-copy, which probably maybe is not actually
allowed by D3D11 due to array textures, see --d3d11va-zero-copy), so
the P010 path is completely untested. It doesn't work, I'll delete all
this ANGLE hwdec code.

Fixes: #7054
2019-10-16 23:41:06 +02:00
Jan Ekström eaa3c1c922 vo_gpu/d3d11: fix memleak of the adapter description string 2019-10-15 22:12:48 +03:00
Jan Ekström 03e7a36a73 vo_gpu/d3d11: remove unnecessary nullptr check
mp_to_utf8 will abort in case of either invalid input or OOM.
2019-10-15 22:12:48 +03:00