Log in

View Full Version : ApplyRange range in filter


wonkey_monkey
1st January 2010, 18:01
I'm writing a few plugins and using applyrange to only apply them to certain sections of video. This all works fine until I try to use a filter that needs to know how far into the section it is being applied (such as when applying a moving mask from another file).

PVideoFrame __stdcall selectivecolour::GetFrame(int n, IScriptEnvironment* env) {

My problem is that the variable n gives the frame number of the video, not of the section selected with ApplyRange. Is there a way of getting that information within the filter, or will I have to pass it in some other way?

I've previously made wrapper functions in AVS to actually split the video, but is there an easier way?

David

IanB
1st January 2010, 22:54
If you use the Trim/Splice model instead of ApplyRange, you will get the segment frame number....
A=Trim(0, 123)
B=Trim(124, 567).selectivecolour(... # global frame 124 will be local frame 0
C=Trim(568, 0)

A + B + C
...

The ApplyRange implementation is :-...
X=Last
Y=selectivecolour(... # global frame n will be local frame n

A=X.Trim(0, 123)
B=Y.Trim(124, 567)
C=X.Trim(568, 0)

A + B + C
...

The other option is to pass an offset parameter like is done for ShowTime/ShowSMPTE/ShowFrameNumber

wonkey_monkey
1st January 2010, 23:02
I think I'll go with an offset parameter, otherwise I'll be writing wrappers for every function and some of them have 18 parameters...

Thanks for the info.

David