X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_decoder.h;h=7417fee44a5800859cf7b4c9dd56c100fbcdf03c;hb=HEAD;hp=c104d8201971a3b1ee98bf72dfed3f58f619945c;hpb=17e80bc37eea735629e13f068005653428c44cce;p=dcpomatic.git diff --git a/src/lib/audio_decoder.h b/src/lib/audio_decoder.h index c104d8201..7417fee44 100644 --- a/src/lib/audio_decoder.h +++ b/src/lib/audio_decoder.h @@ -1,5 +1,5 @@ /* - Copyright (C) 2012-2017 Carl Hetherington + Copyright (C) 2012-2021 Carl Hetherington This file is part of DCP-o-matic. @@ -18,42 +18,62 @@ */ + /** @file src/lib/audio_decoder.h * @brief Parent class for audio decoders. */ + #ifndef DCPOMATIC_AUDIO_DECODER_H #define DCPOMATIC_AUDIO_DECODER_H -#include "decoder.h" -#include "content_audio.h" + #include "audio_stream.h" +#include "content_audio.h" +#include "decoder.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, public DecoderPart +class AudioDecoder : public std::enable_shared_from_this, public DecoderPart { public: - AudioDecoder (Decoder* parent, boost::shared_ptr content, boost::shared_ptr log); + AudioDecoder (Decoder* parent, std::shared_ptr content, bool fast); + + boost::optional position (std::shared_ptr film) const override; + void emit(std::shared_ptr film, AudioStreamPtr stream, std::shared_ptr, dcpomatic::ContentTime, bool flushing = false); + void seek () override; + void flush (); - ContentTime position () const; - void emit (AudioStreamPtr stream, boost::shared_ptr, ContentTime); - void seek (); + dcpomatic::ContentTime stream_position (std::shared_ptr film, AudioStreamPtr stream) const; boost::signals2::signal Data; private: - /** Frame after the last one that was emitted from Data for each AudioStream */ - std::map _positions; + void silence (AudioStreamPtr stream, int milliseconds); + + std::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