From a1318769138379192cd0d381877808e928cffe44 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Mon, 10 Feb 2014 13:24:20 +0000 Subject: elusive bank bug./http GET a/render --- rotord/src/rotor.h | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'rotord/src/rotor.h') 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 ℑ + if (get_frame(wanted,frame)) return ℑ //only return if succesful } } -- cgit v1.2.3