Welcome to Doom9's Forum, THE in-place to be for everyone interested in DVD conversion. Before you start posting please read the forum rules. By posting to this forum you agree to abide by the rules. |
26th October 2021, 06:03 | #4545 | Link |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
When creating filter, where do we put the xyvInit() initial function in API4 now? It was gone in the example filter. And in the createVideoFilter(), there are this two lines in the example script:
Code:
VSFilterDependency deps[] = {{d.node, rpStrictSpatial}}; vsapi->createVideoFilter(out, "Invert", vi, invertGetFrame, invertFree, fmParallel, deps, 1, data, core); |
26th October 2021, 10:27 | #4546 | Link | |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
|
Quote:
2. It's an array where you list all the nodes and in which order you will request frames from them to generate the output. StrictSpatial is obviously for spatial only filters, NoFrameReuse is for reordering filters of certain types (basically if you request all output frames once none of the input frames will be requested twice, trim, splice and similar fit into this category). General is for everything else. NumDeps is simply how items are in the deps array.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
|
26th October 2021, 23:46 | #4547 | Link |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
Okay got it. Also can you add some example filter written in c++? Because when I got stuck with the c syntax, I couldn't find any other example because everybody was writing in c++. For example, I want to use the isConstantVideoFormat() from the VSHelper4.h, I included the header file in my c file #include "VSHelper4.h", but visual studio still couldn't recognize the function.
|
27th October 2021, 06:16 | #4551 | Link |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
Thanks, worked.
Now I ran into another problem trying to build the filter. The build succeeded, but the function didn't get register. Here is the xxxCreate function. Code:
void VS_CC levelsCreate(const VSMap *in, VSMap *out, void *userData, VSCore *core, const VSAPI *vsapi) { LevelsData d; LevelsData *data; int err; d.node = vsapi->mapGetNode(in, "clip", 0, 0); d.vi = *vsapi->getVideoInfo(d.node); d.factor = vsapi->mapGetFloat(in, "factor", 0, &err); if (err) { d.factor = 100.0; } // Comparing them directly? if (d.factor < 0.0 || d.factor > 100.0) { vsapi->mapSetError(out, "Levels: factor must be between 0 and 100 (inclusive)"); vsapi->freeNode(d.node); return; } if (!vsh_isConstantVideoFormat(&d.vi) || d.vi.format.sampleType != stInteger || d.vi.format.bitsPerSample != 8) { vsapi->mapSetError(out, "Levels: only constant format 8bit integer input supported"); vsapi->freeNode(d.node); return; } if (d.vi.width) d.vi.width += 256; if (d.vi.height) d.vi.height = MAX(256, d.vi.height); data = (LevelsData *)malloc(sizeof(d)); *data = d; VSFilterDependency deps[] = { {d.node, rpStrictSpatial} }; vsapi->createVideoFilter(out, "Levels", &d.vi, levelsGetFrame, levelsFree, fmParallel, deps, 1, data, core); } ######################################## void VS_CC levelsCreate(const VSMap *in, VSMap *out, void *userData, VSCore *core, const VSAPI *vsapi); VS_EXTERNAL_API(void) VapourSynthPluginInit2(VSPlugin* plugin, const VSPLUGINAPI* vspapi) { vspapi->configPlugin("com.nodame.histogram", "hist", "VapourSynth Histogram Plugin", VS_MAKE_VERSION(1, 0), VAPOURSYNTH_API_VERSION, 1, plugin); vspapi->registerFunction("Levels", "clip:clip;factor:float:opt;", "clip:vnode;", levelsCreate, NULL, plugin); } |
27th October 2021, 11:37 | #4554 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
|
Protip: if you misuse the api you'll get warnings for things like invalid argument strings if you run things from the commandline
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
28th October 2021, 12:23 | #4556 | Link |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
|
Attach a debugger, duh. If there's no error message then your own code crashed inside the getframe function.
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
28th October 2021, 17:49 | #4558 | Link | |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
|
Quote:
https://github.com/vapoursynth/vs-mi...lters.cpp#L132
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
|
28th October 2021, 21:58 | #4559 | Link | |
Registered User
Join Date: Sep 2006
Posts: 1,657
|
Quote:
Last edited by lansing; 28th October 2021 at 22:19. |
|
28th October 2021, 22:54 | #4560 | Link | |
Professional Code Monkey
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
|
Quote:
Not the best example but few places do this in the VS code (see unpackRGB32Create): https://github.com/vapoursynth/vapou...ompat.cpp#L897
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet |
|
Tags |
speed, vaporware, vapoursynth |
Thread Tools | Search this Thread |
Display Modes | |
|
|