From 7721ae689fa7dc1e01b7344f2297ed704537e7f2 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Fri, 26 Aug 2022 15:17:59 +0200 Subject: [PATCH 01/11] Fix Avisynth paths for portable build Also apply the change in 75db50b to the portable build. The .mo files, on the other hand, already work as they are. --- packages/win_installer/portable/create-portable.ps1 | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/win_installer/portable/create-portable.ps1 b/packages/win_installer/portable/create-portable.ps1 index 0b121254f..4f4717bfe 100644 --- a/packages/win_installer/portable/create-portable.ps1 +++ b/packages/win_installer/portable/create-portable.ps1 @@ -53,9 +53,9 @@ Write-Output 'Copying - translations' Copy-New-Items "$InstallerDir\share\locale\*" "$PortableOutputDir\locale" -Recurse Write-Output 'Copying - codecs' Write-Output 'Copying - codecs\Avisynth' -Copy-New-Item $InstallerDepsDir\AvisynthPlus64\x86-64\DevIL.dll $PortableOutputDir -Copy-New-Item $InstallerDepsDir\AvisynthPlus64\x86-64\AviSynth.dll $PortableOutputDir -Copy-New-Item $InstallerDepsDir\AvisynthPlus64\x86-64\plugins\DirectShowSource.dll $PortableOutputDir +Copy-New-Item $InstallerDepsDir\AvisynthPlus64\x64\system\DevIL.dll $PortableOutputDir +Copy-New-Item $InstallerDepsDir\AvisynthPlus64\x64\AviSynth.dll $PortableOutputDir +Copy-New-Item $InstallerDepsDir\AvisynthPlus64\x64\plugins\DirectShowSource.dll $PortableOutputDir Write-Output 'Copying - codecs\VSFilter' Copy-New-Item $InstallerDepsDir\VSFilter\x64\VSFilter.dll $PortableOutputDir\csri Write-Output 'Copying - runtimes\MS-CRT' From fb7f4bdd9aa3eeea32abeef1c7e9b2ec9914a359 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Fri, 26 Aug 2022 15:25:09 +0200 Subject: [PATCH 02/11] installer: Bump VCRedist to 17 (2015 - 2022) The windows-latest platform in the CI already uses VS2022, so let's bump the VCRedist to match. --- tools/win-installer-setup.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/win-installer-setup.ps1 b/tools/win-installer-setup.ps1 index 312bf292c..6a403d21a 100644 --- a/tools/win-installer-setup.ps1 +++ b/tools/win-installer-setup.ps1 @@ -71,7 +71,7 @@ if (!(Test-Path ffi-experiments)) { # VC++ redistributable if (!(Test-Path VC_redist)) { $redistDir = New-Item -ItemType Directory VC_redist - Invoke-WebRequest https://aka.ms/vs/16/release/VC_redist.x64.exe -OutFile "$redistDir\VC_redist.x64.exe" -UseBasicParsing + Invoke-WebRequest https://aka.ms/vs/17/release/VC_redist.x64.exe -OutFile "$redistDir\VC_redist.x64.exe" -UseBasicParsing } # TODO dictionaries From 3fedc88641f6d1ae2b638b8d2e55e21abb4d0dd3 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Sun, 28 Aug 2022 01:38:41 +0200 Subject: [PATCH 03/11] Include strings.rc as resource file on Windows This was included here: https://github.com/Aegisub/Aegisub/blob/6f546951b4f004da16ce19ba638bf3eedefb9f31/build/Aegisub/Aegisub.vcxproj.filters#L1094 in the MSVC build. --- src/meson.build | 1 + 1 file changed, 1 insertion(+) diff --git a/src/meson.build b/src/meson.build index 72587d366..368c1d7ba 100644 --- a/src/meson.build +++ b/src/meson.build @@ -214,6 +214,7 @@ elif host_machine.system() == 'windows' depends: version_h, include_directories: [res_inc, version_inc, wx_inc]) endif + aegisub_src += windows.compile_resources('res/strings.rc') endif if conf.has('WITH_FONTCONFIG') From 7ea1d650a950d9211cce944226ca3b66c8d96dbb Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Mon, 29 Aug 2022 11:08:21 +0200 Subject: [PATCH 04/11] bestsource: Fixes to fps and colorspace conversion Some of these got lost in the process before. For now, default to 709 if the colorspace is unkown. More detailed colorspace guessing can be added in the future. --- src/video_provider_bestsource.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/video_provider_bestsource.cpp b/src/video_provider_bestsource.cpp index 3b5e0834c..a75a8c676 100644 --- a/src/video_provider_bestsource.cpp +++ b/src/video_provider_bestsource.cpp @@ -147,7 +147,7 @@ BSVideoProvider::BSVideoProvider(agi::fs::path const& filename, std::string cons Keyframes.push_back(n); } - TimecodesVector.push_back((int) frame->GetAVFrame()->pts); + TimecodesVector.push_back(frame->Pts * properties.TimeBase.Den / properties.TimeBase.Num); ps->SetProgress(n, properties.NumFrames); } @@ -182,6 +182,14 @@ void BSVideoProvider::GetFrame(int n, VideoFrame &out) { throw VideoDecodeError("Couldn't convert frame!"); } + int range = frame->color_range == AVCOL_RANGE_JPEG; + const int *coefficients = sws_getCoefficients(frame->colorspace == AVCOL_SPC_UNSPECIFIED ? AVCOL_SPC_BT709 : frame->colorspace); + + sws_setColorspaceDetails(context, + coefficients, range, + coefficients, range, + 0, 1 << 16, 1 << 16); + out.data.resize(frame->width * frame->height * 4); uint8_t *data[1] = {&out.data[0]}; int stride[1] = {frame->width * 4}; From a394aefd1a8a4e4fd49c50f068543a37884813cd Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Tue, 13 Sep 2022 22:41:18 +0200 Subject: [PATCH 05/11] Fix crash when cancelling automation scripts When cancelling an automation macro from the progress dialog, the dialog throws a UserCancelException. If the macro still runs to the end afterwards (instead of calling aegisub.cancel or causing an exception), the two return values are left on the stack. This causes assertion errors due to check_stack when those are enabled. --- src/auto4_lua.cpp | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/src/auto4_lua.cpp b/src/auto4_lua.cpp index 6c131902e..2044c3681 100644 --- a/src/auto4_lua.cpp +++ b/src/auto4_lua.cpp @@ -624,27 +624,33 @@ namespace { { bool failed = false; BackgroundScriptRunner bsr(parent, title); - bsr.Run([&](ProgressSink *ps) { - LuaProgressSink lps(L, ps, can_open_config); + try { + bsr.Run([&](ProgressSink *ps) { + LuaProgressSink lps(L, ps, can_open_config); - // Insert our error handler under the function to call - lua_pushcclosure(L, add_stack_trace, 0); - lua_insert(L, -nargs - 2); + // Insert our error handler under the function to call + lua_pushcclosure(L, add_stack_trace, 0); + lua_insert(L, -nargs - 2); - if (lua_pcall(L, nargs, nresults, -nargs - 2)) { - if (!lua_isnil(L, -1)) { - // if the call failed, log the error here - ps->Log("\n\nLua reported a runtime error:\n"); - ps->Log(get_string_or_default(L, -1)); + if (lua_pcall(L, nargs, nresults, -nargs - 2)) { + if (!lua_isnil(L, -1)) { + // if the call failed, log the error here + ps->Log("\n\nLua reported a runtime error:\n"); + ps->Log(get_string_or_default(L, -1)); + } + lua_pop(L, 2); + failed = true; } - lua_pop(L, 2); - failed = true; - } - else - lua_remove(L, -nresults - 1); + else + lua_remove(L, -nresults - 1); - lua_gc(L, LUA_GCCOLLECT, 0); - }); + lua_gc(L, LUA_GCCOLLECT, 0); + }); + } catch (agi::UserCancelException const&) { + if (!failed) + lua_pop(L, 2); + throw; + } if (failed) throw agi::UserCancelException("Script threw an error"); } From 38efde92e353a88529dbbf25760d894434873808 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Wed, 14 Sep 2022 11:31:24 +0200 Subject: [PATCH 06/11] folding: Fix selections jumping around --- src/base_grid.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/base_grid.cpp b/src/base_grid.cpp index b01a0dac2..0dc7bc538 100644 --- a/src/base_grid.cpp +++ b/src/base_grid.cpp @@ -483,13 +483,13 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) { else { // Only scroll if the mouse has moved to a different row to avoid // scrolling on sloppy clicks - if (row != extendRow) { + if (VisRowToRow(row) != extendRow) { if (row <= yPos) ScrollTo(yPos - 3); // When dragging down we give a 3 row margin to make it easier // to see what's going on, but we don't want to scroll down if // the user clicks on the bottom row and drags up - else if (row > yPos + h / lineHeight - (row > extendRow ? 3 : 1)) + else if (row > yPos + h / lineHeight - (VisRowToRow(row) > extendRow ? 3 : 1)) ScrollTo(yPos + 3); } } @@ -512,7 +512,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) { int old_y_pos = yPos; context->selectionController->SetActiveLine(dlg); ScrollTo(old_y_pos); - extendRow = row; + extendRow = VisRowToRow(row); auto const& selection = context->selectionController->GetSelectedSet(); @@ -541,7 +541,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) { // Block select if ((click && shift && !alt) || holding) { extendRow = old_extend; - int i1 = row; + int i1 = VisRowToRow(row); int i2 = extendRow; if (i1 > i2) @@ -550,7 +550,7 @@ void BaseGrid::OnMouseEvent(wxMouseEvent &event) { // Toggle each Selection newsel; if (ctrl) newsel = selection; - for (int i = VisRowToRow(i1); i <= VisRowToRow(i2); i++) + for (int i = i1; i <= i2; i++) newsel.insert(GetDialogue(i)); context->selectionController->SetSelectedSet(std::move(newsel)); return; @@ -739,14 +739,14 @@ void BaseGrid::OnKeyDown(wxKeyEvent &event) { if (shift && !ctrl && !alt) { extendRow = old_extend; // Set range - int begin = next; + int begin = VisRowToRow(next); int end = extendRow; if (end < begin) std::swap(begin, end); // Select range Selection newsel; - for (int i = VisRowToRow(begin); i <= VisRowToRow(end); i++) + for (int i = begin; i <= end; i++) newsel.insert(GetDialogue(i)); context->selectionController->SetSelectedSet(std::move(newsel)); From 22fb4c6e8cb8be3ad135077980fe7c50b8929a62 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Tue, 27 Sep 2022 16:54:15 +0200 Subject: [PATCH 07/11] Move luabins back to vendor Workaround for TypesettingTools/Aegisub#162 --- meson.build | 2 +- {subprojects => vendor}/luabins/AUTHORS | 0 {subprojects => vendor}/luabins/BENCHMARK | 0 {subprojects => vendor}/luabins/COPYRIGHT | 0 {subprojects => vendor}/luabins/HISTORY | 0 {subprojects => vendor}/luabins/README.md | 0 {subprojects => vendor}/luabins/TODO | 0 {subprojects => vendor}/luabins/etc/benchmark.lua | 0 {subprojects => vendor}/luabins/etc/checkfmt.lua | 0 {subprojects => vendor}/luabins/etc/dataset.lua | 0 {subprojects => vendor}/luabins/etc/tolua.lua | 0 {subprojects => vendor}/luabins/etc/toluabins.lua | 0 .../luabins/rockspec/luabins-0.1.1-1.rockspec | 0 .../luabins/rockspec/luabins-0.1.1-2.rockspec | 0 .../luabins/rockspec/luabins-0.2-1.rockspec | 0 .../luabins/rockspec/luabins-0.3-1.rockspec | 0 .../luabins/rockspec/luabins-scm-1.rockspec | 0 .../luabins/rockspec/luabins-scm-2.rockspec | 0 {subprojects => vendor}/luabins/src/fwrite.c | 0 {subprojects => vendor}/luabins/src/fwrite.h | 0 {subprojects => vendor}/luabins/src/load.c | 0 {subprojects => vendor}/luabins/src/luabins.c | 0 {subprojects => vendor}/luabins/src/luabins.h | 0 {subprojects => vendor}/luabins/src/luaheaders.h | 0 {subprojects => vendor}/luabins/src/luainternals.c | 0 {subprojects => vendor}/luabins/src/luainternals.h | 0 {subprojects => vendor}/luabins/src/lualess.h | 0 {subprojects => vendor}/luabins/src/meson.build | 0 {subprojects => vendor}/luabins/src/save.c | 0 {subprojects => vendor}/luabins/src/savebuffer.c | 0 {subprojects => vendor}/luabins/src/savebuffer.h | 0 {subprojects => vendor}/luabins/src/saveload.h | 0 {subprojects => vendor}/luabins/src/write.c | 0 {subprojects => vendor}/luabins/src/write.h | 0 {subprojects => vendor}/luabins/test/large_data.lua | 0 .../luabins/test/large_data.luabins | Bin {subprojects => vendor}/luabins/test/test.c | 0 {subprojects => vendor}/luabins/test/test.h | 0 {subprojects => vendor}/luabins/test/test.lua | 0 {subprojects => vendor}/luabins/test/test_api.c | 0 .../luabins/test/test_fwrite_api.c | 0 .../luabins/test/test_savebuffer.c | 0 .../luabins/test/test_write_api.c | 0 {subprojects => vendor}/luabins/test/util.c | 0 {subprojects => vendor}/luabins/test/util.h | 0 .../luabins/test/write_tests.inc | 0 46 files changed, 1 insertion(+), 1 deletion(-) rename {subprojects => vendor}/luabins/AUTHORS (100%) rename {subprojects => vendor}/luabins/BENCHMARK (100%) rename {subprojects => vendor}/luabins/COPYRIGHT (100%) rename {subprojects => vendor}/luabins/HISTORY (100%) rename {subprojects => vendor}/luabins/README.md (100%) rename {subprojects => vendor}/luabins/TODO (100%) rename {subprojects => vendor}/luabins/etc/benchmark.lua (100%) rename {subprojects => vendor}/luabins/etc/checkfmt.lua (100%) rename {subprojects => vendor}/luabins/etc/dataset.lua (100%) rename {subprojects => vendor}/luabins/etc/tolua.lua (100%) rename {subprojects => vendor}/luabins/etc/toluabins.lua (100%) rename {subprojects => vendor}/luabins/rockspec/luabins-0.1.1-1.rockspec (100%) rename {subprojects => vendor}/luabins/rockspec/luabins-0.1.1-2.rockspec (100%) rename {subprojects => vendor}/luabins/rockspec/luabins-0.2-1.rockspec (100%) rename {subprojects => vendor}/luabins/rockspec/luabins-0.3-1.rockspec (100%) rename {subprojects => vendor}/luabins/rockspec/luabins-scm-1.rockspec (100%) rename {subprojects => vendor}/luabins/rockspec/luabins-scm-2.rockspec (100%) rename {subprojects => vendor}/luabins/src/fwrite.c (100%) rename {subprojects => vendor}/luabins/src/fwrite.h (100%) rename {subprojects => vendor}/luabins/src/load.c (100%) rename {subprojects => vendor}/luabins/src/luabins.c (100%) rename {subprojects => vendor}/luabins/src/luabins.h (100%) rename {subprojects => vendor}/luabins/src/luaheaders.h (100%) rename {subprojects => vendor}/luabins/src/luainternals.c (100%) rename {subprojects => vendor}/luabins/src/luainternals.h (100%) rename {subprojects => vendor}/luabins/src/lualess.h (100%) rename {subprojects => vendor}/luabins/src/meson.build (100%) rename {subprojects => vendor}/luabins/src/save.c (100%) rename {subprojects => vendor}/luabins/src/savebuffer.c (100%) rename {subprojects => vendor}/luabins/src/savebuffer.h (100%) rename {subprojects => vendor}/luabins/src/saveload.h (100%) rename {subprojects => vendor}/luabins/src/write.c (100%) rename {subprojects => vendor}/luabins/src/write.h (100%) rename {subprojects => vendor}/luabins/test/large_data.lua (100%) rename {subprojects => vendor}/luabins/test/large_data.luabins (100%) rename {subprojects => vendor}/luabins/test/test.c (100%) rename {subprojects => vendor}/luabins/test/test.h (100%) rename {subprojects => vendor}/luabins/test/test.lua (100%) rename {subprojects => vendor}/luabins/test/test_api.c (100%) rename {subprojects => vendor}/luabins/test/test_fwrite_api.c (100%) rename {subprojects => vendor}/luabins/test/test_savebuffer.c (100%) rename {subprojects => vendor}/luabins/test/test_write_api.c (100%) rename {subprojects => vendor}/luabins/test/util.c (100%) rename {subprojects => vendor}/luabins/test/util.h (100%) rename {subprojects => vendor}/luabins/test/write_tests.inc (100%) diff --git a/meson.build b/meson.build index 9029f5070..1448c971a 100644 --- a/meson.build +++ b/meson.build @@ -294,7 +294,7 @@ if not deps.contains(luajit) else luajit_inc = include_directories(luajit.get_variable('includedir')) endif -subdir('subprojects/luabins/src') +subdir('vendor/luabins/src') dep_gl = dependency('gl', required: false) if not dep_gl.found() diff --git a/subprojects/luabins/AUTHORS b/vendor/luabins/AUTHORS similarity index 100% rename from subprojects/luabins/AUTHORS rename to vendor/luabins/AUTHORS diff --git a/subprojects/luabins/BENCHMARK b/vendor/luabins/BENCHMARK similarity index 100% rename from subprojects/luabins/BENCHMARK rename to vendor/luabins/BENCHMARK diff --git a/subprojects/luabins/COPYRIGHT b/vendor/luabins/COPYRIGHT similarity index 100% rename from subprojects/luabins/COPYRIGHT rename to vendor/luabins/COPYRIGHT diff --git a/subprojects/luabins/HISTORY b/vendor/luabins/HISTORY similarity index 100% rename from subprojects/luabins/HISTORY rename to vendor/luabins/HISTORY diff --git a/subprojects/luabins/README.md b/vendor/luabins/README.md similarity index 100% rename from subprojects/luabins/README.md rename to vendor/luabins/README.md diff --git a/subprojects/luabins/TODO b/vendor/luabins/TODO similarity index 100% rename from subprojects/luabins/TODO rename to vendor/luabins/TODO diff --git a/subprojects/luabins/etc/benchmark.lua b/vendor/luabins/etc/benchmark.lua similarity index 100% rename from subprojects/luabins/etc/benchmark.lua rename to vendor/luabins/etc/benchmark.lua diff --git a/subprojects/luabins/etc/checkfmt.lua b/vendor/luabins/etc/checkfmt.lua similarity index 100% rename from subprojects/luabins/etc/checkfmt.lua rename to vendor/luabins/etc/checkfmt.lua diff --git a/subprojects/luabins/etc/dataset.lua b/vendor/luabins/etc/dataset.lua similarity index 100% rename from subprojects/luabins/etc/dataset.lua rename to vendor/luabins/etc/dataset.lua diff --git a/subprojects/luabins/etc/tolua.lua b/vendor/luabins/etc/tolua.lua similarity index 100% rename from subprojects/luabins/etc/tolua.lua rename to vendor/luabins/etc/tolua.lua diff --git a/subprojects/luabins/etc/toluabins.lua b/vendor/luabins/etc/toluabins.lua similarity index 100% rename from subprojects/luabins/etc/toluabins.lua rename to vendor/luabins/etc/toluabins.lua diff --git a/subprojects/luabins/rockspec/luabins-0.1.1-1.rockspec b/vendor/luabins/rockspec/luabins-0.1.1-1.rockspec similarity index 100% rename from subprojects/luabins/rockspec/luabins-0.1.1-1.rockspec rename to vendor/luabins/rockspec/luabins-0.1.1-1.rockspec diff --git a/subprojects/luabins/rockspec/luabins-0.1.1-2.rockspec b/vendor/luabins/rockspec/luabins-0.1.1-2.rockspec similarity index 100% rename from subprojects/luabins/rockspec/luabins-0.1.1-2.rockspec rename to vendor/luabins/rockspec/luabins-0.1.1-2.rockspec diff --git a/subprojects/luabins/rockspec/luabins-0.2-1.rockspec b/vendor/luabins/rockspec/luabins-0.2-1.rockspec similarity index 100% rename from subprojects/luabins/rockspec/luabins-0.2-1.rockspec rename to vendor/luabins/rockspec/luabins-0.2-1.rockspec diff --git a/subprojects/luabins/rockspec/luabins-0.3-1.rockspec b/vendor/luabins/rockspec/luabins-0.3-1.rockspec similarity index 100% rename from subprojects/luabins/rockspec/luabins-0.3-1.rockspec rename to vendor/luabins/rockspec/luabins-0.3-1.rockspec diff --git a/subprojects/luabins/rockspec/luabins-scm-1.rockspec b/vendor/luabins/rockspec/luabins-scm-1.rockspec similarity index 100% rename from subprojects/luabins/rockspec/luabins-scm-1.rockspec rename to vendor/luabins/rockspec/luabins-scm-1.rockspec diff --git a/subprojects/luabins/rockspec/luabins-scm-2.rockspec b/vendor/luabins/rockspec/luabins-scm-2.rockspec similarity index 100% rename from subprojects/luabins/rockspec/luabins-scm-2.rockspec rename to vendor/luabins/rockspec/luabins-scm-2.rockspec diff --git a/subprojects/luabins/src/fwrite.c b/vendor/luabins/src/fwrite.c similarity index 100% rename from subprojects/luabins/src/fwrite.c rename to vendor/luabins/src/fwrite.c diff --git a/subprojects/luabins/src/fwrite.h b/vendor/luabins/src/fwrite.h similarity index 100% rename from subprojects/luabins/src/fwrite.h rename to vendor/luabins/src/fwrite.h diff --git a/subprojects/luabins/src/load.c b/vendor/luabins/src/load.c similarity index 100% rename from subprojects/luabins/src/load.c rename to vendor/luabins/src/load.c diff --git a/subprojects/luabins/src/luabins.c b/vendor/luabins/src/luabins.c similarity index 100% rename from subprojects/luabins/src/luabins.c rename to vendor/luabins/src/luabins.c diff --git a/subprojects/luabins/src/luabins.h b/vendor/luabins/src/luabins.h similarity index 100% rename from subprojects/luabins/src/luabins.h rename to vendor/luabins/src/luabins.h diff --git a/subprojects/luabins/src/luaheaders.h b/vendor/luabins/src/luaheaders.h similarity index 100% rename from subprojects/luabins/src/luaheaders.h rename to vendor/luabins/src/luaheaders.h diff --git a/subprojects/luabins/src/luainternals.c b/vendor/luabins/src/luainternals.c similarity index 100% rename from subprojects/luabins/src/luainternals.c rename to vendor/luabins/src/luainternals.c diff --git a/subprojects/luabins/src/luainternals.h b/vendor/luabins/src/luainternals.h similarity index 100% rename from subprojects/luabins/src/luainternals.h rename to vendor/luabins/src/luainternals.h diff --git a/subprojects/luabins/src/lualess.h b/vendor/luabins/src/lualess.h similarity index 100% rename from subprojects/luabins/src/lualess.h rename to vendor/luabins/src/lualess.h diff --git a/subprojects/luabins/src/meson.build b/vendor/luabins/src/meson.build similarity index 100% rename from subprojects/luabins/src/meson.build rename to vendor/luabins/src/meson.build diff --git a/subprojects/luabins/src/save.c b/vendor/luabins/src/save.c similarity index 100% rename from subprojects/luabins/src/save.c rename to vendor/luabins/src/save.c diff --git a/subprojects/luabins/src/savebuffer.c b/vendor/luabins/src/savebuffer.c similarity index 100% rename from subprojects/luabins/src/savebuffer.c rename to vendor/luabins/src/savebuffer.c diff --git a/subprojects/luabins/src/savebuffer.h b/vendor/luabins/src/savebuffer.h similarity index 100% rename from subprojects/luabins/src/savebuffer.h rename to vendor/luabins/src/savebuffer.h diff --git a/subprojects/luabins/src/saveload.h b/vendor/luabins/src/saveload.h similarity index 100% rename from subprojects/luabins/src/saveload.h rename to vendor/luabins/src/saveload.h diff --git a/subprojects/luabins/src/write.c b/vendor/luabins/src/write.c similarity index 100% rename from subprojects/luabins/src/write.c rename to vendor/luabins/src/write.c diff --git a/subprojects/luabins/src/write.h b/vendor/luabins/src/write.h similarity index 100% rename from subprojects/luabins/src/write.h rename to vendor/luabins/src/write.h diff --git a/subprojects/luabins/test/large_data.lua b/vendor/luabins/test/large_data.lua similarity index 100% rename from subprojects/luabins/test/large_data.lua rename to vendor/luabins/test/large_data.lua diff --git a/subprojects/luabins/test/large_data.luabins b/vendor/luabins/test/large_data.luabins similarity index 100% rename from subprojects/luabins/test/large_data.luabins rename to vendor/luabins/test/large_data.luabins diff --git a/subprojects/luabins/test/test.c b/vendor/luabins/test/test.c similarity index 100% rename from subprojects/luabins/test/test.c rename to vendor/luabins/test/test.c diff --git a/subprojects/luabins/test/test.h b/vendor/luabins/test/test.h similarity index 100% rename from subprojects/luabins/test/test.h rename to vendor/luabins/test/test.h diff --git a/subprojects/luabins/test/test.lua b/vendor/luabins/test/test.lua similarity index 100% rename from subprojects/luabins/test/test.lua rename to vendor/luabins/test/test.lua diff --git a/subprojects/luabins/test/test_api.c b/vendor/luabins/test/test_api.c similarity index 100% rename from subprojects/luabins/test/test_api.c rename to vendor/luabins/test/test_api.c diff --git a/subprojects/luabins/test/test_fwrite_api.c b/vendor/luabins/test/test_fwrite_api.c similarity index 100% rename from subprojects/luabins/test/test_fwrite_api.c rename to vendor/luabins/test/test_fwrite_api.c diff --git a/subprojects/luabins/test/test_savebuffer.c b/vendor/luabins/test/test_savebuffer.c similarity index 100% rename from subprojects/luabins/test/test_savebuffer.c rename to vendor/luabins/test/test_savebuffer.c diff --git a/subprojects/luabins/test/test_write_api.c b/vendor/luabins/test/test_write_api.c similarity index 100% rename from subprojects/luabins/test/test_write_api.c rename to vendor/luabins/test/test_write_api.c diff --git a/subprojects/luabins/test/util.c b/vendor/luabins/test/util.c similarity index 100% rename from subprojects/luabins/test/util.c rename to vendor/luabins/test/util.c diff --git a/subprojects/luabins/test/util.h b/vendor/luabins/test/util.h similarity index 100% rename from subprojects/luabins/test/util.h rename to vendor/luabins/test/util.h diff --git a/subprojects/luabins/test/write_tests.inc b/vendor/luabins/test/write_tests.inc similarity index 100% rename from subprojects/luabins/test/write_tests.inc rename to vendor/luabins/test/write_tests.inc From 961b3dfbee770b2c79763f7c9e7767580950b07a Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Tue, 27 Sep 2022 22:40:04 +0200 Subject: [PATCH 08/11] README: workarounds branch --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 108bf31e2..405cada7f 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ Go [here](#branchfeature-list) for the new features. ### Don't we have enough Aegisub forks already?? -We absolutely do, and I'm aware that adding another one [doesn't sound like a good idea on paper](https://xkcd.com/927/). However, +We absolutely do, and I'm aware that adding another one [doesn't sound like](https://xkcd.com/927/) a [good idea on paper](https://cdn.discordapp.com/attachments/425357202963038208/1007103606421459004/unknown.png). However, - None of the existing forks are completely satisfying at the moment: - [wangqr's fork](https://github.com/wangqr/Aegisub) is actively maintained, but focussing more on stability. It's missing most of the modern features. @@ -28,10 +28,11 @@ This list is for navigating the repository. Go to the [release page](https://git - [`bestsource`](https://github.com/arch1t3cht/Aegisub/tree/bestsource): Add BestSource audio and video source. This source is slower than others by multiple orders of magnitude, but in exchange it can guarantee exact seeking. - [`vapoursynth`](https://github.com/arch1t3cht/Aegisub/tree/vapoursynth): Add Vapoursynth audio and video source - [`bugfixes`](https://github.com/arch1t3cht/Aegisub/tree/bugfixes): Various fixes necessary for compilation. Most branches are based on this. +- [`workarounds`](https://github.com/arch1t3cht/Aegisub/tree/workarounds): Same as `bugfixes`, but these are hacky fixes that probably shouldn't be pulled without more work. - [`fixes`](https://github.com/arch1t3cht/Aegisub/tree/fixes): Miscellaneous bugfixes - [`misc`](https://github.com/arch1t3cht/Aegisub/tree/misc): Other miscellaneous additions - [`misc_dc`](https://github.com/arch1t3cht/Aegisub/tree/misc_dc): Miscellaneous changes taken from AegisubDC -- [`xa-ds2`](https://github.com/arch1t3cht/Aegisub/tree/xa-ds2): Add XAudio2 backend and allow stereo playback for some other backends, by wangqr and Shinon. +- [`xa2-ds`](https://github.com/arch1t3cht/Aegisub/tree/xa2-ds): Add XAudio2 backend and allow stereo playback for some other backends, by wangqr and Shinon. - [`stereo`](https://github.com/arch1t3cht/Aegisub/tree/stereo): Add multi-channel support for the other audio backends where possible. - [`video_panning_feature`](https://github.com/arch1t3cht/Aegisub/tree/video_panning_feature): Merge [moex3's video zoom and panning](https://github.com/TypesettingTools/Aegisub/pull/150), with an OSX fix and more options to control zoom behavior - [`spectrum-frequency-mapping`](https://github.com/arch1t3cht/Aegisub/tree/spectrum-frequency-mapping): Merge EleonoreMizo's [spectrum display improvements](https://github.com/TypesettingTools/Aegisub/pull/94), and also make Shift+Scroll vertically zoom the audio display @@ -43,13 +44,10 @@ If it wasn't introduced by my fork, I can still take a look, but I can't promise You can find me for support on various servers, including the cave and the TSTools server linked below. -#### Building fails with a "CMake sandbox violation" -This is an upstream bug in meson. For now, you need to downgrade meson using `pip install meson==0.62.2`. - #### Aegisub on Linux doesn't recognize my GTK theme This is probably because you're building with wxgtk2. Building with wxgtk3 fixes this, but causes some problems of its own (notably the broken color picker, occasional crashes when opening file dialogs from automation scripts, and general layouting issues). -The exact way of switching depends on your Linux distribution, but essentially you need to ensure that `wx-config` or the next best variant of it points to wxgtk3. If it points to wxgtk2 by default and deinstalling wxgtk2 isn't an option, you can also temporarily move it out of the path. Then, fully reconfigure meson using `meson configure --clearcache` and `meson setup --reconfigure`. +The exact way of switching depends on your Linux distribution, but essentially you need to ensure that `wx-config` or the next best variant of it points to wxgtk3. If it points to wxgtk2 by default and deinstalling wxgtk2 isn't an option, you can also temporarily move it out of the path or use a `native-file` in your meson project. Then, fully reconfigure meson using `meson configure --clearcache` and `meson setup --reconfigure`. #### I get errors like "Option not found" after merging one of these branches The changes to `default_config.json` or similar files weren't detected by meson due to missing regen dependencies. You can either merge the `bugfixes` branch or rebuild from scratch. From fe77a1a0b8c29a9fa2d0c45f6779b4a6459872f3 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Tue, 27 Sep 2022 22:59:01 +0200 Subject: [PATCH 09/11] avisynth: Check if file exists before creating provider Since FileNotFound exceptions don't abort the provider search, opening an invalid path would show errors such as "avisynth not found" when Avisynth wasn't installed, even if Avisynth wasn't selected as the video provider. --- src/audio_provider_avs.cpp | 3 +-- src/video_provider_avs.cpp | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/src/audio_provider_avs.cpp b/src/audio_provider_avs.cpp index 0daa77e8e..fff0ed823 100644 --- a/src/audio_provider_avs.cpp +++ b/src/audio_provider_avs.cpp @@ -64,8 +64,6 @@ public: }; AvisynthAudioProvider::AvisynthAudioProvider(agi::fs::path const& filename) try { - agi::acs::CheckFileRead(filename); - std::lock_guard lock(avs_wrapper.GetMutex()); try { @@ -150,6 +148,7 @@ void AvisynthAudioProvider::FillBuffer(void *buf, int64_t start, int64_t count) } std::unique_ptr CreateAvisynthAudioProvider(agi::fs::path const& file, agi::BackgroundRunner *) { + agi::acs::CheckFileRead(file); return agi::make_unique(file); } #endif diff --git a/src/video_provider_avs.cpp b/src/video_provider_avs.cpp index 7c779e800..263310675 100644 --- a/src/video_provider_avs.cpp +++ b/src/video_provider_avs.cpp @@ -94,8 +94,6 @@ public: }; AvisynthVideoProvider::AvisynthVideoProvider(agi::fs::path const& filename, std::string const& colormatrix) try { - agi::acs::CheckFileRead(filename); - std::lock_guard lock(avs.GetMutex()); #ifdef _WIN32 @@ -326,6 +324,7 @@ void AvisynthVideoProvider::GetFrame(int n, VideoFrame &out) { namespace agi { class BackgroundRunner; } std::unique_ptr CreateAvisynthVideoProvider(agi::fs::path const& path, std::string const& colormatrix, agi::BackgroundRunner *) { + agi::acs::CheckFileRead(path); return agi::make_unique(path, colormatrix); } #endif // HAVE_AVISYNTH From febce3ecdc389ab89aa9ef03b97237a80f26db92 Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Tue, 27 Sep 2022 21:28:38 +0200 Subject: [PATCH 10/11] vapoursynth: Add configurable default script This default script will be executed to load any file whose file name extension is not .py or .vpy . The gui code for setting the default script is still a bit wonky as it doesn't fit the rest of the preferences pages nicely, but it works for now. --- src/audio_provider_vs.cpp | 4 +-- src/libresrc/default_config.json | 6 +++++ src/libresrc/osx/default_config.json | 6 +++++ src/meson.build | 1 + src/preferences.cpp | 27 ++++++++++++++++++++ src/preferences_base.cpp | 14 +++++++++++ src/preferences_base.h | 1 + src/vapoursynth_common.cpp | 37 ++++++++++++++++++++++++++++ src/vapoursynth_common.h | 24 ++++++++++++++++++ src/video_provider_vs.cpp | 6 ++--- 10 files changed, 121 insertions(+), 5 deletions(-) create mode 100644 src/vapoursynth_common.cpp create mode 100644 src/vapoursynth_common.h diff --git a/src/audio_provider_vs.cpp b/src/audio_provider_vs.cpp index 02d469b51..e66779502 100644 --- a/src/audio_provider_vs.cpp +++ b/src/audio_provider_vs.cpp @@ -28,13 +28,13 @@ #include #include -#include #include #include #include #include "vapoursynth_wrap.h" +#include "vapoursynth_common.h" #include "VSScript4.h" namespace { @@ -62,7 +62,7 @@ VapoursynthAudioProvider::VapoursynthAudioProvider(agi::fs::path const& filename throw VapoursynthError("Error creating script API"); } vs.GetScriptAPI()->evalSetWorkingDir(script, 1); - if (vs.GetScriptAPI()->evaluateFile(script, filename.string().c_str())) { + if (OpenScriptOrVideo(vs.GetScriptAPI(), script, filename, OPT_GET("Provider/Audio/VapourSynth/Default Script")->GetString())) { std::string msg = agi::format("Error executing VapourSynth script: %s", vs.GetScriptAPI()->getError(script)); vs.GetScriptAPI()->freeScript(script); throw VapoursynthError(msg); diff --git a/src/libresrc/default_config.json b/src/libresrc/default_config.json index a530abb17..3e76c8e06 100644 --- a/src/libresrc/default_config.json +++ b/src/libresrc/default_config.json @@ -336,6 +336,9 @@ "BestSource": { "Max Cache Size" : 100, "Aegisub Cache" : true + }, + "VapourSynth" : { + "Default Script" : "import vapoursynth as vs\nvs.core.bas.Source(source=filename).set_output()" } }, "Avisynth" : { @@ -362,6 +365,9 @@ "Max Cache Size" : 1024, "Threads" : 0, "Seek Preroll" : 12 + }, + "VapourSynth" : { + "Default Script" : "import vapoursynth as vs\nvs.core.lsmas.LWLibavSource(source=filename).set_output()" } } }, diff --git a/src/libresrc/osx/default_config.json b/src/libresrc/osx/default_config.json index a857a6bf0..61a9e965a 100644 --- a/src/libresrc/osx/default_config.json +++ b/src/libresrc/osx/default_config.json @@ -336,6 +336,9 @@ "BestSource": { "Max Cache Size" : 100, "Aegisub Cache" : true + }, + "VapourSynth" : { + "Default Script" : "import vapoursynth as vs\nvs.core.bas.Source(source=filename).set_output()" } }, "Avisynth" : { @@ -362,6 +365,9 @@ "Max Cache Size" : 1024, "Threads" : 0, "Seek Preroll" : 12 + }, + "VapourSynth" : { + "Default Script" : "import vapoursynth as vs\nvs.core.lsmas.LWLibavSource(source=filename).set_output()" } } }, diff --git a/src/meson.build b/src/meson.build index 4f339ae47..0f73d662b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -240,6 +240,7 @@ opt_src = [ 'video_provider_bestsource.cpp', 'bestsource_common.cpp']], ['VapourSynth', ['vapoursynth_wrap.cpp', + 'vapoursynth_common.cpp', 'audio_provider_vs.cpp', 'video_provider_vs.cpp']], diff --git a/src/preferences.cpp b/src/preferences.cpp index 1945055e0..d97acb88c 100644 --- a/src/preferences.cpp +++ b/src/preferences.cpp @@ -469,6 +469,32 @@ void Advanced_Video(wxTreebook *book, Preferences *parent) { p->SetSizerAndFit(p->sizer); } +void VapourSynth(wxTreebook *book, Preferences *parent) { +#ifdef WITH_VAPOURSYNTH + auto p = new OptionPage(book, parent, _("VapourSynth"), OptionPage::PAGE_SUB); + auto video = p->PageSizer(_("Default Video Script")); + + auto vhint = new wxStaticText(p, wxID_ANY, _("This script will be executed to load video files that aren't\nVapourSynth scripts (i.e. end in .py or .vpy).\nThe filename variable stores the path to the file.")); + p->sizer->Fit(p); + vhint->Wrap(400); + video->Add(vhint, 0, wxALL, 5); + video->AddSpacer(16); + + p->OptionAddMultiline(video, "Provider/Video/VapourSynth/Default Script"); + + auto audio = p->PageSizer(_("Default Audio Script")); + auto ahint = new wxStaticText(p, wxID_ANY, _("This script will be executed to load audio files that aren't\nVapourSynth scripts (i.e. end in .py or .vpy).\nThe filename variable stores the path to the file.")); + p->sizer->Fit(p); + ahint->Wrap(400); + audio->Add(ahint, 0, wxALL, 5); + audio->AddSpacer(16); + + p->OptionAddMultiline(audio, "Provider/Audio/VapourSynth/Default Script"); + + p->SetSizerAndFit(p->sizer); +#endif +} + /// wxDataViewIconTextRenderer with command name autocompletion class CommandRenderer final : public wxDataViewCustomRenderer { wxArrayString autocomplete; @@ -724,6 +750,7 @@ Preferences::Preferences(wxWindow *parent): wxDialog(parent, -1, _("Preferences" Advanced(book, this); Advanced_Audio(book, this); Advanced_Video(book, this); + VapourSynth(book, this); book->Fit(); diff --git a/src/preferences_base.cpp b/src/preferences_base.cpp index cb2c832d7..b0c345c2f 100644 --- a/src/preferences_base.cpp +++ b/src/preferences_base.cpp @@ -156,6 +156,20 @@ wxControl *OptionPage::OptionAdd(wxFlexGridSizer *flex, const wxString &name, co } } +wxControl *OptionPage::OptionAddMultiline(wxSizer *sizer, const char *opt_name) { + parent->AddChangeableOption(opt_name); + const auto opt = OPT_GET(opt_name); + + if (opt->GetType() != agi::OptionType::String) { + throw agi::InternalError("Unsupported type for multiline option"); + } + + auto text = new wxTextCtrl(this, -1, to_wx(opt->GetString()), wxDefaultPosition, wxSize(-1, 200), wxTE_MULTILINE); + text->Bind(wxEVT_TEXT, StringUpdater(opt_name, parent)); + sizer->Add(text, wxSizerFlags().Expand()); + return text; +} + void OptionPage::OptionChoice(wxFlexGridSizer *flex, const wxString &name, const wxArrayString &choices, const char *opt_name) { parent->AddChangeableOption(opt_name); const auto opt = OPT_GET(opt_name); diff --git a/src/preferences_base.h b/src/preferences_base.h index d88507f9f..6581f2d0d 100644 --- a/src/preferences_base.h +++ b/src/preferences_base.h @@ -43,6 +43,7 @@ public: void CellSkip(wxFlexGridSizer *flex); wxControl *OptionAdd(wxFlexGridSizer *flex, const wxString &name, const char *opt_name, double min=0, double max=INT_MAX, double inc=1); + wxControl *OptionAddMultiline(wxSizer *flex, const char *opt_name); void OptionChoice(wxFlexGridSizer *flex, const wxString &name, const wxArrayString &choices, const char *opt_name); void OptionBrowse(wxFlexGridSizer *flex, const wxString &name, const char *opt_name, wxControl *enabler = nullptr, bool do_enable = false); void OptionFont(wxSizer *sizer, std::string opt_prefix); diff --git a/src/vapoursynth_common.cpp b/src/vapoursynth_common.cpp new file mode 100644 index 000000000..617849360 --- /dev/null +++ b/src/vapoursynth_common.cpp @@ -0,0 +1,37 @@ +// Copyright (c) 2022, arch1t3cht +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// +// Aegisub Project http://www.aegisub.org/ + +#ifdef WITH_VAPOURSYNTH +#include "vapoursynth_common.h" + +#include "options.h" +#include + +#include + +int OpenScriptOrVideo(const VSSCRIPTAPI *api, VSScript *script, agi::fs::path const& filename, std::string default_script) { + if (agi::fs::HasExtension(filename, "py") || agi::fs::HasExtension(filename, "vpy")) { + return api->evaluateFile(script, filename.string().c_str()); + } else { + std::string fname = filename.string(); + boost::replace_all(fname, "\\", "\\\\"); + boost::replace_all(fname, "'", "\\'"); + std::string vscript = "filename = '" + fname + "'\n" + default_script; + return api->evaluateBuffer(script, vscript.c_str(), "aegisub"); + } +} + +#endif // WITH_VAPOURSYNTH diff --git a/src/vapoursynth_common.h b/src/vapoursynth_common.h new file mode 100644 index 000000000..06479e45e --- /dev/null +++ b/src/vapoursynth_common.h @@ -0,0 +1,24 @@ +// Copyright (c) 2022, arch1t3cht +// +// Permission to use, copy, modify, and distribute this software for any +// purpose with or without fee is hereby granted, provided that the above +// copyright notice and this permission notice appear in all copies. +// +// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +// +// Aegisub Project http://www.aegisub.org/ + +#ifdef WITH_VAPOURSYNTH +#include "VSScript4.h" + +#include + +int OpenScriptOrVideo(const VSSCRIPTAPI *api, VSScript *script, agi::fs::path const& filename, std::string default_script); + +#endif // WITH_VAPOURSYNTH diff --git a/src/video_provider_vs.cpp b/src/video_provider_vs.cpp index 3f9839e38..fa5dfdbf1 100644 --- a/src/video_provider_vs.cpp +++ b/src/video_provider_vs.cpp @@ -22,13 +22,13 @@ #include #include -#include #include #include #include #include "vapoursynth_wrap.h" +#include "vapoursynth_common.h" #include "VSScript4.h" #include "VSHelper4.h" #include "VSConstants4.h" @@ -113,7 +113,7 @@ VapoursynthVideoProvider::VapoursynthVideoProvider(agi::fs::path const& filename throw VapoursynthError("Error creating script API"); } vs.GetScriptAPI()->evalSetWorkingDir(script, 1); - if (vs.GetScriptAPI()->evaluateFile(script, filename.string().c_str())) { + if (OpenScriptOrVideo(vs.GetScriptAPI(), script, filename, OPT_GET("Provider/Video/VapourSynth/Default Script")->GetString())) { std::string msg = agi::format("Error executing VapourSynth script: %s", vs.GetScriptAPI()->getError(script)); vs.GetScriptAPI()->freeScript(script); throw VapoursynthError(msg); @@ -279,4 +279,4 @@ namespace agi { class BackgroundRunner; } std::unique_ptr CreateVapoursynthVideoProvider(agi::fs::path const& path, std::string const& colormatrix, agi::BackgroundRunner *) { return agi::make_unique(path, colormatrix); } -#endif // HAVE_VAPOURSYNTH +#endif // WITH_VAPOURSYNTH From 40a9344d44a4f0e6194fd9b9577d13af0eeeeaaf Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Tue, 27 Sep 2022 23:17:54 +0200 Subject: [PATCH 11/11] vapoursynth: Check if file exists before creating provider Since FileNotFound exceptions don't abort the provider search, opening an invalid path would show errors such as "vapoursynth not found" when VapourSynth wasn't installed, even if VapourSynth wasn't selected as the default video provider. --- src/audio_provider_vs.cpp | 2 +- src/video_provider_vs.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/audio_provider_vs.cpp b/src/audio_provider_vs.cpp index e66779502..575daaad6 100644 --- a/src/audio_provider_vs.cpp +++ b/src/audio_provider_vs.cpp @@ -54,7 +54,6 @@ public: }; VapoursynthAudioProvider::VapoursynthAudioProvider(agi::fs::path const& filename) try { - agi::acs::CheckFileRead(filename); std::lock_guard lock(vs.GetMutex()); script = vs.GetScriptAPI()->createScript(nullptr); @@ -162,6 +161,7 @@ VapoursynthAudioProvider::~VapoursynthAudioProvider() { } std::unique_ptr CreateVapoursynthAudioProvider(agi::fs::path const& file, agi::BackgroundRunner *) { + agi::acs::CheckFileRead(file); return agi::make_unique(file); } #endif diff --git a/src/video_provider_vs.cpp b/src/video_provider_vs.cpp index fa5dfdbf1..a0a006f43 100644 --- a/src/video_provider_vs.cpp +++ b/src/video_provider_vs.cpp @@ -105,7 +105,6 @@ void VapoursynthVideoProvider::SetResizeArg(VSMap *args, const VSMap *props, con } VapoursynthVideoProvider::VapoursynthVideoProvider(agi::fs::path const& filename, std::string const& colormatrix) try { - agi::acs::CheckFileRead(filename); std::lock_guard lock(vs.GetMutex()); script = vs.GetScriptAPI()->createScript(nullptr); @@ -277,6 +276,7 @@ VapoursynthVideoProvider::~VapoursynthVideoProvider() { namespace agi { class BackgroundRunner; } std::unique_ptr CreateVapoursynthVideoProvider(agi::fs::path const& path, std::string const& colormatrix, agi::BackgroundRunner *) { + agi::acs::CheckFileRead(path); return agi::make_unique(path, colormatrix); } #endif // WITH_VAPOURSYNTH