2023-02-26 03:50:08 +00:00
|
|
|
# So we don't have to reorganize the entire directory tree.
|
|
|
|
incdir = include_directories('../')
|
|
|
|
outdir = join_paths(build_root, 'test', 'out')
|
2024-04-12 15:09:27 +00:00
|
|
|
refdir = ''
|
2023-02-26 03:50:08 +00:00
|
|
|
|
|
|
|
# Convenient testing libraries. An adhoc collection of
|
|
|
|
# mpv objects that test_utils.c needs. Paths and subprocesses
|
|
|
|
# are required in order to run a diff command when comparing
|
|
|
|
# different files. Stuff will probably break if core things are
|
|
|
|
# carelessly moved around.
|
|
|
|
test_utils_args = []
|
|
|
|
test_utils_files = [
|
|
|
|
'audio/chmap.c',
|
|
|
|
'audio/format.c',
|
|
|
|
'common/common.c',
|
|
|
|
'misc/bstr.c',
|
|
|
|
'misc/dispatch.c',
|
|
|
|
'misc/json.c',
|
|
|
|
'misc/node.c',
|
2024-02-19 09:11:25 +00:00
|
|
|
'misc/path_utils.c',
|
2023-02-26 03:50:08 +00:00
|
|
|
'misc/random.c',
|
|
|
|
'misc/thread_tools.c',
|
|
|
|
'options/m_config_core.c',
|
|
|
|
'options/m_config_frontend.c',
|
|
|
|
'options/m_option.c',
|
|
|
|
'options/path.c',
|
|
|
|
'osdep/io.c',
|
|
|
|
'osdep/subprocess.c',
|
2023-10-18 13:45:47 +00:00
|
|
|
'osdep/timer.c',
|
|
|
|
timer_source,
|
2023-02-26 03:50:08 +00:00
|
|
|
path_source,
|
|
|
|
subprocess_source,
|
|
|
|
'ta/ta.c',
|
|
|
|
'ta/ta_talloc.c',
|
|
|
|
'ta/ta_utils.c'
|
|
|
|
]
|
2023-09-15 14:51:44 +00:00
|
|
|
|
|
|
|
test_utils_deps = [libavutil, libm]
|
|
|
|
|
2023-10-22 01:49:04 +00:00
|
|
|
if win32
|
|
|
|
test_utils_files += 'osdep/windows_utils.c'
|
|
|
|
endif
|
|
|
|
|
2023-10-22 00:43:15 +00:00
|
|
|
if features['pthread-debug']
|
2023-10-22 02:12:14 +00:00
|
|
|
test_utils_files += 'osdep/threads-posix.c'
|
2023-10-22 00:43:15 +00:00
|
|
|
endif
|
|
|
|
|
2023-10-18 13:45:47 +00:00
|
|
|
# The zimg code requires using threads.
|
2023-10-22 00:43:15 +00:00
|
|
|
if not features['win32-threads']
|
2023-09-15 14:51:44 +00:00
|
|
|
test_utils_deps += pthreads
|
2023-02-26 03:50:08 +00:00
|
|
|
endif
|
|
|
|
|
|
|
|
if features['win32-desktop']
|
2023-12-15 16:29:56 +00:00
|
|
|
test_utils_deps += cc.find_library('imm32')
|
2023-10-26 19:13:12 +00:00
|
|
|
test_utils_deps += cc.find_library('ntdll')
|
2024-05-05 16:50:38 +00:00
|
|
|
if features['pathcch']
|
|
|
|
test_utils_deps += cc.find_library('pathcch')
|
|
|
|
endif
|
2023-02-26 03:50:08 +00:00
|
|
|
endif
|
|
|
|
test_utils_objects = libmpv.extract_objects(test_utils_files)
|
|
|
|
test_utils = static_library('test-utils', 'test_utils.c', include_directories: incdir,
|
|
|
|
c_args: test_utils_args, objects: test_utils_objects,
|
|
|
|
dependencies: test_utils_deps)
|
|
|
|
|
|
|
|
# For getting imgfmts and stuff.
|
|
|
|
img_utils_files = [
|
|
|
|
'misc/thread_pool.c',
|
|
|
|
'video/csputils.c',
|
|
|
|
'video/fmt-conversion.c',
|
|
|
|
'video/img_format.c',
|
|
|
|
'video/mp_image.c',
|
2023-11-03 23:52:14 +00:00
|
|
|
'video/out/placebo/utils.c',
|
2023-02-26 03:50:08 +00:00
|
|
|
'video/sws_utils.c'
|
|
|
|
]
|
|
|
|
if features['zimg']
|
|
|
|
img_utils_files += ['video/repack.c', 'video/zimg.c']
|
|
|
|
endif
|
|
|
|
|
|
|
|
img_utils_objects = libmpv.extract_objects(img_utils_files)
|
|
|
|
img_utils = static_library('img-utils', 'img_utils.c', include_directories: incdir,
|
2024-02-23 16:57:12 +00:00
|
|
|
dependencies: [libavcodec, libplacebo], objects: img_utils_objects)
|
2023-02-26 03:50:08 +00:00
|
|
|
|
|
|
|
# The actual tests.
|
|
|
|
chmap_files = [
|
|
|
|
'audio/chmap_sel.c'
|
|
|
|
]
|
|
|
|
if features['av-channel-layout']
|
|
|
|
chmap_files += 'audio/chmap_avchannel.c'
|
|
|
|
endif
|
|
|
|
chmap_objects = libmpv.extract_objects(chmap_files)
|
|
|
|
chmap = executable('chmap', 'chmap.c', include_directories: incdir,
|
2023-08-06 17:36:12 +00:00
|
|
|
dependencies: [libavutil], objects: chmap_objects,
|
|
|
|
link_with: test_utils)
|
2023-02-26 03:50:08 +00:00
|
|
|
test('chmap', chmap)
|
|
|
|
|
|
|
|
gl_video_objects = libmpv.extract_objects('video/out/gpu/ra.c',
|
|
|
|
'video/out/gpu/utils.c')
|
|
|
|
gl_video = executable('gl-video', 'gl_video.c', objects: gl_video_objects,
|
2024-02-23 16:57:12 +00:00
|
|
|
dependencies: [libavutil, libplacebo], include_directories: incdir,
|
2023-09-16 05:42:16 +00:00
|
|
|
link_with: [img_utils, test_utils])
|
2023-02-26 03:50:08 +00:00
|
|
|
test('gl-video', gl_video)
|
|
|
|
|
|
|
|
json = executable('json', 'json.c', include_directories: incdir, link_with: test_utils)
|
|
|
|
test('json', json)
|
|
|
|
|
|
|
|
linked_list = executable('linked-list', files('linked_list.c'), include_directories: incdir)
|
|
|
|
test('linked-list', linked_list)
|
|
|
|
|
2023-10-18 13:45:47 +00:00
|
|
|
timer = executable('timer', files('timer.c'), include_directories: incdir, link_with: test_utils)
|
|
|
|
test('timer', timer)
|
|
|
|
|
2023-11-19 20:22:24 +00:00
|
|
|
format = executable('format', files('format.c'), include_directories: incdir, link_with: test_utils)
|
|
|
|
test('format', format)
|
|
|
|
|
2023-02-26 03:50:08 +00:00
|
|
|
paths_objects = libmpv.extract_objects('options/path.c', path_source)
|
|
|
|
paths = executable('paths', 'paths.c', include_directories: incdir,
|
|
|
|
objects: paths_objects, link_with: test_utils)
|
|
|
|
test('paths', paths)
|
|
|
|
|
|
|
|
if get_option('libmpv')
|
2024-04-15 16:35:44 +00:00
|
|
|
exe = executable('libmpv-test', 'libmpv_test.c',
|
|
|
|
include_directories: incdir, link_with: libmpv)
|
2023-07-26 14:35:01 +00:00
|
|
|
file = join_paths(source_root, 'etc', 'mpv-icon-8bit-16x16.png')
|
2024-04-15 16:35:44 +00:00
|
|
|
test('libmpv', exe, args: file, timeout: 60)
|
|
|
|
|
|
|
|
exe = executable('libmpv-encode', 'libmpv_encode.c',
|
|
|
|
include_directories: incdir, link_with: libmpv)
|
|
|
|
test('libmpv-encode', exe, timeout: 30)
|
2023-02-26 03:50:08 +00:00
|
|
|
endif
|
|
|
|
|
2024-04-12 15:09:27 +00:00
|
|
|
# Supported libavutil versions that work with these tests.
|
2023-02-26 03:50:08 +00:00
|
|
|
# Will need to be manually updated when ffmpeg adds/removes more formats in the future.
|
2024-04-12 14:36:11 +00:00
|
|
|
if libavutil.version().version_compare('>= 59.0.100')
|
2024-04-12 15:09:27 +00:00
|
|
|
refdir = join_paths(source_root, 'test', 'ref', 'ffmpeg7')
|
|
|
|
elif libavutil.version().version_compare('>= 58.27.100')
|
|
|
|
refdir = join_paths(source_root, 'test', 'ref', 'ffmpeg6')
|
|
|
|
endif
|
2023-02-26 03:50:08 +00:00
|
|
|
|
2024-04-12 15:09:27 +00:00
|
|
|
if refdir != ''
|
2023-03-27 20:42:17 +00:00
|
|
|
# The CI can randomly fail if libavutil isn't explicitly linked again here.
|
2023-02-26 03:50:08 +00:00
|
|
|
img_format = executable('img-format', 'img_format.c', include_directories: incdir,
|
2023-10-23 22:44:18 +00:00
|
|
|
dependencies: [libavutil, libplacebo], link_with: [img_utils, test_utils])
|
2023-02-26 03:50:08 +00:00
|
|
|
test('img-format', img_format, args: [refdir, outdir], suite: 'ffmpeg')
|
|
|
|
|
|
|
|
|
|
|
|
scale_sws_objects = libmpv.extract_objects('video/image_writer.c',
|
|
|
|
'video/repack.c')
|
|
|
|
scale_sws = executable('scale-sws', ['scale_sws.c', 'scale_test.c'], include_directories: incdir,
|
2023-10-23 22:44:18 +00:00
|
|
|
objects: scale_sws_objects, dependencies: [libavutil, libavformat, libswscale, jpeg, zimg, libplacebo],
|
2023-02-26 03:50:08 +00:00
|
|
|
link_with: [img_utils, test_utils])
|
|
|
|
test('scale-sws', scale_sws, args: [refdir, outdir], suite: 'ffmpeg')
|
|
|
|
|
|
|
|
if features['zimg']
|
|
|
|
repack_objects = libmpv.extract_objects('sub/draw_bmp.c')
|
|
|
|
repack = executable('repack', 'repack.c', include_directories: incdir, objects: repack_objects,
|
2023-10-23 22:44:18 +00:00
|
|
|
dependencies: [libavutil, libswscale, zimg, libplacebo], link_with: [img_utils, test_utils])
|
2023-02-26 03:50:08 +00:00
|
|
|
test('repack', repack, args: [refdir, outdir], suite: 'ffmpeg')
|
|
|
|
|
|
|
|
scale_zimg_objects = libmpv.extract_objects('video/image_writer.c')
|
|
|
|
scale_zimg = executable('scale-zimg', ['scale_test.c', 'scale_zimg.c'], include_directories: incdir,
|
2023-10-23 22:44:18 +00:00
|
|
|
objects: scale_zimg_objects, dependencies:[libavutil, libavformat, libswscale, jpeg, zimg, libplacebo],
|
2023-02-26 03:50:08 +00:00
|
|
|
link_with: [img_utils, test_utils])
|
|
|
|
test('scale-zimg', scale_zimg, args: [refdir, outdir], suite: 'ffmpeg')
|
|
|
|
endif
|
|
|
|
endif
|