Skip to content

Commit

Permalink
Add frame functions
Browse files Browse the repository at this point in the history
  • Loading branch information
Setsugennoao committed May 23, 2024
1 parent 4af2092 commit fd06c50
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lib/vscapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,18 @@ static void VS_CC getNodePtr(const VSMap *in, VSMap *out, void *userData, VSCore
returnPtr(in, out, vsapi->mapGetNode(in, "clip", 0, 0), core, vsapi);
}

static void VS_CC getNodePtr(const VSMap *in, VSMap *out, void *userData, VSCore *core, const VSAPI *vsapi) {
returnPtr(in, out, vsapi->mapGetFrame(in, "frame", 0, 0), core, vsapi);
}

static void VS_CC getNodeFromPtr(const VSMap *in, VSMap *out, void *userData, VSCore *core, const VSAPI *vsapi) {
vsapi->mapConsumeNode(out, "clip", (VSNode *) vsapi->mapGetInt(in, "ptr", 0, 0), maReplace);
}

static void VS_CC getFrameFromPtr(const VSMap *in, VSMap *out, void *userData, VSCore *core, const VSAPI *vsapi) {
vsapi->mapConsumeFrame(out, "frame", (VSFrame *) vsapi->mapGetInt(in, "ptr", 0, 0), maReplace);
}

VS_EXTERNAL_API(void) VapourSynthPluginInit2(VSPlugin *plugin, const VSPLUGINAPI *vspapi) {
vspapi->configPlugin(
"dev.setsugen.vscapi", "vscapi", "Helper plugin for vapoursynth-capi.", VS_MAKE_VERSION(1, 0),
Expand All @@ -28,6 +36,8 @@ VS_EXTERNAL_API(void) VapourSynthPluginInit2(VSPlugin *plugin, const VSPLUGINAPI

char *vnode = "clip:vnode;";
char *anode = "clip:anode;";
char *vframe = "frame:vframe;";
char *aframe = "frame:aframe;";
char *ptr = "ptr:int;";

vspapi->registerFunction("getVSCApiPtr", "", ptr, returnPtr, (void *) plugin, plugin);
Expand All @@ -41,6 +51,12 @@ VS_EXTERNAL_API(void) VapourSynthPluginInit2(VSPlugin *plugin, const VSPLUGINAPI
vspapi->registerFunction("getVNodePtr", vnode, ptr, getNodePtr, NULL, plugin);
vspapi->registerFunction("getANodePtr", anode, ptr, getNodePtr, NULL, plugin);

vspapi->registerFunction("getVFramePtr", vframe, ptr, getFramePtr, NULL, plugin);
vspapi->registerFunction("getAFramePtr", aframe, ptr, getFramePtr, NULL, plugin);

vspapi->registerFunction("getVNodeFromPtr", ptr, vnode, getNodeFromPtr, NULL, plugin);
vspapi->registerFunction("getANodeFromPtr", ptr, anode, getNodeFromPtr, NULL, plugin);

vspapi->registerFunction("getVFrameFromPtr", ptr, vframe, getFrameFromPtr, NULL, plugin);
vspapi->registerFunction("getAFrameFromPtr", ptr, aframe, getFrameFromPtr, NULL, plugin);
}

0 comments on commit fd06c50

Please sign in to comment.