X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_decoder.h;h=8bd65a67137a7ed4fffa4bbaf098b19975054788;hb=44da1840ca17d0945cb1886bb17218990850894c;hp=315cd94e49a34531023961a421784653d6c88802;hpb=0cb31de2be2b51a8bc19e55ceb1b86dc26ea1c42;p=dcpomatic.git diff --git a/src/lib/audio_decoder.h b/src/lib/audio_decoder.h index 315cd94e4..8bd65a671 100644 --- a/src/lib/audio_decoder.h +++ b/src/lib/audio_decoder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2016 Carl Hetherington + Copyright (C) 2012-2018 Carl Hetherington This file is part of DCP-o-matic. @@ -28,40 +28,46 @@ #include "decoder.h" #include "content_audio.h" #include "audio_stream.h" +#include "decoder_part.h" #include +#include class AudioBuffers; class AudioContent; class AudioDecoderStream; class Log; +class Film; +class Resampler; /** @class AudioDecoder. * @brief Parent class for audio decoders. */ -class AudioDecoder : public boost::enable_shared_from_this +class AudioDecoder : public boost::enable_shared_from_this, public DecoderPart { public: - AudioDecoder (Decoder* parent, boost::shared_ptr, boost::shared_ptr log); + AudioDecoder (Decoder* parent, boost::shared_ptr content, bool fast); - /** Try to fetch some audio from a specific place in this content. - * @param frame Frame to start from (after resampling, if applicable) - * @param length Frames to get (after resampling, if applicable) - * @param accurate true to try hard to return frames from exactly `frame', false if we don't mind nearby frames. - * @return Time-stamped audio data which may or may not be from the location (and of the length) requested. - */ - ContentAudio get (AudioStreamPtr stream, Frame time, Frame length, bool accurate); + boost::optional position (boost::shared_ptr film) const; + void emit (boost::shared_ptr film, AudioStreamPtr stream, boost::shared_ptr, dcpomatic::ContentTime); + void seek (); + void flush (); - void set_ignore (); - void set_fast (); + dcpomatic::ContentTime stream_position (boost::shared_ptr film, AudioStreamPtr stream) const; - void give (AudioStreamPtr stream, boost::shared_ptr, ContentTime); - void flush (); - void seek (ContentTime t, bool accurate); + boost::signals2::signal Data; private: - /** An AudioDecoderStream object to manage each stream in _audio_content */ - std::map > _streams; - bool _ignore; + void silence (int milliseconds); + + boost::shared_ptr _content; + /** Frame after the last one that was emitted from Data (i.e. at the resampled rate, if applicable) + * for each AudioStream. + */ + typedef std::map PositionMap; + PositionMap _positions; + typedef std::map > ResamplerMap; + ResamplerMap _resamplers; + bool _fast; };