Because current_frame is defined inside scriptclip ( third line of ScriptClip::GetFrame() ) and hence is defined before the creation of the Subtitle filter.
I made the same test you did, with one of my filter which I modified to make it create a variable current_frametype. I can't reproduce the behavior you're encountering. For me, there is always the one frame lag. Is there a chance you would have mistyped current_frametype by current_frame ?
(I realize the context of this post is somewhat hard to get). The conclusion is: It is possible to add an "after_frame=true/false". It will however result in two GetFrame calls, and the result of the first will be discarded. The reason ConditionalReader and XstatImport (Xvid stat importer) works is because they are to be placed _after_ the scriptclip filter.
:confused: you soon make me give up... 1) I made an AviSource which sets in its GetFrame a variable "current_frametype" (which is filled with e.g. "D 34" meaning DroppedFrame, frame 34. 2) When I then use ScriptClip(""" subtitle(current_frametype) """) there is NO lag. On frame 34 there is the string "D 34" printed - there is no lag, Subtitle gets called AFTER AviSource has set the variable. 3) BUT when I use a function as here the string addition ScriptClip(""" subtitle(" " + current_frametype) """) or ANY OTHER scriptfunction inside the Subtitle command, there is the lag you described and explained. Of course I can upload my DLL/source somewhere to test, but it's a mere env->SetVar(...) in the AviSource::GetFrame
I understood you : What I said last was that I made a modification in one of my filter to do a env->SetVar(...) inside its GetFrame function. I used the following scripts : Code: