diff options
| author | Tim Redfern <tim@herge.(none)> | 2013-05-07 15:15:13 +0100 |
|---|---|---|
| committer | Tim Redfern <tim@herge.(none)> | 2013-05-07 15:15:13 +0100 |
| commit | 2d507172c6d4e267cc1571f197990dee1d217f74 (patch) | |
| tree | f05b8b08fae8f1b512bb04c196fd90fa19df1d66 /rotord/rendercontext.cpp | |
| parent | 31ba1ab9504c5a4080d9703a37ab3d4f82066037 (diff) | |
succesful render with a dirty hack
Diffstat (limited to 'rotord/rendercontext.cpp')
| -rw-r--r-- | rotord/rendercontext.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/rotord/rendercontext.cpp b/rotord/rendercontext.cpp index cdb1cf7..fc5936b 100644 --- a/rotord/rendercontext.cpp +++ b/rotord/rendercontext.cpp @@ -18,7 +18,7 @@ void Render_context::runTask() { for (auto a: analysers) { processors.push_back(dynamic_cast<Base_audio_processor*>(a)); } - if (load_audio(audio_filename,processors)) { + if (_load_audio(audio_filename,processors)) { audio_loaded=true; state=IDLE; } @@ -272,10 +272,16 @@ Command_response Render_context::session_command(const std::vector<std::string>& //http://blog.tomaka17.com/2012/03/libavcodeclibavformat-tutorial/ //great to use c++11 features bool Render_context::load_audio(const string &filename,vector<Base_audio_processor*> processors){ + audioloader.setup(filename); + av_dump_format(audioloader.formatContext, 0, 0, false); //avformat.h line 1256 + int samples = ((audioloader.formatContext->duration + 5000)*audioloader.codecContext->sample_rate)/AV_TIME_BASE; + graph.duration=((float)audioloader.formatContext->duration)/AV_TIME_BASE; + + for (auto p: processors) { - if(!p->init(codecContext->channels,16,samples,codecContext->sample_rate) ){ + if(!p->init(audioloader.codecContext->channels,audioloader.codecContext->bits_per_raw_sample,samples,audioloader.codecContext->sample_rate) ){ cerr<<"Plugin failed to initialse"<<endl; return false; } |
