From e8819ad7580f25eea7ca3c59cf0a3979d76a6b44 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 23 May 2013 08:07:38 +0100 Subject: Some more tidying up. --- src/lib/audio_decoder.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/lib/audio_decoder.cc') 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 f, shared_ptrcontent_audio_frame_rate() != _output_audio_frame_rate) { + shared_ptr 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 out (new AudioBuffers (_film->audio_mapping().dcp_channels(), 256)); + shared_ptr film = _film.lock (); + assert (film); + + shared_ptr 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 data, Time time) Audio (data, time); - _next_audio = time + _film->audio_frames_to_time (data->frames()); + shared_ptr film = _film.lock (); + assert (film); + _next_audio = time + film->audio_frames_to_time (data->frames()); } -- cgit v1.2.3