Log in

View Full Version : avisynth feature request


primitive
8th September 2002, 19:53
I have plugin autoloading working, and it's great, but there's an obvious enhancement that I think has been missed: function exporting and autoloading.

I see it working like this:
1) You put an .avs file in your plugin directory where you have one or more functions defined. It doesn't matter whether or not the .avs actually returns a video clip (making it so that .avs files with just a function definition in them would work).
2) At the end of the .avs, you put a line that says something like "export <funcname>", one line for each function you want to export (so you can have multiple definitions in one file).
3) When avisynth scans your plugin directory for plugins to register, it also scans .avs files in that same directory, looking for the "export" lines. It registers those functions, too.
4) You can use those functions avisynth imported for you as if you had defined them in your .avs.

I see potential namespace issues, but I don't think they'd be any more serious than the namespace issues already implicit in having plugin autoloading. (I'm assuming that the plugin autoloader warns you if you have a namespace conflict instead of catching on fire.)

Let me know what you think,

-p

dividee
8th September 2002, 22:22
I don't understand. What you're talking about is already present (except there is no need for an 'export' clause).
Try it: put, for instance, the vdub_filters.avs in the plugin directory; you can then use in your script any function defined there.

It's not perfect: if, for instance, there is an error in this avs, any script you try to load will give you this error. Such avs should only contain function definitions (and global variables), no main processing section. Also some people reported error when other files are present in the plugin directory (I didn't have the time to look at it yet), but as long as you only put plugins and valid avs (as defined above), it should be alright.

About namespace conflict, no error is given: the last function defined takes precedence.

primitive
9th September 2002, 00:27
Originally posted by dividee
I don't understand. What you're talking about is already present (except there is no need for an 'export' clause).
Try it: put, for instance, the vdub_filters.avs in the plugin directory; you can then use in your script any function defined there.

It's not perfect: if, for instance, there is an error in this avs, any script you try to load will give you this error. Such avs should only contain function definitions (and global variables), no main processing section. Also some people reported error when other files are present in the plugin directory (I didn't have the time to look at it yet), but as long as you only put plugins and valid avs (as defined above), it should be alright.

About namespace conflict, no error is given: the last function defined takes precedence.

Cool!

I didn't know that something like this had already been implemented; it wasn't anywhere in the documentation that I got with 2.05, and I thought it would be a neat idea.

Carry on, then ;)

-inq

Guest
9th September 2002, 02:57
@dividee

I'm putting my Filter.def files in the plugin directory. Is this then fraught with peril? If so, couldn't you limit file loading to .avs and .dll extensions?

Belgabor
9th September 2002, 10:06
Don't forget .vdf for those dual plugins (e.g. Textsub)

@neuron2: Yes, other files can give problems atm. I had my whole plugin docs in the plugin dir and avisynth wouldnt load any scripts anymore.

Cheers
Belgabor

dividee
9th September 2002, 12:16
The plugin directory is a logical place to put the .def file.
Avisynth only loads files matching "*.avs" and "*.dll" with the FindFirstFile/FindNextFile API. In my tests it worked, but I later discovered that only the first three letters are checked for the extension, so foo.dllxxx is also loaded. I didn't test with subdirectories in the plugin dir. I'll work on it tonight.

.vdf files aren't loaded automatically. I can add them, but it will only preload them if the file also contains an avisynth interface (i.e. "dual plugins"). Preloading of native vdub plugins is already achieved if you put vdub_filters.avs in your plugin dir.

Marc FD
9th September 2002, 15:33
If a plugin is not used in my script, would it be loaded ?
If you have several plugins in your plugins dir, would script loading take more time ?

Thx.