From f4c9ea89fa6d642813dc06387e956ef062ad9de1 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 2 Apr 2013 17:14:27 +0100 Subject: baffled by premature EOF --- rotord/rotor.cpp | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 5 deletions(-) (limited to 'rotord/rotor.cpp') diff --git a/rotord/rotor.cpp b/rotord/rotor.cpp index 2ab5734..53ba33b 100644 --- a/rotord/rotor.cpp +++ b/rotord/rotor.cpp @@ -431,9 +431,31 @@ bool Render_context::load_audio(const string &filename,vectorcodec->capabilities & CODEC_CAP_TRUNCATED) codecContext->codec->capabilities|=CODEC_FLAG_TRUNCATED; + // + // av_dump_format(formatContext, 0, 0, false); //avformat.h line 1256 int samples = ((formatContext->duration + 5000)*codecContext->sample_rate)/AV_TIME_BASE; @@ -514,10 +542,19 @@ bool Render_context::load_audio(const string &filename,vectorindex) { // Try to decode the packet into a frame @@ -535,12 +572,20 @@ bool Render_context::load_audio(const string &filename,vector doxygen" into google (like // "AVFrame doxygen" for AVFrame's docs) + + //av_get_channel_layout_string (char *buf, int buf_size, int nb_channels, uint64_t channel_layout) + + if (diag) { + cerr << "first frame: "<nb_samples<<" samples in "<format)<<" format with channel layout "<channel_layout<< std::endl; + diag=false; + } //std::cout << "Got a frame: bytes " << bytes << ", "<nb_samples<<" samples"<process_frame(frame->data[0],frame->nb_samples); } + mutex.lock(); progress=((double)sample_processed)/samples; mutex.unlock(); @@ -568,6 +613,9 @@ bool Render_context::load_audio(const string &filename,vector>3); + int bytes=(bits>>3); int stride=channels*bytes; int in_sample=0; while (in_sample