Skip to content

Commit

Permalink
Adjust how VSAPI is obtained to let VSScript.dll handle the loading o…
Browse files Browse the repository at this point in the history
…f VapourSynth.dll

Change VPSF filter mode to fmParallel. Should change anything since we don't use requestFrameFilter() at all
  • Loading branch information
CrendKing committed Jun 13, 2024
1 parent 37ba15f commit 6a06c0d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 12 deletions.
5 changes: 1 addition & 4 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
},
}
]
}
7 changes: 4 additions & 3 deletions build.ps1
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
[CmdletBinding()]
Param(
$configuration = 'release',
$platform = 'x64'
$Configuration = 'release',
$Platform = 'x64'
)


Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion filter_common/src/pch.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
#ifdef AVSF_AVISYNTH
#include <avisynth.h>
#else
#include <VapourSynth4.h>
#include <VSHelper4.h>
#include <VSScript4.h>
#include <VapourSynth4.h>
#endif
#include <SimpleIni.h>
#include <VSConstants4.h>
Expand Down
8 changes: 4 additions & 4 deletions vapoursynth_filter/src/frameserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -99,8 +99,8 @@ 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<CSynthFilter *>(filter), GetVsCore());
AVSF_VPS_API->setCacheMode(_sourceClip, 0);
_sourceClip = AVSF_VPS_API->createVideoFilter2("VpsFilter_Source", &sourceVideoInfo, SourceGetFrame, nullptr, fmParallel, nullptr, 0, const_cast<CSynthFilter *>(filter), GetVsCore());
AVSF_VPS_API->setCacheMode(_sourceClip, cmForceDisable);

VSMap *sourceInputs = AVSF_VPS_API->createMap();
AVSF_VPS_API->mapSetNode(sourceInputs, VPS_VAR_NAME_SOURCE_NODE, _sourceClip, 0);
Expand Down

0 comments on commit 6a06c0d

Please sign in to comment.