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 | |
| parent | 2d507172c6d4e267cc1571f197990dee1d217f74 (diff) | |
fixed output hang
| -rw-r--r-- | rotord/01.mp3 | bin | 10375915 -> 0 bytes | |||
| -rw-r--r-- | rotord/libavaudioloader.cpp | 8 | ||||
| -rwxr-xr-x | rotord/rotor.cpp | 43 |
3 files changed, 11 insertions, 40 deletions
diff --git a/rotord/01.mp3 b/rotord/01.mp3 Binary files differdeleted file mode 100644 index 92e9c6d..0000000 --- a/rotord/01.mp3 +++ /dev/null diff --git a/rotord/libavaudioloader.cpp b/rotord/libavaudioloader.cpp index ef84560..a894727 100644 --- a/rotord/libavaudioloader.cpp +++ b/rotord/libavaudioloader.cpp @@ -150,7 +150,7 @@ bool libav::Audioloader::setup(const std::string &filename){ uint16_t* libav::Audioloader::get_samples(int num){ //presumes 16bpc here //std::cerr << "request "<<num<<" samples: "<<(ready?"ready":"not ready")<<std::endl; - if(!ready) return nullptr; + //if(!ready) return nullptr; //shuffle down samples if (sample_start>0){ @@ -177,9 +177,7 @@ uint16_t* libav::Audioloader::get_samples(int num){ //presumes 16bpc here for (int i=0;i<frame->nb_samples;i++) { for (int j=0;j<channels;j++) { buffer[((sample_end+i)*frame->channels)+j]= ((uint16_t*) frame->buf[j]->data)[i]; - //temporarily disabled audio as its is SIGSEV with audio from delorentos - - + //buffer[(j*frame->channels)+(sample_end+i)]= ((uint16_t*) frame->buf[j]->data)[i]; ??planar?? nope } } @@ -191,7 +189,7 @@ uint16_t* libav::Audioloader::get_samples(int num){ //presumes 16bpc here buffer[(channels*i)+j]=0; } } - + sample_end=num; } //std::cerr<<"filling buffer to "<<((sample_end+frame->nb_samples)*frame->channels)<<std::endl; 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(); |
