diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-08-20 15:00:23 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-08-20 15:00:23 +0100 |
| commit | 7c66c73d883ad1d815b26463b14a106176829eef (patch) | |
| tree | b7a3a9237afe6f100b95ec8eea5c0f605a863ffd /rotord | |
| parent | b79752f96f9e58c0b4636cc024add698e0ce0c5f (diff) | |
frame mode for video loader + audio output bugfix
Diffstat (limited to 'rotord')
| -rwxr-xr-x | rotord/src/rotor.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/rotord/src/rotor.cpp b/rotord/src/rotor.cpp index 73ef0cc..407004e 100755 --- a/rotord/src/rotor.cpp +++ b/rotord/src/rotor.cpp @@ -212,10 +212,13 @@ 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"); + if (usingaudio){ + //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"); + uint16_t *audioframe=new uint16_t[samples_in_frame]; + } float vstep=1.0f/framerate; float v=0.0f; @@ -261,7 +264,12 @@ bool Video_output::render(const float duration, const float framerate,const stri logger.information("Video_output: rendered "+output_filename+": in "+ofToString(mtime)+" seconds"); - if (usingaudio) audioloader.close(); + if (usingaudio) { + audioloader.close(); + delete[] audioframe; + } + + return true; } @@ -311,8 +319,6 @@ Image* Video_loader::output(const Frame_spec &frame){ 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"); |
