Log in

View Full Version : Use of Invoke()


Guest
1st June 2004, 02:18
I want to run a filter using Invoke() from within another filter, BUT...I want it to run after the current filter. The instances of Invoke() that I have seen run the invoked filter before the current filter, by calling Invoke() in the create function.

Is there a way to Invoke() a filter to run after the current filter? For the curious, I want to invoke a color space conversion after the main processing of mpeg2source().

Thank you.

stickboy
1st June 2004, 09:57
Originally posted by neuron2:
The instances of Invoke() that I have seen run the invoked filter before the current filter, by calling Invoke() in the create function.Can't you call Invoke after the filter is constructed but before the create function returns? That is, something like:
AVSValue __cdecl
CreateFoo(AVSValue args, void* /* userDataP */, IScriptEnvironment* envP)
{
AVSValue v = new FooFilter(args[0].AsClip());
try
{
AVSValue args[] = { v, ... };
v = envP->Invoke("SomeInternalFunction",
AVSValue(args, ARRAY_LENGTH(args)), ... );
}
catch (IScriptEnvironment::NotFound)
{
envP->ThrowError("...");
}
return v;
}That's what I do in my Shuffle (http://www.avisynth.org/stickboy/) filter, where I invoke Subtitle to display the seed value.

Guest
1st June 2004, 12:52
I assumed that would invoke it before my filter, but you were right, it invokes it after. Thanks!

sh0dan
2nd June 2004, 12:49
Note - there is no cache inserted between the two filters. If your second filter has benefit from a cache, you can Invoke the InternalCache command. See the bottom of: EnvInvoke (http://www.avisynth.org/index.php?page=EnvInvoke).