The last big remaining piece of VapourSynth's puzzle is being able to create functions that manipulate frames directly in Nim.
Filter's in VapourSynth are created following this structure. Where VapourSynthPluginInit is used to register a plugin. It registers a function in a plugin.
During the function registration, filterCreate function is referenced. The function filterCreate creates the filter calling createFilter. Three addiotional functions are referenced here:
A proper filter example can be found here.
I don't want to create plugins from Nim, but I need to keep most of these steps anyway.
I managed to do something that compiles: function.nim, but doesn't work (yes, I know there is plenty of rubbish in it). I think it has to do with something related with memory managment or nil pointers of stuff like that (I don't have the expertise).
I have reached a point where:
I need somebody's help who actually knows what is doing ;oP (not my case). When I execute function.nim I get the following runtime error:
/home/jose/src/VapourSynth.nim/test/function.nim(327) cropAbsCreate1 SIGSEGV: Illegal storage access. (Attempt to read from nil?) Error: execution of an external program failed: '/home/jose/src/VapourSynth.nim/test/function '
which relates to this line.
Any clue?
I could have a look in the weekend but
This is my error:
[INFO] Function created by calling 'createFunc'
[INFO] `in` created
[INFO] Calling 'callFunc'
[INFO] Starting 'cropAbsCreate1'
Attempted to read key 'height' from a map with error set: Index: Can't open '2sec.mkv'
Traceback (most recent call last)
.../Programming/Nim/VapourSynth.nim/test/function.nim(293) function
.../Programming/Nim/VapourSynth.nim/test/function.nim(207) cropAbsCreate1
SIGABRT: Abnormal termination.
Also your error mentions line 327 but there is no line 327? I found the following in history: https://github.com/mantielero/VapourSynth.nim/blob/2e8d0391d50c83a4f6f30a0f6fa3a1f394731ce5/test/function.nim#L327-L335
I suppose your own error is related to the missing property I get after your refactoring.
I fixed this issue. Now we can create filters in pure Nim.
Right now, it is only a small improvement when compared with C because it only avoids having the filter within a plugin.
Slowly getting there.