summaryrefslogtreecommitdiff
path: root/rotord/src/rotor.h
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/src/rotor.h')
-rw-r--r--rotord/src/rotor.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index a54fedd..2720e47 100644
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -396,6 +396,9 @@ namespace Rotor {
description="Cycles through video inputs according to selector signal";
duplicate_inputs=true;
UID="93dd9d76-2d09-11e3-9589-5bbbeea1b304";
+ segment=0;
+ segment_start=0.0f;
+ lastframe=0;
}
Video_cycler(map<string,string> &settings):Video_cycler() {
base_settings(settings);
@@ -408,6 +411,34 @@ namespace Rotor {
int im2=(im1+1)%image_inputs.size();
//work out timing
+ float ph=inputs[0]->get((Time_spec)frame);
+ int seg=((int)ph);
+ int thisframe=((Time_spec)frame).frame();
+ if(thisframe==lastframe||thisframe==lastframe+1){
+ if (segment!=seg){
+ //start of new segment
+ cerr<<"Video_cycler: segment "<<seg<<" started: "<<((Time_spec)frame).time<<endl;
+ segment=seg;
+ segment_start=((Time_spec)frame).time;
+ }
+ }
+ else {
+ if (thisframe==0){
+ segment_start=0.0f;
+ segment=seg;
+ }
+ else {
+ //find segment start
+ Time_spec testframe=(Time_spec)frame.lastframe();
+ while ((int)inputs[0]->get(testframe)==seg&&testframe.frame()>0){
+ testframe=testframe.lastframe();
+
+ }
+ segment_start=testframe.time;
+ segment=seg;
+ }
+ }
+ float wanted=(((Time_spec)frame).time-segment_start);
float f=fmod(inputs[0]->get((Time_spec)frame),1.0f);
Image *in1=image_inputs[im1]->get(frame);