From 2d507172c6d4e267cc1571f197990dee1d217f74 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 7 May 2013 15:15:13 +0100 Subject: succesful render with a dirty hack --- rotord/rendercontext.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'rotord/rendercontext.cpp') 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(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& //http://blog.tomaka17.com/2012/03/libavcodeclibavformat-tutorial/ //great to use c++11 features bool Render_context::load_audio(const string &filename,vector 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"<