diff options
| author | Tim Redfern <tim@herge.(none)> | 2013-05-08 10:06:00 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@herge.(none)> | 2013-05-08 10:06:00 +0100 |
| commit | 147f2d29a85cb1af80459546d95857e1ce3344f3 (patch) | |
| tree | 2719e2e809a41198ceffc40a366ca1f753677936 /rotord/rotor.cpp | |
| parent | 2d507172c6d4e267cc1571f197990dee1d217f74 (diff) | |
fixed output hang
Diffstat (limited to 'rotord/rotor.cpp')
| -rwxr-xr-x | rotord/rotor.cpp | 43 |
1 files changed, 8 insertions, 35 deletions
diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index 67f8c0c..c25fed4 100755 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -181,47 +181,20 @@ bool Video_output::render(const float duration, const float framerate,const stri float v=0.0f; float vf=0.0f; float af=0.0f; - while (vf<duration) { //float f=0.0f;f<duration;f+=step) { - cerr << "Rotor: rendering frame "<<progress<< endl; - if (progress>0.998) { - //stop here - int nothing=0; - //seems that the last frame of samples causes std::max to have <error reading variables> - } - else { //DIRTY HACK - //seems to be that the audio frames have to be a little ahead - //and the frame->pts comes from video - while (fless(vf,af)) { - //insert audio frames until we are ahead of the video - uint16_t* s=audioloader.get_samples(exporter->get_audio_framesize()); - if (s) { - exporter->encodeFrame(s); - } - af+=exporter->get_audio_step(); - } - } + while (vf<duration) { + while (fless(vf,af)) { + //insert audio frames until we are ahead of the video + exporter->encodeFrame(audioloader.get_samples(exporter->get_audio_framesize())); + af+=exporter->get_audio_step(); + } + + Image* i=get_output(Frame_spec(vf,framerate,outW,outH)); if (i) { exporter->encodeFrame(i->RGBdata); } vf+=vstep; progress=vf/duration; - - - /* - if (!exporter->encodeFrame(i->RGBdata)){ - //if (!exporter->encodeFrame(get_output(Frame_spec(f,framerate,outW,outH))->RGBdata,audioloader.get_packet())){ - cerr << "Rotor: video output failed"<<endl; - break; - } - else { - cerr << "Rotor: rendered "<<(f*spct)<<"%"<<endl; - if (f*spct>99.5){ - - cerr<<"stop here"<<endl; - } - } - */ } exporter->finishRecord(); |
