Thread: Vapoursynth
View Single Post
Old 9th September 2012, 11:40   #6  |  Link
Myrsloik
Professional Code Monkey
 
Myrsloik's Avatar
 
Join Date: Jun 2003
Location: Kinnarps Chair
Posts: 2,548
Quote:
Originally Posted by TurboPascal7 View Post
Awesome project. Finally, something that can completely replace avisynth one day.

I played around with it and wrote a simple (buggy, ugly etc.) wrapper to provide more avisynth-like syntax (chaining support, positional arguments, case insensitivity): http://privatepaste.com/0b53562cdb
While it definitely shouldn't be used for anything real in its current state, I hope it shows that vapoursynth could benefit from better API.

Thoughts:
1. list_functions() should return a string and not output it to stdout by itself. IMHO, this is just wrong (see _rebuild_functions_cache function).
2. There should be a list_functions() analog, that would return the same data in dictionary/list/whatever form. I'm pretty sure you have one internally. Possible use case: editors, wrappers.
3. Chaining support, or you can call it 'fluent interface'. Just because it makes things so much easier.
4. Positional argument. I'm not sure why you like it verbose while most programming languages use this kind of args without any problems. Some don't even support named arguments.
5. Case-insensitivity should be added. Or at least lowercase bindings for all functions. Good editor could help, sure, but right now it takes me ages to type FFVideoSource correctly.
6. Some list_functions() analog for core functions. Because your (cython?) objects don't support __dict__, inspect.getargspec and other reflection methods. This can be solved with good documentation too.

I'm not very good with python and I'm pretty sure that some of these questions can be solved by a simple correct wrapper without your help. Having all this in core API would be nice though.

Also, optional parameters don't seem to work right now. And CropAbs accepts negative width/height but then outputs garbage. IMHO it should behave like avisynth's crop function.
1. will be changed for the next version
2. will probably happen some day
3. suggest a way to implement it that's not completely unpythonian and I'll consider it
4. some day
5. I will not add case insensitive stuff to a case sensitive language. Maybe some day I'll make lowercase versions acceptable too.
6. It's already included in list_functions(), why do you need one more?

I think I've fixed the crop argument checks. Can you give an example of the optional arguments maybe not working?
__________________
VapourSynth - proving that scripting languages and video processing isn't dead yet
Myrsloik is offline   Reply With Quote