X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_decoder.cc;h=c0ef02f65d5ab5518dcb7e53aa145b1ff3f9a598;hb=98060a4e6f02b418f30b4b736e5880a357454c40;hp=e2006a795d9c31e650f99c64cb3634f18047ca67;hpb=a054c067ab2cbf6c5abc5df4caa08ffaac206f0b;p=dcpomatic.git diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc index e2006a795..c0ef02f65 100644 --- a/src/lib/audio_decoder.cc +++ b/src/lib/audio_decoder.cc @@ -18,12 +18,41 @@ */ #include "audio_decoder.h" +#include "audio_buffers.h" +#include "exceptions.h" +#include "log.h" +#include "resampler.h" +#include "i18n.h" + +using std::stringstream; +using std::list; +using std::pair; +using std::cout; using boost::optional; using boost::shared_ptr; -AudioDecoder::AudioDecoder (shared_ptr f, shared_ptr c) - : Decoder (f) +AudioDecoder::AudioDecoder (shared_ptr film, shared_ptr content) + : Decoder (film) + , _audio_content (content) + , _audio_position (0) { } + +void +AudioDecoder::audio (shared_ptr data, AudioContent::Frame frame) +{ + Audio (data, frame); + _audio_position = frame + data->frames (); +} + +/** This is a bit odd, but necessary when we have (e.g.) FFmpegDecoders with no audio. + * The player needs to know that there is no audio otherwise it will keep trying to + * pass() the decoder to get it to emit audio. + */ +bool +AudioDecoder::has_audio () const +{ + return _audio_content->audio_channels () > 0; +}