From 2d507172c6d4e267cc1571f197990dee1d217f74 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 7 May 2013 15:15:13 +0100 Subject: succesful render with a dirty hack --- rotord/rotor.cpp | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) (limited to 'rotord/rotor.cpp') diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index 46bc9c9..67f8c0c 100755 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -182,24 +182,32 @@ bool Video_output::render(const float duration, const float framerate,const stri float vf=0.0f; float af=0.0f; while (vfpts comes from video - while (flessorequal(vf,af)) { - //insert audio frames until we are ahead of the video - uint16_t* s=audioloader.get_samples(exporter->get_audio_framesize()); - exporter->encodeFrame(s); - af+=exporter->get_audio_step(); - } + cerr << "Rotor: rendering frame "<0.998) { + //stop here + int nothing=0; + //seems that the last frame of samples causes std::max to have + } + 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(); + } + } Image* i=get_output(Frame_spec(vf,framerate,outW,outH)); if (i) { exporter->encodeFrame(i->RGBdata); } vf+=vstep; progress=vf/duration; - if (progress>0.99) { - //stop here - //seems that the last frame of samples causes std::max to have - } + + /* if (!exporter->encodeFrame(i->RGBdata)){ //if (!exporter->encodeFrame(get_output(Frame_spec(f,framerate,outW,outH))->RGBdata,audioloader.get_packet())){ @@ -215,6 +223,7 @@ bool Video_output::render(const float duration, const float framerate,const stri } */ } + exporter->finishRecord(); cerr << "Rotor: Video_output finished "<< endl; return true; -- cgit v1.2.3