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"
12 const VSVideoInfo
*vi
;
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
, 1, 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
) {
46 d
.node
= vsapi
->propGetNode(in
, "clip", 0, 0);
47 d
.vi
= vsapi
->getVideoInfo(d
.node
);
49 data
= malloc(sizeof(d
));
52 vsapi
->createFilter(in
, out
, "Filter", filterInit
, filterGetFrame
, filterFree
, fmParallel
, 0, data
, core
);
56 //////////////////////////////////////////
59 VS_EXTERNAL_API(void) VapourSynthPluginInit(VSConfigPlugin configFunc
, VSRegisterFunction registerFunc
, VSPlugin
*plugin
) {
60 configFunc("com.example.filter", "filter", "VapourSynth Filter Skeleton", VAPOURSYNTH_API_VERSION
, 1, plugin
);
61 registerFunc("Filter", "clip:clip;", filterCreate
, 0, plugin
);