summaryrefslogtreecommitdiff
path: root/rotord/src
diff options
context:
space:
mode:
authorTim Redfern <tim@eclectronics.org>2014-02-10 13:24:20 +0000
committerTim Redfern <tim@eclectronics.org>2014-02-10 13:24:20 +0000
commita1318769138379192cd0d381877808e928cffe44 (patch)
treebbab3f7f40b3fe9e9192eb76f33d30c70c618331 /rotord/src
parent8fe0c8d0fd02d42ecd68e562c734d4f41cb41700 (diff)
elusive bank bug./http GET a/render
Diffstat (limited to 'rotord/src')
-rw-r--r--rotord/src/libavwrapper.h2
-rw-r--r--rotord/src/rotor.h25
2 files changed, 14 insertions, 13 deletions
diff --git a/rotord/src/libavwrapper.h b/rotord/src/libavwrapper.h
index 162a77e..fc628c0 100644
--- a/rotord/src/libavwrapper.h
+++ b/rotord/src/libavwrapper.h
@@ -77,7 +77,7 @@ namespace libav {
std::cerr<<"ffmpegsource: "<<err.Buffer<<std::endl;
return false;
}
- frame = FFMS_GetFrame(source, wanted%props->NumFrames, &err);
+ frame = FFMS_GetFrame(source, std::max(0,wanted%props->NumFrames), &err);
if (frame == NULL) {
std::cerr<<"ffmpegsource: "<<err.Buffer<<std::endl;
return false;
diff --git a/rotord/src/rotor.h b/rotord/src/rotor.h
index a7cdbdc..5a48011 100644
--- a/rotord/src/rotor.h
+++ b/rotord/src/rotor.h
@@ -932,8 +932,9 @@ namespace Rotor {
logger.error("libav::decoder failed to load "+filename);
return false;
}
- bool get_frame(double wanted,const Frame_spec &frame){
- wanted=max(0.0,wanted);
+ bool get_frame(double wanted,const Frame_spec &frame){ //dangerous stuff all in here
+ //we know the video is succesfully loaded
+ //ignore this for now
if (attributes["frame_mode"]->intVal==VIDEOFRAMES_blend){
if (((int)wanted)!=lastframe){
//get a new pair of frames possibly by switching the next one
@@ -962,7 +963,8 @@ namespace Rotor {
image+=in2t;
}
else {
- if (((int)wanted)!=Base_video::lastframe){
+ if (((int)wanted)!=lastframe){ //removed Basevideo::lastframe, what was this???
+ //added check for -ve frame
if (!players[clip_loaded].fetch_frame(frame.w,frame.h,((int)wanted))) { //seek fail
Poco::Logger& logger = Poco::Logger::get(Log_name);
logger.error("Video_loader failed to seek frame "+toString(wanted)+" of "+attributes["filename"]->value);
@@ -977,13 +979,12 @@ namespace Rotor {
return true;
}
Image *output(const Frame_spec &frame){
- if (!inputs[0]->connection){ //default to single loader
+ if (!inputs[0]->connection){ //default to single loader if the selector isn't in use
if (!isLoaded){
- if (Base_video::load(media_path+attributes["filenames"]->vals[0] )) {
- isLoaded=true;
- }
- else {
- isLoaded=false;
+ if (attributes["filenames"]->vals.size()){
+ if (Base_video::load(media_path+attributes["filenames"]->vals[0])) {
+ isLoaded=true;
+ }
}
}
if (isLoaded){
@@ -998,7 +999,7 @@ namespace Rotor {
players.resize(attributes["filenames"]->vals.size());
ph=seg==0?ph:fmod(ph,seg);
if (clip_loaded!=wv){
- if (load(wv)) { //always checks if loading is succesful
+ if (load(wv)) { //check if loading is succesful
clip_loaded=wv;
isLoaded=true;
}
@@ -1007,7 +1008,7 @@ namespace Rotor {
// clip_loaded=-1;
//}
}
- if (isLoaded){ //always checks if loading is succesful
+ if (isLoaded){ //always checks if loading was succesful
int wanted=0.0;
int thisframe=((Time_spec)frame).frame();
double clipframerate=(parameters["framerate"]->value==0.0?players[clip_loaded].get_framerate():parameters["framerate"]->value);
@@ -1045,7 +1046,7 @@ namespace Rotor {
wanted=ph*players[clip_loaded].get_number_frames();
break;
}
- if (get_frame(wanted,frame)) return &image;
+ if (get_frame(wanted,frame)) return &image; //only return if succesful
}
}