From 7e9afbfda4cd1c253630edf555e18d9099df255d Mon Sep 17 00:00:00 2001 From: Crend King <975235+CrendKing@users.noreply.github.com> Date: Thu, 13 Jun 2024 05:15:53 -0700 Subject: [PATCH] Adjust how VSAPI is obtained to let VSScript.dll handle the loading of VapourSynth.dll Change VPSF filter mode to fmParallel. Should change anything since we don't use requestFrameFilter() at all --- .vscode/launch.json | 5 +---- build.ps1 | 7 ++++--- filter_common/src/pch.h | 2 +- vapoursynth_filter/src/frameserver.cpp | 6 +++--- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index f05eaa4..7d4fecc 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -6,11 +6,8 @@ "type": "cppvsdbg", "request": "launch", "program": "regsvr32", - "args": ["${workspaceFolder}/debug/avisynth_filter_64.ax"], + "args": ["${workspaceFolder}/x64/Debug/vapoursynth_filter_64.ax"], "cwd": "${workspaceFolder}", - "sourceFileMap": { - "d:/a/avisynth_filter/avisynth_filter": "${workspaceFolder}" - }, } ] } diff --git a/build.ps1 b/build.ps1 index b17db2a..d7cfb0b 100644 --- a/build.ps1 +++ b/build.ps1 @@ -1,6 +1,7 @@ +[CmdletBinding()] Param( - $configuration = 'release', - $platform = 'x64' + $Configuration = 'release', + $Platform = 'x64' ) @@ -75,5 +76,5 @@ if (!(Test-Path $workingDir)) { git clone https://github.com/brofield/simpleini.git --depth=1 dep_simpleini } -MSBuild.exe -property:"Configuration=${configuration};Platform=${platform}" -maxCpuCount -nologo avisynth_filter.sln +MSBuild.exe -property:"Configuration=${Configuration};Platform=${Platform}" -maxCpuCount -nologo avisynth_filter.sln exit $LASTEXITCODE diff --git a/filter_common/src/pch.h b/filter_common/src/pch.h index 7849bae..b7ad9c7 100644 --- a/filter_common/src/pch.h +++ b/filter_common/src/pch.h @@ -48,9 +48,9 @@ #ifdef AVSF_AVISYNTH #include #else + #include #include #include - #include #endif #include #include diff --git a/vapoursynth_filter/src/frameserver.cpp b/vapoursynth_filter/src/frameserver.cpp index 8ef043f..52363be 100644 --- a/vapoursynth_filter/src/frameserver.cpp +++ b/vapoursynth_filter/src/frameserver.cpp @@ -50,14 +50,14 @@ FrameServerCommon::FrameServerCommon() { Environment::GetInstance().Log(L"FrameServerCommon()"); _vsScriptApi = getVSScriptAPI(VSSCRIPT_API_VERSION); - _vsApi = getVapourSynthAPI(VAPOURSYNTH_API_VERSION); - if (_vsApi == nullptr || _vsScriptApi == nullptr) { + if (_vsScriptApi == nullptr) { const WCHAR *errorMessage = L"Unable to initialize VapourSynth API 4.0"; Environment::GetInstance().Log(errorMessage); MessageBoxW(nullptr, errorMessage, FILTER_NAME_FULL, MB_ICONERROR); throw; } + _vsApi = _vsScriptApi->getVSAPI(VAPOURSYNTH_API_VERSION); VSCore *vsCore = _vsApi->createCore(0); VSCoreInfo coreInfo; _vsApi->getCoreInfo(vsCore, &coreInfo); @@ -99,7 +99,7 @@ auto FrameServerBase::ReloadScript(const AM_MEDIA_TYPE &mediaType, bool ignoreDi const VSVideoInfo &sourceVideoInfo = Format::GetVideoFormat(mediaType, this).videoInfo; FrameServerCommon::GetInstance()._sourceVideoInfo = sourceVideoInfo; - _sourceClip = AVSF_VPS_API->createVideoFilter2("VpsFilter_Source", &sourceVideoInfo, SourceGetFrame, nullptr, fmParallelRequests, nullptr, 0, const_cast(filter), GetVsCore()); + _sourceClip = AVSF_VPS_API->createVideoFilter2("VpsFilter_Source", &sourceVideoInfo, SourceGetFrame, nullptr, fmParallel, nullptr, 0, const_cast(filter), GetVsCore()); AVSF_VPS_API->setCacheMode(_sourceClip, 0); VSMap *sourceInputs = AVSF_VPS_API->createMap();