R15 – API Improvements

The time has come to break the API slightly to add some missing features. It also ends the alpha support discussion. The proper (and only) way to handle alpha is to return it as a separate mask clip. To make this easier filters now have a reasonably simple API to return more than one clip.

The new filters this time try to fill in some of the biggest feature holes, they are Merge, MaskedMerge and AVISource. MaskedMerge is very similar to masktool’s mt_merge in terms of functionality and the other two are very similar to the internal Avisynth filters with the same name. AVISource can of course open both VapourSynth and Avisynth scripts for import too.

There are also minor changes that need to be done to make plugins compile (binary compatibility with old plugins is however preserved). Previously the VSNodeRef type was always declared as const, this superfluous const declaration has now been removed everywhere in the API. Below are examples of the other two changes needed.

vsapi->setVideoInfo(a, b);
Change it to:
vsapi->setVideoInfo(a, 1, b);

The other construct that needs changing is filter creation which now automatically assigns itself to the out map:

cref = vsapi->createFilter(in, out, "Invert", invertInit, invertGetFrame, invertFree, fmParallel, 0, data, core);
vsapi->propSetNode(out, "clip", cref, 0);
vsapi->freeNode(cref);
Change it to:
vsapi->createFilter(in, out, "Invert", invertInit, invertGetFrame, invertFree, fmParallel, 0, data, core);

And don’t forget to check out my previous post with suggested tasks if you want to help out.