I finally got those video properties done in the 3.0 code.
Here are what I made :
Clips are now marked (through VideoInfo) as either frames or fields clips.
Filters are expected to enforce this distinction the way you can imagine. (essentially no mixing field/frame)
Frames have self knowledge of ColorSpace, width, height and type.
Type can be FIELD_TOP, FIELD_BOTTOM, PROGRESSIVE, INTERLACED_TTF, INTERLACED_BFF, UNKNOWN.
The first two are for use in fields clips, the four others in frames clips.
When creating a videoframe from a videoinfo, if the clip is a field one, frame type is defaulted to top. If it is a frame clip and colospace/dimension allow interlacing frame type becomes UNKNOWN, and otherwise PROGRESSIVE.
UNKOWN type is not supposed to be kept, filters are expected to change it into one of the 3 others.
As for frame properties, after some brainstorming, thinking about really complex things, finally remenbering the KISS rule...
I came to this proposal :
Distinguish 3 types of properties/flags :
- state properties : their value depends only of the videoframe, and will always be the same whenever, wherever it is needed. Then it makes sense to allow their attachment to const VideoFrame as they a re not a modification but just an additional info.
These properties are discarded when the frame is accessed for modification.
An example of these could be decomb frame comb status.
- forward porperties : properties we want passed through the filter chain for some reason. It suppose a method to make new videoframe inherit them correctly, and more importantly a (polymophic) method to deal with collisions (what to do when more than one ancestors with the property). They can be added normally to a PVideoFrame, but change a CPVideoFrame to a clone with the propery added (trick to keep state properties).
Of course they are not discarded by frame modifications.
The only example I could come up with is to time filters chain :
a filter mark frames with a property with the processing time as value and an addition collision method, and an other make the difference between the processing time and the value passed through.
- other properties : those who are none of the above, are discarded by modifications and are attached like forward ones.
|