Log in

View Full Version : Invoke("Subtitle") again - but with a source filter


WarpEnterprises
10th October 2005, 13:52
If I want to use Subtitle in my plugin on a per-frame-base, I use something like this in GetFrame

AVSValue args[8];
const char* arg_names[11] = { 0, 0, "x", "y", "font", "size"};
args[0] = child;
args[1] = ...
resultClip = (env->Invoke("Subtitle",AVSValue(args,8), arg_names )).AsClip();
PVideoFrame src1 = resultClip->GetFrame(n, env);
return src1;
This works fine as long as there already is a PClip ("child" in this case). Subtitle is chained between my GetFrame and the rest.

But what if my filter is a source filter?
The above does not work because my filter is already on top of the chain - using "this" instead of "child" recurses infinitely.

So how can I nicely do this?

Counting the number of recursions done seems not quite nice, although it works.

IanB
11th October 2005, 10:02
Be 2 classes. The first to do the source generation and the second to First().Subtitle.()