1 //////////////////////////////////////////
2 // This file contains a simple filter
3 // skeleton you can use to get started.
4 // With no changes it simply passes
7 #include "VapourSynth.h"
8 #include "VapourSynth.h"
11 const VSNodeRef
*node
;
15 static void VS_CC
filterInit(VSMap
*in
, VSMap
*out
, void **instanceData
, VSNode
*node
, VSCore
*core
, const VSAPI
*vsapi
) {
16 FilterData
*d
= (FilterData
*) * instanceData
;
17 vsapi
->setVideoInfo(d
->vi
, node
);
20 static const VSFrameRef
*VS_CC
filterGetFrame(int n
, int activationReason
, void **instanceData
, void **frameData
, VSFrameContext
*frameCtx
, VSCore
*core
, const VSAPI
*vsapi
) {
21 FilterData
*d
= (FilterData
*) * instanceData
;
23 if (activationReason
== arInitial
) {
24 vsapi
->requestFrameFilter(n
, d
->node
, frameCtx
);
25 } else if (activationReason
== arAllFramesReady
) {
26 const VSFrameRef
*frame
= vsapi
->getFrameFilter(n
, d
->node
, frameCtx
);
36 static void VS_CC
filterFree(void *instanceData
, VSCore
*core
, const VSAPI
*vsapi
) {
37 FilterData
*d
= (FilterData
*)instanceData
;
38 vsapi
->freeNode(d
->node
);
42 static void VS_CC
filterCreate(const VSMap
*in
, VSMap
*out
, void *userData
, VSCore
*core
, const VSAPI
*vsapi
) {
45 const VSNodeRef
*cref
;
47 d
.node
= vsapi
->propGetNode(in
, "clip", 0, 0);
48 d
.vi
= vsapi
->getVideoInfo(d
.node
);
50 data
= malloc(sizeof(d
));
53 cref
= vsapi
->createFilter(in
, out
, "Filter", filterInit
, filterGetFrame
, filterFree
, fmParallel
, 0, data
, core
);
54 vsapi
->propSetNode(out
, "clip", cref
, 0);
55 vsapi
->freeNode(cref
);
59 //////////////////////////////////////////
62 void VS_CC
filterlibInitialize(VSConfigPlugin configFunc
, VSRegisterFunction registerFunc
, VSPlugin
*plugin
) {
63 configFunc("com.example.filter", "filter", "VapourSynth Filter Skeleton", VAPOURSYNTH_API_VERSION
, 1, plugin
);
64 registerFunc("Filter", "clip:clip;", filterCreate
, 0, plugin
);