Skip to content

Commit

Permalink
Merge branches 'bestsource', 'vapoursynth' and 'bugfixes' into feature
Browse files Browse the repository at this point in the history
  • Loading branch information
arch1t3cht committed Mar 8, 2024
4 parents e2e3906 + 4f8cb84 + bf8bbb6 + 86295a8 commit cd2e894
Show file tree
Hide file tree
Showing 12 changed files with 100 additions and 216 deletions.
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
8 changes: 4 additions & 4 deletions automation/vapoursynth/aegisub_vs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion packages/win_installer/fragment_codecs.iss
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/audio_provider_bestsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class BSAudioProvider final : public agi::AudioProvider {
/// @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) {
Expand Down
2 changes: 1 addition & 1 deletion src/libresrc/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down
2 changes: 1 addition & 1 deletion src/libresrc/osx/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down
4 changes: 2 additions & 2 deletions src/video_provider_bestsource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions subprojects/bestsource.wrap
Original file line number Diff line number Diff line change
@@ -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
66 changes: 66 additions & 0 deletions subprojects/packagefiles/bestsource/0001.patch
Original file line number Diff line number Diff line change
@@ -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'))
156 changes: 0 additions & 156 deletions subprojects/packagefiles/bestsource/libp2p/p2p_api.h

This file was deleted.

36 changes: 0 additions & 36 deletions subprojects/packagefiles/bestsource/meson.build

This file was deleted.

18 changes: 9 additions & 9 deletions tools/win-installer-setup.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit cd2e894

Please sign in to comment.