2021-11-07 19:28:16 +00:00
|
|
|
project('mpv',
|
|
|
|
'c',
|
|
|
|
license: ['GPL2+', 'LGPL2.1+'],
|
|
|
|
version: files('./VERSION'),
|
2023-05-01 17:05:00 +00:00
|
|
|
meson_version: '>=0.62.0',
|
2021-11-07 19:28:16 +00:00
|
|
|
default_options: [
|
2024-05-20 11:53:13 +00:00
|
|
|
'backend_max_links=16',
|
2021-11-07 19:28:16 +00:00
|
|
|
'buildtype=debugoptimized',
|
|
|
|
'b_lundef=false',
|
|
|
|
'c_std=c11',
|
2024-06-15 20:19:03 +00:00
|
|
|
'cpp_std=c++20',
|
|
|
|
'cpp_eh=default',
|
2024-03-08 06:50:25 +00:00
|
|
|
'warning_level=2',
|
2021-11-07 19:28:16 +00:00
|
|
|
]
|
|
|
|
)
|
|
|
|
|
|
|
|
build_root = meson.project_build_root()
|
|
|
|
source_root = meson.project_source_root()
|
2023-10-29 15:15:40 +00:00
|
|
|
python = find_program('python3')
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2022-08-12 18:02:41 +00:00
|
|
|
# ffmpeg
|
2024-06-21 17:22:29 +00:00
|
|
|
libavcodec = dependency('libavcodec', version: '>= 60.31.102')
|
|
|
|
libavfilter = dependency('libavfilter', version: '>= 9.12.100')
|
|
|
|
libavformat = dependency('libavformat', version: '>= 60.16.100')
|
|
|
|
libavutil = dependency('libavutil', version: '>= 58.29.100')
|
|
|
|
libswresample = dependency('libswresample', version: '>= 4.12.100')
|
|
|
|
libswscale = dependency('libswscale', version: '>= 7.5.100')
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2024-02-10 19:44:46 +00:00
|
|
|
libplacebo = dependency('libplacebo', version: '>=6.338.2',
|
|
|
|
default_options: ['default_library=static', 'demos=false'])
|
2023-09-19 21:20:26 +00:00
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
libass = dependency('libass', version: '>= 0.12.2')
|
|
|
|
|
2022-06-15 22:06:56 +00:00
|
|
|
# the dependency order of libass -> ffmpeg is necessary due to
|
|
|
|
# static linking symbol resolution between fontconfig and MinGW
|
|
|
|
dependencies = [libass,
|
2022-08-12 18:02:41 +00:00
|
|
|
libavcodec,
|
|
|
|
libavfilter,
|
|
|
|
libavformat,
|
|
|
|
libavutil,
|
2023-09-19 21:20:26 +00:00
|
|
|
libplacebo,
|
2022-08-12 18:02:41 +00:00
|
|
|
libswresample,
|
2023-09-15 14:51:44 +00:00
|
|
|
libswscale]
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2022-08-13 00:25:50 +00:00
|
|
|
# Keeps track of all enabled/disabled features
|
|
|
|
features = {
|
|
|
|
'debug': get_option('debug'),
|
|
|
|
'ffmpeg': true,
|
|
|
|
'gpl': get_option('gpl'),
|
|
|
|
'libass': true,
|
2023-09-19 21:20:26 +00:00
|
|
|
'libplacebo': true,
|
2022-08-13 00:25:50 +00:00
|
|
|
}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
# generic sources
|
|
|
|
sources = files(
|
|
|
|
## Audio
|
|
|
|
'audio/aframe.c',
|
|
|
|
'audio/chmap.c',
|
2024-06-21 16:24:30 +00:00
|
|
|
'audio/chmap_avchannel.c',
|
2021-11-07 19:28:16 +00:00
|
|
|
'audio/chmap_sel.c',
|
|
|
|
'audio/decode/ad_lavc.c',
|
|
|
|
'audio/decode/ad_spdif.c',
|
|
|
|
'audio/filter/af_drop.c',
|
|
|
|
'audio/filter/af_format.c',
|
|
|
|
'audio/filter/af_lavcac3enc.c',
|
|
|
|
'audio/filter/af_scaletempo.c',
|
|
|
|
'audio/filter/af_scaletempo2.c',
|
|
|
|
'audio/filter/af_scaletempo2_internals.c',
|
|
|
|
'audio/fmt-conversion.c',
|
|
|
|
'audio/format.c',
|
|
|
|
'audio/out/ao.c',
|
|
|
|
'audio/out/ao_lavc.c',
|
|
|
|
'audio/out/ao_null.c',
|
|
|
|
'audio/out/ao_pcm.c',
|
|
|
|
'audio/out/buffer.c',
|
|
|
|
|
|
|
|
## Core
|
|
|
|
'common/av_common.c',
|
|
|
|
'common/av_log.c',
|
|
|
|
'common/codecs.c',
|
|
|
|
'common/common.c',
|
|
|
|
'common/encode_lavc.c',
|
|
|
|
'common/msg.c',
|
|
|
|
'common/playlist.c',
|
|
|
|
'common/recorder.c',
|
|
|
|
'common/stats.c',
|
|
|
|
'common/tags.c',
|
|
|
|
'common/version.c',
|
|
|
|
|
|
|
|
## Demuxers
|
|
|
|
'demux/codec_tags.c',
|
|
|
|
'demux/cue.c',
|
|
|
|
'demux/cache.c',
|
|
|
|
'demux/demux.c',
|
|
|
|
'demux/demux_cue.c',
|
|
|
|
'demux/demux_disc.c',
|
|
|
|
'demux/demux_edl.c',
|
|
|
|
'demux/demux_lavf.c',
|
|
|
|
'demux/demux_mf.c',
|
|
|
|
'demux/demux_mkv.c',
|
|
|
|
'demux/demux_mkv_timeline.c',
|
|
|
|
'demux/demux_null.c',
|
|
|
|
'demux/demux_playlist.c',
|
|
|
|
'demux/demux_raw.c',
|
|
|
|
'demux/demux_timeline.c',
|
|
|
|
'demux/ebml.c',
|
|
|
|
'demux/packet.c',
|
|
|
|
'demux/timeline.c',
|
|
|
|
|
|
|
|
## Filters
|
|
|
|
'filters/f_async_queue.c',
|
|
|
|
'filters/f_autoconvert.c',
|
|
|
|
'filters/f_auto_filters.c',
|
|
|
|
'filters/f_decoder_wrapper.c',
|
|
|
|
'filters/f_demux_in.c',
|
|
|
|
'filters/f_hwtransfer.c',
|
|
|
|
'filters/f_lavfi.c',
|
|
|
|
'filters/f_output_chain.c',
|
|
|
|
'filters/f_swresample.c',
|
|
|
|
'filters/f_swscale.c',
|
|
|
|
'filters/f_utils.c',
|
|
|
|
'filters/filter.c',
|
|
|
|
'filters/frame.c',
|
|
|
|
'filters/user_filters.c',
|
|
|
|
|
|
|
|
## Input
|
|
|
|
'input/cmd.c',
|
|
|
|
'input/event.c',
|
|
|
|
'input/input.c',
|
|
|
|
'input/ipc.c',
|
|
|
|
'input/keycodes.c',
|
|
|
|
|
|
|
|
## Misc
|
|
|
|
'misc/bstr.c',
|
|
|
|
'misc/charset_conv.c',
|
|
|
|
'misc/dispatch.c',
|
2024-02-19 08:41:45 +00:00
|
|
|
'misc/io_utils.c',
|
2021-11-07 19:28:16 +00:00
|
|
|
'misc/json.c',
|
2024-04-17 16:42:15 +00:00
|
|
|
'misc/language.c',
|
2021-11-07 19:28:16 +00:00
|
|
|
'misc/natural_sort.c',
|
|
|
|
'misc/node.c',
|
2024-02-19 09:11:25 +00:00
|
|
|
'misc/path_utils.c',
|
2022-08-15 01:28:54 +00:00
|
|
|
'misc/random.c',
|
2021-11-07 19:28:16 +00:00
|
|
|
'misc/rendezvous.c',
|
|
|
|
'misc/thread_pool.c',
|
|
|
|
'misc/thread_tools.c',
|
|
|
|
|
|
|
|
## Options
|
|
|
|
'options/m_config_core.c',
|
|
|
|
'options/m_config_frontend.c',
|
|
|
|
'options/m_option.c',
|
|
|
|
'options/m_property.c',
|
|
|
|
'options/options.c',
|
|
|
|
'options/parse_commandline.c',
|
|
|
|
'options/parse_configfile.c',
|
|
|
|
'options/path.c',
|
|
|
|
|
|
|
|
## Player
|
|
|
|
'player/audio.c',
|
|
|
|
'player/client.c',
|
|
|
|
'player/command.c',
|
|
|
|
'player/configfiles.c',
|
|
|
|
'player/external_files.c',
|
|
|
|
'player/loadfile.c',
|
|
|
|
'player/main.c',
|
|
|
|
'player/misc.c',
|
|
|
|
'player/osd.c',
|
|
|
|
'player/playloop.c',
|
|
|
|
'player/screenshot.c',
|
|
|
|
'player/scripting.c',
|
|
|
|
'player/sub.c',
|
|
|
|
'player/video.c',
|
|
|
|
|
|
|
|
## Streams
|
|
|
|
'stream/cookies.c',
|
|
|
|
'stream/stream.c',
|
|
|
|
'stream/stream_avdevice.c',
|
|
|
|
'stream/stream_cb.c',
|
|
|
|
'stream/stream_concat.c',
|
|
|
|
'stream/stream_edl.c',
|
|
|
|
'stream/stream_file.c',
|
|
|
|
'stream/stream_lavf.c',
|
|
|
|
'stream/stream_memory.c',
|
|
|
|
'stream/stream_mf.c',
|
|
|
|
'stream/stream_null.c',
|
|
|
|
'stream/stream_slice.c',
|
|
|
|
|
|
|
|
## Subtitles
|
|
|
|
'sub/ass_mp.c',
|
|
|
|
'sub/dec_sub.c',
|
|
|
|
'sub/draw_bmp.c',
|
|
|
|
'sub/filter_sdh.c',
|
|
|
|
'sub/img_convert.c',
|
|
|
|
'sub/lavc_conv.c',
|
|
|
|
'sub/osd.c',
|
|
|
|
'sub/osd_libass.c',
|
|
|
|
'sub/sd_ass.c',
|
|
|
|
'sub/sd_lavc.c',
|
|
|
|
|
|
|
|
## Video
|
|
|
|
'video/csputils.c',
|
|
|
|
'video/decode/vd_lavc.c',
|
|
|
|
'video/filter/refqueue.c',
|
|
|
|
'video/filter/vf_format.c',
|
|
|
|
'video/filter/vf_sub.c',
|
|
|
|
'video/fmt-conversion.c',
|
|
|
|
'video/hwdec.c',
|
|
|
|
'video/image_loader.c',
|
|
|
|
'video/image_writer.c',
|
|
|
|
'video/img_format.c',
|
|
|
|
'video/mp_image.c',
|
|
|
|
'video/mp_image_pool.c',
|
|
|
|
'video/out/aspect.c',
|
|
|
|
'video/out/bitmap_packer.c',
|
|
|
|
'video/out/dither.c',
|
|
|
|
'video/out/dr_helper.c',
|
|
|
|
'video/out/filter_kernels.c',
|
|
|
|
'video/out/gpu/context.c',
|
|
|
|
'video/out/gpu/error_diffusion.c',
|
|
|
|
'video/out/gpu/hwdec.c',
|
|
|
|
'video/out/gpu/lcms.c',
|
|
|
|
'video/out/gpu/libmpv_gpu.c',
|
|
|
|
'video/out/gpu/osd.c',
|
|
|
|
'video/out/gpu/ra.c',
|
|
|
|
'video/out/gpu/shader_cache.c',
|
|
|
|
'video/out/gpu/spirv.c',
|
|
|
|
'video/out/gpu/user_shaders.c',
|
|
|
|
'video/out/gpu/utils.c',
|
|
|
|
'video/out/gpu/video.c',
|
|
|
|
'video/out/gpu/video_shaders.c',
|
|
|
|
'video/out/libmpv_sw.c',
|
|
|
|
'video/out/vo.c',
|
|
|
|
'video/out/vo_gpu.c',
|
|
|
|
'video/out/vo_image.c',
|
|
|
|
'video/out/vo_lavc.c',
|
|
|
|
'video/out/vo_libmpv.c',
|
|
|
|
'video/out/vo_null.c',
|
|
|
|
'video/out/vo_tct.c',
|
2022-12-13 14:58:13 +00:00
|
|
|
'video/out/vo_kitty.c',
|
2021-11-07 19:28:16 +00:00
|
|
|
'video/out/win_state.c',
|
|
|
|
'video/repack.c',
|
|
|
|
'video/sws_utils.c',
|
|
|
|
|
2023-09-19 21:20:26 +00:00
|
|
|
## libplacebo
|
|
|
|
'video/out/placebo/ra_pl.c',
|
|
|
|
'video/out/placebo/utils.c',
|
|
|
|
'video/out/vo_gpu_next.c',
|
|
|
|
'video/out/gpu_next/context.c',
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
## osdep
|
|
|
|
'osdep/io.c',
|
2024-02-27 15:55:29 +00:00
|
|
|
'osdep/semaphore-mac.c',
|
2021-11-07 19:28:16 +00:00
|
|
|
'osdep/subprocess.c',
|
|
|
|
'osdep/timer.c',
|
|
|
|
|
|
|
|
## tree_allocator
|
|
|
|
'ta/ta.c',
|
|
|
|
'ta/ta_talloc.c',
|
|
|
|
'ta/ta_utils.c'
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
# compiler stuff
|
|
|
|
cc = meson.get_compiler('c')
|
|
|
|
|
2023-11-24 06:19:19 +00:00
|
|
|
flags = ['-D_FILE_OFFSET_BITS=64']
|
2021-11-07 19:28:16 +00:00
|
|
|
link_flags = []
|
|
|
|
|
2024-06-04 19:51:26 +00:00
|
|
|
test_flags = ['-Wdisabled-optimization',
|
2021-11-07 19:28:16 +00:00
|
|
|
'-Wempty-body',
|
2024-06-04 19:51:26 +00:00
|
|
|
'-Wformat',
|
|
|
|
'-Wimplicit-fallthrough',
|
|
|
|
'-Wmissing-prototypes',
|
|
|
|
'-Wparentheses',
|
|
|
|
'-Wpointer-arith',
|
|
|
|
'-Wshadow',
|
2021-11-07 19:28:16 +00:00
|
|
|
'-Wstrict-prototypes',
|
2024-06-04 19:51:26 +00:00
|
|
|
'-Wundef',
|
2021-11-07 19:28:16 +00:00
|
|
|
'-Wvla',
|
2024-06-04 19:51:26 +00:00
|
|
|
'-Werror=implicit-function-declaration',
|
|
|
|
'-Wno-cast-function-type',
|
|
|
|
'-Wno-format-zero-length',
|
|
|
|
'-Wno-missing-field-initializers',
|
|
|
|
'-Wno-pointer-sign',
|
|
|
|
'-Wno-sign-compare',
|
|
|
|
'-Wno-switch',
|
|
|
|
'-Wno-unused-parameter',
|
2024-06-05 17:30:11 +00:00
|
|
|
'-fno-math-errno',
|
2024-06-05 17:31:52 +00:00
|
|
|
'-fno-signed-zeros',
|
|
|
|
'-fno-trapping-math']
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
flags += cc.get_supported_arguments(test_flags)
|
|
|
|
|
2021-11-15 00:34:51 +00:00
|
|
|
if cc.has_multi_arguments('-Wformat', '-Werror=format-security')
|
2024-06-04 19:51:26 +00:00
|
|
|
flags += '-Werror=format-security'
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
darwin = host_machine.system() == 'darwin'
|
|
|
|
win32 = host_machine.system() == 'cygwin' or host_machine.system() == 'windows'
|
2022-08-13 00:25:50 +00:00
|
|
|
posix = not win32
|
2022-11-08 00:02:22 +00:00
|
|
|
|
|
|
|
features += {'darwin': darwin}
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'posix': posix}
|
|
|
|
features += {'dos-paths': win32, 'win32': win32}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2023-11-24 06:19:19 +00:00
|
|
|
mswin_flags = ['-D_WIN32_WINNT=0x0602', '-DWINVER=0x0602', '-DUNICODE',
|
|
|
|
'-DCOBJMACROS', '-DINITGUID', '-U__STRICT_ANSI__', '-DNOMINMAX',
|
2024-05-01 17:07:44 +00:00
|
|
|
'-D_USE_MATH_DEFINES', '-DWIN32_LEAN_AND_MEAN',
|
|
|
|
'-D_CRT_DECLARE_NONSTDC_NAMES', '-D_CRT_NONSTDC_NO_WARNINGS',
|
|
|
|
'-D_CRT_SECURE_NO_WARNINGS']
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
if host_machine.system() == 'windows'
|
2023-11-24 04:44:59 +00:00
|
|
|
flags += [mswin_flags]
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if host_machine.system() == 'cygwin'
|
|
|
|
flags += [mswin_flags, '-mwin32']
|
|
|
|
endif
|
|
|
|
|
2023-11-24 06:19:19 +00:00
|
|
|
if posix
|
|
|
|
flags += ['-D_GNU_SOURCE']
|
|
|
|
endif
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
if cc.has_link_argument('-Wl,-z,noexecstack')
|
|
|
|
link_flags += '-Wl,-z,noexecstack'
|
|
|
|
endif
|
|
|
|
|
|
|
|
if cc.has_link_argument('-Wl,--nxcompat,--no-seh,--dynamicbase')
|
|
|
|
link_flags += '-Wl,--nxcompat,--no-seh,--dynamicbase'
|
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'build-date': get_option('build-date')}
|
2022-08-16 16:41:52 +00:00
|
|
|
if not features['build-date']
|
2021-11-07 19:28:16 +00:00
|
|
|
flags += '-DNO_BUILD_TIMESTAMPS'
|
|
|
|
endif
|
|
|
|
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'ta-leak-report': get_option('ta-leak-report')}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2023-05-01 17:05:00 +00:00
|
|
|
libdl = dependency('dl', required: false)
|
|
|
|
features += {'libdl': libdl.found()}
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['libdl']
|
2023-05-01 17:05:00 +00:00
|
|
|
dependencies += libdl
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2023-10-18 14:32:16 +00:00
|
|
|
# C11 atomics are mandatory but linking to the library is not always required.
|
|
|
|
dependencies += cc.find_library('atomic', required: false)
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
cplugins = get_option('cplugins').require(
|
2023-08-17 14:21:08 +00:00
|
|
|
win32 or (features['libdl'] and cc.has_link_argument('-rdynamic')),
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'cplugins not supported by the os or compiler!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'cplugins': cplugins.allowed()}
|
2023-08-17 14:21:08 +00:00
|
|
|
if features['cplugins'] and not win32
|
2021-11-07 19:28:16 +00:00
|
|
|
link_flags += '-rdynamic'
|
|
|
|
endif
|
|
|
|
|
2023-10-22 00:43:15 +00:00
|
|
|
win32_threads = get_option('win32-threads').require(win32)
|
|
|
|
|
|
|
|
features += {'win32-threads': win32_threads.allowed()}
|
|
|
|
if not features['win32-threads']
|
2023-09-15 14:51:44 +00:00
|
|
|
pthreads = dependency('threads')
|
2023-10-22 02:12:14 +00:00
|
|
|
sources += files('osdep/threads-posix.c')
|
2023-10-28 19:18:18 +00:00
|
|
|
features += {'pthread-condattr-setclock':
|
|
|
|
cc.has_header_symbol('pthread.h',
|
|
|
|
'pthread_condattr_setclock',
|
2023-11-24 06:21:29 +00:00
|
|
|
args: '-D_GNU_SOURCE',
|
2023-10-28 19:18:18 +00:00
|
|
|
dependencies: pthreads)}
|
2023-09-15 14:51:44 +00:00
|
|
|
dependencies += pthreads
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
pthread_debug = get_option('pthread-debug').require(
|
2023-10-22 00:43:15 +00:00
|
|
|
win32_threads.disabled(),
|
|
|
|
error_message: 'win32-threads was found!',
|
2021-11-07 19:28:16 +00:00
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'pthread-debug': pthread_debug.allowed()}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2024-02-03 04:40:06 +00:00
|
|
|
if get_option('fuzzers')
|
|
|
|
if get_option('cplayer') or not get_option('libmpv')
|
|
|
|
error('fuzzers require !cplayer and libmpv')
|
|
|
|
endif
|
|
|
|
# Adding flags manually until https://github.com/mesonbuild/meson/pull/9825
|
|
|
|
flags += ['-fsanitize=address,undefined,fuzzer', '-fno-omit-frame-pointer']
|
2024-06-23 14:44:45 +00:00
|
|
|
flags += ['-DFUZZING_BUILD_MODE_UNSAFE_FOR_PRODUCTION']
|
2024-02-03 04:40:06 +00:00
|
|
|
link_flags += ['-fsanitize=address,undefined,fuzzer', '-fno-omit-frame-pointer']
|
|
|
|
endif
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
add_project_arguments(flags, language: 'c')
|
2024-03-08 06:50:25 +00:00
|
|
|
add_project_arguments(['-Wno-unused-parameter'], language: 'objc')
|
2024-05-10 18:46:07 +00:00
|
|
|
add_project_link_arguments(link_flags, language: ['c', 'cpp', 'objc'])
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
# osdep
|
|
|
|
cocoa = dependency('appleframeworks', modules: ['Cocoa', 'IOKit', 'QuartzCore'],
|
|
|
|
required: get_option('cocoa'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'cocoa': cocoa.found()}
|
|
|
|
if features['cocoa']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += cocoa
|
2024-02-27 15:55:29 +00:00
|
|
|
sources += files('osdep/language-mac.c',
|
|
|
|
'osdep/path-mac.m',
|
|
|
|
'osdep/utils-mac.c',
|
2024-03-23 19:09:15 +00:00
|
|
|
'osdep/mac/app_bridge.m')
|
2024-03-07 12:45:27 +00:00
|
|
|
main_fn_source = files('osdep/main-fn-mac.c')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if posix
|
2023-02-26 03:50:08 +00:00
|
|
|
path_source = files('osdep/path-unix.c')
|
2023-12-02 15:39:19 +00:00
|
|
|
if cc.has_function('fork', prefix : '#include <unistd.h>')
|
2024-05-22 01:40:05 +00:00
|
|
|
sources += files('osdep/subprocess-posix.c')
|
2023-12-02 15:39:19 +00:00
|
|
|
else
|
2024-05-22 01:40:05 +00:00
|
|
|
sources += files('osdep/subprocess-dummy.c')
|
2023-12-02 15:39:19 +00:00
|
|
|
endif
|
2023-10-18 13:19:56 +00:00
|
|
|
sources += files('input/ipc-unix.c',
|
2023-09-18 02:59:16 +00:00
|
|
|
'osdep/poll_wrapper.c',
|
2021-11-07 19:28:16 +00:00
|
|
|
'osdep/terminal-unix.c',
|
|
|
|
'sub/filter_regex.c')
|
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
if posix and not features['cocoa']
|
2024-03-07 12:45:27 +00:00
|
|
|
sources += files('osdep/language-posix.c')
|
|
|
|
main_fn_source = files('osdep/main-fn-unix.c')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if darwin
|
2022-11-08 00:02:22 +00:00
|
|
|
path_source = files('osdep/path-darwin.c')
|
2023-10-18 13:19:56 +00:00
|
|
|
timer_source = files('osdep/timer-darwin.c')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if posix and not darwin
|
2023-10-18 13:19:56 +00:00
|
|
|
timer_source = files('osdep/timer-linux.c')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2023-09-18 03:27:12 +00:00
|
|
|
features += {'ppoll': cc.has_function('ppoll', args: '-D_GNU_SOURCE',
|
|
|
|
prefix: '#include <poll.h>')}
|
2024-06-04 18:55:33 +00:00
|
|
|
features += {'memrchr': cc.has_function('memrchr', args: '-D_GNU_SOURCE',
|
|
|
|
prefix: '#include <string.h>')}
|
2023-09-18 03:27:12 +00:00
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
cd_devices = {
|
|
|
|
'windows': 'D:',
|
|
|
|
'cygwin': 'D:',
|
|
|
|
'darwin': '/dev/disk1',
|
|
|
|
'freebsd': '/dev/cd0',
|
|
|
|
'openbsd': '/dev/rcd0c',
|
|
|
|
'linux': '/dev/sr0',
|
|
|
|
}
|
|
|
|
if host_machine.system() in cd_devices
|
|
|
|
cd_device = cd_devices[host_machine.system()]
|
|
|
|
else
|
|
|
|
cd_device = '/dev/cdrom'
|
|
|
|
endif
|
|
|
|
|
|
|
|
dvd_devices = {
|
|
|
|
'windows': 'D:',
|
|
|
|
'cygwin': 'D:',
|
|
|
|
'darwin': '/dev/diskN',
|
|
|
|
'freebsd': '/dev/cd0',
|
|
|
|
'openbsd': '/dev/rcd0c',
|
|
|
|
'linux': '/dev/sr0',
|
|
|
|
}
|
|
|
|
if host_machine.system() in cd_devices
|
|
|
|
dvd_device = dvd_devices[host_machine.system()]
|
|
|
|
else
|
|
|
|
dvd_device = '/dev/dvd'
|
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'android': host_machine.system() == 'android'}
|
|
|
|
if features['android']
|
2021-11-15 17:24:06 +00:00
|
|
|
dependencies += cc.find_library('android')
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('audio/out/ao_audiotrack.c',
|
2021-11-15 17:24:06 +00:00
|
|
|
'misc/jni.c',
|
|
|
|
'osdep/android/strnlen.c',
|
2021-11-07 19:28:16 +00:00
|
|
|
'video/out/android_common.c',
|
|
|
|
'video/out/vo_mediacodec_embed.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
uwp_opt = get_option('uwp').require(
|
|
|
|
not get_option('cplayer'),
|
|
|
|
error_message: 'cplayer is not false!',
|
|
|
|
)
|
|
|
|
uwp = cc.find_library('windowsapp', required: uwp_opt)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'uwp': uwp.found()}
|
|
|
|
if features['uwp']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += uwp
|
2023-10-18 13:19:56 +00:00
|
|
|
path_source = files('osdep/path-uwp.c')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'win32-executable': win32 and get_option('cplayer')}
|
2021-11-07 19:28:16 +00:00
|
|
|
if win32
|
2023-10-22 01:18:15 +00:00
|
|
|
timer_source = files('osdep/timer-win32.c')
|
2023-10-18 13:19:56 +00:00
|
|
|
sources += files('osdep/w32_keyboard.c',
|
2021-11-07 19:28:16 +00:00
|
|
|
'osdep/windows_utils.c')
|
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'win32-desktop': win32 and not uwp.found()}
|
|
|
|
if features['win32-desktop']
|
2024-05-05 16:50:38 +00:00
|
|
|
pathcch = cc.find_library('pathcch', required: false)
|
|
|
|
features += {'pathcch': pathcch.found()}
|
|
|
|
if features['pathcch']
|
|
|
|
dependencies += pathcch
|
|
|
|
endif
|
2021-11-07 19:28:16 +00:00
|
|
|
win32_desktop_libs = [cc.find_library('avrt'),
|
|
|
|
cc.find_library('dwmapi'),
|
|
|
|
cc.find_library('gdi32'),
|
2023-12-15 16:29:56 +00:00
|
|
|
cc.find_library('imm32'),
|
2023-10-26 19:13:12 +00:00
|
|
|
cc.find_library('ntdll'),
|
2021-11-07 19:28:16 +00:00
|
|
|
cc.find_library('ole32'),
|
|
|
|
cc.find_library('uuid'),
|
2023-03-19 05:40:53 +00:00
|
|
|
cc.find_library('uxtheme'),
|
2023-10-28 18:11:56 +00:00
|
|
|
cc.find_library('version')]
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += win32_desktop_libs
|
2023-02-26 03:50:08 +00:00
|
|
|
path_source = files('osdep/path-win.c')
|
2023-10-18 13:19:56 +00:00
|
|
|
sources += files('input/ipc-win.c',
|
2021-05-26 22:55:08 +00:00
|
|
|
'osdep/language-win.c',
|
2024-05-22 01:40:05 +00:00
|
|
|
'osdep/subprocess-win.c',
|
2021-11-07 19:28:16 +00:00
|
|
|
'osdep/terminal-win.c',
|
|
|
|
'video/out/w32_common.c',
|
|
|
|
'video/out/win32/displayconfig.c',
|
2024-03-14 16:06:58 +00:00
|
|
|
'video/out/win32/droptarget.c',
|
|
|
|
'video/out/win32/menu.c')
|
2024-03-07 12:45:27 +00:00
|
|
|
main_fn_source = files('osdep/main-fn-win.c')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
if not posix and not features['win32-desktop']
|
2023-11-07 01:39:21 +00:00
|
|
|
sources += files('input/ipc-dummy.c',
|
2024-05-22 01:40:05 +00:00
|
|
|
'osdep/subprocess-dummy.c',
|
2023-11-07 01:39:21 +00:00
|
|
|
'osdep/terminal-dummy.c')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'glob-posix': cc.has_function('glob', prefix: '#include <glob.h>')}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
features += {'glob-win32': win32 and not features['glob-posix']}
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['glob-win32']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('osdep/glob-win.c')
|
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'glob': features['glob-posix'] or features['glob-win32']}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'vt.h': cc.has_header_symbol('sys/vt.h', 'VT_GETMODE')}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'consio.h': not features['vt.h'] and cc.has_header_symbol('sys/consio.h', 'VT_GETMODE')}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2024-07-29 03:14:45 +00:00
|
|
|
features += {'wsdisplay-usl-io.h': cc.has_header_symbol('dev/wscons/wsdisplay_usl_io.h', 'VT_GETMODE', prefix: '#include <sys/types.h>')}
|
|
|
|
|
2023-01-31 15:22:59 +00:00
|
|
|
# macOS's pthread_setname_np is a special snowflake and differs from literally every other platform.
|
2024-02-27 15:55:29 +00:00
|
|
|
features += {'mac-thread-name': darwin}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2023-01-31 15:22:59 +00:00
|
|
|
features += {'glibc-thread-name': false}
|
2024-02-27 15:55:29 +00:00
|
|
|
if not features['mac-thread-name']
|
2023-01-31 15:22:59 +00:00
|
|
|
features += {'glibc-thread-name': posix and cc.has_function('pthread_setname_np', args: '-D_GNU_SOURCE',
|
|
|
|
dependencies: pthreads, prefix: '#include <pthread.h>')}
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'bsd-thread-name': false}
|
2024-02-27 15:55:29 +00:00
|
|
|
if not features['mac-thread-name'] and not features['glibc-thread-name']
|
2023-01-31 15:22:59 +00:00
|
|
|
features += {'bsd-thread-name': posix and cc.has_function('pthread_set_name_np', dependencies: pthreads,
|
|
|
|
prefix: '#include <pthread.h>\n#include <pthread_np.h>')}
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'bsd-fstatfs': cc.has_function('fstatfs', prefix: '#include <sys/mount.h>\n#include <sys/param.h>')}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'linux-fstatfs': cc.has_function('fstatfs', prefix: '#include <sys/vfs.h>')}
|
2022-08-13 00:25:50 +00:00
|
|
|
|
2023-01-31 19:59:21 +00:00
|
|
|
vector_attribute = '''int main() {
|
|
|
|
float v __attribute__((vector_size(32)));
|
|
|
|
}
|
|
|
|
'''
|
2022-08-13 00:25:50 +00:00
|
|
|
vector = get_option('vector').require(
|
2023-01-31 19:59:21 +00:00
|
|
|
cc.compiles(vector_attribute, name: 'vector check'),
|
2022-08-13 00:25:50 +00:00
|
|
|
error_message: 'the compiler does not support gcc vectors!',
|
|
|
|
)
|
|
|
|
features += {'vector': vector.allowed()}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2024-05-22 01:40:05 +00:00
|
|
|
sources += path_source + timer_source
|
2023-10-18 13:19:56 +00:00
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
# various file generations
|
|
|
|
tools_directory = join_paths(source_root, 'TOOLS')
|
2023-01-12 03:44:29 +00:00
|
|
|
docutils_wrapper = find_program(join_paths(tools_directory, 'docutils-wrapper.py'))
|
2021-11-07 19:28:16 +00:00
|
|
|
file2string = find_program(join_paths(tools_directory, 'file2string.py'))
|
|
|
|
matroska = find_program(join_paths(tools_directory, 'matroska.py'))
|
2024-05-14 18:32:18 +00:00
|
|
|
mpv_desktop = find_program(join_paths(tools_directory, 'gen-mpv-desktop.py'))
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2023-07-23 22:54:35 +00:00
|
|
|
ebml_defs = custom_target('ebml_defs.inc',
|
|
|
|
output: 'ebml_defs.inc',
|
|
|
|
command: [matroska, '--generate-definitions', '@OUTPUT@'],
|
|
|
|
)
|
|
|
|
|
|
|
|
ebml_types = custom_target('ebml_types.h',
|
|
|
|
output: 'ebml_types.h',
|
|
|
|
command: [matroska, '--generate-header', '@OUTPUT@'],
|
|
|
|
)
|
|
|
|
|
2023-07-30 10:34:55 +00:00
|
|
|
sources += [ebml_defs, ebml_types]
|
2023-07-23 22:54:35 +00:00
|
|
|
|
2023-07-30 10:34:55 +00:00
|
|
|
subdir('common')
|
2023-07-23 22:54:35 +00:00
|
|
|
subdir('etc')
|
|
|
|
subdir('player')
|
|
|
|
subdir('sub')
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
if darwin
|
2023-07-23 22:54:35 +00:00
|
|
|
subdir(join_paths('TOOLS', 'osxbundle'))
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
cdda_opt = get_option('cdda').require(
|
|
|
|
get_option('gpl'),
|
|
|
|
error_message: 'the build is not GPL!',
|
|
|
|
)
|
2023-10-18 16:16:51 +00:00
|
|
|
cdio = dependency('libcdio', version: '>= 0.90', required: cdda_opt)
|
2021-11-07 19:28:16 +00:00
|
|
|
cdda = dependency('libcdio_paranoia', required: cdda_opt)
|
2023-10-18 16:16:51 +00:00
|
|
|
features += {'cdda': cdda.found() and cdio.found()}
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['cdda']
|
2023-10-18 16:16:51 +00:00
|
|
|
dependencies += [cdda, cdio]
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('stream/stream_cdda.c')
|
|
|
|
endif
|
|
|
|
|
2023-11-28 20:05:57 +00:00
|
|
|
dvbin_opt = get_option('dvbin').require(
|
2021-11-07 19:28:16 +00:00
|
|
|
get_option('gpl'),
|
|
|
|
error_message: 'the build is not GPL!',
|
|
|
|
)
|
2023-11-28 20:05:57 +00:00
|
|
|
dvbin = cc.has_header('linux/dvb/frontend.h', required: dvbin_opt)
|
|
|
|
features += {'dvbin': dvbin}
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['dvbin']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('stream/dvb_tune.c',
|
|
|
|
'stream/stream_dvb.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
dvdnav_opt = get_option('dvdnav').require(
|
|
|
|
get_option('gpl'),
|
|
|
|
error_message: 'the build is not GPL!',
|
|
|
|
)
|
|
|
|
dvdnav = dependency('dvdnav', version: '>= 4.2.0', required: dvdnav_opt)
|
|
|
|
dvdread = dependency('dvdread', version: '>= 4.1.0', required: dvdnav_opt)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'dvdnav': dvdnav.found() and dvdread.found()}
|
|
|
|
if features['dvdnav']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += [dvdnav, dvdread]
|
|
|
|
sources += files('stream/stream_dvdnav.c')
|
|
|
|
endif
|
|
|
|
|
2022-01-08 18:03:30 +00:00
|
|
|
iconv = dependency('iconv', required: get_option('iconv'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'iconv': iconv.found()}
|
|
|
|
if features['iconv']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += iconv
|
|
|
|
endif
|
|
|
|
|
|
|
|
javascript = dependency('mujs', version: '>= 1.0.0', required: get_option('javascript'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'javascript': javascript.found()}
|
|
|
|
if features['javascript']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += javascript
|
|
|
|
sources += files('player/javascript.c',
|
|
|
|
'sub/filter_jsre.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
lcms2 = dependency('lcms2', version: '>= 2.6', required: get_option('lcms2'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'lcms2': lcms2.found()}
|
|
|
|
if features['lcms2']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += lcms2
|
|
|
|
endif
|
|
|
|
|
|
|
|
libarchive = dependency('libarchive', version: '>= 3.4.0', required: get_option('libarchive'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'libarchive': libarchive.found()}
|
|
|
|
if features['libarchive']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += libarchive
|
|
|
|
sources += files('demux/demux_libarchive.c',
|
|
|
|
'stream/stream_libarchive.c')
|
|
|
|
endif
|
|
|
|
|
2024-06-21 17:22:29 +00:00
|
|
|
libavdevice = dependency('libavdevice', version: '>= 60.3.100', required: get_option('libavdevice'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'libavdevice': libavdevice.found()}
|
|
|
|
if features['libavdevice']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += libavdevice
|
|
|
|
endif
|
|
|
|
|
|
|
|
libbluray = dependency('libbluray', version: '>= 0.3.0', required: get_option('libbluray'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'libbluray': libbluray.found()}
|
|
|
|
if features['libbluray']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += libbluray
|
|
|
|
sources += files('stream/stream_bluray.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
libm = cc.find_library('m', required: false)
|
2024-03-23 18:59:58 +00:00
|
|
|
if libm.found()
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += libm
|
|
|
|
endif
|
|
|
|
|
|
|
|
librt = cc.find_library('rt', required: false)
|
2024-03-23 18:59:58 +00:00
|
|
|
if librt.found()
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += librt
|
|
|
|
endif
|
|
|
|
|
2022-08-12 18:02:41 +00:00
|
|
|
lua = dependency('', required: false)
|
2021-11-07 19:28:16 +00:00
|
|
|
lua_opt = get_option('lua')
|
|
|
|
if lua_opt != 'disabled'
|
2021-11-15 00:39:25 +00:00
|
|
|
lua_version = [['lua', ['>=5.1.0', '<5.3.0']], # generic lua.pc
|
|
|
|
['lua52', '>= 5.2.0'],
|
2021-11-07 19:28:16 +00:00
|
|
|
['lua5.2', '>= 5.2.0'],
|
|
|
|
['lua-5.2', '>= 5.2.0'],
|
|
|
|
['luajit', '>= 2.0.0'],
|
|
|
|
['lua51', '>= 5.1.0'],
|
|
|
|
['lua5.1', '>= 5.1.0'],
|
|
|
|
['lua-5.1', '>= 5.1.0']]
|
|
|
|
foreach version : lua_version
|
|
|
|
if lua_opt == 'auto' or lua_opt == 'enabled'
|
2022-08-12 18:02:41 +00:00
|
|
|
lua = dependency(version[0], version: version[1], required: false)
|
|
|
|
if lua.found()
|
2021-11-07 19:28:16 +00:00
|
|
|
break
|
|
|
|
endif
|
|
|
|
elif lua_opt == version[0]
|
2022-08-12 18:02:41 +00:00
|
|
|
lua = dependency(version[0], version: version[1])
|
|
|
|
if lua.found()
|
2021-11-07 19:28:16 +00:00
|
|
|
break
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'lua': lua.found()}
|
|
|
|
lua_version = lua.name()
|
|
|
|
if features['lua']
|
2022-08-12 18:02:41 +00:00
|
|
|
dependencies += lua
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('player/lua.c')
|
|
|
|
endif
|
2022-08-14 22:36:08 +00:00
|
|
|
if not features['lua'] and lua_opt == 'enabled'
|
2024-03-23 19:04:37 +00:00
|
|
|
error('Lua enabled but no suitable Lua version could be found!')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
rubberband = dependency('rubberband', version: '>= 1.8.0', required: get_option('rubberband'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'rubberband': rubberband.found()}
|
|
|
|
if features['rubberband']
|
2024-03-23 19:04:37 +00:00
|
|
|
features += {'rubberband-3': rubberband.version().version_compare('>= 3.0.0')}
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += rubberband
|
|
|
|
sources += files('audio/filter/af_rubberband.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
sdl2 = dependency('sdl2', required: get_option('sdl2'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'sdl2': sdl2.found()}
|
|
|
|
if features['sdl2']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += sdl2
|
|
|
|
endif
|
|
|
|
|
|
|
|
sdl2_gamepad = get_option('sdl2-gamepad').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['sdl2'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'sdl2 was not found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'sdl2-gamepad': sdl2_gamepad.allowed()}
|
|
|
|
if features['sdl2-gamepad']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('input/sdl_gamepad.c')
|
|
|
|
endif
|
|
|
|
|
2021-11-15 00:43:34 +00:00
|
|
|
uchardet_opt = get_option('uchardet').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['iconv'],
|
2021-11-15 00:43:34 +00:00
|
|
|
error_message: 'iconv was not found!',
|
|
|
|
)
|
|
|
|
uchardet = dependency('uchardet', required: uchardet_opt)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'uchardet': uchardet.found()}
|
|
|
|
if features['uchardet']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += uchardet
|
|
|
|
endif
|
|
|
|
|
vf_vapoursynth: upgrade to VapourSynth API v4
VapourSynth introduced their version 4 API in R55, 3 years ago. mpv is
still using the deprecated version 3. I think it is good to migrate
before VapourSynth completely removes it.
The most impacted area is the video format. Previously we have a fixed
table of supported formats, each represented by an integer. In v4, the
integer is replaced by pointer to the full struct of the format.
Second, the way to create video filter is changed. Previously caller
needs to supply a "initialization" callback to `createFilter()`, which
sets up video info etc. In v4, video info is prepared first, passed to
the `createVideoFilter2()` and we get back the node.
Also, previously mpv was using the `fmSerial` filter mode, which means
VapourSynth 1) can only request one frame from mpv at a time, and 2) the
order of frames requested must be sequential. I propose to change it to
the parallel request mode, which requests multiple frames at a time in
semi random order. The reasons are, for 1), the get frame function,
`infiltGetFrame()`, unlocks the mutex during output image generation,
thus can benefit from parallel requests. For 2) thanks to the frame
buffer, unordered frame requests are acceptable. Just make sure the
buffer is large enough.
Third, the way VapourSynth scripting environment works change. In v4,
the scripting API is operated through struct pointer, much like the
exist `vsapi` pointer. The "finalize" function is also no longer needed.
2024-06-09 06:08:22 +00:00
|
|
|
vapoursynth = dependency('vapoursynth', version: '>= 56', required: get_option('vapoursynth'))
|
|
|
|
vapoursynth_script = dependency('vapoursynth-script', version: '>= 56',
|
2021-11-07 19:28:16 +00:00
|
|
|
required: get_option('vapoursynth'))
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'vapoursynth': vapoursynth.found() and vapoursynth_script.found()}
|
|
|
|
if features['vapoursynth']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += [vapoursynth, vapoursynth_script]
|
|
|
|
sources += files('video/filter/vf_vapoursynth.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
zimg = dependency('zimg', version: '>= 2.9', required: get_option('zimg'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'zimg': zimg.found()}
|
|
|
|
if features['zimg']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += zimg
|
|
|
|
sources += files('video/filter/vf_fingerprint.c',
|
|
|
|
'video/zimg.c')
|
2023-01-24 09:26:25 +00:00
|
|
|
features += {'zimg-st428': zimg.version().version_compare('>= 3.0.5')}
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
zlib = dependency('zlib', required: get_option('zlib'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'zlib': zlib.found()}
|
|
|
|
if features['zlib']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += zlib
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# audio output dependencies
|
|
|
|
alsa = dependency('alsa', version: '>= 1.0.18', required: get_option('alsa'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'alsa': alsa.found()}
|
|
|
|
if features['alsa']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += alsa
|
|
|
|
sources += files('audio/out/ao_alsa.c')
|
|
|
|
endif
|
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
audiounit_opt = get_option('audiounit').require(darwin)
|
2021-11-07 19:28:16 +00:00
|
|
|
audiounit = {
|
|
|
|
'deps': dependency('appleframeworks', modules: ['Foundation', 'AudioToolbox'],
|
2024-03-23 19:04:37 +00:00
|
|
|
required: audiounit_opt),
|
2021-11-07 19:28:16 +00:00
|
|
|
'symbol': cc.has_header_symbol('AudioToolbox/AudioToolbox.h', 'kAudioUnitSubType_RemoteIO',
|
2024-03-23 19:04:37 +00:00
|
|
|
required: audiounit_opt),
|
2021-11-07 19:28:16 +00:00
|
|
|
}
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'audiounit': audiounit['deps'].found() and audiounit['symbol']}
|
|
|
|
if features['audiounit']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += audiounit['deps']
|
|
|
|
sources += files('audio/out/ao_audiounit.m')
|
|
|
|
endif
|
|
|
|
|
2024-03-16 20:14:47 +00:00
|
|
|
avfoundation = dependency('appleframeworks', modules: ['CoreMedia', 'AVFoundation'],
|
|
|
|
required: get_option('avfoundation'))
|
|
|
|
features += {'avfoundation': avfoundation.found()}
|
|
|
|
if features['avfoundation']
|
|
|
|
dependencies += avfoundation
|
|
|
|
sources += files('audio/out/ao_avfoundation.m')
|
|
|
|
endif
|
|
|
|
|
2022-05-12 15:12:31 +00:00
|
|
|
coreaudio = dependency('appleframeworks', modules: ['CoreFoundation', 'CoreAudio',
|
2021-11-07 19:28:16 +00:00
|
|
|
'AudioUnit', 'AudioToolbox'], required: get_option('coreaudio'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'coreaudio': coreaudio.found()}
|
|
|
|
if features['coreaudio']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += coreaudio
|
|
|
|
sources += files('audio/out/ao_coreaudio.c',
|
|
|
|
'audio/out/ao_coreaudio_exclusive.c',
|
|
|
|
'audio/out/ao_coreaudio_properties.c')
|
|
|
|
endif
|
|
|
|
|
2024-03-16 20:14:47 +00:00
|
|
|
if features['audiounit'] or features['coreaudio'] or features['avfoundation']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('audio/out/ao_coreaudio_chmap.c',
|
2024-04-18 16:52:16 +00:00
|
|
|
'audio/out/ao_coreaudio_utils.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
if features['avfoundation']
|
|
|
|
sources += files('audio/out/ao_coreaudio_properties.c')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
jack_opt = get_option('jack').require(
|
|
|
|
get_option('gpl'),
|
|
|
|
error_message: 'the build is not GPL!',
|
|
|
|
)
|
|
|
|
jack = dependency('jack', required: jack_opt)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'jack': jack.found()}
|
|
|
|
if features['jack']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += jack
|
|
|
|
sources += files('audio/out/ao_jack.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
openal = dependency('openal', version: '>= 1.13', required: get_option('openal'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'openal': openal.found()}
|
|
|
|
if features['openal']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += openal
|
|
|
|
sources += files('audio/out/ao_openal.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
opensles = cc.find_library('OpenSLES', required: get_option('opensles'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'opensles': opensles.found()}
|
|
|
|
if features['opensles']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += opensles
|
|
|
|
sources += files('audio/out/ao_opensles.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
oss_opt = get_option('oss-audio').require(
|
|
|
|
get_option('gpl'),
|
|
|
|
error_message: 'the build is not GPL!',
|
|
|
|
)
|
2023-08-15 19:31:30 +00:00
|
|
|
features += {'oss-audio': cc.has_header_symbol('sys/soundcard.h', 'SNDCTL_DSP_HALT',
|
2022-08-14 22:36:08 +00:00
|
|
|
required: oss_opt)}
|
|
|
|
if features['oss-audio']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('audio/out/ao_oss.c')
|
|
|
|
endif
|
|
|
|
|
2024-07-05 13:47:04 +00:00
|
|
|
pipewire = dependency('libpipewire-0.3', version: '>= 0.3.57', required: get_option('pipewire'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'pipewire': pipewire.found()}
|
|
|
|
if features['pipewire']
|
2022-01-06 20:54:21 +00:00
|
|
|
dependencies += pipewire
|
|
|
|
sources += files('audio/out/ao_pipewire.c')
|
|
|
|
endif
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
pulse = dependency('libpulse', version: '>= 1.0', required: get_option('pulse'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'pulse': pulse.found()}
|
|
|
|
if features['pulse']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += pulse
|
|
|
|
sources += files('audio/out/ao_pulse.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
sdl2_audio = get_option('sdl2-audio').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['sdl2'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'sdl2 was not found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'sdl2-audio': sdl2_audio.allowed()}
|
|
|
|
if features['sdl2-audio']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('audio/out/ao_sdl.c')
|
|
|
|
endif
|
|
|
|
|
2022-01-11 16:23:52 +00:00
|
|
|
sndio = dependency('sndio', required: get_option('sndio'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'sndio': sndio.found()}
|
2023-07-24 20:01:25 +00:00
|
|
|
features += {'sndio-1-9': sndio.version().version_compare('>= 1.9.0')}
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['sndio']
|
2022-01-11 16:23:52 +00:00
|
|
|
dependencies += sndio
|
|
|
|
sources += files('audio/out/ao_sndio.c')
|
|
|
|
endif
|
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
wasapi = cc.has_header_symbol('audioclient.h', 'IAudioClient', required:
|
|
|
|
get_option('wasapi').require(win32))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'wasapi': wasapi}
|
|
|
|
if features['wasapi']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('audio/out/ao_wasapi.c',
|
|
|
|
'audio/out/ao_wasapi_changenotify.c',
|
|
|
|
'audio/out/ao_wasapi_utils.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# video output dependencies
|
|
|
|
caca_opt = get_option('caca').require(
|
|
|
|
get_option('gpl'),
|
|
|
|
error_message: 'the build is not GPL!',
|
|
|
|
)
|
|
|
|
caca = dependency('caca', version: '>= 0.99.beta18', required: caca_opt)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'caca': caca.found()}
|
|
|
|
if features['caca']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += caca
|
|
|
|
sources += files('video/out/vo_caca.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
direct3d_opt = get_option('direct3d').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
get_option('gpl') and features['win32-desktop'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'the build is not GPL or this is not a win32 desktop!',
|
|
|
|
)
|
2023-01-30 22:14:28 +00:00
|
|
|
direct3d = cc.has_header('d3d9.h', required: direct3d_opt)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'direct3d': direct3d}
|
|
|
|
if features['direct3d']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/vo_direct3d.c')
|
|
|
|
endif
|
|
|
|
|
2023-07-31 18:35:24 +00:00
|
|
|
drm = dependency('libdrm', version: '>= 2.4.105', required: get_option('drm'))
|
2024-07-29 03:14:45 +00:00
|
|
|
features += {'drm': drm.found() and (features['vt.h'] or features['consio.h'] or features['wsdisplay-usl-io.h'])}
|
2022-08-13 00:25:50 +00:00
|
|
|
if features['drm']
|
2022-08-14 22:36:08 +00:00
|
|
|
dependencies += drm
|
hwdec/drmprime: add drmprime hwdec-interop
In the confusing landscape of hardware video decoding APIs, we have had
a long standing support gap for the v4l2 based APIs implemented for the
various SoCs from Rockship, Amlogic, Allwinner, etc. While VAAPI is the
defacto default for desktop GPUs, the developers who work on these SoCs
(who are not the vendors!) have preferred to implement kernel APIs
rather than maintain a userspace driver as VAAPI would require.
While there are two v4l2 APIs (m2m and requests), and multiple forks of
ffmpeg where support for those APIs languishes without reaching
upstream, we can at least say that these APIs export frames as DRMPrime
dmabufs, and that they use the ffmpeg drm hwcontext.
With those two constants, it is possible for us to write a
hwdec-interop without worrying about the mess underneath - for the most
part.
Accordingly, this change implements a hwdec-interop for any decoder
that produces frames as DRMPrime dmabufs. The bulk of the heavy
lifting is done by the dmabuf interop code we already had from
supporting vaapi, and which I refactored for reusability in a previous
set of changes.
When we combine that with the fact that we can't probe for supported
formats, the new code in this change is pretty simple.
This change also includes the hwcontext_fns that are required for us to
be able to configure the hwcontext used by `hwdec=drm-copy`. This is
technically unrelated, but it seemed a good time to fill this gap.
From a testing perspective, I have directly tested on a RockPRO64,
while others have tested with different flavours of Rockchip and on
Amlogic, providing m2m coverage.
I have some other SoCs that I need to spin up to test with, but I don't
expect big surprises, and when we inevitably need to account for new
special cases down the line, we can do so - we won't be able to support
every possible configuration blindly.
2022-07-31 20:47:23 +00:00
|
|
|
sources += files('video/drmprime.c',
|
|
|
|
'video/out/drm_atomic.c',
|
2021-11-07 19:28:16 +00:00
|
|
|
'video/out/drm_common.c',
|
|
|
|
'video/out/drm_prime.c',
|
hwdec/drmprime: add drmprime hwdec-interop
In the confusing landscape of hardware video decoding APIs, we have had
a long standing support gap for the v4l2 based APIs implemented for the
various SoCs from Rockship, Amlogic, Allwinner, etc. While VAAPI is the
defacto default for desktop GPUs, the developers who work on these SoCs
(who are not the vendors!) have preferred to implement kernel APIs
rather than maintain a userspace driver as VAAPI would require.
While there are two v4l2 APIs (m2m and requests), and multiple forks of
ffmpeg where support for those APIs languishes without reaching
upstream, we can at least say that these APIs export frames as DRMPrime
dmabufs, and that they use the ffmpeg drm hwcontext.
With those two constants, it is possible for us to write a
hwdec-interop without worrying about the mess underneath - for the most
part.
Accordingly, this change implements a hwdec-interop for any decoder
that produces frames as DRMPrime dmabufs. The bulk of the heavy
lifting is done by the dmabuf interop code we already had from
supporting vaapi, and which I refactored for reusability in a previous
set of changes.
When we combine that with the fact that we can't probe for supported
formats, the new code in this change is pretty simple.
This change also includes the hwcontext_fns that are required for us to
be able to configure the hwcontext used by `hwdec=drm-copy`. This is
technically unrelated, but it seemed a good time to fill this gap.
From a testing perspective, I have directly tested on a RockPRO64,
while others have tested with different flavours of Rockchip and on
Amlogic, providing m2m coverage.
I have some other SoCs that I need to spin up to test with, but I don't
expect big surprises, and when we inevitably need to account for new
special cases down the line, we can do so - we won't be able to support
every possible configuration blindly.
2022-07-31 20:47:23 +00:00
|
|
|
'video/out/hwdec/hwdec_drmprime.c',
|
2022-08-27 16:53:31 +00:00
|
|
|
'video/out/hwdec/hwdec_drmprime_overlay.c',
|
2021-11-07 19:28:16 +00:00
|
|
|
'video/out/vo_drm.c')
|
|
|
|
endif
|
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
gbm_opt = get_option('gbm').require(
|
|
|
|
features['drm'],
|
|
|
|
error_message: 'drm was not found!'
|
|
|
|
)
|
|
|
|
gbm = dependency('gbm', version: '>= 17.1.0', required: gbm_opt)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'gbm': gbm.found()}
|
|
|
|
if features['gbm']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += gbm
|
|
|
|
endif
|
|
|
|
|
|
|
|
jpeg = dependency('libjpeg', required: get_option('jpeg'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'jpeg': jpeg.found()}
|
|
|
|
if features['jpeg']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += jpeg
|
|
|
|
endif
|
|
|
|
|
|
|
|
sdl2_video = get_option('sdl2-video').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['sdl2'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'sdl2 was not found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'sdl2-video': sdl2_video.allowed()}
|
|
|
|
if features['sdl2-video']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/vo_sdl.c')
|
|
|
|
endif
|
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
shaderc = dependency('shaderc', required:
|
|
|
|
get_option('shaderc').require(features['win32-desktop']))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'shaderc': shaderc.found()}
|
|
|
|
if features['shaderc']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += shaderc
|
|
|
|
sources += files('video/out/gpu/spirv_shaderc.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
sixel = dependency('libsixel', version: '>= 1.5', required: get_option('sixel'))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'sixel': sixel.found()}
|
|
|
|
if features['sixel']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += sixel
|
|
|
|
sources += files('video/out/vo_sixel.c')
|
|
|
|
endif
|
|
|
|
|
2023-08-20 20:40:58 +00:00
|
|
|
features += {'posix-shm': false}
|
2022-12-26 14:08:07 +00:00
|
|
|
if features['posix']
|
2023-08-20 20:40:58 +00:00
|
|
|
features += {'posix-shm': cc.has_function('shm_open', prefix: '#include <sys/mman.h>')}
|
2022-12-26 14:08:07 +00:00
|
|
|
endif
|
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
spirv_cross = dependency('spirv-cross-c-shared', required:
|
|
|
|
get_option('spirv-cross').require(features['win32-desktop']))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'spirv-cross': spirv_cross.found()}
|
|
|
|
if features['spirv-cross']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += spirv_cross
|
|
|
|
endif
|
|
|
|
|
|
|
|
d3d11 = get_option('d3d11').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['win32-desktop'] and features['shaderc'] and features['spirv-cross'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'Either is not a win32 desktop or shaderc nor spirv-cross were found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'d3d11': d3d11.allowed()}
|
|
|
|
if features['d3d11']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/d3d11/context.c',
|
|
|
|
'video/out/d3d11/ra_d3d11.c')
|
2023-05-01 01:11:15 +00:00
|
|
|
features += {'dxgi-debug-d3d11': cc.has_header_symbol('d3d11sdklayers.h', 'DXGI_DEBUG_D3D11')}
|
2023-05-01 15:43:25 +00:00
|
|
|
features += {'dxgi-debug': cc.has_header_symbol('dxgidebug.h', 'IID_IDXGIInfoQueue')}
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
wayland = {
|
2024-07-05 15:35:57 +00:00
|
|
|
'deps': [dependency('wayland-client', version: '>= 1.21.0', required: get_option('wayland')),
|
|
|
|
dependency('wayland-cursor', version: '>= 1.21.0', required: get_option('wayland')),
|
|
|
|
dependency('wayland-protocols', version: '>= 1.31', required: get_option('wayland')),
|
2021-11-07 19:28:16 +00:00
|
|
|
dependency('xkbcommon', version: '>= 0.3.0', required: get_option('wayland'))],
|
2022-11-15 12:18:56 +00:00
|
|
|
'header': cc.has_header('linux/input-event-codes.h', required: get_option('wayland'),
|
|
|
|
# Pass CFLAGS from a related package as a hint for non-Linux
|
|
|
|
dependencies: dependency('wayland-client', required: get_option('wayland'))),
|
2021-11-07 19:28:16 +00:00
|
|
|
'scanner': find_program('wayland-scanner', required: get_option('wayland')),
|
|
|
|
}
|
2022-08-13 00:25:50 +00:00
|
|
|
wayland_deps = true
|
2021-11-07 19:28:16 +00:00
|
|
|
foreach dep: wayland['deps']
|
|
|
|
if not dep.found()
|
2022-08-13 00:25:50 +00:00
|
|
|
wayland_deps = false
|
2021-11-07 19:28:16 +00:00
|
|
|
break
|
|
|
|
endif
|
|
|
|
endforeach
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'wayland': wayland_deps and wayland['header'] and wayland['scanner'].found()}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2022-08-13 00:25:50 +00:00
|
|
|
if features['wayland']
|
2023-07-23 22:54:35 +00:00
|
|
|
subdir(join_paths('video', 'out'))
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2023-08-20 20:40:58 +00:00
|
|
|
features += {'memfd-create': false}
|
2022-08-13 00:25:50 +00:00
|
|
|
if features['wayland']
|
2023-08-20 20:40:58 +00:00
|
|
|
features += {'memfd-create': cc.has_function('memfd_create',
|
2022-08-14 22:36:08 +00:00
|
|
|
prefix: '#define _GNU_SOURCE\n#include <sys/mman.h>')}
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
2023-08-20 20:40:58 +00:00
|
|
|
if features['wayland'] and features['memfd-create']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/vo_wlshm.c')
|
|
|
|
endif
|
|
|
|
|
2023-07-13 01:11:32 +00:00
|
|
|
dmabuf_wayland = get_option('dmabuf-wayland').require(
|
2023-08-20 20:40:58 +00:00
|
|
|
features['drm'] and features['memfd-create'] and features['wayland'],
|
|
|
|
error_message: 'drm, memfd-create or wayland was not found!',
|
2023-07-13 01:11:32 +00:00
|
|
|
)
|
|
|
|
features += {'dmabuf-wayland': dmabuf_wayland.allowed()}
|
|
|
|
if features['dmabuf-wayland']
|
|
|
|
sources += files('video/out/vo_dmabuf_wayland.c')
|
|
|
|
sources += files('video/out/hwdec/dmabuf_interop_wl.c')
|
|
|
|
sources += files('video/out/wldmabuf/context_wldmabuf.c')
|
|
|
|
sources += files('video/out/wldmabuf/ra_wldmabuf.c')
|
|
|
|
endif
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
x11_opt = get_option('x11').require(
|
|
|
|
get_option('gpl'),
|
|
|
|
error_message: 'the build is not GPL!',
|
|
|
|
)
|
|
|
|
x11 = {
|
|
|
|
'deps': [dependency('x11', version: '>= 1.0.0', required: x11_opt),
|
|
|
|
dependency('xscrnsaver', version: '>= 1.0.0', required: x11_opt),
|
|
|
|
dependency('xext', version: '>= 1.0.0', required: x11_opt),
|
x11: support xorg present extension
This builds off of present_sync which was introduced in a previous
commit to support xorg's present extension in all of the X11 backends
(sans vdpau) in mpv. It turns out there is an Xpresent library that
integrates the xorg present extention with Xlib (which barely anyone
seems to use), so this can be added without too much trouble. The
workflow is to first setup the event by telling Xorg we would like to
receive PresentCompleteNotify (there are others in the extension but
this is the only one we really care about). After that, just call
XPresentNotifyMSC after every buffer swap with a target_msc of 0. Xorg
then returns the last presentation through its usual event loop and we
go ahead and use that information to update mpv's values for vsync
timing purposes. One theoretical weakness of this approach is that the
present event is put on the same queue as the rest of the XEvents. It
would be nicer for it be placed somewhere else so we could just wait
on that queue without having to deal with other possible events in
there. In theory, xcb could do that with special events, but it doesn't
really matter in practice.
Unsurprisingly, this doesn't work on NVIDIA. Well NVIDIA does actually
receive presentation events, but for whatever the calculations used make
timings worse which defeats the purpose. This works perfectly fine on
Mesa however. Utilizing the previous commit that detects Xrandr
providers, we can enable this mechanism for users that have both Mesa
and not NVIDIA (to avoid messing up anyone that has a switchable
graphics system or such). Patches welcome if anyone figures out how to
fix this on NVIDIA.
Unlike the EGL/GLX sync extensions, the present extension works with any
graphics API (good for vulkan since its timing extension has been in
development hell). NVIDIA also happens to have zero support for the
EGL/GLX sync extensions, so we can just remove it with no loss. Only
Xorg ever used it and other backends already have their own present
methods. vo_vdpau VO is a special case that has its own fancying timing
code in its flip_page. This presumably works well, and I have no way of
testing it so just leave it as it is.
2022-06-10 16:49:38 +00:00
|
|
|
dependency('xpresent', version: '>= 1.0.0', required: x11_opt),
|
2023-08-12 22:54:11 +00:00
|
|
|
dependency('xrandr', version: '>= 1.4.0', required: x11_opt)],
|
2021-11-07 19:28:16 +00:00
|
|
|
}
|
2022-08-13 00:25:50 +00:00
|
|
|
x11_deps = true
|
2021-11-07 19:28:16 +00:00
|
|
|
foreach dep: x11['deps']
|
|
|
|
if not dep.found()
|
2022-08-13 00:25:50 +00:00
|
|
|
x11_deps = false
|
2021-11-07 19:28:16 +00:00
|
|
|
break
|
|
|
|
endif
|
|
|
|
endforeach
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'x11': x11_deps}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2022-08-13 00:25:50 +00:00
|
|
|
if features['x11']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += x11['deps']
|
|
|
|
sources += files('video/out/vo_x11.c',
|
|
|
|
'video/out/x11_common.c')
|
|
|
|
endif
|
|
|
|
|
2021-11-15 14:04:18 +00:00
|
|
|
xv_opt = get_option('xv').require(
|
2022-08-13 00:25:50 +00:00
|
|
|
features['x11'],
|
2021-11-15 14:04:18 +00:00
|
|
|
error_message: 'x11 could not be found!',
|
|
|
|
)
|
|
|
|
xv = dependency('xv', required: xv_opt)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'xv': xv.found()}
|
|
|
|
if features['xv']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += xv
|
|
|
|
sources += files('video/out/vo_xv.c')
|
|
|
|
endif
|
|
|
|
|
2023-11-22 18:44:13 +00:00
|
|
|
if features['wayland'] or features['x11'] or features['drm']
|
2022-06-10 16:49:28 +00:00
|
|
|
sources += ('video/out/present_sync.c')
|
|
|
|
endif
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
# OpenGL feature checking
|
2022-08-13 00:25:50 +00:00
|
|
|
gl_allowed = get_option('gl').allowed()
|
2022-08-15 16:30:11 +00:00
|
|
|
features += {'gl': false}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
GL = dependency('', required: false)
|
|
|
|
if darwin
|
|
|
|
GL = dependency('appleframeworks', modules: 'OpenGL', required: get_option('gl-cocoa'))
|
2022-08-14 22:36:08 +00:00
|
|
|
elif features['win32-desktop']
|
2021-11-07 19:28:16 +00:00
|
|
|
GL = dependency('GL', required: get_option('gl-win32'))
|
2022-08-13 00:25:50 +00:00
|
|
|
elif features['x11']
|
2021-11-07 19:28:16 +00:00
|
|
|
GL = dependency('GL', required: get_option('gl-x11'))
|
|
|
|
endif
|
|
|
|
|
|
|
|
gl_cocoa = get_option('gl-cocoa').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['cocoa'] and GL.found() and gl_allowed,
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'cocoa and GL were not found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'gl-cocoa': gl_cocoa.allowed()}
|
|
|
|
if features['gl-cocoa']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += GL
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'gl': true}
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
gl_win32 = get_option('gl-win32').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
GL.found() and gl_allowed and features['win32-desktop'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'GL and win32 desktop were not found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'gl-win32': gl_win32.allowed()}
|
|
|
|
if features['gl-win32']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += GL
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'gl': true}
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/context_win.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
gl_x11 = get_option('gl-x11').require(
|
2022-08-13 00:25:50 +00:00
|
|
|
GL.found() and gl_allowed and features['x11'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'GL and x11 were not found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'gl-x11': gl_x11.allowed()}
|
|
|
|
if features['gl-x11']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += GL
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'gl': true}
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/context_glx.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
gl_dxinterop = get_option('gl-dxinterop').require(
|
2024-03-23 19:04:37 +00:00
|
|
|
features['gl-win32'] and
|
|
|
|
cc.has_header_symbol('GL/wglext.h', 'WGL_ACCESS_READ_ONLY_NV',
|
|
|
|
prefix: '#include <GL/gl.h>') and
|
|
|
|
cc.has_header_symbol('d3d9.h', 'IDirect3D9Ex'),
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'gl-dxinterop could not be found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'gl-dxinterop': gl_dxinterop.allowed()}
|
|
|
|
if features['gl-dxinterop']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/context_dxinterop.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
egl_angle = get_option('egl-angle').require(
|
2023-03-30 13:24:22 +00:00
|
|
|
features['gl-win32'] and
|
|
|
|
cc.has_header_symbol('EGL/eglext.h',
|
|
|
|
'EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE',
|
|
|
|
prefix: '#include <EGL/egl.h>') and
|
|
|
|
cc.has_header_symbol('EGL/eglext_angle.h',
|
|
|
|
'PFNEGLCREATEDEVICEANGLEPROC',
|
|
|
|
# TODO: change to list when meson 1.0.0 is required
|
|
|
|
prefix: '#include <EGL/egl.h>\n#include <EGL/eglext.h>'),
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'egl-angle could not be found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'egl-angle': egl_angle.allowed()}
|
|
|
|
if features['egl-angle']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/angle_dynamic.c')
|
|
|
|
endif
|
|
|
|
|
2024-03-21 09:12:28 +00:00
|
|
|
egl_dep = cc.find_library('EGL', required:
|
|
|
|
get_option('egl-angle-lib').require(features['egl-angle']))
|
2021-11-07 19:28:16 +00:00
|
|
|
egl_angle_lib = get_option('egl-angle-lib').require(
|
2024-03-21 09:12:28 +00:00
|
|
|
egl_dep.found() and cc.has_function('eglCreateWindowSurface',
|
2023-01-17 01:27:04 +00:00
|
|
|
dependencies: egl_dep,
|
2022-08-14 22:36:08 +00:00
|
|
|
prefix: '#include <EGL/egl.h>'),
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'egl-angle-lib could not be found!',
|
|
|
|
)
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'egl-angle-lib': egl_angle_lib.allowed()}
|
2023-01-17 01:27:04 +00:00
|
|
|
if features['egl-angle-lib']
|
|
|
|
dependencies += egl_dep
|
|
|
|
endif
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
egl_angle_win32 = get_option('egl-angle-win32').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['egl-angle'] and features['win32-desktop'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'either this is not a win32 desktop or egl-angle was not found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'egl-angle-win32': egl_angle_win32.allowed()}
|
|
|
|
if features['egl-angle-win32']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/context_angle.c')
|
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['d3d11'] or features['egl-angle-win32']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/gpu/d3d11_helpers.c')
|
|
|
|
endif
|
|
|
|
|
2024-03-21 08:53:30 +00:00
|
|
|
egl = dependency('egl', version: '>= 1.4.0', required: get_option('egl'))
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'egl': egl.found() and gl_allowed}
|
|
|
|
if features['egl']
|
|
|
|
dependencies += egl
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2021-11-15 17:24:06 +00:00
|
|
|
egl_android_opt = get_option('egl-android').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['android'] and gl_allowed,
|
2021-11-15 17:24:06 +00:00
|
|
|
error_message: 'the OS is not android!',
|
2021-11-07 19:28:16 +00:00
|
|
|
)
|
2021-11-15 17:24:06 +00:00
|
|
|
egl_android = cc.find_library('EGL', required: egl_android_opt)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'egl-android': egl_android.found()}
|
|
|
|
if features['egl-android']
|
2021-11-15 17:24:06 +00:00
|
|
|
dependencies += egl_android
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'gl': true}
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/context_android.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
egl_drm = get_option('egl-drm').require(
|
2024-03-23 19:04:37 +00:00
|
|
|
features['drm'] and features['egl'] and features['gbm'] and gl_allowed,
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'either drm, egl, or gbm could not be found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'egl-drm': egl_drm.allowed()}
|
|
|
|
if features['egl-drm']
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'gl': true}
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/context_drm_egl.c')
|
|
|
|
endif
|
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
egl_wayland_opt = get_option('egl-wayland').require(
|
|
|
|
features['egl'] and features['wayland'] and gl_allowed,
|
|
|
|
error_message: 'either egl or wayland could not be found!',
|
|
|
|
)
|
|
|
|
egl_wayland = dependency('wayland-egl', version: '>= 9.0.0', required: egl_wayland_opt)
|
|
|
|
features += {'egl-wayland': egl_wayland.found()}
|
2023-07-23 20:05:59 +00:00
|
|
|
if features['egl-wayland']
|
2022-08-13 00:25:50 +00:00
|
|
|
dependencies += egl_wayland
|
|
|
|
features += {'gl': true}
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/context_wayland.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
egl_x11 = get_option('egl-x11').require(
|
2022-08-13 00:25:50 +00:00
|
|
|
features['egl'] and gl_allowed and features['x11'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'either egl or x11 could not be found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'egl-x11': egl_x11.allowed()}
|
|
|
|
if features['egl-x11']
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'gl': true}
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/context_x11egl.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
plain_gl = get_option('plain-gl').require(
|
2023-01-19 03:14:23 +00:00
|
|
|
gl_allowed,
|
|
|
|
error_message: 'gl was not enabled!',
|
2021-11-07 19:28:16 +00:00
|
|
|
)
|
2023-01-19 18:16:40 +00:00
|
|
|
if plain_gl.allowed()
|
2022-08-13 00:25:50 +00:00
|
|
|
features += {'gl': true}
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2024-03-21 09:08:48 +00:00
|
|
|
if features['egl'] or features['egl-android'] or features['egl-angle-win32']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/egl_helpers.c')
|
|
|
|
endif
|
|
|
|
|
2024-03-21 09:08:48 +00:00
|
|
|
if features['gl'] and features['egl']
|
2022-04-16 16:34:13 +00:00
|
|
|
sources += files('video/filter/vf_gpu_egl.c')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2022-08-13 00:25:50 +00:00
|
|
|
if features['gl']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/common.c',
|
|
|
|
'video/out/opengl/context.c',
|
|
|
|
'video/out/opengl/formats.c',
|
|
|
|
'video/out/opengl/libmpv_gl.c',
|
|
|
|
'video/out/opengl/ra_gl.c',
|
|
|
|
'video/out/opengl/utils.c')
|
2022-08-13 00:25:50 +00:00
|
|
|
elif not features['gl'] and get_option('gl').enabled()
|
2021-11-07 19:28:16 +00:00
|
|
|
error('gl enabled but no OpenGL video output could be found!')
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# vulkan
|
2021-11-15 17:24:06 +00:00
|
|
|
vulkan_opt = get_option('vulkan').require(
|
2022-08-25 19:57:35 +00:00
|
|
|
libplacebo.get_variable('pl_has_vulkan', default_value: '0') == '1',
|
2023-09-19 21:20:26 +00:00
|
|
|
error_message: 'libplacebo compiled without vulkan support!',
|
2021-11-15 17:24:06 +00:00
|
|
|
)
|
2023-09-09 18:54:40 +00:00
|
|
|
vulkan = dependency('vulkan', version: '>= 1.1.70', required: vulkan_opt)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'vulkan': vulkan.found()}
|
|
|
|
if features['vulkan']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += vulkan
|
|
|
|
sources += files('video/out/vulkan/context.c',
|
2022-04-16 16:34:13 +00:00
|
|
|
'video/out/vulkan/utils.c',
|
|
|
|
'video/filter/vf_gpu_vulkan.c')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['vulkan'] and features['android']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/vulkan/context_android.c')
|
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['vulkan'] and features['wayland']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/vulkan/context_wayland.c')
|
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['vulkan'] and features['win32-desktop']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/vulkan/context_win.c')
|
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['vulkan'] and features['x11']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/vulkan/context_xlib.c')
|
|
|
|
endif
|
|
|
|
|
2024-05-17 23:36:09 +00:00
|
|
|
features += {'vk-khr-display': vulkan.type_name() == 'internal' or
|
|
|
|
cc.has_function('vkCreateDisplayPlaneSurfaceKHR', prefix: '#include <vulkan/vulkan_core.h>',
|
2023-02-20 02:23:33 +00:00
|
|
|
dependencies: [vulkan])}
|
2023-08-20 20:40:58 +00:00
|
|
|
if features['vk-khr-display']
|
2023-02-20 02:23:33 +00:00
|
|
|
sources += files('video/out/vulkan/context_display.c')
|
|
|
|
endif
|
|
|
|
|
2022-04-16 16:34:13 +00:00
|
|
|
if features['vulkan'] or (features['gl'] and features['egl'])
|
|
|
|
sources += files('video/filter/vf_gpu.c')
|
|
|
|
endif
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
# hwaccel
|
2023-06-04 17:28:59 +00:00
|
|
|
ffnvcodec = dependency('ffnvcodec', version: '>= 11.1.5.1', required: false)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'ffnvcodec': ffnvcodec.found()}
|
|
|
|
if features['ffnvcodec']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += ffnvcodec
|
|
|
|
sources += files('video/cuda.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
cuda_hwaccel = get_option('cuda-hwaccel').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['ffnvcodec'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'ffnvcodec was not found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'cuda-hwaccel': cuda_hwaccel.allowed()}
|
|
|
|
if features['cuda-hwaccel']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/hwdec/hwdec_cuda.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
cuda_interop = get_option('cuda-interop').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['cuda-hwaccel'] and (features['gl'] or features['vulkan']),
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'cuda-hwaccel and either gl or vulkan were not found!',
|
|
|
|
)
|
2024-03-23 19:04:37 +00:00
|
|
|
features += {'cuda-interop': cuda_interop.allowed()}
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['cuda-interop'] and features['gl']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/hwdec/hwdec_cuda_gl.c')
|
|
|
|
endif
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['cuda-interop'] and features['vulkan']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/hwdec/hwdec_cuda_vk.c')
|
|
|
|
endif
|
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
android_media_ndk = get_option('android-media-ndk').require(
|
|
|
|
features['android'] and cc.has_header_symbol('media/NdkImageReader.h', 'AIMAGE_FORMAT_PRIVATE')
|
|
|
|
)
|
|
|
|
features += {'android-media-ndk': android_media_ndk.allowed()}
|
|
|
|
if features['android-media-ndk']
|
|
|
|
# header only, library is dynamically loaded
|
|
|
|
sources += files('video/out/hwdec/hwdec_aimagereader.c')
|
|
|
|
endif
|
|
|
|
|
hwdec_vulkan: add Vulkan HW Interop
Vulkan Video Decoding has finally become a reality, as it's now
showing up in shipping drivers, and the ffmpeg support has been
merged.
With that in mind, this change introduces HW interop support for
ffmpeg Vulkan frames. The implementation is functionally complete - it
can display frames produced by hardware decoding, and it can work with
ffmpeg vulkan filters. There are still various caveats due to gaps and
bugs in drivers, so YMMV, as always.
Primary testing has been done on Intel, AMD, and nvidia hardware on
Linux with basic Windows testing on nvidia.
Notable caveats:
* Due to driver bugs, video decoding on nvidia does not work right now,
unless you use the Vulkan Beta driver. It can be worked around, but
requires ffmpeg changes that are not considered acceptable to merge.
* Even if those work-arounds are applied, Vulkan filters will not work
on video that was decoded by Vulkan, due to additional bugs in the
nvidia drivers. The filters do work correctly on content decoded some
other way, and then uploaded to Vulkan (eg: Decode with nvdec, upload
with --vf=format=vulkan)
* Vulkan filters can only be used with drivers that support
VK_EXT_descriptor_buffer which doesn't include Intel ANV as yet.
There is an MR outstanding for this.
* When dealing with 1080p content, there may be some visual distortion
in the bottom lines of frames due to chroma scaling incorporating the
extra hidden lines at the bottom of the frame (1080p content is
actually stored as 1088 lines), depending on the hardware/driver
combination and the scaling algorithm. This cannot be easily
addressed as the mechanical fix for it violates the Vulkan spec, and
probably requires a spec change to resolve properly.
All of these caveats will be fixed in either drivers or ffmpeg, and so
will not require mpv changes (unless something unexpected happens)
If you want to run on nvidia with the non-beta drivers, you can this
ffmpeg tree with the work-around patches:
* https://github.com/philipl/FFmpeg/tree/vulkan-nvidia-workarounds
2022-03-12 19:21:29 +00:00
|
|
|
vulkan_interop = get_option('vulkan-interop').require(
|
2024-06-21 16:35:11 +00:00
|
|
|
features['vulkan'] and vulkan.version().version_compare('>=1.3.238'),
|
|
|
|
error_message: 'Vulkan Interop requires vulkan headers >= 1.3.238',
|
hwdec_vulkan: add Vulkan HW Interop
Vulkan Video Decoding has finally become a reality, as it's now
showing up in shipping drivers, and the ffmpeg support has been
merged.
With that in mind, this change introduces HW interop support for
ffmpeg Vulkan frames. The implementation is functionally complete - it
can display frames produced by hardware decoding, and it can work with
ffmpeg vulkan filters. There are still various caveats due to gaps and
bugs in drivers, so YMMV, as always.
Primary testing has been done on Intel, AMD, and nvidia hardware on
Linux with basic Windows testing on nvidia.
Notable caveats:
* Due to driver bugs, video decoding on nvidia does not work right now,
unless you use the Vulkan Beta driver. It can be worked around, but
requires ffmpeg changes that are not considered acceptable to merge.
* Even if those work-arounds are applied, Vulkan filters will not work
on video that was decoded by Vulkan, due to additional bugs in the
nvidia drivers. The filters do work correctly on content decoded some
other way, and then uploaded to Vulkan (eg: Decode with nvdec, upload
with --vf=format=vulkan)
* Vulkan filters can only be used with drivers that support
VK_EXT_descriptor_buffer which doesn't include Intel ANV as yet.
There is an MR outstanding for this.
* When dealing with 1080p content, there may be some visual distortion
in the bottom lines of frames due to chroma scaling incorporating the
extra hidden lines at the bottom of the frame (1080p content is
actually stored as 1088 lines), depending on the hardware/driver
combination and the scaling algorithm. This cannot be easily
addressed as the mechanical fix for it violates the Vulkan spec, and
probably requires a spec change to resolve properly.
All of these caveats will be fixed in either drivers or ffmpeg, and so
will not require mpv changes (unless something unexpected happens)
If you want to run on nvidia with the non-beta drivers, you can this
ffmpeg tree with the work-around patches:
* https://github.com/philipl/FFmpeg/tree/vulkan-nvidia-workarounds
2022-03-12 19:21:29 +00:00
|
|
|
)
|
|
|
|
features += {'vulkan-interop': vulkan_interop.allowed()}
|
2024-03-23 19:04:37 +00:00
|
|
|
if features['vulkan-interop']
|
hwdec_vulkan: add Vulkan HW Interop
Vulkan Video Decoding has finally become a reality, as it's now
showing up in shipping drivers, and the ffmpeg support has been
merged.
With that in mind, this change introduces HW interop support for
ffmpeg Vulkan frames. The implementation is functionally complete - it
can display frames produced by hardware decoding, and it can work with
ffmpeg vulkan filters. There are still various caveats due to gaps and
bugs in drivers, so YMMV, as always.
Primary testing has been done on Intel, AMD, and nvidia hardware on
Linux with basic Windows testing on nvidia.
Notable caveats:
* Due to driver bugs, video decoding on nvidia does not work right now,
unless you use the Vulkan Beta driver. It can be worked around, but
requires ffmpeg changes that are not considered acceptable to merge.
* Even if those work-arounds are applied, Vulkan filters will not work
on video that was decoded by Vulkan, due to additional bugs in the
nvidia drivers. The filters do work correctly on content decoded some
other way, and then uploaded to Vulkan (eg: Decode with nvdec, upload
with --vf=format=vulkan)
* Vulkan filters can only be used with drivers that support
VK_EXT_descriptor_buffer which doesn't include Intel ANV as yet.
There is an MR outstanding for this.
* When dealing with 1080p content, there may be some visual distortion
in the bottom lines of frames due to chroma scaling incorporating the
extra hidden lines at the bottom of the frame (1080p content is
actually stored as 1088 lines), depending on the hardware/driver
combination and the scaling algorithm. This cannot be easily
addressed as the mechanical fix for it violates the Vulkan spec, and
probably requires a spec change to resolve properly.
All of these caveats will be fixed in either drivers or ffmpeg, and so
will not require mpv changes (unless something unexpected happens)
If you want to run on nvidia with the non-beta drivers, you can this
ffmpeg tree with the work-around patches:
* https://github.com/philipl/FFmpeg/tree/vulkan-nvidia-workarounds
2022-03-12 19:21:29 +00:00
|
|
|
sources += files('video/out/hwdec/hwdec_vulkan.c')
|
|
|
|
endif
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
d3d_hwaccel = get_option('d3d-hwaccel').require(
|
|
|
|
win32,
|
|
|
|
error_message: 'the os is not win32!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'d3d-hwaccel': d3d_hwaccel.allowed()}
|
|
|
|
if features['d3d-hwaccel']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/d3d.c',
|
|
|
|
'video/filter/vf_d3d11vpp.c')
|
|
|
|
endif
|
2022-08-13 00:25:50 +00:00
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
if features['d3d-hwaccel'] and features['egl-angle']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/hwdec_d3d11egl.c')
|
|
|
|
endif
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['d3d-hwaccel'] and features['d3d11']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/d3d11/hwdec_d3d11va.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
d3d9_hwaccel = get_option('d3d9-hwaccel').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['d3d-hwaccel'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'd3d-hwaccel was not found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'d3d9-hwaccel': d3d9_hwaccel.allowed()}
|
|
|
|
if features['d3d9-hwaccel'] and features['egl-angle']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/hwdec_dxva2egl.c')
|
|
|
|
endif
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['d3d9-hwaccel'] and features['d3d11']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/d3d11/hwdec_dxva2dxgi.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
gl_dxinterop_d3d9 = get_option('gl-dxinterop-d3d9').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['gl-dxinterop'] and features['d3d9-hwaccel'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'gl-dxinterop and d3d9-hwaccel were not found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'gl-dxinterop-d3d9': gl_dxinterop_d3d9.allowed()}
|
|
|
|
if features['gl-dxinterop-d3d9']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/hwdec_dxva2gldx.c')
|
|
|
|
endif
|
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
# this is an arbitrary GLES 3.x symbol
|
|
|
|
ios_gl = cc.has_header_symbol('OpenGLES/ES3/glext.h', 'GL_RGB32F', required:
|
|
|
|
get_option('ios-gl').require(darwin))
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'ios-gl': ios_gl}
|
|
|
|
if features['ios-gl']
|
2022-07-14 02:26:14 +00:00
|
|
|
sources += files('video/out/hwdec/hwdec_ios_gl.m')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2023-07-25 14:10:42 +00:00
|
|
|
libva = dependency('libva', version: '>= 1.1.0', required: get_option('vaapi'))
|
2022-08-13 00:25:50 +00:00
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
vaapi_drm = dependency('libva-drm', version: '>= 1.1.0', required:
|
|
|
|
get_option('vaapi-drm').require(libva.found() and features['drm']))
|
2023-07-25 14:10:42 +00:00
|
|
|
features += {'vaapi-drm': vaapi_drm.found()}
|
2022-08-13 00:25:50 +00:00
|
|
|
if features['vaapi-drm']
|
|
|
|
dependencies += vaapi_drm
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
vaapi_wayland = dependency('libva-wayland', version: '>= 1.1.0', required:
|
|
|
|
get_option('vaapi-wayland').require(libva.found() and features['wayland']))
|
2023-07-25 14:10:42 +00:00
|
|
|
features += {'vaapi-wayland': vaapi_wayland.found()}
|
2022-08-13 00:25:50 +00:00
|
|
|
if features['vaapi-wayland']
|
|
|
|
dependencies += vaapi_wayland
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
vaapi_x11 = dependency('libva-x11', version: '>= 1.1.0', required:
|
|
|
|
get_option('vaapi-x11').require(libva.found() and features['x11']))
|
2023-07-25 14:10:42 +00:00
|
|
|
features += {'vaapi-x11': vaapi_x11.found()}
|
2022-08-13 00:25:50 +00:00
|
|
|
if features['vaapi-x11']
|
|
|
|
dependencies += vaapi_x11
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/vo_vaapi.c')
|
|
|
|
endif
|
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
vaapi_win32 = dependency('libva-win32', required:
|
|
|
|
get_option('vaapi-win32').require(libva.found() and win32))
|
2023-11-07 23:05:40 +00:00
|
|
|
features += {'vaapi-win32': vaapi_win32.found()}
|
|
|
|
if features['vaapi-win32']
|
|
|
|
dependencies += vaapi_win32
|
|
|
|
endif
|
|
|
|
|
2023-07-25 19:38:25 +00:00
|
|
|
vaapi = get_option('vaapi').require(libva.found() and (features['vaapi-drm'] or
|
2023-11-07 23:05:40 +00:00
|
|
|
features['vaapi-wayland'] or features['vaapi-x11'] or
|
|
|
|
features['vaapi-win32']))
|
2023-07-25 14:10:42 +00:00
|
|
|
features += {'vaapi': vaapi.allowed()}
|
|
|
|
|
|
|
|
if features['vaapi']
|
|
|
|
dependencies += libva
|
|
|
|
sources += files('video/filter/vf_vavpp.c',
|
2023-09-19 21:20:26 +00:00
|
|
|
'video/vaapi.c',
|
|
|
|
'video/out/hwdec/hwdec_vaapi.c',
|
|
|
|
'video/out/hwdec/dmabuf_interop_pl.c')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
features += {'dmabuf-interop-gl': features['egl'] and features['drm']}
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['dmabuf-interop-gl']
|
2022-07-31 19:59:15 +00:00
|
|
|
sources += files('video/out/hwdec/dmabuf_interop_gl.c')
|
|
|
|
endif
|
|
|
|
|
2022-06-19 01:51:31 +00:00
|
|
|
vdpau_opt = get_option('vdpau').require(
|
2022-08-13 00:25:50 +00:00
|
|
|
features['x11'],
|
2022-06-19 01:51:31 +00:00
|
|
|
error_message: 'x11 was not found!',
|
|
|
|
)
|
|
|
|
vdpau = dependency('vdpau', version: '>= 0.2', required: vdpau_opt)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'vdpau': vdpau.found()}
|
|
|
|
if features['vdpau']
|
2021-11-07 19:28:16 +00:00
|
|
|
dependencies += vdpau
|
|
|
|
sources += files('video/filter/vf_vdpaupp.c',
|
|
|
|
'video/out/vo_vdpau.c',
|
|
|
|
'video/vdpau.c',
|
|
|
|
'video/vdpau_mixer.c')
|
|
|
|
endif
|
2022-08-14 22:36:08 +00:00
|
|
|
|
2024-03-23 19:04:37 +00:00
|
|
|
features += {'vdpau-gl-x11': features['vdpau'] and gl_x11.allowed()}
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['vdpau'] and features['vdpau-gl-x11']
|
2021-11-07 19:28:16 +00:00
|
|
|
sources += files('video/out/opengl/hwdec_vdpau.c')
|
|
|
|
endif
|
|
|
|
|
|
|
|
videotoolbox_gl = get_option('videotoolbox-gl').require(
|
2022-08-14 22:36:08 +00:00
|
|
|
features['gl-cocoa'] or features['ios-gl'],
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'gl-cocoa nor ios-gl could be found!',
|
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'videotoolbox-gl': videotoolbox_gl.allowed()}
|
2024-03-23 19:04:37 +00:00
|
|
|
corevideo = dependency('appleframeworks', modules: ['CoreVideo'], required:
|
|
|
|
get_option('videotoolbox-pl').require(darwin))
|
2022-07-14 02:26:14 +00:00
|
|
|
videotoolbox_pl = get_option('videotoolbox-pl').require(
|
|
|
|
features['vulkan'] and corevideo.found(),
|
|
|
|
error_message: 'vulkan or CV metal support could be found!',
|
|
|
|
)
|
|
|
|
features += {'videotoolbox-pl': videotoolbox_pl.allowed()}
|
2024-03-10 14:50:43 +00:00
|
|
|
if features['videotoolbox-gl'] or features['videotoolbox-pl'] or features['ios-gl']
|
2022-07-14 02:26:14 +00:00
|
|
|
sources += files('video/out/hwdec/hwdec_vt.c')
|
|
|
|
endif
|
2022-08-14 22:36:08 +00:00
|
|
|
if features['videotoolbox-gl']
|
2022-07-14 02:26:14 +00:00
|
|
|
sources += files('video/out/hwdec/hwdec_mac_gl.c')
|
|
|
|
endif
|
|
|
|
if features['videotoolbox-pl']
|
|
|
|
dependencies += corevideo
|
|
|
|
sources += files('video/out/hwdec/hwdec_vt_pl.m')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
# macOS features
|
2023-08-15 02:14:52 +00:00
|
|
|
macos_sdk_version_py = ''
|
|
|
|
if darwin
|
|
|
|
macos_sdk_version_py = find_program(join_paths(source_root, 'TOOLS', 'macos-sdk-version.py'),
|
|
|
|
required: true)
|
|
|
|
endif
|
|
|
|
|
2023-01-19 22:08:31 +00:00
|
|
|
macos_sdk_path = ''
|
|
|
|
macos_sdk_version = '0.0'
|
2023-08-15 02:14:52 +00:00
|
|
|
if darwin and macos_sdk_version_py.found()
|
2023-10-29 15:15:40 +00:00
|
|
|
macos_sdk_info = run_command(macos_sdk_version_py, check: true).stdout().split(',')
|
2023-11-07 20:47:30 +00:00
|
|
|
macos_sdk_path = macos_sdk_info[0]
|
|
|
|
macos_sdk_version = macos_sdk_info[1]
|
2021-11-15 00:43:34 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if macos_sdk_path != ''
|
|
|
|
message('Detected macOS sdk path: ' + macos_sdk_path)
|
|
|
|
endif
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
if macos_sdk_version != '0.0'
|
|
|
|
message('Detected macOS SDK: ' + macos_sdk_version)
|
|
|
|
add_languages('objc')
|
|
|
|
objc_link_flags = ['-isysroot', macos_sdk_path, '-L/usr/lib', '-L/usr/local/lib']
|
|
|
|
add_project_link_arguments(objc_link_flags, language: ['c', 'objc'])
|
|
|
|
endif
|
|
|
|
|
2023-01-19 22:08:31 +00:00
|
|
|
xcrun = find_program('xcrun', required: get_option('swift-build').require(darwin))
|
2021-11-07 19:28:16 +00:00
|
|
|
swift_ver = '0.0'
|
|
|
|
if xcrun.found()
|
2022-01-17 14:34:23 +00:00
|
|
|
swift_prog = find_program(run_command(xcrun, '-find', 'swift', check: true).stdout().strip())
|
|
|
|
swift_ver_string = run_command(swift_prog, '-version', check: true).stdout()
|
2021-11-07 19:28:16 +00:00
|
|
|
verRe = '''
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
import re
|
|
|
|
import sys
|
|
|
|
verRe = re.compile("(?i)version\s?([\d.]+)")
|
|
|
|
swift_ver = verRe.search(sys.argv[1]).group(1)
|
|
|
|
sys.stdout.write(swift_ver)
|
|
|
|
'''
|
2022-01-17 14:34:23 +00:00
|
|
|
swift_ver = run_command(python, '-c', verRe, swift_ver_string, check: true).stdout()
|
2021-11-07 19:28:16 +00:00
|
|
|
message('Detected Swift version: ' + swift_ver)
|
|
|
|
endif
|
|
|
|
|
|
|
|
swift = get_option('swift-build').require(
|
2023-10-21 14:53:54 +00:00
|
|
|
darwin and macos_sdk_version.version_compare('>= 10.15') and swift_ver.version_compare('>= 4.1'),
|
2021-11-07 19:28:16 +00:00
|
|
|
error_message: 'A suitable macos sdk version or swift version could not be found!',
|
|
|
|
)
|
2023-09-30 14:01:04 +00:00
|
|
|
features += {'swift': swift.allowed()}
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
swift_sources = []
|
2023-09-30 14:01:04 +00:00
|
|
|
if features['cocoa'] and features['swift']
|
2024-03-29 14:48:36 +00:00
|
|
|
swift_sources += files('osdep/mac/application.swift',
|
|
|
|
'osdep/mac/app_hub.swift',
|
2024-03-23 15:23:19 +00:00
|
|
|
'osdep/mac/event_helper.swift',
|
2024-03-09 14:48:54 +00:00
|
|
|
'osdep/mac/input_helper.swift',
|
2024-03-23 19:09:15 +00:00
|
|
|
'osdep/mac/libmpv_helper.swift',
|
2024-02-27 15:55:29 +00:00
|
|
|
'osdep/mac/log_helper.swift',
|
2024-03-03 01:49:11 +00:00
|
|
|
'osdep/mac/menu_bar.swift',
|
2024-03-19 18:50:44 +00:00
|
|
|
'osdep/mac/option_helper.swift',
|
2024-02-27 15:55:29 +00:00
|
|
|
'osdep/mac/precise_timer.swift',
|
2024-04-06 21:31:05 +00:00
|
|
|
'osdep/mac/presentation.swift',
|
2024-02-27 15:55:29 +00:00
|
|
|
'osdep/mac/swift_compat.swift',
|
|
|
|
'osdep/mac/swift_extensions.swift',
|
2024-03-18 21:22:11 +00:00
|
|
|
'osdep/mac/type_helper.swift',
|
2021-11-07 19:28:16 +00:00
|
|
|
'video/out/mac/common.swift',
|
|
|
|
'video/out/mac/title_bar.swift',
|
|
|
|
'video/out/mac/view.swift',
|
|
|
|
'video/out/mac/window.swift')
|
|
|
|
endif
|
|
|
|
|
2024-06-15 13:18:43 +00:00
|
|
|
macos_10_15_4_features = get_option('macos-10-15-4-features').require(
|
|
|
|
macos_sdk_version.version_compare('>= 10.15.4'),
|
|
|
|
error_message: 'A macos sdk version >= 10.15.4 could not be found!',
|
|
|
|
)
|
|
|
|
features += {'macos-10-15-4-features': macos_10_15_4_features.allowed()}
|
|
|
|
|
2024-04-28 17:21:01 +00:00
|
|
|
macos_11_features = get_option('macos-11-features').require(
|
|
|
|
macos_sdk_version.version_compare('>= 11'),
|
|
|
|
error_message: 'A macos sdk version >= 11 could not be found!',
|
|
|
|
)
|
|
|
|
features += {'macos-11-features': macos_11_features.allowed()}
|
|
|
|
|
2024-06-15 14:51:08 +00:00
|
|
|
macos_11_3_features = get_option('macos-11-3-features').require(
|
|
|
|
macos_sdk_version.version_compare('>= 11.3'),
|
|
|
|
error_message: 'A macos sdk version >= 11.3 could not be found!',
|
|
|
|
)
|
|
|
|
features += {'macos-11-3-features': macos_11_3_features.allowed()}
|
|
|
|
|
2024-04-28 17:21:01 +00:00
|
|
|
macos_12_features = get_option('macos-12-features').require(
|
|
|
|
macos_sdk_version.version_compare('>= 12'),
|
|
|
|
error_message: 'A macos sdk version >= 12 could not be found!',
|
|
|
|
)
|
|
|
|
features += {'macos-12-features': macos_12_features.allowed()}
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
macos_cocoa_cb = get_option('macos-cocoa-cb').require(
|
2023-11-10 13:34:29 +00:00
|
|
|
features['cocoa'] and features['gl-cocoa'] and features['swift'],
|
|
|
|
error_message: 'Either cocoa, gl-cocoa or swift could not be found!',
|
2021-11-07 19:28:16 +00:00
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'macos-cocoa-cb': macos_cocoa_cb.allowed()}
|
|
|
|
if features['macos-cocoa-cb']
|
2021-11-07 19:28:16 +00:00
|
|
|
swift_sources += files('video/out/cocoa_cb_common.swift',
|
|
|
|
'video/out/mac/gl_layer.swift')
|
|
|
|
endif
|
2023-09-30 14:01:04 +00:00
|
|
|
if features['cocoa'] and features['vulkan'] and features['swift']
|
|
|
|
swift_sources += files('video/out/mac_common.swift',
|
|
|
|
'video/out/mac/metal_layer.swift')
|
|
|
|
sources += files('video/out/vulkan/context_mac.m')
|
|
|
|
endif
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
macos_media_player = get_option('macos-media-player').require(
|
2023-10-21 14:53:54 +00:00
|
|
|
features['swift'],
|
|
|
|
error_message: 'Swift was not found!',
|
2021-11-07 19:28:16 +00:00
|
|
|
)
|
2022-08-14 22:36:08 +00:00
|
|
|
features += {'macos-media-player': macos_media_player.allowed()}
|
|
|
|
if features['macos-media-player']
|
2024-02-27 15:55:29 +00:00
|
|
|
swift_sources += files('osdep/mac/remote_command_center.swift')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2022-11-11 16:18:25 +00:00
|
|
|
macos_touchbar = get_option('macos-touchbar').require(
|
2023-01-31 16:12:44 +00:00
|
|
|
features['cocoa'] and cc.has_header('AppKit/NSTouchBar.h'),
|
|
|
|
error_message: 'Either cocoa could not be found or AppKit/NSTouchBar.h could not be found!',
|
2022-11-11 16:18:25 +00:00
|
|
|
)
|
|
|
|
features += {'macos-touchbar': macos_touchbar.allowed()}
|
2022-08-13 00:25:50 +00:00
|
|
|
if features['macos-touchbar']
|
2024-03-17 16:12:09 +00:00
|
|
|
swift_sources += files('osdep/mac/touch_bar.swift')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
2024-03-03 01:49:11 +00:00
|
|
|
if features['swift'] and swift_sources.length() > 0
|
|
|
|
subdir('osdep/mac')
|
|
|
|
endif
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
# manpages
|
|
|
|
manpage = 'DOCS/man/mpv.rst'
|
2021-12-17 18:31:21 +00:00
|
|
|
rst2man = find_program('rst2man', 'rst2man.py', required: get_option('manpage-build'))
|
2024-03-23 18:59:58 +00:00
|
|
|
if rst2man.found()
|
2021-11-07 19:28:16 +00:00
|
|
|
mandir = get_option('mandir')
|
2021-11-15 00:43:34 +00:00
|
|
|
custom_target('manpages',
|
2021-11-07 19:28:16 +00:00
|
|
|
input: manpage,
|
|
|
|
output: 'mpv.1',
|
2023-01-05 23:28:16 +00:00
|
|
|
command: [
|
|
|
|
docutils_wrapper, rst2man,
|
|
|
|
'--record-dependencies', '@DEPFILE@',
|
|
|
|
'--strip-elements-with-class=contents',
|
|
|
|
'@INPUT@', '@OUTPUT@'],
|
|
|
|
depfile: 'mpv.1.dep',
|
2021-11-07 19:28:16 +00:00
|
|
|
install: true,
|
|
|
|
install_dir: join_paths(mandir, 'man1')
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
2023-01-13 04:46:26 +00:00
|
|
|
rst2html = find_program('rst2html', 'rst2html.py', required: get_option('html-build'))
|
2024-03-23 18:59:58 +00:00
|
|
|
if rst2html.found()
|
2021-11-07 19:28:16 +00:00
|
|
|
datadir = get_option('datadir')
|
2021-11-15 00:43:34 +00:00
|
|
|
custom_target('html-manpages',
|
2021-11-07 19:28:16 +00:00
|
|
|
input: manpage,
|
|
|
|
output: 'mpv.html',
|
2023-01-05 23:28:16 +00:00
|
|
|
command: [
|
|
|
|
docutils_wrapper, rst2html,
|
|
|
|
'--record-dependencies', '@DEPFILE@',
|
|
|
|
'@INPUT@', '@OUTPUT@'],
|
|
|
|
depfile: 'mpv.html.dep',
|
2021-11-07 19:28:16 +00:00
|
|
|
install: true,
|
|
|
|
install_dir: join_paths(datadir, 'doc', 'mpv')
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
rst2pdf = find_program('rst2pdf', required: get_option('pdf-build'))
|
2024-03-23 18:59:58 +00:00
|
|
|
if rst2pdf.found()
|
2023-05-01 17:05:00 +00:00
|
|
|
dependency_file = rst2pdf.version().version_compare('>=0.100')
|
2021-11-07 19:28:16 +00:00
|
|
|
datadir = get_option('datadir')
|
2021-11-15 00:43:34 +00:00
|
|
|
custom_target('pdf-manpages',
|
2021-11-07 19:28:16 +00:00
|
|
|
input: manpage,
|
|
|
|
output: 'mpv.pdf',
|
2023-03-06 19:11:07 +00:00
|
|
|
command: [
|
|
|
|
docutils_wrapper, rst2pdf,
|
|
|
|
'-c', '-b', '1', '--repeat-table-rows',
|
2023-05-01 17:05:00 +00:00
|
|
|
dependency_file ? ['--record-dependencies', '@DEPFILE@'] : [],
|
2023-03-06 19:11:07 +00:00
|
|
|
'@INPUT@', '-o', '@OUTPUT@'],
|
|
|
|
depfile: 'mpv.pdf.dep',
|
2021-11-07 19:28:16 +00:00
|
|
|
install: true,
|
|
|
|
install_dir: join_paths(datadir, 'doc', 'mpv')
|
|
|
|
)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2023-02-21 01:34:02 +00:00
|
|
|
if meson.version().version_compare('>= 1.1.0')
|
|
|
|
configuration = meson.build_options()
|
|
|
|
else
|
|
|
|
# Arbitrary hardcoded things to pass if the meson version is too
|
|
|
|
# old to have the build_options method.
|
|
|
|
configuration = 'meson configure build ' + '-Dprefix=' + get_option('prefix') + \
|
|
|
|
' -Dbuildtype=' + get_option('buildtype') + \
|
|
|
|
' -Doptimization=' + get_option('optimization')
|
|
|
|
endif
|
2021-11-07 19:28:16 +00:00
|
|
|
|
|
|
|
|
|
|
|
# Set config.h
|
|
|
|
conf_data = configuration_data()
|
|
|
|
conf_data.set_quoted('CONFIGURATION', configuration)
|
|
|
|
conf_data.set_quoted('DEFAULT_DVD_DEVICE', dvd_device)
|
|
|
|
conf_data.set_quoted('DEFAULT_CDROM_DEVICE', cd_device)
|
2022-08-13 00:25:50 +00:00
|
|
|
|
|
|
|
# Loop over all features in the build, create a define and add them to config.h
|
|
|
|
feature_keys = []
|
|
|
|
foreach feature, allowed: features
|
|
|
|
define = 'HAVE_@0@'.format(feature.underscorify().to_upper())
|
|
|
|
conf_data.set10(define, allowed)
|
|
|
|
# special handling for lua
|
|
|
|
if feature == 'lua' and allowed
|
|
|
|
feature_keys += lua_version
|
|
|
|
continue
|
|
|
|
endif
|
|
|
|
if allowed
|
|
|
|
feature_keys += feature
|
|
|
|
endif
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
|
|
|
|
# Script to sort the feature_keys object.
|
|
|
|
feature_sort = '''
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
|
|
features = " ".join(sorted(sys.argv[1:]))
|
|
|
|
sys.stdout.write(features)
|
|
|
|
'''
|
|
|
|
feature_str = run_command(python, '-c', feature_sort, feature_keys, check: true).stdout()
|
2021-11-07 19:28:16 +00:00
|
|
|
conf_data.set_quoted('FULLCONFIG', feature_str)
|
2022-11-19 18:46:06 +00:00
|
|
|
conf_data.set_quoted('MPV_CONFDIR', join_paths(get_option('prefix'), get_option('sysconfdir'), 'mpv'))
|
2022-01-23 05:06:26 +00:00
|
|
|
conf_data.set_quoted('PLATFORM', host_machine.system())
|
2021-11-07 19:28:16 +00:00
|
|
|
configure_file(output : 'config.h', configuration : conf_data)
|
|
|
|
message('List of enabled features: ' + feature_str)
|
|
|
|
|
2023-01-19 02:46:26 +00:00
|
|
|
# These are intentionally not added to conf_data.
|
|
|
|
features += {'cplayer': get_option('cplayer')}
|
|
|
|
features += {'libmpv-' + get_option('default_library'): get_option('libmpv')}
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
|
2022-08-13 00:25:50 +00:00
|
|
|
# build targets
|
2021-11-07 19:28:16 +00:00
|
|
|
if win32
|
|
|
|
windows = import('windows')
|
|
|
|
res_flags = ['--codepage=65001']
|
|
|
|
|
|
|
|
# Unintuitively, this compile operates out of the osdep subdirectory.
|
|
|
|
# Hence, these includes are needed.
|
|
|
|
res_includes = [source_root, build_root]
|
|
|
|
|
|
|
|
resources = ['etc/mpv-icon-8bit-16x16.png',
|
|
|
|
'etc/mpv-icon-8bit-32x32.png',
|
|
|
|
'etc/mpv-icon-8bit-64x64.png',
|
|
|
|
'etc/mpv-icon-8bit-128x128.png',
|
|
|
|
'etc/mpv-icon.ico',
|
|
|
|
'osdep/mpv.exe.manifest']
|
|
|
|
|
|
|
|
sources += windows.compile_resources('osdep/mpv.rc', args: res_flags, depend_files: resources,
|
|
|
|
depends: version_h, include_directories: res_includes)
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
2023-01-27 01:59:17 +00:00
|
|
|
client_h_define = cc.get_define('MPV_CLIENT_API_VERSION', prefix: '#include "libmpv/client.h"',
|
|
|
|
include_directories: include_directories('.'))
|
|
|
|
major = client_h_define.split('|')[0].split('<<')[0].strip('() ')
|
|
|
|
minor = client_h_define.split('|')[1].strip('() ')
|
|
|
|
client_api_version = major + '.' + minor + '.0'
|
|
|
|
|
|
|
|
libmpv = library('mpv', sources, dependencies: dependencies, gnu_symbol_visibility: 'hidden',
|
2023-09-05 20:06:13 +00:00
|
|
|
link_args: cc.get_supported_link_arguments(['-Wl,-Bsymbolic']),
|
2023-10-22 00:43:15 +00:00
|
|
|
version: client_api_version, install: get_option('libmpv'),
|
|
|
|
build_by_default: get_option('libmpv'))
|
2023-01-27 01:59:17 +00:00
|
|
|
|
|
|
|
|
2021-11-07 19:28:16 +00:00
|
|
|
if get_option('libmpv')
|
|
|
|
pkg = import('pkgconfig')
|
|
|
|
pkg.generate(libmpv, version: client_api_version,
|
|
|
|
description: 'mpv media player client library')
|
|
|
|
|
2021-11-29 12:12:02 +00:00
|
|
|
headers = ['libmpv/client.h', 'libmpv/render.h',
|
2021-11-07 19:28:16 +00:00
|
|
|
'libmpv/render_gl.h', 'libmpv/stream_cb.h']
|
|
|
|
install_headers(headers, subdir: 'mpv')
|
2023-10-02 16:36:20 +00:00
|
|
|
|
|
|
|
# Allow projects to build with libmpv by cloning into ./subprojects/mpv
|
|
|
|
libmpv_dep = declare_dependency(link_with: libmpv)
|
|
|
|
meson.override_dependency('mpv', libmpv_dep)
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('cplayer')
|
|
|
|
datadir = get_option('datadir')
|
|
|
|
confdir = get_option('sysconfdir')
|
|
|
|
|
|
|
|
conf_files = ['etc/mpv.conf', 'etc/input.conf',
|
|
|
|
'etc/mplayer-input.conf', 'etc/restore-old-bindings.conf']
|
|
|
|
install_data(conf_files, install_dir: join_paths(datadir, 'doc', 'mpv'))
|
|
|
|
|
|
|
|
bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
|
|
|
|
install_data('etc/mpv.bash-completion', install_dir: bash_install_dir, rename: 'mpv')
|
|
|
|
|
|
|
|
zsh_install_dir = join_paths(datadir, 'zsh', 'site-functions')
|
|
|
|
install_data('etc/_mpv.zsh', install_dir: zsh_install_dir, rename: '_mpv')
|
|
|
|
|
2022-09-06 18:17:36 +00:00
|
|
|
install_data('etc/mpv.metainfo.xml', install_dir: join_paths(datadir, 'metainfo'))
|
2021-11-07 19:28:16 +00:00
|
|
|
install_data('etc/encoding-profiles.conf', install_dir: join_paths(confdir, 'mpv'))
|
|
|
|
|
|
|
|
foreach size: ['16x16', '32x32', '64x64', '128x128']
|
|
|
|
icon_dir = join_paths(datadir, 'icons', 'hicolor', size, 'apps')
|
|
|
|
install_data('etc/mpv-icon-8bit-' + size + '.png', install_dir: icon_dir, rename: 'mpv.png')
|
|
|
|
endforeach
|
|
|
|
|
|
|
|
hicolor_dir = join_paths(datadir, 'icons', 'hicolor')
|
|
|
|
install_data('etc/mpv-gradient.svg', install_dir: join_paths(hicolor_dir, 'scalable', 'apps'),
|
|
|
|
rename: 'mpv.svg')
|
|
|
|
install_data('etc/mpv-symbolic.svg', install_dir: join_paths(hicolor_dir, 'symbolic', 'apps'))
|
|
|
|
|
2024-03-07 12:45:27 +00:00
|
|
|
mpv = executable('mpv', main_fn_source, objects: libmpv.extract_all_objects(recursive: true), dependencies: dependencies,
|
2024-05-01 17:06:21 +00:00
|
|
|
win_subsystem: 'windows', install: true)
|
2023-11-27 19:19:35 +00:00
|
|
|
|
|
|
|
# Older meson versions generate this in the player subdirectory.
|
|
|
|
if win32 and meson.version().version_compare('>= 1.3.0')
|
|
|
|
wrapper_sources= 'osdep/win32-console-wrapper.c'
|
|
|
|
executable('mpv', wrapper_sources, c_args: '-municode', link_args: '-municode',
|
|
|
|
name_suffix: 'com', install: true)
|
|
|
|
endif
|
2024-02-21 19:56:41 +00:00
|
|
|
|
|
|
|
if darwin
|
|
|
|
osxbundle = find_program(join_paths(tools_directory, 'osxbundle.py'), required: true)
|
|
|
|
custom_target('macos-bundle',
|
|
|
|
output: 'mpv.app',
|
|
|
|
command: [osxbundle, mpv.full_path(), '@SOURCE_ROOT@'],
|
|
|
|
)
|
|
|
|
endif
|
2024-05-14 18:32:18 +00:00
|
|
|
|
|
|
|
if not win32 and not darwin
|
|
|
|
if meson.can_run_host_binaries()
|
|
|
|
mpv_desktop_path = join_paths(source_root, 'etc', 'mpv.desktop')
|
|
|
|
custom_target('mpv.desktop',
|
|
|
|
depends: mpv,
|
|
|
|
output: 'mpv.desktop',
|
|
|
|
command: [mpv_desktop, mpv_desktop_path, mpv.full_path(), '@OUTPUT@'],
|
|
|
|
install: true,
|
|
|
|
install_dir: join_paths(datadir, 'applications'),
|
|
|
|
)
|
|
|
|
else
|
|
|
|
install_data('etc/mpv.desktop', install_dir: join_paths(datadir, 'applications'))
|
|
|
|
endif
|
|
|
|
endif
|
2023-02-26 03:50:08 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if get_option('tests')
|
|
|
|
subdir('test')
|
2021-11-07 19:28:16 +00:00
|
|
|
endif
|
2022-06-20 14:10:43 +00:00
|
|
|
|
2024-02-03 04:40:06 +00:00
|
|
|
if get_option('fuzzers')
|
|
|
|
subdir('fuzzers')
|
|
|
|
endif
|
|
|
|
|
2022-08-14 22:36:08 +00:00
|
|
|
summary({'d3d11': features['d3d11'],
|
|
|
|
'javascript': features['javascript'],
|
2022-06-20 14:10:43 +00:00
|
|
|
'libmpv': get_option('libmpv'),
|
2022-08-14 22:36:08 +00:00
|
|
|
'lua': features['lua'],
|
2022-08-13 00:25:50 +00:00
|
|
|
'opengl': features['gl'],
|
2022-08-14 22:36:08 +00:00
|
|
|
'vulkan': features['vulkan'],
|
2022-08-13 00:25:50 +00:00
|
|
|
'wayland': features['wayland'],
|
|
|
|
'x11': features['x11']},
|
2022-06-20 14:10:43 +00:00
|
|
|
bool_yn: true)
|