summaryrefslogtreecommitdiff
path: root/src/lib/audio_decoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-05-23 08:07:38 +0100
committerCarl Hetherington <cth@carlh.net>2013-05-23 08:07:38 +0100
commite8819ad7580f25eea7ca3c59cf0a3979d76a6b44 (patch)
tree1ecec7476192945084a822916c1d565f35054ade /src/lib/audio_decoder.cc
parent929b4c37eaf9593892f61df80309a8c8ad6c05a0 (diff)
Some more tidying up.
Diffstat (limited to 'src/lib/audio_decoder.cc')
-rw-r--r--src/lib/audio_decoder.cc14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc
index fbc66c335..c33f68c01 100644
--- a/src/lib/audio_decoder.cc
+++ b/src/lib/audio_decoder.cc
@@ -36,9 +36,12 @@ AudioDecoder::AudioDecoder (shared_ptr<const Film> f, shared_ptr<const AudioCont
{
if (_audio_content->content_audio_frame_rate() != _output_audio_frame_rate) {
+ shared_ptr<const Film> film = _film.lock ();
+ assert (film);
+
stringstream s;
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 ());
+ film->log()->log (s.str ());
/* We will be using planar float data when we call the
resampler. As far as I can see, the audio channel
@@ -79,7 +82,10 @@ AudioDecoder::process_end ()
{
if (_swr_context) {
- shared_ptr<AudioBuffers> out (new AudioBuffers (_film->audio_mapping().dcp_channels(), 256));
+ shared_ptr<const Film> film = _film.lock ();
+ assert (film);
+
+ shared_ptr<AudioBuffers> out (new AudioBuffers (film->audio_mapping().dcp_channels(), 256));
while (1) {
int const frames = swr_convert (_swr_context, (uint8_t **) out->data(), 256, 0, 0);
@@ -130,7 +136,9 @@ AudioDecoder::emit_audio (shared_ptr<const AudioBuffers> data, Time time)
Audio (data, time);
- _next_audio = time + _film->audio_frames_to_time (data->frames());
+ shared_ptr<const Film> film = _film.lock ();
+ assert (film);
+ _next_audio = time + film->audio_frames_to_time (data->frames());
}