X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_decoder.h;h=8765be42674c3fd8a41323c5bf865dfdab2d7071;hb=9d904847726295852b78b0029939d0f848793d06;hp=10d88d1ec5f7f76c516881d93394b6659a9666c0;hpb=22b13599407e45d85d1c83e0805aa14965b0ab19;p=dcpomatic.git diff --git a/src/lib/audio_decoder.h b/src/lib/audio_decoder.h index 10d88d1ec..8765be426 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. @@ -36,6 +36,7 @@ class AudioBuffers; class AudioContent; class AudioDecoderStream; class Log; +class Resampler; /** @class AudioDecoder. * @brief Parent class for audio decoders. @@ -43,22 +44,31 @@ class Log; 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, boost::shared_ptr log, bool fast); - boost::optional position () const; - - void set_fast (); + ContentTime position () const; + void emit (AudioStreamPtr stream, boost::shared_ptr, ContentTime); + void seek (); void flush (); - void emit (AudioStreamPtr stream, boost::shared_ptr, ContentTime); + ContentTime stream_position (AudioStreamPtr stream) const; + /** @return Number of frames of data that were accepted */ boost::signals2::signal Data; private: - /** An AudioDecoderStream object to manage each stream in _audio_content */ - typedef std::map > StreamMap; - StreamMap _streams; - std::map _positions; + 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; }; #endif