2014-03-12 00:40:55 +01:00
|
|
|
import re
|
2014-11-19 18:51:53 +01:00
|
|
|
import os
|
2014-03-12 00:40:55 +01:00
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
def _add_rst_manual_dependencies(ctx):
|
|
|
|
manpage_sources_basenames = """
|
|
|
|
options.rst ao.rst vo.rst af.rst vf.rst encode.rst
|
2014-10-14 22:35:37 +02:00
|
|
|
input.rst osc.rst lua.rst ipc.rst changes.rst""".split()
|
2013-07-16 13:28:28 +02:00
|
|
|
|
2014-06-20 23:01:12 +02:00
|
|
|
manpage_sources = ['DOCS/man/'+x for x in manpage_sources_basenames]
|
2013-07-16 13:28:28 +02:00
|
|
|
|
|
|
|
for manpage_source in manpage_sources:
|
|
|
|
ctx.add_manual_dependency(
|
2014-06-20 23:01:12 +02:00
|
|
|
ctx.path.find_node('DOCS/man/mpv.rst'),
|
2013-07-16 13:28:28 +02:00
|
|
|
ctx.path.find_node(manpage_source))
|
|
|
|
|
2015-12-29 20:57:09 +01:00
|
|
|
def _build_html(ctx):
|
|
|
|
ctx(
|
|
|
|
name = 'rst2html',
|
|
|
|
target = 'DOCS/man/mpv.html',
|
|
|
|
source = 'DOCS/man/mpv.rst',
|
|
|
|
rule = '${RST2HTML} ${SRC} ${TGT}',
|
2016-07-26 08:55:54 +02:00
|
|
|
install_path = ctx.env.HTMLDIR)
|
2015-12-29 20:57:09 +01:00
|
|
|
|
|
|
|
_add_rst_manual_dependencies(ctx)
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
def _build_man(ctx):
|
|
|
|
ctx(
|
|
|
|
name = 'rst2man',
|
2014-06-20 23:01:12 +02:00
|
|
|
target = 'DOCS/man/mpv.1',
|
|
|
|
source = 'DOCS/man/mpv.rst',
|
2013-07-16 13:28:28 +02:00
|
|
|
rule = '${RST2MAN} ${SRC} ${TGT}',
|
2013-11-23 11:35:16 +01:00
|
|
|
install_path = ctx.env.MANDIR + '/man1')
|
2013-07-16 13:28:28 +02:00
|
|
|
|
|
|
|
_add_rst_manual_dependencies(ctx)
|
|
|
|
|
|
|
|
def _build_pdf(ctx):
|
2014-01-08 16:43:33 +01:00
|
|
|
ctx(
|
|
|
|
name = 'rst2pdf',
|
2014-06-20 23:01:12 +02:00
|
|
|
target = 'DOCS/man/mpv.pdf',
|
|
|
|
source = 'DOCS/man/mpv.rst',
|
2014-01-08 16:43:33 +01:00
|
|
|
rule = '${RST2PDF} -c --repeat-table-rows ${SRC} -o ${TGT}',
|
|
|
|
install_path = ctx.env.DOCDIR)
|
2013-07-16 13:28:28 +02:00
|
|
|
|
|
|
|
_add_rst_manual_dependencies(ctx)
|
|
|
|
|
2014-12-28 09:38:22 +01:00
|
|
|
def _all_includes(ctx):
|
|
|
|
return [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
|
|
|
|
ctx.dependencies_includes()
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
def build(ctx):
|
|
|
|
ctx.load('waf_customizations')
|
|
|
|
ctx.load('generators.sources')
|
|
|
|
|
2014-01-14 08:18:05 +01:00
|
|
|
ctx.file2string(
|
|
|
|
source = "TOOLS/osxbundle/mpv.app/Contents/Resources/icon.icns",
|
|
|
|
target = "osdep/macosx_icon.inc")
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
ctx.file2string(
|
|
|
|
source = "video/out/x11_icon.bin",
|
|
|
|
target = "video/out/x11_icon.inc")
|
|
|
|
|
|
|
|
ctx.file2string(
|
|
|
|
source = "etc/input.conf",
|
2013-12-17 01:23:09 +01:00
|
|
|
target = "input/input_conf.h")
|
2013-07-16 13:28:28 +02:00
|
|
|
|
2016-09-15 13:45:23 +02:00
|
|
|
ctx.file2string(
|
|
|
|
source = "etc/builtin.conf",
|
|
|
|
target = "player/builtin_conf.inc")
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
ctx.file2string(
|
|
|
|
source = "sub/osd_font.otf",
|
|
|
|
target = "sub/osd_font.h")
|
|
|
|
|
2014-11-19 18:51:53 +01:00
|
|
|
lua_files = ["defaults.lua", "assdraw.lua", "options.lua", "osc.lua",
|
|
|
|
"ytdl_hook.lua"]
|
|
|
|
for fn in lua_files:
|
|
|
|
fn = "player/lua/" + fn
|
|
|
|
ctx.file2string(source = fn, target = os.path.splitext(fn)[0] + ".inc")
|
2013-07-16 13:28:28 +02:00
|
|
|
|
|
|
|
ctx.matroska_header(
|
|
|
|
source = "demux/ebml.c demux/demux_mkv.c",
|
|
|
|
target = "ebml_types.h")
|
|
|
|
|
|
|
|
ctx.matroska_definitions(
|
|
|
|
source = "demux/ebml.c",
|
|
|
|
target = "ebml_defs.c")
|
|
|
|
|
2015-05-02 18:47:57 +02:00
|
|
|
if ctx.env.DEST_OS == 'win32':
|
|
|
|
main_fn_c = 'osdep/main-fn-win.c'
|
|
|
|
elif ctx.dependency_satisfied('cocoa'):
|
|
|
|
main_fn_c = 'osdep/main-fn-cocoa.c'
|
|
|
|
else:
|
|
|
|
main_fn_c = 'osdep/main-fn-unix.c'
|
2015-03-29 13:36:46 +02:00
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
getch2_c = {
|
2013-12-19 21:31:27 +01:00
|
|
|
'win32': 'osdep/terminal-win.c',
|
|
|
|
}.get(ctx.env.DEST_OS, "osdep/terminal-unix.c")
|
2013-07-16 13:28:28 +02:00
|
|
|
|
|
|
|
timer_c = {
|
|
|
|
'win32': 'osdep/timer-win2.c',
|
|
|
|
'darwin': 'osdep/timer-darwin.c',
|
|
|
|
}.get(ctx.env.DEST_OS, "osdep/timer-linux.c")
|
|
|
|
|
|
|
|
sources = [
|
|
|
|
## Audio
|
|
|
|
( "audio/audio.c" ),
|
|
|
|
( "audio/audio_buffer.c" ),
|
|
|
|
( "audio/chmap.c" ),
|
|
|
|
( "audio/chmap_sel.c" ),
|
|
|
|
( "audio/fmt-conversion.c" ),
|
|
|
|
( "audio/format.c" ),
|
|
|
|
( "audio/decode/ad_lavc.c" ),
|
|
|
|
( "audio/decode/ad_spdif.c" ),
|
|
|
|
( "audio/decode/dec_audio.c" ),
|
|
|
|
( "audio/filter/af.c" ),
|
|
|
|
( "audio/filter/af_channels.c" ),
|
|
|
|
( "audio/filter/af_drc.c" ),
|
|
|
|
( "audio/filter/af_equalizer.c" ),
|
|
|
|
( "audio/filter/af_format.c" ),
|
|
|
|
( "audio/filter/af_lavcac3enc.c" ),
|
2016-02-05 23:17:33 +01:00
|
|
|
( "audio/filter/af_lavfi.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "audio/filter/af_lavrresample.c" ),
|
|
|
|
( "audio/filter/af_pan.c" ),
|
2015-02-10 23:50:17 +01:00
|
|
|
( "audio/filter/af_rubberband.c", "rubberband" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "audio/filter/af_scaletempo.c" ),
|
|
|
|
( "audio/filter/af_volume.c" ),
|
|
|
|
( "audio/filter/tools.c" ),
|
|
|
|
( "audio/out/ao.c" ),
|
|
|
|
( "audio/out/ao_alsa.c", "alsa" ),
|
|
|
|
( "audio/out/ao_coreaudio.c", "coreaudio" ),
|
2015-05-05 21:47:19 +02:00
|
|
|
( "audio/out/ao_coreaudio_chmap.c", "coreaudio" ),
|
2014-10-23 09:55:17 +02:00
|
|
|
( "audio/out/ao_coreaudio_exclusive.c", "coreaudio" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "audio/out/ao_coreaudio_properties.c", "coreaudio" ),
|
|
|
|
( "audio/out/ao_coreaudio_utils.c", "coreaudio" ),
|
|
|
|
( "audio/out/ao_jack.c", "jack" ),
|
|
|
|
( "audio/out/ao_lavc.c", "encoding" ),
|
|
|
|
( "audio/out/ao_null.c" ),
|
|
|
|
( "audio/out/ao_openal.c", "openal" ),
|
2016-02-14 18:03:47 +01:00
|
|
|
( "audio/out/ao_opensles.c", "opensles" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "audio/out/ao_oss.c", "oss-audio" ),
|
|
|
|
( "audio/out/ao_pcm.c" ),
|
|
|
|
( "audio/out/ao_pulse.c", "pulse" ),
|
|
|
|
( "audio/out/ao_rsound.c", "rsound" ),
|
2014-01-25 00:30:28 +01:00
|
|
|
( "audio/out/ao_sdl.c", "sdl1" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "audio/out/ao_sdl.c", "sdl2" ),
|
|
|
|
( "audio/out/ao_sndio.c", "sndio" ),
|
|
|
|
( "audio/out/ao_wasapi.c", "wasapi" ),
|
2014-03-10 00:13:36 +01:00
|
|
|
( "audio/out/ao_wasapi_utils.c", "wasapi" ),
|
2014-11-17 12:37:51 +01:00
|
|
|
( "audio/out/ao_wasapi_changenotify.c", "wasapi" ),
|
2014-03-09 00:04:37 +01:00
|
|
|
( "audio/out/pull.c" ),
|
|
|
|
( "audio/out/push.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
|
|
|
|
## Core
|
2013-12-17 02:39:45 +01:00
|
|
|
( "common/av_common.c" ),
|
|
|
|
( "common/av_log.c" ),
|
|
|
|
( "common/codecs.c" ),
|
|
|
|
( "common/encode_lavc.c", "encoding" ),
|
|
|
|
( "common/common.c" ),
|
2014-04-13 14:01:55 +02:00
|
|
|
( "common/tags.c" ),
|
2013-12-17 02:39:45 +01:00
|
|
|
( "common/msg.c" ),
|
|
|
|
( "common/playlist.c" ),
|
|
|
|
( "common/version.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
|
|
|
|
## Demuxers
|
|
|
|
( "demux/codec_tags.c" ),
|
2015-05-19 21:36:21 +02:00
|
|
|
( "demux/cue.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "demux/demux.c" ),
|
|
|
|
( "demux/demux_cue.c" ),
|
2014-07-15 01:49:02 +02:00
|
|
|
( "demux/demux_disc.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "demux/demux_edl.c" ),
|
|
|
|
( "demux/demux_lavf.c" ),
|
stream: libarchive wrapper for reading compressed archives
This works similar to the existing .rar support, but uses libarchive.
libarchive supports a number of formats, including zip and (most of)
rar.
Unfortunately, seeking does not work too well. Most libarchive readers
do not support seeking, so it's emulated by skipping data until the
target position. On backwards seek, the file is reopened. This works
fine on a local machine (and if the file is not too large), but will
perform not so well over network connection.
This is disabled by default for now. One reason is that we try
libarchive on every file we open, before trying libavformat, and I'm not
sure if I trust libarchive that much yet. Another reason is that this
breaks multivolume rar support. While libarchive supports seeking in
rar, and (probably) supports multivolume archive, our support of
libarchive (probably) does not. I don't care about multivolume rar, but
vocal users do.
2015-08-17 00:55:26 +02:00
|
|
|
( "demux/demux_libarchive.c", "libarchive" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "demux/demux_mf.c" ),
|
|
|
|
( "demux/demux_mkv.c" ),
|
2015-02-17 23:47:37 +01:00
|
|
|
( "demux/demux_mkv_timeline.c" ),
|
2016-03-04 23:51:55 +01:00
|
|
|
( "demux/demux_null.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "demux/demux_playlist.c" ),
|
|
|
|
( "demux/demux_raw.c" ),
|
2015-03-24 21:29:09 +01:00
|
|
|
( "demux/demux_rar.c" ),
|
Rewrite ordered chapters and timeline stuff
This uses a different method to piece segments together. The old
approach basically changes to a new file (with a new start offset) any
time a segment ends. This meant waiting for audio/video end on segment
end, and then changing to the new segment all at once. It had a very
weird impact on the playback core, and some things (like truly gapless
segment transitions, or frame backstepping) just didn't work.
The new approach adds the demux_timeline pseudo-demuxer, which presents
an uniform packet stream from the many segments. This is pretty similar
to how ordered chapters are implemented everywhere else. It also reminds
of the FFmpeg concat pseudo-demuxer.
The "pure" version of this approach doesn't work though. Segments can
actually have different codec configurations (different extradata), and
subtitles are most likely broken too. (Subtitles have multiple corner
cases which break the pure stream-concatenation approach completely.)
To counter this, we do two things:
- Reinit the decoder with each segment. We go as far as allowing
concatenating files with completely different codecs for the sake
of EDL (which also uses the timeline infrastructure). A "lighter"
approach would try to make use of decoder mechanism to update e.g.
the extradata, but that seems fragile.
- Clip decoded data to segment boundaries. This is equivalent to
normal playback core mechanisms like hr-seek, but now the playback
core doesn't need to care about these things.
These two mechanisms are equivalent to what happened in the old
implementation, except they don't happen in the playback core anymore.
In other words, the playback core is completely relieved from timeline
implementation details. (Which honestly is exactly what I'm trying to
do here. I don't think ordered chapter behavior deserves improvement,
even if it's bad - but I want to get it out from the playback core.)
There is code duplication between audio and video decoder common code.
This is awful and could be shareable - but this will happen later.
Note that the audio path has some code to clip audio frames for the
purpose of codec preroll/gapless handling, but it's not shared as
sharing it would cause more pain than it would help.
2016-02-15 21:04:07 +01:00
|
|
|
( "demux/demux_timeline.c" ),
|
2014-07-05 17:00:23 +02:00
|
|
|
( "demux/demux_tv.c", "tv" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "demux/ebml.c" ),
|
2014-07-05 16:45:28 +02:00
|
|
|
( "demux/packet.c" ),
|
2015-02-17 23:46:12 +01:00
|
|
|
( "demux/timeline.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
|
2013-12-17 01:23:09 +01:00
|
|
|
## Input
|
2013-12-26 17:10:35 +01:00
|
|
|
( "input/cmd_list.c" ),
|
|
|
|
( "input/cmd_parse.c" ),
|
2014-01-04 16:59:22 +01:00
|
|
|
( "input/event.c" ),
|
2013-12-17 01:23:09 +01:00
|
|
|
( "input/input.c" ),
|
2016-03-17 09:27:30 +01:00
|
|
|
( "input/ipc.c" ),
|
|
|
|
( "input/ipc-unix.c", "!mingw" ),
|
|
|
|
( "input/ipc-win.c", "mingw" ),
|
2013-12-26 17:10:35 +01:00
|
|
|
( "input/keycodes.c" ),
|
2015-12-07 08:51:33 +01:00
|
|
|
( "input/pipe-win32.c", "mingw" ),
|
2013-12-17 01:23:09 +01:00
|
|
|
|
2013-12-17 02:39:45 +01:00
|
|
|
## Misc
|
2014-08-29 12:09:04 +02:00
|
|
|
( "misc/bstr.c" ),
|
2013-12-17 02:39:45 +01:00
|
|
|
( "misc/charset_conv.c" ),
|
2014-04-23 20:37:57 +02:00
|
|
|
( "misc/dispatch.c" ),
|
2014-10-16 11:48:18 +02:00
|
|
|
( "misc/json.c" ),
|
2016-08-28 19:33:52 +02:00
|
|
|
( "misc/node.c" ),
|
2014-04-23 20:37:57 +02:00
|
|
|
( "misc/ring.c" ),
|
Add Plan 9-style barriers
Plan 9 has a very interesting synchronization mechanism, the
rendezvous() call. A good property of this is that you don't need to
explicitly initialize and destroy a barrier object, unlike as with e.g.
POSIX barriers (which are mandatory to begin with). Upon "meeting", they
can exchange a value.
This mechanism will be nice to synchronize certain stages of
initialization between threads in the following commit.
Unlike Plan 9 rendezvous(), this is not implemented with a hashtable,
because that would require additional effort (especially if you want to
make it actually scele). Unlike the Plan 9 variant, we use intptr_t
instead of void* as type for the value, because I expect that we will be
mostly passing a status code as value and not a pointer. Converting an
integer to void* requires two cast (because the integer needs to be
intptr_t), the other way around it's only one cast.
We don't particularly care about performance in this case either. It's
simply not important for our use-case. So a simple linked list is used
for waiters, and on wakeup, all waiters are temporarily woken up.
2014-07-26 20:29:48 +02:00
|
|
|
( "misc/rendezvous.c" ),
|
2013-12-17 02:39:45 +01:00
|
|
|
|
2013-12-17 02:02:25 +01:00
|
|
|
## Options
|
|
|
|
( "options/m_config.c" ),
|
|
|
|
( "options/m_option.c" ),
|
|
|
|
( "options/m_property.c" ),
|
|
|
|
( "options/options.c" ),
|
|
|
|
( "options/parse_commandline.c" ),
|
|
|
|
( "options/parse_configfile.c" ),
|
|
|
|
( "options/path.c" ),
|
|
|
|
|
2013-12-17 00:53:22 +01:00
|
|
|
## Player
|
|
|
|
( "player/audio.c" ),
|
2014-02-10 21:01:35 +01:00
|
|
|
( "player/client.c" ),
|
2013-12-17 00:53:22 +01:00
|
|
|
( "player/command.c" ),
|
|
|
|
( "player/configfiles.c" ),
|
2015-09-20 18:05:06 +02:00
|
|
|
( "player/external_files.c" ),
|
2013-12-17 00:53:22 +01:00
|
|
|
( "player/loadfile.c" ),
|
|
|
|
( "player/main.c" ),
|
|
|
|
( "player/misc.c" ),
|
2016-02-05 23:19:56 +01:00
|
|
|
( "player/lavfi.c" ),
|
2013-12-17 01:15:48 +01:00
|
|
|
( "player/lua.c", "lua" ),
|
2013-12-17 00:53:22 +01:00
|
|
|
( "player/osd.c" ),
|
|
|
|
( "player/playloop.c" ),
|
|
|
|
( "player/screenshot.c" ),
|
2014-05-13 01:14:07 +02:00
|
|
|
( "player/scripting.c" ),
|
2013-12-17 00:53:22 +01:00
|
|
|
( "player/sub.c" ),
|
|
|
|
( "player/video.c" ),
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
## Streams
|
|
|
|
( "stream/ai_alsa1x.c", "alsa" ),
|
|
|
|
( "stream/ai_oss.c", "oss-audio" ),
|
|
|
|
( "stream/ai_sndio.c", "sndio" ),
|
|
|
|
( "stream/audio_in.c", "audio-input" ),
|
2013-11-28 19:28:38 +01:00
|
|
|
( "stream/cache.c" ),
|
2014-06-22 02:50:52 +02:00
|
|
|
( "stream/cache_file.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "stream/cookies.c" ),
|
|
|
|
( "stream/dvb_tune.c", "dvbin" ),
|
|
|
|
( "stream/frequencies.c", "tv" ),
|
|
|
|
( "stream/rar.c" ),
|
|
|
|
( "stream/stream.c" ),
|
|
|
|
( "stream/stream_avdevice.c" ),
|
2014-07-15 01:49:02 +02:00
|
|
|
( "stream/stream_bluray.c", "libbluray" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "stream/stream_cdda.c", "cdda" ),
|
|
|
|
( "stream/stream_dvb.c", "dvbin" ),
|
2014-07-15 01:49:02 +02:00
|
|
|
( "stream/stream_dvd.c", "dvdread" ),
|
|
|
|
( "stream/stream_dvd_common.c", "dvdread" ),
|
|
|
|
( "stream/stream_dvdnav.c", "dvdnav" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "stream/stream_edl.c" ),
|
|
|
|
( "stream/stream_file.c" ),
|
2016-08-07 18:10:05 +02:00
|
|
|
( "stream/stream_cb.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "stream/stream_lavf.c" ),
|
stream: libarchive wrapper for reading compressed archives
This works similar to the existing .rar support, but uses libarchive.
libarchive supports a number of formats, including zip and (most of)
rar.
Unfortunately, seeking does not work too well. Most libarchive readers
do not support seeking, so it's emulated by skipping data until the
target position. On backwards seek, the file is reopened. This works
fine on a local machine (and if the file is not too large), but will
perform not so well over network connection.
This is disabled by default for now. One reason is that we try
libarchive on every file we open, before trying libavformat, and I'm not
sure if I trust libarchive that much yet. Another reason is that this
breaks multivolume rar support. While libarchive supports seeking in
rar, and (probably) supports multivolume archive, our support of
libarchive (probably) does not. I don't care about multivolume rar, but
vocal users do.
2015-08-17 00:55:26 +02:00
|
|
|
( "stream/stream_libarchive.c", "libarchive" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "stream/stream_memory.c" ),
|
|
|
|
( "stream/stream_mf.c" ),
|
|
|
|
( "stream/stream_null.c" ),
|
|
|
|
( "stream/stream_rar.c" ),
|
|
|
|
( "stream/stream_smb.c", "libsmbclient" ),
|
|
|
|
( "stream/stream_tv.c", "tv" ),
|
|
|
|
( "stream/tv.c", "tv" ),
|
|
|
|
( "stream/tvi_dummy.c", "tv" ),
|
|
|
|
( "stream/tvi_v4l2.c", "tv-v4l2"),
|
|
|
|
|
|
|
|
## Subtitles
|
|
|
|
( "sub/ass_mp.c", "libass"),
|
|
|
|
( "sub/dec_sub.c" ),
|
|
|
|
( "sub/draw_bmp.c" ),
|
|
|
|
( "sub/img_convert.c" ),
|
2015-12-18 01:57:35 +01:00
|
|
|
( "sub/lavc_conv.c" ),
|
2013-11-24 12:58:06 +01:00
|
|
|
( "sub/osd.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "sub/osd_dummy.c", "dummy-osd" ),
|
|
|
|
( "sub/osd_libass.c", "libass-osd" ),
|
|
|
|
( "sub/sd_ass.c", "libass" ),
|
|
|
|
( "sub/sd_lavc.c" ),
|
|
|
|
|
|
|
|
## Video
|
|
|
|
( "video/csputils.c" ),
|
|
|
|
( "video/fmt-conversion.c" ),
|
2015-09-25 18:58:17 +02:00
|
|
|
( "video/gpu_memcpy.c", "sse4-intrinsics" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/image_writer.c" ),
|
|
|
|
( "video/img_format.c" ),
|
2016-05-09 19:42:03 +02:00
|
|
|
( "video/hwdec.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/mp_image.c" ),
|
|
|
|
( "video/mp_image_pool.c" ),
|
|
|
|
( "video/sws_utils.c" ),
|
|
|
|
( "video/vaapi.c", "vaapi" ),
|
|
|
|
( "video/vdpau.c", "vdpau" ),
|
2014-04-29 15:07:21 +02:00
|
|
|
( "video/vdpau_mixer.c", "vdpau" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/decode/dec_video.c"),
|
hwdec/opengl: Add support for CUDA and cuvid/NvDecode
Nvidia's "NvDecode" API (up until recently called "cuvid" is a cross
platform, but nvidia proprietary API that exposes their hardware
video decoding capabilities. It is analogous to their DXVA or VDPAU
support on Windows or Linux but without using platform specific API
calls.
As a rule, you'd rather use DXVA or VDPAU as these are more mature
and well supported APIs, but on Linux, VDPAU is falling behind the
hardware capabilities, and there's no sign that nvidia are making
the investments to update it.
Most concretely, this means that there is no VP8/9 or HEVC Main10
support in VDPAU. On the other hand, NvDecode does export vp8/9 and
partial support for HEVC Main10 (more on that below).
ffmpeg already has support in the form of the "cuvid" family of
decoders. Due to the design of the API, it is best exposed as a full
decoder rather than an hwaccel. As such, there are decoders like
h264_cuvid, hevc_cuvid, etc.
These decoders support two output paths today - in both cases, NV12
frames are returned, either in CUDA device memory or regular system
memory.
In the case of the system memory path, the decoders can be used
as-is in mpv today with a command line like:
mpv --vd=lavc:h264_cuvid foobar.mp4
Doing this will take advantage of hardware decoding, but the cost
of the memcpy to system memory adds up, especially for high
resolution video (4K etc).
To avoid that, we need an hwdec that takes advantage of CUDA's
OpenGL interop to copy from device memory into OpenGL textures.
That is what this change implements.
The process is relatively simple as only basic device context
aquisition needs to be done by us - the CUDA buffer pool is managed
by the decoder - thankfully.
The hwdec looks a bit like the vdpau interop one - the hwdec
maintains a single set of plane textures and each output frame
is repeatedly mapped into these textures to pass on.
The frames are always in NV12 format, at least until 10bit output
supports emerges.
The only slightly interesting part of the copying process is that
CUDA works by associating PBOs, so we need to define these for
each of the textures.
TODO Items:
* I need to add a download_image function for screenshots. This
would do the same copy to system memory that the decoder's
system memory output does.
* There are items to investigate on the ffmpeg side. There appears
to be a problem with timestamps for some content.
Final note: I mentioned HEVC Main10. While there is no 10bit output
support, NvDecode can return dithered 8bit NV12 so you can take
advantage of the hardware acceleration.
This particular mode requires compiling ffmpeg with a modified
header (or possibly the CUDA 8 RC) and is not upstream in ffmpeg
yet.
Usage:
You will need to specify vo=opengl and hwdec=cuda.
Note that hwdec=auto will probably not work as it will try to use
vdpau first.
mpv --hwdec=cuda --vo=opengl foobar.mp4
If you want to use filters that require frames in system memory,
just use the decoder directly without the hwdec, as documented
above.
2016-09-05 00:23:55 +02:00
|
|
|
( "video/decode/cuda.c", "cuda-gl" ),
|
2016-05-11 14:37:03 +02:00
|
|
|
( "video/decode/dxva2.c", "d3d-hwaccel" ),
|
|
|
|
( "video/decode/d3d11va.c", "d3d-hwaccel" ),
|
2016-06-28 20:04:16 +02:00
|
|
|
( "video/decode/d3d.c", "win32" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/decode/vaapi.c", "vaapi-hwaccel" ),
|
|
|
|
( "video/decode/vd_lavc.c" ),
|
2015-07-11 17:21:39 +02:00
|
|
|
( "video/decode/videotoolbox.c", "videotoolbox-hwaccel" ),
|
2015-05-28 21:56:13 +02:00
|
|
|
( "video/decode/vdpau.c", "vdpau-hwaccel" ),
|
2016-05-25 19:01:32 +02:00
|
|
|
( "video/filter/refqueue.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/filter/vf.c" ),
|
2014-07-30 22:44:35 +02:00
|
|
|
( "video/filter/vf_buffer.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/filter/vf_crop.c" ),
|
2016-05-28 18:23:17 +02:00
|
|
|
( "video/filter/vf_d3d11vpp.c", "d3d-hwaccel" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/filter/vf_dlopen.c", "dlopen" ),
|
|
|
|
( "video/filter/vf_dsize.c" ),
|
|
|
|
( "video/filter/vf_eq.c" ),
|
|
|
|
( "video/filter/vf_expand.c" ),
|
|
|
|
( "video/filter/vf_flip.c" ),
|
|
|
|
( "video/filter/vf_format.c" ),
|
2016-02-05 23:17:33 +01:00
|
|
|
( "video/filter/vf_gradfun.c" ),
|
|
|
|
( "video/filter/vf_lavfi.c" ),
|
|
|
|
( "video/filter/vf_mirror.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/filter/vf_noformat.c" ),
|
2016-02-05 23:17:33 +01:00
|
|
|
( "video/filter/vf_pullup.c" ),
|
|
|
|
( "video/filter/vf_rotate.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/filter/vf_scale.c" ),
|
2016-02-05 23:17:33 +01:00
|
|
|
( "video/filter/vf_stereo3d.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/filter/vf_sub.c" ),
|
2014-10-12 01:31:20 +02:00
|
|
|
( "video/filter/vf_vapoursynth.c", "vapoursynth-core" ),
|
2015-10-17 14:25:09 +02:00
|
|
|
( "video/filter/vf_vavpp.c", "vaapi"),
|
2014-04-29 15:07:21 +02:00
|
|
|
( "video/filter/vf_vdpaupp.c", "vdpau" ),
|
2015-07-09 01:50:38 +02:00
|
|
|
( "video/filter/vf_vdpaurb.c", "vdpau" ),
|
2016-02-05 23:17:33 +01:00
|
|
|
( "video/filter/vf_yadif.c" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/out/aspect.c" ),
|
|
|
|
( "video/out/bitmap_packer.c" ),
|
2014-10-05 22:31:33 +02:00
|
|
|
( "video/out/cocoa/video_view.m", "cocoa" ),
|
|
|
|
( "video/out/cocoa/events_view.m", "cocoa" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/out/cocoa/window.m", "cocoa" ),
|
|
|
|
( "video/out/cocoa_common.m", "cocoa" ),
|
|
|
|
( "video/out/dither.c" ),
|
|
|
|
( "video/out/filter_kernels.c" ),
|
2016-05-11 12:33:49 +02:00
|
|
|
( "video/out/opengl/angle_dynamic.c", "egl-angle" ),
|
2015-08-29 04:12:56 +02:00
|
|
|
( "video/out/opengl/common.c", "gl" ),
|
2015-12-19 12:59:07 +01:00
|
|
|
( "video/out/opengl/context.c", "gl" ),
|
2015-12-19 13:05:10 +01:00
|
|
|
( "video/out/opengl/context_angle.c", "egl-angle" ),
|
|
|
|
( "video/out/opengl/context_cocoa.c", "gl-cocoa" ),
|
|
|
|
( "video/out/opengl/context_drm_egl.c", "egl-drm" ),
|
|
|
|
( "video/out/opengl/context_dxinterop.c","gl-dxinterop" ),
|
2016-09-13 17:03:24 +02:00
|
|
|
( "video/out/opengl/context_mali_fbdev.c","mali-fbdev" ),
|
2015-12-19 13:05:10 +01:00
|
|
|
( "video/out/opengl/context_rpi.c", "rpi" ),
|
|
|
|
( "video/out/opengl/context_wayland.c", "gl-wayland" ),
|
|
|
|
( "video/out/opengl/context_w32.c", "gl-win32" ),
|
|
|
|
( "video/out/opengl/context_x11.c", "gl-x11" ),
|
|
|
|
( "video/out/opengl/context_x11egl.c", "egl-x11" ),
|
2015-12-19 12:45:07 +01:00
|
|
|
( "video/out/opengl/egl_helpers.c", "egl-helpers" ),
|
2016-05-12 20:08:49 +02:00
|
|
|
( "video/out/opengl/formats.c", "gl" ),
|
2015-08-29 04:12:56 +02:00
|
|
|
( "video/out/opengl/hwdec.c", "gl" ),
|
hwdec/opengl: Add support for CUDA and cuvid/NvDecode
Nvidia's "NvDecode" API (up until recently called "cuvid" is a cross
platform, but nvidia proprietary API that exposes their hardware
video decoding capabilities. It is analogous to their DXVA or VDPAU
support on Windows or Linux but without using platform specific API
calls.
As a rule, you'd rather use DXVA or VDPAU as these are more mature
and well supported APIs, but on Linux, VDPAU is falling behind the
hardware capabilities, and there's no sign that nvidia are making
the investments to update it.
Most concretely, this means that there is no VP8/9 or HEVC Main10
support in VDPAU. On the other hand, NvDecode does export vp8/9 and
partial support for HEVC Main10 (more on that below).
ffmpeg already has support in the form of the "cuvid" family of
decoders. Due to the design of the API, it is best exposed as a full
decoder rather than an hwaccel. As such, there are decoders like
h264_cuvid, hevc_cuvid, etc.
These decoders support two output paths today - in both cases, NV12
frames are returned, either in CUDA device memory or regular system
memory.
In the case of the system memory path, the decoders can be used
as-is in mpv today with a command line like:
mpv --vd=lavc:h264_cuvid foobar.mp4
Doing this will take advantage of hardware decoding, but the cost
of the memcpy to system memory adds up, especially for high
resolution video (4K etc).
To avoid that, we need an hwdec that takes advantage of CUDA's
OpenGL interop to copy from device memory into OpenGL textures.
That is what this change implements.
The process is relatively simple as only basic device context
aquisition needs to be done by us - the CUDA buffer pool is managed
by the decoder - thankfully.
The hwdec looks a bit like the vdpau interop one - the hwdec
maintains a single set of plane textures and each output frame
is repeatedly mapped into these textures to pass on.
The frames are always in NV12 format, at least until 10bit output
supports emerges.
The only slightly interesting part of the copying process is that
CUDA works by associating PBOs, so we need to define these for
each of the textures.
TODO Items:
* I need to add a download_image function for screenshots. This
would do the same copy to system memory that the decoder's
system memory output does.
* There are items to investigate on the ffmpeg side. There appears
to be a problem with timestamps for some content.
Final note: I mentioned HEVC Main10. While there is no 10bit output
support, NvDecode can return dithered 8bit NV12 so you can take
advantage of the hardware acceleration.
This particular mode requires compiling ffmpeg with a modified
header (or possibly the CUDA 8 RC) and is not upstream in ffmpeg
yet.
Usage:
You will need to specify vo=opengl and hwdec=cuda.
Note that hwdec=auto will probably not work as it will try to use
vdpau first.
mpv --hwdec=cuda --vo=opengl foobar.mp4
If you want to use filters that require frames in system memory,
just use the decoder directly without the hwdec, as documented
above.
2016-09-05 00:23:55 +02:00
|
|
|
( "video/out/opengl/hwdec_cuda.c", "cuda-gl" ),
|
2016-04-27 13:49:47 +02:00
|
|
|
( "video/out/opengl/hwdec_d3d11egl.c", "egl-angle" ),
|
video: remove d3d11 video processor use from OpenGL interop
We now have a video filter that uses the d3d11 video processor, so it
makes no sense to have one in the VO interop code. The VO uses it for
formats not directly supported by ANGLE (so the video data is converted
to a RGB texture, which ANGLE can take in).
Change this so that the video filter is automatically inserted if
needed. Move the code that maps RGB surfaces to its own inteorp backend.
Add a bunch of new image formats, which are used to enforce the new
constraints, and to automatically insert the filter only when needed.
The added vf mechanism to auto-insert the d3d11vpp filter is very dumb
and primitive, and will work only for this specific purpose. The format
negotiation mechanism in the filter chain is generally not very pretty,
and mostly broken as well. (libavfilter has a different mechanism, and
these mechanisms don't match well, so vf_lavfi uses some sort of hack.
It only works because hwaccel and non-hwaccel formats are strictly
separated.)
The RGB interop is now only used with older ANGLE versions. The only
reason I'm keeping it is because it's relatively isolated (uses only
existing mechanisms and adds no new concepts), and because I want to be
able to compare the behavior of the old code with the new one for
testing. It will be removed eventually.
If ANGLE has NV12 interop, P010 is now handled by converting to NV12
with the video processor, instead of converting it to RGB and using the
old mechanism to import that as a texture.
2016-05-29 17:13:22 +02:00
|
|
|
( "video/out/opengl/hwdec_d3d11eglrgb.c","egl-angle" ),
|
2015-08-29 04:12:56 +02:00
|
|
|
( "video/out/opengl/hwdec_dxva2.c", "gl-win32" ),
|
2016-02-17 19:17:52 +01:00
|
|
|
( "video/out/opengl/hwdec_dxva2gldx.c", "gl-dxinterop" ),
|
2016-03-08 04:53:24 +01:00
|
|
|
( "video/out/opengl/hwdec_dxva2egl.c", "egl-angle" ),
|
2016-09-12 15:08:38 +02:00
|
|
|
( "video/out/opengl/hwdec_osx.c", "videotoolbox-gl" ),
|
|
|
|
( "video/out/opengl/hwdec_rpi.c", "rpi" ),
|
2015-09-27 20:09:10 +02:00
|
|
|
( "video/out/opengl/hwdec_vaegl.c", "vaapi-egl" ),
|
2015-08-29 04:12:56 +02:00
|
|
|
( "video/out/opengl/hwdec_vaglx.c", "vaapi-glx" ),
|
|
|
|
( "video/out/opengl/hwdec_vdpau.c", "vdpau-gl-x11" ),
|
|
|
|
( "video/out/opengl/lcms.c", "gl" ),
|
|
|
|
( "video/out/opengl/osd.c", "gl" ),
|
2016-04-21 01:33:13 +02:00
|
|
|
( "video/out/opengl/user_shaders.c", "gl" ),
|
2015-08-29 04:12:56 +02:00
|
|
|
( "video/out/opengl/utils.c", "gl" ),
|
|
|
|
( "video/out/opengl/video.c", "gl" ),
|
2015-09-05 14:03:00 +02:00
|
|
|
( "video/out/opengl/video_shaders.c", "gl" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/out/vo.c" ),
|
|
|
|
( "video/out/vo_caca.c", "caca" ),
|
2015-04-15 18:14:14 +02:00
|
|
|
( "video/out/vo_drm.c", "drm" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/out/vo_direct3d.c", "direct3d" ),
|
|
|
|
( "video/out/vo_image.c" ),
|
|
|
|
( "video/out/vo_lavc.c", "encoding" ),
|
2015-03-29 15:12:11 +02:00
|
|
|
( "video/out/vo_rpi.c", "rpi" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/out/vo_null.c" ),
|
|
|
|
( "video/out/vo_opengl.c", "gl" ),
|
2014-12-09 17:47:02 +01:00
|
|
|
( "video/out/vo_opengl_cb.c", "gl" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/out/vo_sdl.c", "sdl2" ),
|
2015-09-27 20:09:10 +02:00
|
|
|
( "video/out/vo_vaapi.c", "vaapi-x11" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/out/vo_vdpau.c", "vdpau" ),
|
|
|
|
( "video/out/vo_wayland.c", "wayland" ),
|
2015-09-30 22:52:22 +02:00
|
|
|
( "video/out/vo_x11.c" , "x11" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/out/vo_xv.c", "xv" ),
|
2015-03-11 23:40:54 +01:00
|
|
|
( "video/out/w32_common.c", "win32" ),
|
2015-02-03 05:25:50 +01:00
|
|
|
( "video/out/win32/displayconfig.c", "win32" ),
|
2015-11-25 12:07:22 +01:00
|
|
|
( "video/out/win32/exclusive_hack.c", "gl-win32" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/out/wayland_common.c", "wayland" ),
|
2014-09-10 18:42:04 +02:00
|
|
|
( "video/out/wayland/buffer.c", "wayland" ),
|
|
|
|
( "video/out/wayland/memfile.c", "wayland" ),
|
2014-05-06 20:22:32 +02:00
|
|
|
( "video/out/win_state.c"),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "video/out/x11_common.c", "x11" ),
|
2015-04-19 09:39:58 +02:00
|
|
|
( "video/out/drm_common.c", "drm" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
|
|
|
|
## osdep
|
|
|
|
( getch2_c ),
|
|
|
|
( "osdep/io.c" ),
|
|
|
|
( "osdep/timer.c" ),
|
|
|
|
( timer_c ),
|
|
|
|
( "osdep/threads.c" ),
|
|
|
|
|
2014-10-17 17:07:01 +02:00
|
|
|
( "osdep/ar/HIDRemote.m", "apple-remote" ),
|
2015-05-02 18:09:01 +02:00
|
|
|
( "osdep/macosx_application.m", "cocoa" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "osdep/macosx_events.m", "cocoa" ),
|
osdep: add POSIX semaphore emulation for OSX
OSX is POSIX conformant, but it's a sad joke: it provides the
<semaphore.h> prototype as the standard demands, but they're empty
wrappers, and all functions just return ENOSYS.
Emulate them similar to how osdep/io.h emulate filesystem functions on
Windows. By including the header, working sem_* functions become
available.
To make it async-signal safe, use a pipe for wakeup (write() is AS-safe,
but mutexes can't be). Actually I'm not sure anymore if we really need
AS-safety, but for now the emulation can do it.
On Linux, the system provides a far more efficient and robust
implementation. We definitely want to avoid using the emulation if
possible, so this code is active on OSX only. For convenience we always
build the source file though, even if the implementation is disabled and
no actual code is generated.
(Linux provides working semaphores, but is formally not POSIX
conformant. On OSX it's the opposite. Is POSIX a complete joke?)
2014-09-10 03:09:41 +02:00
|
|
|
( "osdep/semaphore_osx.c" ),
|
2015-04-15 22:43:02 +02:00
|
|
|
( "osdep/subprocess.c" ),
|
2014-11-22 07:21:33 +01:00
|
|
|
( "osdep/subprocess-posix.c", "posix-spawn" ),
|
|
|
|
( "osdep/subprocess-win.c", "os-win32" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "osdep/path-macosx.m", "cocoa" ),
|
2015-05-01 21:13:44 +02:00
|
|
|
( "osdep/path-unix.c"),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "osdep/path-win.c", "os-win32" ),
|
|
|
|
( "osdep/path-win.c", "os-cygwin" ),
|
|
|
|
( "osdep/glob-win.c", "glob-win32-replacement" ),
|
2014-01-19 14:20:02 +01:00
|
|
|
( "osdep/w32_keyboard.c", "os-win32" ),
|
|
|
|
( "osdep/w32_keyboard.c", "os-cygwin" ),
|
2016-01-11 14:39:19 +01:00
|
|
|
( "osdep/windows_utils.c", "win32" ),
|
2013-07-16 13:28:28 +02:00
|
|
|
( "osdep/mpv.rc", "win32-executable" ),
|
2015-01-01 15:10:42 +01:00
|
|
|
( "osdep/win32/pthread.c", "win32-internal-pthreads"),
|
2016-02-07 13:27:46 +01:00
|
|
|
( "osdep/android/strnlen.c", "android"),
|
2013-07-16 13:28:28 +02:00
|
|
|
|
|
|
|
## tree_allocator
|
|
|
|
"ta/ta.c", "ta/ta_talloc.c", "ta/ta_utils.c"
|
|
|
|
]
|
|
|
|
|
|
|
|
if ctx.dependency_satisfied('win32-executable'):
|
|
|
|
from waflib import TaskGen
|
|
|
|
|
|
|
|
TaskGen.declare_chain(
|
|
|
|
name = 'windres',
|
|
|
|
rule = '${WINDRES} ${WINDRES_FLAGS} ${SRC} ${TGT}',
|
|
|
|
ext_in = '.rc',
|
|
|
|
ext_out = '-rc.o',
|
|
|
|
color = 'PINK')
|
|
|
|
|
|
|
|
ctx.env.WINDRES_FLAGS = [
|
|
|
|
'--include-dir={0}'.format(ctx.bldnode.abspath()),
|
|
|
|
'--include-dir={0}'.format(ctx.srcnode.abspath())
|
|
|
|
]
|
|
|
|
|
|
|
|
for node in 'osdep/mpv.exe.manifest etc/mpv-icon.ico'.split():
|
|
|
|
ctx.add_manual_dependency(
|
|
|
|
ctx.path.find_node('osdep/mpv.rc'),
|
|
|
|
ctx.path.find_node(node))
|
|
|
|
|
2015-07-17 09:39:52 +02:00
|
|
|
version = ctx.bldnode.find_node('version.h')
|
|
|
|
if version:
|
|
|
|
ctx.add_manual_dependency(
|
|
|
|
ctx.path.find_node('osdep/mpv.rc'),
|
|
|
|
version)
|
2015-07-15 15:23:10 +02:00
|
|
|
|
2014-12-28 09:38:22 +01:00
|
|
|
if ctx.dependency_satisfied('cplayer') or ctx.dependency_satisfied('test'):
|
|
|
|
ctx(
|
|
|
|
target = "objects",
|
|
|
|
source = ctx.filtered_sources(sources),
|
|
|
|
use = ctx.dependencies_use(),
|
|
|
|
includes = _all_includes(ctx),
|
|
|
|
features = "c",
|
|
|
|
)
|
|
|
|
|
2014-08-04 10:54:22 +02:00
|
|
|
if ctx.dependency_satisfied('cplayer'):
|
|
|
|
ctx(
|
|
|
|
target = "mpv",
|
2015-03-29 13:36:46 +02:00
|
|
|
source = main_fn_c,
|
2014-12-29 18:30:24 +01:00
|
|
|
use = ctx.dependencies_use() + ['objects'],
|
2014-12-28 09:38:22 +01:00
|
|
|
includes = _all_includes(ctx),
|
2014-08-04 10:54:22 +02:00
|
|
|
features = "c cprogram",
|
2014-11-01 10:57:10 +01:00
|
|
|
install_path = ctx.env.BINDIR
|
2014-08-04 10:54:22 +02:00
|
|
|
)
|
2016-01-11 22:13:16 +01:00
|
|
|
for f in ['mpv.conf', 'input.conf', 'mplayer-input.conf', \
|
2014-10-11 16:16:02 +02:00
|
|
|
'restore-old-bindings.conf']:
|
|
|
|
ctx.install_as(os.path.join(ctx.env.DOCDIR, f),
|
|
|
|
os.path.join('etc/', f))
|
2013-07-16 13:28:28 +02:00
|
|
|
|
2014-11-21 01:47:30 +01:00
|
|
|
if ctx.env.DEST_OS == 'win32':
|
|
|
|
wrapctx = ctx(
|
|
|
|
target = "mpv",
|
|
|
|
source = ['osdep/win32-console-wrapper.c'],
|
|
|
|
features = "c cprogram",
|
|
|
|
install_path = ctx.env.BINDIR
|
|
|
|
)
|
|
|
|
|
|
|
|
wrapctx.env.cprogram_PATTERN = "%s.com"
|
|
|
|
wrapflags = ['-municode', '-mconsole']
|
|
|
|
wrapctx.env.CFLAGS = wrapflags
|
|
|
|
wrapctx.env.LAST_LINKFLAGS = wrapflags
|
|
|
|
|
2014-12-28 09:38:22 +01:00
|
|
|
if ctx.dependency_satisfied('test'):
|
|
|
|
for test in ctx.path.ant_glob("test/*.c"):
|
|
|
|
ctx(
|
2016-05-29 19:33:30 +02:00
|
|
|
target = os.path.splitext(test.srcpath())[0],
|
|
|
|
source = test.srcpath(),
|
|
|
|
use = ctx.dependencies_use() + ['objects'],
|
|
|
|
includes = _all_includes(ctx),
|
|
|
|
features = "c cprogram",
|
|
|
|
install_path = None,
|
2014-12-28 09:38:22 +01:00
|
|
|
)
|
2014-11-21 01:47:30 +01:00
|
|
|
|
2014-06-16 11:22:46 +02:00
|
|
|
build_shared = ctx.dependency_satisfied('libmpv-shared')
|
|
|
|
build_static = ctx.dependency_satisfied('libmpv-static')
|
|
|
|
if build_shared or build_static:
|
|
|
|
if build_shared:
|
2014-08-12 19:19:20 +02:00
|
|
|
waftoolsdir = os.path.join(os.path.dirname(__file__), "waftools")
|
|
|
|
ctx.load("syms", tooldir=waftoolsdir)
|
2016-03-11 17:22:50 +01:00
|
|
|
vre = '#define MPV_CLIENT_API_VERSION MPV_MAKE_VERSION\((.*), (.*)\)'
|
2014-08-05 02:23:14 +02:00
|
|
|
libmpv_header = ctx.path.find_node("libmpv/client.h").read()
|
2016-03-11 17:22:50 +01:00
|
|
|
major, minor = re.search(vre, libmpv_header).groups()
|
2014-08-05 02:23:14 +02:00
|
|
|
libversion = major + '.' + minor + '.0'
|
2014-06-20 19:21:11 +02:00
|
|
|
|
2014-06-16 11:22:46 +02:00
|
|
|
def _build_libmpv(shared):
|
|
|
|
features = "c "
|
|
|
|
if shared:
|
|
|
|
features += "cshlib syms"
|
|
|
|
else:
|
|
|
|
features += "cstlib"
|
2016-02-08 21:39:57 +01:00
|
|
|
|
|
|
|
libmpv_kwargs = {
|
|
|
|
"target": "mpv",
|
|
|
|
"source": ctx.filtered_sources(sources),
|
|
|
|
"use": ctx.dependencies_use(),
|
|
|
|
"includes": [ctx.bldnode.abspath(), ctx.srcnode.abspath()] + \
|
|
|
|
ctx.dependencies_includes(),
|
|
|
|
"features": features,
|
|
|
|
"export_symbols_def": "libmpv/mpv.def",
|
|
|
|
"install_path": ctx.env.LIBDIR,
|
|
|
|
}
|
|
|
|
|
2016-07-29 00:03:19 +02:00
|
|
|
if shared and ctx.dependency_satisfied('android'):
|
|
|
|
# for Android we just add the linker flag without version
|
|
|
|
# as we still need the SONAME for proper linkage.
|
|
|
|
# (LINKFLAGS logic taken from waf's apply_vnum in ccroot.py)
|
|
|
|
v=ctx.env.SONAME_ST%'libmpv.so'
|
|
|
|
ctx.env.append_value('LINKFLAGS',v.split())
|
|
|
|
else:
|
2016-02-08 21:39:57 +01:00
|
|
|
# for all other configurations we want SONAME to be used
|
|
|
|
libmpv_kwargs["vnum"] = libversion
|
|
|
|
|
|
|
|
ctx(**libmpv_kwargs)
|
|
|
|
|
2014-06-16 11:22:46 +02:00
|
|
|
if build_shared:
|
|
|
|
_build_libmpv(True)
|
|
|
|
if build_static:
|
|
|
|
_build_libmpv(False)
|
2014-02-10 21:25:22 +01:00
|
|
|
|
2014-08-07 23:45:40 +02:00
|
|
|
def get_deps():
|
|
|
|
res = ""
|
|
|
|
for k in ctx.env.keys():
|
|
|
|
if k.startswith("LIB_") and k != "LIB_ST":
|
|
|
|
res += " ".join(["-l" + x for x in ctx.env[k]]) + " "
|
|
|
|
return res
|
|
|
|
|
2014-03-11 16:55:49 +01:00
|
|
|
ctx(
|
|
|
|
target = 'libmpv/mpv.pc',
|
|
|
|
source = 'libmpv/mpv.pc.in',
|
|
|
|
features = 'subst',
|
|
|
|
PREFIX = ctx.env.PREFIX,
|
|
|
|
LIBDIR = ctx.env.LIBDIR,
|
|
|
|
INCDIR = ctx.env.INCDIR,
|
2014-03-12 00:40:55 +01:00
|
|
|
VERSION = libversion,
|
2014-08-07 23:45:40 +02:00
|
|
|
PRIV_LIBS = get_deps(),
|
2014-03-11 16:55:49 +01:00
|
|
|
)
|
|
|
|
|
2016-08-07 18:10:05 +02:00
|
|
|
headers = ["client.h", "qthelper.hpp", "opengl_cb.h", "stream_cb.h"]
|
2014-02-10 21:25:22 +01:00
|
|
|
for f in headers:
|
2014-03-11 17:06:06 +01:00
|
|
|
ctx.install_as(ctx.env.INCDIR + '/mpv/' + f, 'libmpv/' + f)
|
2014-02-10 21:25:22 +01:00
|
|
|
|
2014-03-11 16:55:49 +01:00
|
|
|
ctx.install_as(ctx.env.LIBDIR + '/pkgconfig/mpv.pc', 'libmpv/mpv.pc')
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
if ctx.dependency_satisfied("vf-dlopen-filters"):
|
2014-12-04 10:39:11 +01:00
|
|
|
dlfilters = "telecine tile rectangle framestep ildetect".split()
|
2013-07-16 13:28:28 +02:00
|
|
|
for dlfilter in dlfilters:
|
|
|
|
ctx(
|
|
|
|
target = dlfilter,
|
|
|
|
source = ['TOOLS/vf_dlopen/'+dlfilter+'.c',
|
|
|
|
'TOOLS/vf_dlopen/filterutils.c'],
|
|
|
|
includes = [ctx.srcnode.abspath() + '/video/filter'],
|
|
|
|
features = 'c cshlib',
|
|
|
|
install_path = ctx.env.LIBDIR + '/mpv' )
|
|
|
|
|
2015-12-29 20:57:09 +01:00
|
|
|
if ctx.dependency_satisfied('html-build'):
|
|
|
|
_build_html(ctx)
|
|
|
|
|
2013-07-16 13:28:28 +02:00
|
|
|
if ctx.dependency_satisfied('manpage-build'):
|
|
|
|
_build_man(ctx)
|
|
|
|
|
|
|
|
if ctx.dependency_satisfied('pdf-build'):
|
|
|
|
_build_pdf(ctx)
|
|
|
|
|
2014-11-28 22:25:54 +01:00
|
|
|
if ctx.dependency_satisfied('cplayer'):
|
2014-06-08 16:00:43 +02:00
|
|
|
|
2014-11-28 22:25:54 +01:00
|
|
|
if ctx.dependency_satisfied('zsh-comp'):
|
2016-09-10 21:19:59 +02:00
|
|
|
ctx.zshcomp(target = "etc/_mpv", source = "TOOLS/zsh.pl")
|
2014-11-28 22:25:54 +01:00
|
|
|
ctx.install_files(
|
|
|
|
ctx.env.ZSHDIR,
|
|
|
|
['etc/_mpv'])
|
|
|
|
|
|
|
|
ctx.install_files(
|
|
|
|
ctx.env.DATADIR + '/applications',
|
|
|
|
['etc/mpv.desktop'] )
|
2013-07-16 13:28:28 +02:00
|
|
|
|
2016-02-20 22:39:04 +01:00
|
|
|
if ctx.dependency_satisfied('encoding'):
|
|
|
|
ctx.install_files(ctx.env.CONFDIR, ['etc/encoding-profiles.conf'] )
|
2013-12-28 16:32:49 +01:00
|
|
|
|
2014-11-28 22:25:54 +01:00
|
|
|
for size in '16x16 32x32 64x64'.split():
|
|
|
|
ctx.install_as(
|
|
|
|
ctx.env.DATADIR + '/icons/hicolor/' + size + '/apps/mpv.png',
|
|
|
|
'etc/mpv-icon-8bit-' + size + '.png')
|
2015-12-01 08:02:52 +01:00
|
|
|
|
|
|
|
ctx.install_as(
|
|
|
|
ctx.env.DATADIR + '/icons/hicolor/scalable/apps/mpv.svg',
|
|
|
|
'etc/mpv-gradient.svg')
|
2016-03-10 10:15:48 +01:00
|
|
|
|
|
|
|
ctx.install_files(
|
|
|
|
ctx.env.DATADIR + '/icons/hicolor/symbolic/apps',
|
|
|
|
['etc/mpv-symbolic.svg'])
|