Commit Graph

336 Commits

Author SHA1 Message Date
wm4 dd408e68ed d3d: make DXVA2 support optional
This partially reverts the change from a longer time ago to always build
DXVA2 and D3D11VA together.

To make it simpler, we change the following:
- building with ANGLE headers is now required to build D3D hwaccels
- if DXVA2 is enabled, D3D11VA is still forcibly built
- the CLI vo_opengl ANGLE backend is now under --egl-angle-win32

This is done to reduce the dependency mess slightly.
2017-06-30 18:57:37 +02:00
wm4 b8bdb0ba4e build: allow --disable-zlib
Since strictly speaking, it's still optional. It's just very much
recommended not to disable it.
2017-06-29 11:15:11 +02:00
Pedro Pombeiro 4637b029cd Universal Windows Plaform (UWP) support
libmpv only. Some things are still missing.

Heavily reworked.

Signed-off-by: wm4 <wm4@nowhere>
2017-06-29 10:36:16 +02:00
wm4 7eca787571 build: change how some OS specific source files are selected
In a bunch of cases, we emulate highly platform specific APIs on a
higher level across all OSes, such as IPC, terminal, subprocess
handling, and more. We have source files for each OS, and they implement
all the same mpv internal API.

Selecting which source file to use on an OS can be tricky, because there
is partially overlapping and emulated APIs (consider Cygwin on Windows).
Add a pick_first_matching_dep() function to make this slightly easier
and more structured.

Also add dummy backends in some cases, to deal with APIs not being
available.

Clarify the Windows dependency identifiers, as these are the most
confusing.
2017-06-29 10:30:16 +02:00
wm4 70a70b9da3 build: replace glob() check and assume it's always in POSIX
POSIX requires glob(), so no need to check for it. Together with the
fact that we can emulate glob() on Windows, glob() is always available.
2017-06-29 10:30:13 +02:00
wm4 0b77f6fd22 build: remove unnecessary dlopen check
Probably became unnecessary with the vf_dlopen removal.
2017-06-29 10:29:43 +02:00
wm4 5cd7b1c8a6 build: pick up new libavcodec D3D hwaccel API
This was enabled for Libav already. The patches got merged into FFmpeg
now.
2017-06-27 18:08:34 +02:00
wm4 7b84a3b04e build: disable ancient V4L TV support by default 2017-06-25 11:59:03 +02:00
wm4 915722e035 build: remove Linux DVB test fragment
Most of the DVB test fragment was added in 2e399f39 by someone who
wasn't asked for LGPL relicensing permission. Thus remove it. (For some
weird reason, the configure check wasn't even for the later added actual
DVB code.)

Since DVB is disabled by default, this isn't too bad. But if someone
enables it, and the system doesn't support it, he will receive a weird
compilation error. That has to be good enough, until maybe someone adds
a new check.
2017-06-22 13:17:40 +02:00
wm4 9f461b85bf Revert "osdep: NetBSD pthread_setname_np()"
This reverts commit 2e81698d28.

Seems like this was a patch applied from someone who can't agree to LGPL
relicensing (see previous commit), with the author field not properly
set.

This is not so important anyway, so just revert it.
2017-06-22 13:17:40 +02:00
wm4 5c038e6999 build: simplify OSS checks and remove changes by "bugmen0t"
The user bugmen0t was apparently a shared github account with publicly
available login. Thus, we can't get LGPL relicensing permission from the
people who used this account. To relicense successfully, we have to
remove all their changes.

This commit should remove 20d1fc13, f26fb009, defbe48d. It also should
remove whatever test fragments were copied from the ancient configure,
as well as some configure logic (potentially that device path stuff).

I think this change still preserves the most important use-cases of OSS:
BSDs, and the Linux OSS emulation (the latter for testing only).
According to an OSS user, the 4front checks were probably broken anyway.
The SunAudio stuff was probably for (Open)Solaris, which is dead.

ao_oss.c itself will remain GPL, and still contains bugmen0t changes.
2017-06-22 13:17:14 +02:00
Niklas Haas deb9370779 vd: use ST.2086 / HDR10 MaxCLL in addition to mastering metadata
MaxCLL is the more authoritative source for the metadata we are
interested in. The use of mastering metadata is sort of a hack anyway,
since there's no clearly-defined relationship between the mastering peak
brightness and the actual content. (Unlike MaxCLL, which is an explicit
relationship)

Also move the parameter fixing to `fix_image_params`

I don't know if the avutil check is strictly necessary but I've included
it anyway to be on the safe side.
2017-06-18 20:54:44 +02:00
wm4 c680cfd18a vf_dlopen: remove this filter
It was an attempt to move some MPlayer filters (which were removed from
mpv) to external, loadable filters. That worked well, but then the
MPlayer filters were ported to libavfilter (independently), so they're
available again. Also there is a more widely supported and more advanced
loadable filter system supported by mpv: vapoursynth.

In conclusion, vf_dlopen is not useful anymore, confusing, and requires
quite a bit of code (and probably wouldn't survive the rewrite of the
mpv video filter chain, which has to come at some point). It has some
implicit dependencies on internal conventions, like possibly the format
names dropped in the previous commit.

We also deprecated it last release. Drop it.
2017-06-18 13:55:40 +02:00
Avi Halachmi (:avih) 071118e4d2 js: wscript: use pkgconfig for mujs (recently added .pc and 1.0.0 tag) 2017-06-16 15:24:24 +03:00
Avi Halachmi (:avih) d223a63bc5 js: add javascript scripting support using MuJS
Implements JS with almost identical API to the Lua support.

Key differences from Lua:
- The global mp, mp.msg and mp.utils are always available.
- Instead of returning x, error, return x and expose mp.last_error().
- Timers are JS standard set/clear Timeout/Interval.
- Supports CommonJS modules/require.
- Added at mp.utils: getenv, read_file, write_file and few more.
- Global print and dump (expand objects) functions.
- mp.options currently not supported.

See DOCS/man/javascript.rst for more details.
2017-06-14 12:29:32 +02:00
wm4 0754cbc83e d3d: add support for new libavcodec hwaccel API
Unfortunately quite a mess, in particular due to the need to have some
compatibility with the old API. (The old API will be supported only in
short term.)
2017-06-08 21:51:25 +02:00
wm4 11c7775b2c build: enable cplugins by default
There's probably no reason to keep this disabled. The -rdynamic (and the
approach we use) is probably a bit scary, but should not break anything.

Just to be sure I'm hard-disabling this on win32 anyway. We know it
can't work there in its current form.

Fixes #4491.
2017-06-07 20:43:59 +02:00
wm4 83a9b0bc48 videotoolbox: support new libavcodec API
The new API has literally no advantages (other than that we can drop
mp_vt_download_image and other things later), but it's sort-of uniform
with the other hwaccels.

"--videotoolbox-format=no" is not supported with the new API, because it
doesn't "fit in". Probably could be added later again.

The iOS code change is untested (no way to test).
2017-05-24 15:25:48 +02:00
wm4 2b616c0682 vo_opengl: drop TLS usage
TLS is a headache. We should avoid it if we can.

The involved mechanism is unfortunately entangled with the unfortunate
libmpv API for returning pointers to host API objects. This has to be
kept until we change the API somehow.

Practically untested out of pure laziness. I'm sure I'll get a bunch of
reports if it's broken.
2017-05-11 17:47:33 +02:00
wm4 99cef59fc9 dvb: disable by default
It fails building with some older kernel headers, and the current test
does not auto-disable it in these cases.

Since DVB isn't going to be used by many people, I think disabling it by
default is reasonable.
2017-05-11 08:19:02 +02:00
wm4 f38bd0f25a stream_smb: disable by default, mark as GPLv3
It seems libsmbclient has been GPLv3 for years. Also, it's certainly not
LGPL (unlike some of its support libs like talloc). Thus, mpv built with
Samba support is GPLv3.

Disable it by default, so we don't have to go through the trouble to
indicate the correct license in our output, and we don't trick people
into distributing stuff under the wrong license.
2017-05-11 08:19:02 +02:00
wm4 0d122f8963 wscript: make OpenGL VO failure message less misleading
It doesn't even use OpenGL header anymore. What it needs are EGL and GLX
libs/header and similar.
2017-05-04 23:44:06 +02:00
wm4 cb25bb5776 build: remove checks for libGL
We don't need to link against libGL directly, nor do we need OpenGL
headers. The only thing we need is the windowing interop stuff, such as
libEGL.
2017-04-26 17:09:16 +02:00
wm4 f59371de21 video: drop vaapi/vdpau hw decoding support with FFmpeg 3.2
This drops support for the old libavcodec APIs. Now FFmpeg 3.3 or FFmpeg
git is required. Libav has no release with the new APIs yet, so for
Libav git as of a few weeks or months ago or so is required if you want
to use Libav.

Not much actually changes in hwdec_vaegl.c - some code is removed, but
the reindentation inflates the diff.
2017-04-23 16:07:03 +02:00
wm4 927afa311d build: make various x11 protocol extension libs mandatory
Reduces the ifdeffery, which is good and will avoid silent breakages, or
weird behavior if a lib is omitted.

Also reorder the x11_common.c include statements.
2017-04-21 07:30:03 +02:00
Ricardo Constantino aa4b0e319b
wscript: don't make dvdread-common an option
This just checks if dvdread or dvdnav are enabled so it can
compile dvdread code.

Change description to be clearer on what this does differently from
--enable-dvdread.
2017-04-07 16:26:02 +01:00
wm4 eb83ee4a4a vo_opengl: add our own copy of OpenGL headers
gl_headers.h is basically header_fixes.h done consequently. It contains
all OpenGL defines (and some typedefs) we need. We don't include GL
headers provided by the system anymore.

Some care has to be taken by certain windowing APIs including all of
gl.h anyway. Then the definitions could clash. Fortunately, redefining
preprocessor symbols to the same content is allowed and ignored. Also,
redefining typedefs to the same thing is allowed in C11. Apparently the
latter is not allowed in C99, so there is an imperfect attempt to avoid
the typedefs if required API symbols are apparently present already.

The nost risky part about this are the standard typedefs and GLAPIENTRY.
The latter is different only on win32 (and at least consistently so).
The typedefs are mostly based on stdint.h typedefs, which khrplatform.h
clumsily emulates on platforms which don't have it. The biggest
difference is that we define GLsizeiptr directly to ptrdiff_t, instead
of checking for the _WIN64 symbol and defining it to long or long long.

This also typedefs GLsync to __GLsync, just like the khronos headers.
Although symbols prefixed with __ are implementation reserved, khronos
also violates this rule, and having the same definition as khronos will
avoid problems on duplicate definitions.

We can simplify the build scripts too. The ios-gl check seems a bit
wrong now (what we really want to test for is EAGLContext), but I can't
test and thus can't improve it.

cuda_dynamic.h redefined two GL symbols; just include the new headers
directly instead.
2017-04-07 15:09:27 +02:00
wm4 258d6b4a35 wscript: avoid compose_checks in one case
Avoid it where we can, because it tends to have unexpected side-effects.
(Probably not in this case, but still a reason to avoid it.)
2017-04-06 08:42:18 +02:00
wm4 755ce9dac5 build: replace android-gl check with a standard GLES3 check
There's no reason to make it Android specific, as it uses standard
include paths.
2017-04-06 08:35:47 +02:00
Ricardo Constantino 1d2910af95
wscript: fix broken build with dvdread+dvdnav in 34e6a26
Didn't know waf actually tried to compile the same files twice.
2017-03-31 20:17:01 +01:00
Ricardo Constantino 34e6a26f4d
wscript: decouple dvdnav check from dvdread
Reallows enabling dvdnav without enabling dvdread which was broken
in 77cbb3543 when they were both disabled by default.
Since dvdnav requires dvdread, we can enable dvdread:// even if
--enable-dvdread isn't passed.

Fixes #4290
2017-03-31 16:46:58 +01:00
Akemi f8a223b7ac osx: initial Touch Bar support 2017-03-26 20:26:18 +02:00
wm4 a52a52fa6e vdpau: support new vdpau libavcodec decode API
The new API works like the new vaapi API, using generic hwaccel support.

One minor detail is the error message that will be printed if using
non-4:2:0 surfaces (which as far as I can tell is completely broken in
the nVidia drivers and thus not supported by mpv). The HEVC warning
(which is completely broken in the nVidia drivers but should work with
Mesa) had to be added to the generic hwaccel code.

This also trashes display preemption recovery. Fuck that. It never
really worked. If someone complains, I might attempt to add it back
somehow.

This is the 4th iteration of the libavcodec vdpau API (after the
separate decoder API, the manual hwaccel API, and the automatic vdpau
hwaccel API). Fortunately, further iterations will be generic, and not
require much vdpau-specific changes (if any at all).
2017-03-23 11:14:11 +01:00
wm4 77cbb35437 build: disable optical media libs by default (DVD/BD/CD)
Pure garbage.
2017-03-15 01:20:47 +01:00
Alexis Nootens 1245ac1dc5 wscript: substitute cplugins linker flag for macOS compatiblity
For an unknown reason, '-Wl -export-dynamic' doesn't work anymore
on the last macOS build (10.12.3 with Apple LLVM 8.0.0) so forcing
cplugins is useless because the check fails. Replacing the linker
option with its substitute '-rdynamic' do the trick.

The syms module from waf still works as expected and only the
symbols specified in mpv.def are exported.
2017-03-06 15:37:44 +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
James Ross-Gowan f9369750b1 wscript: fix --egl-angle-lib for waf 1.9 2017-02-19 23:49:16 +11:00
wm4 81efe20cd7 atomic: remove __atomic builtin usage
Using these was a temporary solution while some compilers implemented
the underlying atomic mechanisms, but not the C11 language parts (or
that's what I guess). Not really useful for us anymore. Also, there is
the slight risk of having subtly incorrect semantics by using
potentially changing compiler internals and such.
2017-02-13 06:45:40 +01:00
James Ross-Gowan e0250b9604 vo_opengl: angle: rewrite with custom swap chain
This replaces the old backend that exclusively used EGL windowing with
one that can also use ANGLE's ability to render to directly to a
texture. The advantage of this is that it allows mpv to create the swap
chain itself and this allows mpv to use a flip-mode swap chain on a HWND
(which avoids problems with DirectComposition) and to use a longer swap
chain that has six backbuffers by default (which reportedly fixes
problems with rendering 24fps video on 24Hz monitors.)

Also, "screenshot window" should now work on DXGI 1.2 and up (Windows 8
and up.)
2017-02-07 22:45:07 +11:00
wm4 dccb752b5f build: fix --disable-gl if cuda is enabled
video/out/opengl/hwdec_cuda.c is enabled with cuda-hwaccel. But it makes
only sense to build if GL is enabled, and in fact it fails to link
without GL as it calls a specific GL helper function.

In theory it would be perfectly possible to use cuda-copy with GL
disabled. But I'm not bothering with the complexity.
2017-01-30 09:34:10 +01:00
kwkam d41f25009d wscript: add LIBRARY_PATH for library detection
MinGW GCC seems to ignore LIBRARY_PATH which causes problem
when some libraries not using pkg-config were installed to
local directory
2017-01-28 14:02:34 +01:00
Ilya Tumaykin ea40fa36ee build: rpi: rely on pkgconfig for compiler flags
Upstream provides pkgconfig files for quite some time now [1,2].
Use them to determine the required flags instead of hard coding.

This makes cross-compilation easy, which I dare to say is important for
many raspberry-pi users. This also prevents picking libEGL and libGLESv2
from mesa when they are present, which can happen with the current code.

Good distros should put these pkgconfig files into default pkg-config
search path or populate PKG_CONFIG_PATH for users. However, be nice to
everybody and manually look into '/opt/vc/lib/pkgconfig' just in case.
Hence the PKG_CONFIG_PATH mangling.

[1]: https://github.com/raspberrypi/userland/issues/245
[2]: 05d60a01d5
2017-01-28 14:02:22 +01:00
wm4 cfda696580 build: explicitly check for FFmpeg vs. Libav, and their exact versions
In a first pass, we check whether libavcodec is present.

Then we try to compile a snippet and check for FFmpeg vs. Libav. (This
could probably also be done by somehow checking the pkgconfig version.
But pkg-config can't deal with that idiotic FFmpeg idea that a micro
version number >= 100 identifies FFmpeg vs. Libav.)

After that we check the project-specific version numbers. This means it
can no longer happen that we accidentally allow older, unsupported
versions of FFmpeg, just because the Libav version numbers are somehow
this way.

Also drop the resampler checks. We hardcode which resampler to each with
each project. A user can no longer force use of libavresample with
FFmpeg.
2017-01-27 09:57:01 +01:00
wm4 a9e0f4b279 wscript: merge libavfilter check into the main ffmpeg check
It used to be optional. That's why it was separate. No need for that
anymore.
2017-01-27 09:22:52 +01:00
wm4 c3205d294e atomic: drop __sync builtins
The correctness of the stdatomic.h emulation via the __sync builtins is
questionable, and we've been relying on exact stdatomic semantics for a
while, so just get rid of it. Compilers which support __sync but not
stdatomic.h will use to the slow mutex fallback.

Not sure about the __atomic builtins. It doesn't seem to harm either, so
leave it for now.
2017-01-27 09:15:32 +01:00
wm4 d16ba1f7f6 build: new vaapi hwaccel API does not use av_image_copy_uc_from()
Not even Libav does. Whoops. The developer who wrote the FFmpeg code for
this said he could not find any improvements when using the "GPU memcpy"
; instead, it made it actually slower on some hardware.

It's not clear to what extent the "GPU memcpy" was needed for vaapi, but
hopefully not very much (see #2317).

This commit enables use of the new vaapi API by default with FFmpeg.
2017-01-24 08:22:10 +01:00
wm4 b14fac9afa build: replace some FFmpeg API checks with version checks
The FFmpeg versions we support all have the APIs we were checking for.
Only Libav missed them. Simplify this by explicitly checking for FFmpeg
in the code, instead of trying to detect the presence of the API.
2017-01-24 08:11:42 +01:00
wm4 da8011c5df vaapi: detect new API on FFmpeg too, and disable it by default
Since the only way to detect the API is by a version check, this had to
wait until the patches were actually pushed to FFmpeg git (which now
happened).

Since this does not include the new magic GPU memcpy libavutil function
yet, the new vaapi code would be slower if copy mode (like vaapi-copy)
is used. This would be quite bad to use by default, so check for the
function, and if not present, disable the new vaapi code. This
effectively disables it by default on FFmpeg.

(We assume that if the new GPU memcpy exists, vaapi's AVHWFramesContext
implementation will use it.)
2017-01-18 08:17:29 +01:00
wm4 a38283d5d9 vaapi: we don't need SSE intrinsics with the new API
libavutil does this for us. Although the new vaapi decode API does not
strictly introduce or even need av_image_copy_uc_from(), it's implied
that it will be present if the new decode API is present - even if it's
not, we can't use our own SSE code with it anyway.
2017-01-17 15:48:56 +01:00
wm4 44e06b70d5 player: add experimental C plugin interface
This basically reuses the scripting infrastructure.

Note that this needs to be explicitly enabled at compilation. For one,
enabling export for certain symbols from an executable seems to be quite
toolchain-specific. It might not work outside of Linux and cause random
problems within Linux.

If C plugins actually become commonly used and this approach is starting
to turn out as a problem, we can build mpv CLI as a wrapper for libmpv,
which would remove the requirement that plugins pick up host symbols.

I'm being lazy, so implementation/documentation are parked in existing
files, even if that stuff doesn't necessarily belong there. Sue me, or
better send patches.
2017-01-12 17:45:11 +01:00