summaryrefslogtreecommitdiff
path: root/rotord/rotor.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'rotord/rotor.cpp')
-rwxr-xr-xrotord/rotor.cpp27
1 files changed, 17 insertions, 10 deletions
diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp
index 83a3b8f..bd1ace9 100755
--- a/rotord/rotor.cpp
+++ b/rotord/rotor.cpp
@@ -194,10 +194,11 @@ bool Video_output::render(const float duration, const float framerate,const stri
float spct=100.0f/duration;
- if (exporter->setup(outW,outH,bitRate,frameRate,container)) { //codecId,
- if (exporter->record(output_filename)) {
+ //if (exporter->setup(outW,outH,bitRate,frameRate,container)) { //codecId,
+ // if (exporter->record(output_filename)) {
+ libav::encoder encoder=libav::encoder(output_filename.c_str(),outW,outH,framerate);
- cerr << "Rotor: Video_output rendering " << duration << " seconds at " << framerate << " fps, audio frame size: " << exporter->get_audio_framesize()<<endl;
+ //cerr << "Rotor: Video_output rendering " << duration << " seconds at " << framerate << " fps, audio frame size: " << exporter->get_audio_framesize()<<endl;
//25fps video and 43.06640625fps audio? hmm
//how to get the timecodes correct for the interleaved files
@@ -206,25 +207,31 @@ bool Video_output::render(const float duration, const float framerate,const stri
float vf=0.0f;
float af=0.0f;
while (vf<duration-vstep) {
- while (fless(vf,af)) {
+ while (!fless(af,vf)) {
//insert audio frames until we are ahead of the video
- exporter->encodeFrame(audioloader.get_samples(exporter->get_audio_framesize()));
- af+=exporter->get_audio_step();
+ //exporter->encodeFrame(audioloader.get_samples(exporter->get_audio_framesize()));
+ //af+=exporter->get_audio_step();
+ uint16_t *s=audioloader.get_samples(encoder.get_audio_framesize());
+ encoder.write_frame(af,s); //crashes
+ af+=encoder.get_audio_step();
}
Image* i=get_output(Frame_spec(vf,framerate,duration,outW,outH));
if (i) {
- exporter->encodeFrame(i->RGBdata);
+ //exporter->encodeFrame(i->RGBdata);
+
+ //encoder->picture_rgb.pts=;
+ encoder.write_frame(vf,i->RGBdata);
}
vf+=vstep;
progress=vf/duration;
}
- exporter->finishRecord();
+ //exporter->finishRecord();
cerr << "Rotor: Video_output finished "<< endl;
return true;
- }
- }
+ // }
+ //}
return false;
}