diff options
| author | Comment <tim@gray.(none)> | 2013-09-16 23:15:51 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-09-16 23:15:51 +0100 |
| commit | c23c67796989dd436955dbcb14c6c5b8199abca1 (patch) | |
| tree | 0bb6ed4e344152a246d6394eb5a9bed5716dde23 /rotord/src/rotor.cpp | |
| parent | 64046a1fb1f9254a485bac61752684b51afcb622 (diff) | |
cleanup exporter wrapper
Diffstat (limited to 'rotord/src/rotor.cpp')
| -rw-r--r-- | rotord/src/rotor.cpp | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/rotord/src/rotor.cpp b/rotord/src/rotor.cpp index d26cdec..d75b9ed 100644 --- a/rotord/src/rotor.cpp +++ b/rotord/src/rotor.cpp @@ -79,60 +79,3 @@ float Parameter::get(const Time_spec& time){ //gets input and updates variable } return value; } - -bool _Video_loader::load(const string &_filename){ - Logger& logger = Logger::get("Rotor"); - if (isLoaded) { - player.cleanup(); ///should be in decoder class? - isLoaded=false; - } - Poco::Path path; - string uri="file://"+_filename; - isLoaded=player.open(uri); - if (isLoaded){ - logger.information("Video_loader loaded "+_filename+": "\ - +toString(player.getNumberOfFrames())+" frames, "\ - +toString(player.getFrameRate())+" fps, "\ - +toString(player.getWidth())+"x"+toString(player.getHeight())\ - +", channels:"+toString(player.getNumberOfChannels())); - return true; - } - - logger.error("Video_loader failed to load "+_filename); - - return false; -} -Image* _Video_loader::output(const Frame_spec &frame){ - - if (isLoaded){ - //this approach is running into the inability to seek when requesting playback speed > 1. - //need to cache frames so as to avoid asking for a frame other than the next one. - //need an algorithm to find the previous keyframe and seek forward - - float clipframerate=(parameters["framerate"]->value==0.0f?player.getFrameRate():parameters["framerate"]->value); - - float clipspeed=(clipframerate/frame.framerate)*parameters["speed"]->value; - - int wanted; - if (attributes["mode"]->intVal==VIDEOFRAMES_frame) { - wanted=(((int) ((frame.time*frame.framerate)+0.5))%max(1,player.getNumberOfFrames()-1))+1; //+1 is necessary because 1st frame in a video is number 1? - } - if (attributes["mode"]->intVal==VIDEOFRAMES_blend) { - wanted=(((int) ((frame.time*frame.framerate*clipspeed)+0.5))%max(1,player.getNumberOfFrames()-1))+1; //+1 is necessary because 1st frame in a video is number 1? - } - - if (wanted!=lastframe){ - if (!player.fetchFrame(frame.w,frame.h,wanted)) { //seek fail - Logger& logger = Logger::get("Rotor"); - logger.error("Video_loader failed to seek frame "+toString(wanted)+" of "+attributes["filename"]->value); - - if (image.w>0) return ℑ //just return the previous frame if possible - else return nullptr; - } - image.setup_fromRGB(frame.w,frame.h,player.pFrameRGB->data[0],player.pFrameRGB->linesize[0]-(frame.w*3)); - lastframe=wanted; - } - return ℑ - } - return nullptr; -}; |
