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.h37
1 files changed, 16 insertions, 21 deletions
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index 6c03ea0..aa76491 100644
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -212,7 +212,7 @@ namespace Rotor {
};
void init(const string &_key){ //inits int value from set::string vals index
value=_key;
- std::vector<std::string>::iterator it=it = find(vals.begin(),vals.end(),value);
+ std::vector<std::string>::iterator it= find(vals.begin(),vals.end(),value);
if (it!=vals.end()){
intVal = std::distance(vals.begin(),it)+1; //using 1-index for enums
}
@@ -224,9 +224,11 @@ namespace Rotor {
for (auto v:vals) s=s+v+" ";
cerr<<"array attribute "<<title<<": "<<s<<endl;
}
- string value,description,title,type;
- std::vector<std::string> vals;
+ string description,title,value;
int intVal;
+ string type;
+ std::vector<std::string> vals;
+
};
class Node{
public:
@@ -320,7 +322,7 @@ namespace Rotor {
update((Time_spec)frame);
return output(frame);
}
- virtual const Image *output(const Frame_spec &frame)=0;
+ virtual Image *output(const Frame_spec &frame)=0;
Image image;
private:
float image_time; //? could be used to detect image reuse?
@@ -398,16 +400,6 @@ namespace Rotor {
~Video_cycler(){};
bool load(const string &filename);
Image *output(const Frame_spec &frame){
- Frame_spec inframe=frame;
- /*
- switch (attributes["time_mode"]->intVal){
- case CYCLER_rel:
-
- break;
- case CYCLER_stretch:
- break;
- }
- */
if (attributes["mode"]->intVal==CYCLER_mix&&image_inputs.size()>1){
int im1=((int)inputs[0]->get((Time_spec)frame))%image_inputs.size();
int im2=(im1+1)%image_inputs.size();
@@ -428,7 +420,7 @@ namespace Rotor {
return nullptr;
}
//cut mode
- for (int i=0;i<image_inputs.size();i++){
+ for (uint32_t i=0;i<image_inputs.size();i++){
int whichinput=((int)inputs[0]->get((Time_spec)frame)+i)%image_inputs.size();
Image *in=image_inputs[whichinput]->get(frame);
if (in) return in;
@@ -511,12 +503,13 @@ namespace Rotor {
image.setup_fromRGB(frame.w,frame.h,player.frame->Data[0],player.frame->Linesize[0]-(frame.w*3));
}
}
+ return true;
}
Image *output(const Frame_spec &frame){
if (isLoaded){
float clipframerate=(parameters["framerate"]->value==0.0f?player.get_framerate():parameters["framerate"]->value);
float clipspeed=(clipframerate/frame.framerate)*parameters["speed"]->value;
- float wanted;
+ float wanted=0.0f;
if (inputs[0]->connection) {
//using playhead
//should speed affect it?
@@ -594,6 +587,8 @@ namespace Rotor {
description="Loads a banks of video files";
clip_loaded=-1;
isLoaded=false;
+ segment=-1;
+ segment_start=0.0f;
};
Video_bank(map<string,string> &settings): Video_bank() {
base_settings(settings);
@@ -629,7 +624,7 @@ namespace Rotor {
}
}
if (isLoaded){
- int wanted;
+ int wanted=0.0f;
switch (attributes["frame_mode"]->intVal){
case VIDEOTIME_play:
wanted=ph*player.get_number_frames();
@@ -650,9 +645,9 @@ namespace Rotor {
};
private:
int clip_loaded;
- int last_frame;
- float segment_duration; //to allow play within a segment at original speed
string media_path;
+ float segment_start;
+ int segment;
};
class Video_output: public Image_node {
//Video_output 'presents' the output movie. Aspect ratio, bars, fadein/fadeout would happen here
@@ -673,13 +668,13 @@ namespace Rotor {
~Video_output(){ };
void create_envelope(const vector<float> &audio){
if (audio.size()){
- int i=0;
+ uint32_t i=0;
while (i<audio.size()&&audio[i]<silence_threshold) i++;
start_silence=((float)i)/audio.size();
while (i<audio.size()&&audio[i]>audio[i-1]) i++;
start_peak=((float)i-1)/audio.size();
i=audio.size();
- while (i>-1&&audio[i]<silence_threshold) i--;
+ while (i>0&&audio[i]<silence_threshold) i--;
end_silence=((float)i)/audio.size();
while (i<audio.size()&&audio[i]>audio[i+1]) i--;
end_peak=((float)i+1)/audio.size();