PDA

View Full Version : Resize in Plugin


WarpEnterprises
14th March 2003, 14:20
short question:
Is there a way to use the internal resizers in a plugin?
(and if yes How?)

Kurosu
14th March 2003, 14:49
env->invoke(...)?


virtual AVSValue Invoke(const char* name, const AVSValue args, const char** arg_names=0);
You can use this to call a script function. There are many script functions which can be useful from other filters; for example, the Bob filter uses SeparateFields, and several source filters use UnalignedSplice. Some functions, like Weave, are implemented entirely in terms of other functions.
If you're calling a function taking exactly one argument, you can simply pass it in the args parameter; Invoke will convert it into an array for you. In order to call a function taking multiple arguments, you will need to create the array yourself; it can be done like this:
AVSValue args[5] = { clip, 0, true, 4.7, "my hovercraft is full of eels" };
env->Invoke("Frob", AVSValue(args, 5));
In this case Frob would need to have a parameter-type string like "cibfs" or "cfbfs" or "cf.*".
The arg_names parameter can be used to specify named arguments. Named arguments can also be given positionally, if you prefer.
Invoke throws IScriptEnvironment::NotFound if it can't find a matching function prototype. You should be prepared to catch this unless you know that the function exists and will accept the given arguments.

WarpEnterprises
14th March 2003, 22:30
Can you help me with some more details?

I want to call the function in GetFrame (maybe this is not possible as Invoke can only be seen as changing the script?)

So far I tested with a simple one (Blur), with "child" as the clip-Argument. It seems that Blur is called, but how do I get or refer to the result?

Or maybe you can point me to a (simple) example ?

Thx so far!

sh0dan
15th March 2003, 00:50
You get a PClip back from Invoke (when calling an image filter). This is wrapped as an AVSValue. So you can do:

(in constructor code)
PClip newclip = env->Invoke(something).AsClip();

In GetFrame:

src = newclip->GetFrame(10,env);