summaryrefslogtreecommitdiff
path: root/rotord/src/rotor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/src/rotor.cpp')
-rwxr-xr-xrotord/src/rotor.cpp22
1 files changed, 16 insertions, 6 deletions
diff --git a/rotord/src/rotor.cpp b/rotord/src/rotor.cpp
index 7ab9e54..73ef0cc 100755
--- a/rotord/src/rotor.cpp
+++ b/rotord/src/rotor.cpp
@@ -199,12 +199,8 @@ bool Video_output::render(const float duration, const float framerate,const stri
libav::audioloader audioloader;
- bool usingaudio=false;
+ bool usingaudio=audioloader.setup(audio_filename);
float *avframe=nullptr;
- if (audioloader.setup(audio_filename)){
- bool usingaudio=true;
- //avframe=new float[audioloader.channels*]
- }
Logger& logger = Logger::get("Rotor");
@@ -216,6 +212,11 @@ bool Video_output::render(const float duration, const float framerate,const stri
gettimeofday(&start, NULL);
+ //does audioloader output interleaved samples?
+ int samples_in_frame=(audioloader.codecContext->channels*audioloader.codecContext->sample_rate)/framerate;
+ string whether=usingaudio?"Loading":"Cannot load";
+ logger.information(whether+" audio file: "+audio_filename+", each frame contains "+ofToString(samples_in_frame)+" samples at "+ofToString(audioloader.codecContext->sample_rate)+" hz");
+
float vstep=1.0f/framerate;
float v=0.0f;
float vf=0.0f;
@@ -302,7 +303,16 @@ Image* Video_loader::output(const Frame_spec &frame){
float clipspeed=(clipframerate/frame.framerate)*parameters["speed"]->value;
- int wanted=(((int) ((frame.time*frame.framerate*clipspeed)+0.5))%(player.getNumberOfFrames()-1))+1; //+1 is necessary because 1st frame in a video is number 1?
+ int wanted;
+ if (attributes["mode"]->intVal==VIDEOFRAMES_frame) {
+ wanted=(((int) ((frame.time*frame.framerate)+0.5))%(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))%(player.getNumberOfFrames()-1))+1; //+1 is necessary because 1st frame in a video is number 1?
+ }
+
+ cerr<<"Video_loader: wanted frame "<<wanted<<endl;
+
if (wanted!=lastframe){
if (!player.fetchFrame(frame.w,frame.h,wanted)) { //seek fail
Logger& logger = Logger::get("Rotor");