summaryrefslogtreecommitdiff
path: root/src/lib/audio_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-16 08:36:47 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-16 08:36:47 +0100
commit21ce34c2cd04a2e7e133ff693b84c054182f4f91 (patch)
tree5bda50a34b2fa7526dcd682578247f75a85d26b1 /src/lib/audio_decoder.cc
parent0db016f90ae722fc8b72d465e21d9f153f72b340 (diff)
Compiles; strange hang on adding content to a film.
Diffstat (limited to 'src/lib/audio_decoder.cc')
-rw-r--r--src/lib/audio_decoder.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc
index 68554daf9..e1c93ac77 100644
--- a/src/lib/audio_decoder.cc
+++ b/src/lib/audio_decoder.cc
@@ -18,6 +18,7 @@
*/
#include "audio_decoder.h"
+#include "audio_buffers.h"
#include "exceptions.h"
#include "log.h"
@@ -30,11 +31,12 @@ using boost::shared_ptr;
AudioDecoder::AudioDecoder (shared_ptr<const Film> f, shared_ptr<const AudioContent> c)
: Decoder (f)
, _audio_content (c)
+ , _output_audio_frame_rate (_audio_content->output_audio_frame_rate (f))
{
- if (_audio_content->audio_frame_rate() != _film->target_audio_sample_rate()) {
+ if (_audio_content->content_audio_frame_rate() != _output_audio_frame_rate) {
stringstream s;
- s << String::compose ("Will resample audio from %1 to %2", _audio_content->audio_frame_rate(), _film->target_audio_sample_rate());
+ s << String::compose ("Will resample audio from %1 to %2", _audio_content->content_audio_frame_rate(), _output_audio_frame_rate);
_film->log()->log (s.str ());
/* We will be using planar float data when we call the
@@ -49,10 +51,10 @@ AudioDecoder::AudioDecoder (shared_ptr<const Film> f, shared_ptr<const AudioCont
0,
av_get_default_channel_layout (MAX_AUDIO_CHANNELS),
AV_SAMPLE_FMT_FLTP,
- _film->target_audio_sample_rate(),
+ _output_audio_frame_rate,
av_get_default_channel_layout (MAX_AUDIO_CHANNELS),
AV_SAMPLE_FMT_FLTP,
- _audio_content->audio_frame_rate(),
+ _audio_content->content_audio_frame_rate(),
0, 0
);
@@ -74,7 +76,7 @@ AudioDecoder::~AudioDecoder ()
void
AudioDecoder::process_end ()
{
- if (_film->has_audio() && _swr_context) {
+ if (_swr_context) {
shared_ptr<AudioBuffers> out (new AudioBuffers (_film->audio_mapping().dcp_channels(), 256));
@@ -106,7 +108,7 @@ AudioDecoder::emit_audio (shared_ptr<const AudioBuffers> data, Time time)
if (_swr_context) {
/* Compute the resampled frames count and add 32 for luck */
- int const max_resampled_frames = ceil ((int64_t) data->frames() * _film->target_audio_sample_rate() / _audio_content->audio_frame_rate()) + 32;
+ int const max_resampled_frames = ceil ((int64_t) data->frames() * _output_audio_frame_rate / _audio_content->content_audio_frame_rate()) + 32;
shared_ptr<AudioBuffers> resampled (new AudioBuffers (MAX_AUDIO_CHANNELS, max_resampled_frames));