From bb917533ad5beaded24ed56c7c4dc71d50e76263 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 11 Jul 2013 13:12:43 +0100 Subject: Untested audio delay. --- src/lib/audio_decoder.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'src/lib/audio_decoder.cc') diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc index ade11cc32..2fe347cf2 100644 --- a/src/lib/audio_decoder.cc +++ b/src/lib/audio_decoder.cc @@ -31,15 +31,21 @@ using std::cout; using boost::optional; using boost::shared_ptr; -AudioDecoder::AudioDecoder (shared_ptr f) +AudioDecoder::AudioDecoder (shared_ptr f, shared_ptr c) : Decoder (f) , _audio_position (0) { + _delay_frames = c->audio_delay() * c->content_audio_frame_rate() * f->dcp_audio_frame_rate() / (c->output_audio_frame_rate() * 1000); } void AudioDecoder::audio (shared_ptr data, AudioContent::Frame frame) { + frame += _delay_frames; + Audio (data, frame); _audio_position = frame + data->frames (); + if (_audio_position < 0) { + _audio_position = 0; + } } -- cgit v1.2.3