Log in

View Full Version : help coding transition plugin


vcmohan
26th June 2015, 07:57
Trying to code a transition. Input are 2 clips output 1 clip.
in init section do I create a new node as output using
typedef VSNodeRef *(VS_CC *VSCloneNodeRef)(VSNodeRef *node);
and
d.vi = vsapi->getVideoInfo(d.node);
use
vsapi->setVideoInfo(d->vi, 1, node);

Will I not get a constant vi pointer that prevents me in modifying a value in vi?
Request help with a small example code or a reference to a code in the vapoursynth in Gthub!

jackoneill
26th June 2015, 11:24
Summary:

struct FilterData {
VSVideoInfo vi; // not a pointer
// ...
};

filterInit() {
vsapi->setVideoInfo(&d->vi, 1, node); // take its address
}

filterCreate() {
d.vi = *vsapi->getVideoInfo(node); // dereference to get a copy
d.vi.numFrames += 42;
}


Real code: https://github.com/vapoursynth/vapoursynth/blob/master/src/core/reorderfilters.c#L75

Also, createFilter() creates the output node for you. Calling cloneNodeRef() is not necessary.

vcmohan
26th June 2015, 13:44
thanks for helping.