diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a8999ab7e..b5ecc2622 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -123,12 +123,21 @@ jobs: if: matrix.config.os == 'windows-latest' run: | choco install ninja innosetup - $url = "https://github.com/leafo/moonscript/releases/download/win32-v0.5.0/moonscript-187bac54ee5a7450013e9c38e005a0e671b76f45.zip" + + $moonscripturl = "https://github.com/leafo/moonscript/releases/download/win32-v0.5.0/moonscript-187bac54ee5a7450013e9c38e005a0e671b76f45.zip" mkdir moonscript - Invoke-WebRequest -Uri $url -OutFile ".\moonscript\moonscript.zip" - cd moonscript + Invoke-WebRequest -Uri $moonscripturl -OutFile ".\moonscript\moonscript.zip" + pushd moonscript 7z e moonscript.zip Get-Location | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + popd + + $gettexturl = "https://github.com/mlocati/gettext-iconv-windows/releases/download/v0.21-v1.16/gettext0.21-iconv1.16-static-64.zip" + Invoke-WebRequest -Uri $gettexturl -OutFile ".\gettext.zip" + Expand-Archive ".\gettext.zip" -DestinationPath gettext + pushd gettext/bin + Get-Location | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append + popd - name: Install dependencies (MacOS) if: matrix.config.os == 'macos-latest' diff --git a/automation/vapoursynth/aegisub_vs.py b/automation/vapoursynth/aegisub_vs.py index 3e37cb91f..dc354df03 100644 --- a/automation/vapoursynth/aegisub_vs.py +++ b/automation/vapoursynth/aegisub_vs.py @@ -308,15 +308,15 @@ def get_keyframes(filename: str, clip: vs.VideoNode, fallback: str | List[int], def check_audio(filename: str, **kwargs: Any) -> bool: """ Checks whether the given file has an audio track by trying to open it with - BestAudioSource. Requires the `bas` plugin to return correct results, but + BestSource. Requires the `bs` plugin to return correct results, but won't crash if it's not installed. - Additional keyword arguments are passed on to BestAudioSource. + Additional keyword arguments are passed on to BestSource. """ progress_set_message("Checking if the file has an audio track") progress_set_indeterminate() try: - ensure_plugin("bas", "BestAudioSource", "") - vs.core.bas.Source(source=filename, **kwargs) + ensure_plugin("bs", "BestSource", "") + vs.core.bs.AudioSource(source=filename, **kwargs) return True except AttributeError: pass diff --git a/packages/win_installer/fragment_codecs.iss b/packages/win_installer/fragment_codecs.iss index 14d4f503d..70f47194a 100644 --- a/packages/win_installer/fragment_codecs.iss +++ b/packages/win_installer/fragment_codecs.iss @@ -7,6 +7,6 @@ DestDir: {app}; Source: {#DEPS_DIR}\AvisynthPlus64\x64\Output\plugins\DirectShow DestDir: {app}\csri; Source: {#DEPS_DIR}\VSFilter\x64\VSFilter.dll; Flags: ignoreversion; Components: main ; VapourSynth DestDir: {app}\vapoursynth; Source: {#DEPS_DIR}\L-SMASH-Works\libvslsmashsource.dll; Flags: ignoreversion; Components: vapoursynth -DestDir: {app}\vapoursynth; Source: {#DEPS_DIR}\bestaudiosource\win64\BestAudioSource.dll; Flags: ignoreversion; Components: vapoursynth +DestDir: {app}\vapoursynth; Source: {#DEPS_DIR}\BestSource\x64\BestSource.dll; Flags: ignoreversion; Components: vapoursynth DestDir: {app}\vapoursynth; Source: {#DEPS_DIR}\SCXVid\libscxvid.dll; Flags: ignoreversion; Components: vapoursynth DestDir: {app}\vapoursynth; Source: {#DEPS_DIR}\WWXD\libwwxd64.dll; Flags: ignoreversion; Components: vapoursynth diff --git a/src/audio_provider_bestsource.cpp b/src/audio_provider_bestsource.cpp index d95eb949e..2fe16ba3c 100644 --- a/src/audio_provider_bestsource.cpp +++ b/src/audio_provider_bestsource.cpp @@ -52,7 +52,7 @@ public: /// @param filename The filename to open BSAudioProvider::BSAudioProvider(agi::fs::path const& filename, agi::BackgroundRunner *br) try : bsopts() -, bs(filename.string(), -1, -1, GetBSCacheFile(filename), &bsopts) +, bs(filename.string(), -1, -1, 0, GetBSCacheFile(filename), &bsopts) { bs.SetMaxCacheSize(OPT_GET("Provider/Audio/BestSource/Max Cache Size")->GetInt() << 20); br->Run([&](agi::ProgressSink *ps) { diff --git a/src/libresrc/default_config.json b/src/libresrc/default_config.json index 240998fdb..718a3d11a 100644 --- a/src/libresrc/default_config.json +++ b/src/libresrc/default_config.json @@ -352,7 +352,7 @@ "Aegisub Cache" : true }, "VapourSynth" : { - "Default Script" : "# This default script will load an audio file using BestAudioSource.\n# It requires the `bas` plugin.\n\nimport vapoursynth as vs\nimport aegisub_vs as a\na.set_paths(locals())\n\na.ensure_plugin(\"bas\", \"BestAudioSource\", \"To use Aegisub's default audio loader, the `bas` plugin for VapourSynth must be installed\")\nvs.core.bas.Source(source=filename).set_output()" + "Default Script" : "# This default script will load an audio file using BestSource.\n# It requires the `bs` plugin.\n\nimport vapoursynth as vs\nimport aegisub_vs as a\na.set_paths(locals())\n\na.ensure_plugin(\"bs\", \"BestSource\", \"To use Aegisub's default audio loader, the `bs` plugin for VapourSynth must be installed\")\nvs.core.bs.AudioSource(source=filename).set_output()" } }, "Avisynth" : { diff --git a/src/libresrc/osx/default_config.json b/src/libresrc/osx/default_config.json index 01acf37da..9e1ec662e 100644 --- a/src/libresrc/osx/default_config.json +++ b/src/libresrc/osx/default_config.json @@ -352,7 +352,7 @@ "Aegisub Cache" : true }, "VapourSynth" : { - "Default Script" : "# This default script will load an audio file using BestAudioSource.\n# It requires the `bas` plugin.\n\nimport vapoursynth as vs\nimport aegisub_vs as a\na.set_paths(globals())\n\na.ensure_plugin(\"bas\", \"BestAudioSource\", \"To use Aegisub's default audio loader, the `bas` plugin for VapourSynth must be installed\")\nvs.core.bas.Source(source=filename).set_output()" + "Default Script" : "# This default script will load an audio file using BestSource.\n# It requires the `bs` plugin.\n\nimport vapoursynth as vs\nimport aegisub_vs as a\na.set_paths(locals())\n\na.ensure_plugin(\"bs\", \"BestSource\", \"To use Aegisub's default audio loader, the `bs` plugin for VapourSynth must be installed\")\nvs.core.bs.AudioSource(source=filename).set_output()" } }, "Avisynth" : { diff --git a/src/video_provider_bestsource.cpp b/src/video_provider_bestsource.cpp index c7412a4e0..41aa3b23f 100644 --- a/src/video_provider_bestsource.cpp +++ b/src/video_provider_bestsource.cpp @@ -103,12 +103,12 @@ std::string colormatrix_description(const AVFrame *frame) { BSVideoProvider::BSVideoProvider(agi::fs::path const& filename, std::string const& colormatrix, agi::BackgroundRunner *br) try : bsopts() -, bs(filename.string(), "", -1, false, OPT_GET("Provider/Video/BestSource/Threads")->GetInt(), GetBSCacheFile(filename), &bsopts) +, bs(filename.string(), "", 0, -1, false, OPT_GET("Provider/Video/BestSource/Threads")->GetInt(), GetBSCacheFile(filename), &bsopts) { bs.SetMaxCacheSize(OPT_GET("Provider/Video/BestSource/Max Cache Size")->GetInt() << 20); bs.SetSeekPreRoll(OPT_GET("Provider/Video/BestSource/Seek Preroll")->GetInt()); try { - BestAudioSource dummysource(filename.string(), -1, 0, ""); + BestAudioSource dummysource(filename.string(), -1, 0, 0, ""); has_audio = true; } catch (AudioException const& err) { has_audio = false; diff --git a/subprojects/bestsource.wrap b/subprojects/bestsource.wrap index 67943fcb3..4a4dcac9c 100644 --- a/subprojects/bestsource.wrap +++ b/subprojects/bestsource.wrap @@ -1,7 +1,8 @@ [wrap-git] url = https://github.com/vapoursynth/bestsource -revision = ba1249c1f5443be6d0ec2be32490af5bbc96bf99 -patch_directory = bestsource +revision = R1 +clone-recursive = true +diff_files = bestsource/0001.patch [provide] bestsource = bestsource_dep diff --git a/subprojects/packagefiles/bestsource/0001.patch b/subprojects/packagefiles/bestsource/0001.patch new file mode 100644 index 000000000..a57bf3a76 --- /dev/null +++ b/subprojects/packagefiles/bestsource/0001.patch @@ -0,0 +1,66 @@ +diff --git a/meson.build b/meson.build +index 38de461..d56af62 100644 +--- a/meson.build ++++ b/meson.build +@@ -2,10 +2,6 @@ project('BestSource', 'cpp', + default_options: ['buildtype=release', 'b_lto=true', 'b_ndebug=if-release', 'cpp_std=c++14'], + license: 'MIT', + meson_version: '>=0.53.0', +- version: '.'.join([ +- run_command('grep', 'BEST_SOURCE_VERSION_MAJOR', 'src/version.h', check: true).stdout().strip().split()[2], +- run_command('grep', 'BEST_SOURCE_VERSION_MINOR', 'src/version.h', check: true).stdout().strip().split()[2] +- ]) + ) + + link_static = get_option('link_static') +@@ -15,7 +11,6 @@ sources = [ + 'src/BSRational.cpp', + 'src/BSShared.cpp', + 'src/SrcAttribCache.cpp', +- 'src/vapoursynth.cpp', + 'src/videosource.cpp' + ] + +@@ -46,17 +41,23 @@ if host_machine.cpu_family().startswith('x86') + ) + endif + +-vapoursynth_dep = dependency('vapoursynth', version: '>=55').partial_dependency(compile_args: true, includes: true) +- + deps = [ +- vapoursynth_dep, +- dependency('jansson', version: '>=2.12', static: link_static), + dependency('libavcodec', version: '>=60.31.0', static: link_static), + dependency('libavformat', version: '>=60.16.0', static: link_static), + dependency('libavutil', version: '>=58.29.0', static: link_static), + dependency('libswscale', version: '>=7.5.0', static: link_static) + ] + ++jansson_dep = dependency('jansson', version: '>= 2.12', required: false) ++ ++if jansson_dep.found() ++ deps += jansson_dep ++else ++ cmake = import('cmake') ++ jansson = cmake.subproject('jansson') ++ deps += jansson.dependency('jansson') ++endif ++ + is_gnu_linker = meson.get_compiler('cpp').get_linker_id() in ['ld.bfd', 'ld.gold', 'ld.mold'] + link_args = [] + +@@ -66,11 +67,11 @@ elif is_gnu_linker + link_args += ['-Wl,-Bsymbolic'] + endif + +-shared_module('bestsource', sources, ++bs_lib = static_library('bestsource', sources, + dependencies: deps, + gnu_symbol_visibility: 'hidden', +- install: true, +- install_dir: vapoursynth_dep.get_variable(pkgconfig: 'libdir') / 'vapoursynth', + link_args: link_args, + link_with: libs + ) ++ ++bestsource_dep = declare_dependency(link_with: bs_lib, include_directories: include_directories('src')) diff --git a/subprojects/packagefiles/bestsource/libp2p/p2p_api.h b/subprojects/packagefiles/bestsource/libp2p/p2p_api.h deleted file mode 100644 index f66166538..000000000 --- a/subprojects/packagefiles/bestsource/libp2p/p2p_api.h +++ /dev/null @@ -1,156 +0,0 @@ -// Since we don't use ExportAsPlanar, we don't actually need libp2p. -// So instead of adding another wrap and meson build file, and *also* -// patching the include statement in videosource.cpp, we throw a dummy -// header file in the folder that should contain the checkout of libp2p. - -#ifndef P2P_API_H_ -#define P2P_API_H_ - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Notation: [Xa-Ya-Za] - * - * [] denotes a machine word of the specified endianness. Xa-Ya-Za denote - * component X, Y, and Z packed in the word, with bit depths a, b, c, in order - * from MSB to LSB. Padding bits are represented by the component '!'. - */ -enum p2p_packing { - /** [R8-G8-B8] */ - p2p_rgb24_be, /* RGB */ - p2p_rgb24_le, /* BGR */ - p2p_rgb24, - /** [A8-R8-G8-B8] */ - p2p_argb32_be, /* ARGB */ - p2p_argb32_le, /* BGRA */ - p2p_argb32, - /** [A8-Y8-U8-V8] */ - p2p_ayuv_be, /* AYUV */ - p2p_ayuv_le, /* VUYA */ - p2p_ayuv, - /** [R16-G16-B16] */ - p2p_rgb48_be, /* RGB, big-endian components */ - p2p_rgb48_le, /* BGR, little-endian components */ - p2p_rgb48, - /** [A16-R16-G16-B16] */ - p2p_argb64_be, /* ARGB big-endian components */ - p2p_argb64_le, /* BGRA little-endian components */ - p2p_argb64, - /** [A2-R10-G10-B10] */ - p2p_rgb30_be, /* ARGB packed in big-endian DWORD */ - p2p_rgb30_le, /* ARGB packed in little-endian DWORD */ - p2p_rgb30, - /** [A2-V10-Y10-U10] */ - p2p_y410_be, /* AVYU packed in big-endian DWORD */ - p2p_y410_le, /* AVYU packed in little-endian DWORD */ - p2p_y410, - /** [A16-V16-Y16-U16] */ - p2p_y416_be, /* AVYU, big-endian components */ - p2p_y416_le, /* UYVA, little-endian components */ - p2p_y416, - /** [Y8] [U8] [Y8] [V8] */ - p2p_yuy2, - /** [U8] [Y8] [V8] [Y8] */ - p2p_uyvy, - /** [Y10-!6] [U10-!6] [Y10-!6] [V10-!6] */ - p2p_y210_be, /* YUYV, big-endian components, lower 6 bits zero */ - p2p_y210_le, /* YUYV, little-endian components, lower 6 bits zero. Microsoft Y210. */ - p2p_y210, - /** [Y16] [U16] [Y16] [V16] */ - p2p_y216_be, /* YUYV, big-endian components */ - p2p_y216_le, /* YUYV, little-endian components. Microsoft Y216. */ - p2p_y216, - /** [!2-V10-Y10-U10] [!2-Y10-U10-Y10] [!2-U10-Y10-V10] [!2-Y10-V10-Y10] */ - p2p_v210_be, /* v210 with big-endian DWORDs */ - p2p_v210_le, /* Apple/QuickTime v210 */ - p2p_v210, - /** [U16] [Y16] [V16] [Y16] */ - p2p_v216_be, /* UYVY, big-endian components */ - p2p_v216_le, /* UYVY, little-endian components. Apple/QuickTime v216. */ - p2p_v216, - /** [U8-V8] */ - p2p_nv12_be, /* aka NV21, V first */ - p2p_nv12_le, /* NV12 */ - p2p_nv12, - /** [U10-!6-V10-!6] */ - p2p_p010_be, /* NV21, big-endian components, lower 6 bits zero */ - p2p_p010_le, /* NV12, little-endian components, lower 6 bits zero. Microsoft P010. */ - p2p_p010, - /** [U16-V16] */ - p2p_p016_be, /* NV21, big-endian components */ - p2p_p016_le, /* NV12, little-endian components. Microsoft P016. */ - p2p_p016, - /** [U10-!6-V10-!6] */ - p2p_p210_be, /* NV21, big-endian components, lower 6 bits zero */ - p2p_p210_le, /* NV12, little-endian components, lower 6 bits zero. Microsoft P210. */ - p2p_p210, - /** [U16-V16] */ - p2p_p216_be, /* NV21, big-endian components */ - p2p_p216_le, /* NV12, little-endian components. Microsoft P216. */ - p2p_p216, - /** [R8-G8-B8-A8] */ - p2p_rgba32_be, /* RGBA */ - p2p_rgba32_le, /* ABGR */ - p2p_rgba32, - /** [R16-G16-B16-A16] */ - p2p_rgba64_be, /* RGBA, big-endian components */ - p2p_rgba64_le, /* ABGR, little-endian components */ - p2p_rgba64, - /** [A16-B16-G16-R16] */ - p2p_abgr64_be, /* ABGR, big-endian components */ - p2p_abgr64_le, /* RGBA, little-endian components */ - p2p_abgr64, - /** [B16-G16-R16] */ - p2p_bgr48_be, /* BGR, big-endian components */ - p2p_bgr48_le, /* RGB, little-endian components */ - p2p_bgr48, - /** [B16-G16-R16-A16] */ - p2p_bgra64_be, /* BGRA, big-endian components */ - p2p_bgra64_le, /* ARGB, little-endian components */ - p2p_bgra64, - - p2p_packing_max, -}; - -struct p2p_buffer_param { - /** - * Planar order: R-G-B-A or Y-U-V-A. Alpha is optional. - * Packed order: Y-UV if NV12/21, else single plane. Y optional for NV12/21. - */ - const void *src[4]; - void *dst[4]; - ptrdiff_t src_stride[4]; - ptrdiff_t dst_stride[4]; - unsigned width; - unsigned height; - enum p2p_packing packing; -}; - -/** Pack/unpack a range of pixels from a scanline. */ -typedef void (*p2p_unpack_func)(const void *src, void * const dst[4], unsigned left, unsigned right); -typedef void (*p2p_pack_func)(const void * const src[4], void *dst, unsigned left, unsigned right); - -/** Select a line pack/unpack function. */ -p2p_unpack_func p2p_select_unpack_func(enum p2p_packing packing); -p2p_pack_func p2p_select_pack_func(enum p2p_packing packing); -p2p_pack_func p2p_select_pack_func_ex(enum p2p_packing packing, int alpha_one_fill); - - -/** When processing formats like NV12, ignore the unpacked plane. */ -#define P2P_SKIP_UNPACKED_PLANES (1UL << 0) -/** When packing, store a bit pattern of all ones in the alpha channel instead of all zeros. */ -#define P2P_ALPHA_SET_ONE (1UL << 1) - -/** Helper function to pack/unpack between memory locations. */ -void p2p_unpack_frame(const struct p2p_buffer_param *param, unsigned long flags) {}; -void p2p_pack_frame(const struct p2p_buffer_param *param, unsigned long flags) {}; - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif /* P2P_API_H_ */ diff --git a/subprojects/packagefiles/bestsource/meson.build b/subprojects/packagefiles/bestsource/meson.build deleted file mode 100644 index b4f77c93f..000000000 --- a/subprojects/packagefiles/bestsource/meson.build +++ /dev/null @@ -1,36 +0,0 @@ -project('BestSource', 'cpp', - default_options: ['buildtype=release', 'b_ndebug=if-release', 'cpp_std=c++14'], - meson_version: '>=0.48.0' -) - -cmake = import('cmake') - -sources = [ - 'src/audiosource.cpp', - 'src/videosource.cpp', - 'src/SrcAttribCache.cpp', - 'src/BSRational.cpp', -] - -deps = [ - dependency('libavcodec'), - dependency('libavformat'), - dependency('libavutil'), -] - -jansson_dep = dependency('jansson', version: '>= 2.7', required: false) - -if jansson_dep.found() - deps += jansson_dep -else - jansson = cmake.subproject('jansson') - deps += jansson.dependency('jansson') -endif - -bs_lib = static_library('bestsource', sources, - dependencies: deps, - gnu_symbol_visibility: 'hidden' -) - -bestsource_dep = declare_dependency(link_with: bs_lib, include_directories: include_directories('src')) - diff --git a/tools/win-installer-setup.ps1 b/tools/win-installer-setup.ps1 index 8ffb8af73..7999d023a 100644 --- a/tools/win-installer-setup.ps1 +++ b/tools/win-installer-setup.ps1 @@ -75,15 +75,15 @@ if (!(Test-Path L-SMASH-Works)) { Remove-Item release-x86_64-cachedir-cwd.zip } -# bestaudiosource -if (!(Test-Path bestaudiosource)) { - $basDir = New-Item -ItemType Directory bestaudiosource - Set-Location $basDir - $basReleases = Invoke-WebRequest "https://api.github.com/repos/vapoursynth/bestaudiosource/releases/latest" -Headers $GitHeaders -UseBasicParsing | ConvertFrom-Json - $basUrl = $basReleases.assets[0].browser_download_url - Invoke-WebRequest $basUrl -OutFile bas-r1.7z -UseBasicParsing - 7z x bas-r1.7z - Remove-Item bas-r1.7z +# BestSource +if (!(Test-Path BestSource)) { + $bsDir = New-Item -ItemType Directory BestSource + Set-Location $bsDir + $basReleases = Invoke-WebRequest "https://api.github.com/repos/vapoursynth/bestsource/releases/latest" -Headers $GitHeaders -UseBasicParsing | ConvertFrom-Json + $bsUrl = $basReleases.assets[0].browser_download_url + Invoke-WebRequest $bsUrl -OutFile bestsource.7z -UseBasicParsing + 7z x bestsource.7z + Remove-Item bestsource.7z Set-Location $DepsDir }