MysteryX
18th June 2021, 05:58
I want to invoke other functions before and after my filter.
Invoking before is working. Now, how do I invoke something after my filter? I tried something but it results in Resize Error: Invalid Graph State.
Full code is here (https://github.com/mysteryx93/FrameRateConverter/blob/master/Src/VapourSynth/StripeMaskVpy.cpp)
// Convert to GRAY8 for processing.
api->clearMap(Args);
api->propSetNode(Args, "clip", Input, paReplace);
api->propSetInt(Args, "format", pfGray8, paReplace);
Input = Env.InvokeClip("resize", "Point", Args);
if (Input)
{
auto f = new StripeMaskVpy(in, out, core, api, Input, BlkSize, BlkSizeV, Overlap, OverlapV, Thr, Comp, CompV, Str, Strf, Lines);
f->CreateFilter(in, out);
VpyPropReader FilterProp = VpyPropReader(api, out);
Input = FilterProp.GetNode("clip");
if (Input && BitDepth > 8)
{
// Convert back to original bit depth.
api->clearMap(Args);
api->propSetNode(Args, "clip", Input, paReplace);
api->propSetInt(Args, "format", BitDepth <= 16 ? pfGray16 : pfGrayS, paReplace);
Input = Env.InvokeClip("resize", "Point", Args);
api->propSetNode(out, "clip", Input, paReplace);
}
}
VSNodeRef* InvokeClip(const char* ns, const char* func, VSMap* Args)
{
auto Plugin = Api->getPluginByNs(ns, Core);
auto ret = Api->invoke(Plugin, func, Args);
if (Api->getError(ret)) {
// Api->setError(out, api->getError(ret));
Api->freeMap(ret);
return nullptr;
}
auto Result = Api->propGetNode(ret, "clip", 0, NULL);
Api->freeMap(ret);
return Result;
}
Invoking before is working. Now, how do I invoke something after my filter? I tried something but it results in Resize Error: Invalid Graph State.
Full code is here (https://github.com/mysteryx93/FrameRateConverter/blob/master/Src/VapourSynth/StripeMaskVpy.cpp)
// Convert to GRAY8 for processing.
api->clearMap(Args);
api->propSetNode(Args, "clip", Input, paReplace);
api->propSetInt(Args, "format", pfGray8, paReplace);
Input = Env.InvokeClip("resize", "Point", Args);
if (Input)
{
auto f = new StripeMaskVpy(in, out, core, api, Input, BlkSize, BlkSizeV, Overlap, OverlapV, Thr, Comp, CompV, Str, Strf, Lines);
f->CreateFilter(in, out);
VpyPropReader FilterProp = VpyPropReader(api, out);
Input = FilterProp.GetNode("clip");
if (Input && BitDepth > 8)
{
// Convert back to original bit depth.
api->clearMap(Args);
api->propSetNode(Args, "clip", Input, paReplace);
api->propSetInt(Args, "format", BitDepth <= 16 ? pfGray16 : pfGrayS, paReplace);
Input = Env.InvokeClip("resize", "Point", Args);
api->propSetNode(out, "clip", Input, paReplace);
}
}
VSNodeRef* InvokeClip(const char* ns, const char* func, VSMap* Args)
{
auto Plugin = Api->getPluginByNs(ns, Core);
auto ret = Api->invoke(Plugin, func, Args);
if (Api->getError(ret)) {
// Api->setError(out, api->getError(ret));
Api->freeMap(ret);
return nullptr;
}
auto Result = Api->propGetNode(ret, "clip", 0, NULL);
Api->freeMap(ret);
return Result;
}