Commit Graph

3126 Commits

Author SHA1 Message Date
wm4 6551ea5bd3 new build system
Further changes by the following people:

James Ross-Gowan <rossy@jrg.systems>: win32 fixes
2020-06-10 11:25:10 +02:00
Stefano Pigozzi 7e2edad8ef switch the build system to waf
This commit adds a new build system based on waf. configure and Makefile
are deprecated effective immediately and someday in the future they will be
removed (they are still available by running ./old-configure).

You can find how the choice for waf came to be in `DOCS/waf-buildsystem.rst`.
TL;DR: we couldn't get the same level of abstraction and customization with
other build systems we tried (CMake and autotools).

For guidance on how to build the software now, take a look at README.md
and the cross compilation guide.

CREDITS:
This is a squash of ~250 commits. Some of them are not by me, so here is the
deserved attribution:

 - @wm4 contributed some Windows fixes, renamed configure to old-configure
   and contributed to the bootstrap script. Also, GNU/Linux testing.
 - @lachs0r contributed some Windows fixes and the bootstrap script.
 - @Nikoli contributed a lot of testing and discovered many bugs.
 - @CrimsonVoid contributed changes to the bootstrap script.
2013-11-21 21:22:36 +01:00
bugmen0t 417fa2ffec configure: enable v4l2 input on freebsd 2013-11-13 21:16:14 +01:00
bugmen0t 35d7ed7bf1 tvi_v4l2: let libv4l2 convert to a known pixel format
Signed-off-by: wm4 <wm4@nowhere>

Significant modifications over the original patch by not overriding
syscalls with macros ("#define open v4l2open") for fallback, but the
other way around ("#define v4l2open open"). As consequence, the calls
have to be replaced throughout the file.

Untested, although the original patch probably was tested.
2013-11-13 21:15:59 +01:00
wm4 e4bbb1d348 Merge branch 'planar_audio'
Conflicts:
	audio/out/ao_lavc.c
2013-11-12 23:42:04 +01:00
wm4 5388a0cd40 ad_mpg123: reduce ifdeffery
Drop support for anything before 1.14.0.
2013-11-12 23:38:52 +01:00
wm4 84dcb76f27 demux: kill libmng support
It's a dead format that was never used anywhere.
2013-11-11 19:32:45 +01:00
wm4 db6a4eec0a vo_opengl: support for vdpau hardware decoding
This uses vdpau OpenGL interop to convert a vdpau surface to a texture.

Note that this is a bit weak and primitive. Deinterlacing (or any other
form of vdpau postprocessing) is not supported. vo_opengl chroma scaling
and chroma sample position are not supported. Internally, the vdpau
video surfaces are converted to a RGBA surface first, because using the
video surfaces directly is too complicated. (These surfaces are always
split into separate fields, and the vo_opengl core expects progressive
frames or frames with weaved fields.)
2013-11-05 22:28:15 +01:00
Paweł Forysiuk f330884b0a Adjust wayland defines 2013-11-04 21:28:34 +01:00
wm4 3a831b2c01 fix HAVE_PTHREADS being undefined on windows 2013-11-04 00:48:43 +01:00
wm4 00de1320b0 fix HAVE_JACK being undefined
Holy inconsistency, let's just kill it with waf.
2013-11-04 00:48:29 +01:00
wm4 222cfe7fe6 define HAVE_COREAUDIO on platforms other than OSX 2013-11-04 00:43:47 +01:00
wm4 f7b2d644ef Merge branch 'master' into have_configure
Conflicts:
	configure
2013-11-04 00:43:06 +01:00
wm4 2d58fb3b8e vo_opengl: add support for VA-API OpenGL interop
VA-API's OpenGL/GLX interop is pretty bad and perhaps slow (renders a
X11 pixmap into a FBO, and has to go over X11, probably involves one or
more copies), and this code serves more as an example, rather than for
serious use. On the other hand, this might be work much better than
vo_vaapi, even if slightly slower.
2013-11-04 00:11:43 +01:00
Stefano Pigozzi 37388ebb0e configure: uniform the defines to #define HAVE_xxx (0|1)
The configure followed 5 different convetions of defines because the next guy
always wanted to introduce a new better way to uniform it[1]. For an
hypothetic feature 'hurr' you could have had:

  * #define HAVE_HURR 1   / #undef HAVE_DURR
  * #define HAVE_HURR     / #undef HAVE_DURR
  * #define CONFIG_HURR 1 / #undef CONFIG_DURR
  * #define HAVE_HURR 1   / #define HAVE_DURR 0
  * #define CONFIG_HURR 1 / #define CONFIG_DURR 0

All is now uniform and uses:
  * #define HAVE_HURR 1
  * #define HAVE_DURR 0

We like definining to 0 as opposed to `undef` bcause it can help spot typos
and is very helpful when doing big reorganizations in the code.

[1]: http://xkcd.com/927/ related
2013-11-03 21:59:54 +01:00
wm4 dd344b43e8 Enable -Wshadow
This one really did bite me hard (see previous commit), so enable it by
default.

Fix some cases of shadowing throughout the codebase. None of these
change behavior, and all of these were correct code, and just tripped up
the warning.
2013-11-01 13:00:15 +01:00
wm4 bea36dc33f configure: use pkg-config for libsmbclient
Apparently, Samba has .pc files now.
2013-10-19 13:32:30 +02:00
wm4 e046fa584a mp_msg: remove gettext() support
Was disabled by default, was never used, internal support was
inconsistent and poor, and there has been virtually no interest in
creating translations.

And I don't even think that a terminal program should be translated.
This is something for (hypothetical) GUIs.
2013-10-18 22:38:10 +02:00
Christian Neukirchen 3289473678 audio/out: add sndio support
Based on an earlier patch for mplayer by Alexandre Ratchov <alex@caoua.org>
2013-10-03 23:14:03 +02:00
wm4 6048f87e3c Add initial Lua scripting support
This is preliminary. There are still tons of issues, and any aspect
of scripting may change in the future. I decided to merge this
(preliminary) work now because it makes it easier to develop it, not
because it's done. lua.rst is clear enough about it (plus some
sarcasm).

This requires linking to Lua. Lua has no official pkg-config file, but
there are distribution specific .pc files, all with different names.
Adding a non-pkg-config based configure test was considered, but we'd
rather not.

One major complication is that libquvi links against Lua too, and if
the Lua version is different from mpv's, you will get a crash as soon
as libquvi uses Lua. (libquvi by design always runs when a file is
opened.) I would consider this the problem of distros and whoever
builds mpv, but to make things easier for users, we add a terrible
runtime test to the configure script, which probes whether libquvi
will crash. This is disabled when cross-compiling, but in that case
we hope the user knows what he is doing.
2013-09-26 01:28:58 +02:00
Martin Herkt 4e6751609e configure: make the pdflatex check use the tempdir 2013-09-25 16:04:41 +02:00
Martin Herkt cc12f05a52 configure: improve pdflatex check 2013-09-25 15:57:20 +02:00
xylosper 39d1ab82e5 vaapi: add vf_vavpp and use it for deinterlacing
Merged from pull request #246 by xylosper. Minor cosmetic changes, some
adjustments (compatibility with older libva versions), and manpage
additions by wm4.

Signed-off-by: wm4 <wm4@nowhere>
2013-09-25 13:53:42 +02:00
Martin Herkt 3807038193 install: don’t force append /mpv to docdir 2013-09-23 14:09:15 +02:00
Stefano Pigozzi fe7fed590a macosx: always active bundle path lookup if cocoa is active
This is not really something you want to disable anyway. If there is no bundle
the code already does it's falbacks anyway.
2013-09-12 18:45:40 +02:00
Martin Herkt 005407338d Add PDF manual target
This builds a PDF version of the manpage using rst2latex
and pdflatex, and installs it to PREFIX/share/doc/mpv by
default.
2013-09-09 04:34:56 +02:00
Alexander Preisinger 353686e636 configure: build with wayland 1.2.0
For the time being there will be a check if someone uses wayland from git,
because I really really like to have the others formats too.
2013-09-03 20:12:44 +02:00
Alexander Preisinger 13f3b55881 configure: improve wayland check 2013-09-03 19:31:10 +02:00
wm4 f5144077ac configure: fix some descriptions in the help output 2013-09-01 03:03:25 +02:00
Alexander Preisinger c181ae87ce configure: fix build with stable wayland releases 2013-08-28 21:48:21 +02:00
Stefano Pigozzi 75791f4dd9 configure: fix VDA autodetection based on FFmpeg support
The original condition was too weak, requiring only the header. The header is
installed is FFmpeg regardless of the presence of VDA on the system, so just
perform a check on the `ff_vda_create_decoder` function.
2013-08-26 20:00:41 +02:00
Alexander Preisinger 445f8bd29a configure: move wayland-egl check
This makes it possible to build the shm backend when no EGL platform is
available.
2013-08-26 17:20:44 +02:00
Alexander Preisinger 58e826e6f2 wayland: shm based software rendering
A wayland output based on shared memory. This video output is useful for x11
free systems, because the current libGL in mesa provides GLX symbols. It is also
useful for embedded systems where the wayland backend for EGL is not
implemented like the raspberry pi.

At the moment only rgb formats are supported, because there is still no
compositor which supports planar formats like yuv420p. The most used compositor
at the moment, weston, supports only BGR0, BGRA and BGR16 (565).

The BGR16 format is the fastest to convert and render without any noticeable
differences to the BGR32 formats. For this reason the current (very basic)
auto-detection code will prefer the BGR16 format. Also the weston source code
indicates that the preferred format is BGR16 (RGB565).

There are 2 options:
    * default-format (yes|no)  Which uses the BGR32 format
    * alpha (yes|no)    For outputting images and videos with transparencies
2013-08-25 22:46:26 +02:00
Stefano Pigozzi cf2d0b882a configure: fix help for macosx-bundle from autodetected to disabled
The help and configure result wrongly showed this feature was autodetected,
while it is infact disabled by default.
2013-08-25 12:21:34 +02:00
wm4 20e2d74440 configure: fix VDA warning on systems other than OSX
CONFIG_VDA is supposed to be defined to 0 or 1. But on non-OSX systems,
the configure test isn't run at all, so CONFIG_VDA ends up undefined.
2013-08-24 19:45:30 +02:00
Stefano Pigozzi a9cb2dc1b8 video: add vda decode support (with hwaccel) and direct rendering
Decoding H264 using Video Decode Acceleration used the custom 'vda_h264_dec'
decoder in FFmpeg.

The Good: This new implementation has some advantages over the previous one:

 - It works with Libav: vda_h264_dec never got into Libav since they prefer
   client applications to use the hwaccel API.

 - It is way more efficient: in my tests this implementation yields a
   reduction of CPU usage of roughly ~50% compared to using `vda_h264_dec` and
   ~65-75% compared to h264 software decoding. This is mainly because
   `vo_corevideo` was adapted to perform direct rendering of the
   `CVPixelBufferRefs` created by the Video Decode Acceleration API Framework.

The Bad:
  - `vo_corevideo` is required to use VDA decoding acceleration.
  - only works with versions of ffmpeg/libav new enough (needs reference
    refcounting). That is FFmpeg 2.0+ and Libav's git master currently.

The Ugly: VDA was hardcoded to use UYVY (2vuy) for the uploaded video texture.
One one end this makes the code simple since Apple's OpenGL implementation
actually supports this out of the box. It would be nice to support other
output image formats and choose the best format depending on the input, or at
least making it configurable. My tests indicate that CPU usage actually
increases with a 420p IMGFMT output which is not what I would have expected.

NOTE: There is a small memory leak with old versions of FFmpeg and with Libav
since the CVPixelBufferRef is not automatically released when the AVFrame is
deallocated. This can cause leaks inside libavcodec for decoded frames that
are discarded before mpv wraps them inside a refcounted mp_image (this only
happens on seeks).
For frames that enter mpv's refcounting facilities, this is not a problem
since we rewrap the CVPixelBufferRef in our mp_image that properly forwards
CVPixelBufferRetain/CvPixelBufferRelease calls to the underying
CVPixelBufferRef.

So, for FFmpeg use something more recent than `b3d63995` for Libav the patch
was posted to the dev ML in July and in review since, apparently, the proposed
fix is rather hacky.
2013-08-22 12:13:30 +02:00
wm4 8b245c4d4b sd_lavc_conv: don't check AV_CODEC_PROP_TEXT_SUB flag
Not actually useful. This would break whenever a new text subtitle
format would be added, which requires a binary->text transformation.
(mov_text is one such format; disable it.) In general, we would have
to know which packet formats are binary, which we don't, so the only
reasonable way to handle this is a white list.
2013-08-15 23:40:04 +02:00
wm4 12a6f73a2f configure: fix typo 2013-08-12 02:14:00 +02:00
wm4 2827295703 video: add vaapi decode and output support
This is based on the MPlayer VA API patches. To be exact it's based on
a very stripped down version of commit f1ad459a263f8537f6c from
git://gitorious.org/vaapi/mplayer.git.

This doesn't contain useless things like benchmarking hacks and the
demo code for GLX interop. Also, unlike in the original patch, decoding
and video output are split into separate source files (the separation
between decoding and display also makes pixel format hacks unnecessary).

On the other hand, some features not present in the original patch were
added, like screenshot support.

VA API is rather bad for actual video output. Dealing with older libva
versions or the completely broken vdpau backend doesn't help. OSD is
low quality and should be rather slow. In some cases, only either OSD
or subtitles can be shown at the same time (because OSD is drawn first,
OSD is prefered).

Also, libva can't decide whether it accepts straight or premultiplied
alpha for OSD sub-pictures: the vdpau backend seems to assume
premultiplied, while a native vaapi driver uses straight. So I picked
straight alpha. It doesn't matter much, because the blending code for
straight alpha I added to img_convert.c is probably buggy, and ASS
subtitles might be blended incorrectly.

Really good video output with VA API would probably use OpenGL and the
GL interop features, but at this point you might just use vo_opengl.
(Patches for making HW decoding with vo_opengl have a chance of being
accepted.)

Despite these issues, decoding seems to work ok. I still got tearing
on the Intel system I tested (Intel(R) Core(TM) i3-2350M). It was also
tested with the vdpau vaapi wrapper on a nvidia system; however this
was rather broken. (Fortunately, there is no reason to use mpv's VAAPI
support over native VDPAU.)
2013-08-12 01:12:02 +02:00
wm4 878a94d000 configure: lower libdvdread minimum required version
This version number was essentially random. When I switched the test
to pkg-config, I took the libdvdread version from my Debian unstable
system as the minimum (as I knew that this version worked).

A user reported that the libdvdread version 4.1.4 appeared to work
fine, so lower the minimum version to the 4.1.x series.
2013-08-02 17:08:36 +02:00
wm4 a8153f59d5 configure: fix vdpau test if vdpau is disabled/unavailable
The check for HAVE_AV_CODEC_NEW_VDPAU_API just determines whether the
new vdpau libavutil pixel format is available (which implies presence of
the new API). However, that pixel format (and the correspondig config
test define) is also used in generic code (compiled even without vdpau)
in fmt-conversion.c. Since the configure test didn't define the symbol
if vdpau was not available, it broke in this case.
2013-07-30 16:21:33 +02:00
wm4 5accc5e7c1 vdpau: split off decoder parts, use "new" libavcodec vdpau hwaccel API
Move the decoder parts from vo_vdpau.c to a new file vdpau_old.c. This
file is named so because because it's written against the "old"
libavcodec vdpau pseudo-decoder (e.g. "h264_vdpau").

Add support for the "new" libavcodec vdpau support. This was recently
added and replaces the "old" vdpau parts. (In fact, Libav is about to
deprecate and remove the "old" API without deprecation grace period,
so we have to support it now. Moreover, there will probably be no Libav
release which supports both, so the transition is even less smooth than
we could hope, and we have to support both the old and new API.)

Whether the old or new API is used is checked by a configure test: if
the new API is found, it is used, otherwise the old API is assumed.

Some details might be handled differently. Especially display preemption
is a bit problematic with the "new" libavcodec vdpau support: it wants
to keep a pointer to a specific vdpau API function (which can be driver
specific, because preemption might switch drivers). Also, surface IDs
are now directly stored in AVFrames (and mp_images), so they can't be
forced to VDP_INVALID_HANDLE on preemption. (This changes even with
older libavcodec versions, because mp_image always uses the newer
representation to make vo_vdpau.c simpler.)

Decoder initialization in the new code tries to deal with codec
profiles, while the old code always uses the highest profile per codec.

Surface allocation changes. Since the decoder won't call config() in
vo_vdpau.c on video size change anymore, we allow allocating surfaces
of arbitrary size instead of locking it to what the VO was configured.
The non-hwdec code also has slightly different allocation behavior now.

Enabling the old vdpau special decoders via e.g. --vd=lavc:h264_vdpau
doesn't work anymore (a warning suggesting the --hwdec option is
printed instead).
2013-07-28 19:25:07 +02:00
wm4 590f011df1 configure: fix terminfo check
On Linux, the check fails because NULL is not defined. Fix by using 0
instead, which is a perfectly valid null pointer constant, but doesn't
require stddef.h.
2013-07-26 01:47:02 +02:00
wm4 9cc5630fd5 video: support setting libswscale chroma position 2013-07-25 23:03:20 +02:00
Diogo Franco (Kovensky) 1df1eb0b61 configure: Fix bad variable assignment
Bourne shell hates having spaces before or after the = sign.
2013-07-25 12:24:09 -03:00
Diogo Franco (Kovensky) 057467f6b3 getch2: Refactor/rewrite
Still uses termcap, but uses terminfo for loading the termcap database if
possible. Adds configure test to find terminfo; skips the termcap test
if terminfo is found since terminfo provides termcap.

Use termcap completely for special keys; if we can't get it from termcap
and it isn't one of the known fallbacks, we ignore its specialness and
treat as a sequence of UTF-8 codes.

Further hardcoded fallbacks can be added by calling keys_push_once in
load_termcap; there is no limit to the amount of keys pushed.

Uses the "ke" and "ks" capabilities to start / exit application mode, which
is necessary on vt100 emulators (including screen, xterm and all terminals
that emulate either of those) to correctly receive arrow keys.

It's now possible to compile getch2 even without termcap, though it won't
be of much use since it'll be unable to detect special keys.

Converted to 4 spaces per tab, prettified some statements.
2013-07-25 00:01:51 -03:00
Diogo Franco (Kovensky) d5adaed9d8 ao_wasapi0: Rename to ao_wasapi
Nobody knows what the 0 was for. There's no "WASAPI version 0". Just take
it out.
2013-07-22 02:42:38 +02:00
Diogo Franco (Kovensky) b9944e2dc1 configure: Add some -Wno-error= flags to ERRORFLAGS
-Wno-error=deprecated-declarations and -Wno-error=unused-function.
Lets mpv compile with --extra-cflags=-Werror with gcc 4.8.1.
2013-07-21 01:14:18 +02:00
Grzegorz Blach d0020db5f3 Use /dev/cd0 as default cdrom device on FreeBSD 2013-07-16 23:24:24 +02:00
wm4 0a6654ce2f configure: add /usr/local on FreeBSD, also NetBSD/DragonFly
In my opinion this should be unneeded and unclean, which is why I
removed it some time ago. But apparently this is a convenience for BSD
users (so they don't have to use --extra-cflags), so add it back.
2013-07-15 21:31:15 +02:00