X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_decoder.cc;h=c0ef02f65d5ab5518dcb7e53aa145b1ff3f9a598;hb=cadf2d574d144098fffa3c61e0a2be88f496cac6;hp=9d8de971c654356a753f85fc48b8618d49568fc9;hpb=aa230169f8b59b7cb2da9a3bbb8ce5f7600285c0;p=dcpomatic.git diff --git a/src/lib/audio_decoder.cc b/src/lib/audio_decoder.cc index 9d8de971c..c0ef02f65 100644 --- a/src/lib/audio_decoder.cc +++ b/src/lib/audio_decoder.cc @@ -18,19 +18,41 @@ */ #include "audio_decoder.h" -#include "stream.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 o, Job* j) - : Decoder (f, o, j) +AudioDecoder::AudioDecoder (shared_ptr film, shared_ptr content) + : Decoder (film) + , _audio_content (content) + , _audio_position (0) { } void -AudioDecoder::set_audio_stream (shared_ptr s) +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 { - _audio_stream = s; + return _audio_content->audio_channels () > 0; }