diff options
| author | Tim Redfern <tim@eclectronics.org> | 2013-05-27 17:22:16 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2013-05-27 17:22:16 +0100 |
| commit | 14f3d350aa7c9abfd8bc394e87177d3f9e6b8d87 (patch) | |
| tree | 0c6475fc6d320fbd1f718fd8eee5a5d87c67bfa7 /rotord/rotor.cpp | |
| parent | 12c7449bd73a49ede4dacb90a9b0b7f73eb2e287 (diff) | |
adding audio output to avwrapper
Diffstat (limited to 'rotord/rotor.cpp')
| -rwxr-xr-x | rotord/rotor.cpp | 27 |
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; } |
