summaryrefslogtreecommitdiff
path: root/rotord/rotor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/rotor.cpp')
-rwxr-xr-xrotord/rotor.cpp33
1 files changed, 21 insertions, 12 deletions
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 (vf<duration) { //float f=0.0f;f<duration;f+=step) {
- //seems to be that the audio frames have to be a little ahead
- //and the frame->pts 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 "<<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();
+ }
+ }
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 <error reading variables>
- }
+
+
/*
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;