PDA

View Full Version : Can't understand code


Si
8th September 2003, 00:03
I was looking into how Bob works (its a long story thats getting longer :) ) and I got as far as the FieldWise class (function/procedure/subroutine thingy ...) in field.cpp

Fieldwise::Fieldwise(PClip _child1, PClip _child2)
: GenericVideoFilter(_child1), child2(_child2) {}


PVideoFrame __stdcall Fieldwise::GetFrame(int n, IScriptEnvironment* env)
{
return (child->GetParity(n) ? child2 : child)->GetFrame(n, env);
}

It semms to me (I just guess at these things) that it returns 2 different clips depending on parity (assumed field order to me).

I can see that this would be good as part of a Bob filter.:)

But why does the filter seem to return child or child2 when it has parameters of child1 and child2 :confused:

Or is it me getting totally lost with just 4 lines of C++ (again :o )

regards
Simon

Bidoche
8th September 2003, 11:01
You are confusing the names of parameters from the constructor and those of members of the class.

Fieldwise inherits a child clip member through its superclass GenericVideoFilter.
The fact the clip who will become it was named _child1 in constructor is irrelevant, you can choose any name you want for a function parameter.

Si
9th September 2003, 00:07
Thank you:o
regards
Simon