X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Faudio_decoder.h;h=81b48b73cb7ff7aaafcf8a86ff18a4bea28fa744;hb=295076f7bf8d84d19f22a073814968aab76aebcc;hp=ba1520ef53adc72bd441fdb44f4f816ea4b0f701;hpb=4b2cf0764a4091b9466f90e6dbbeb029e04bc2be;p=dcpomatic.git diff --git a/src/lib/audio_decoder.h b/src/lib/audio_decoder.h index ba1520ef5..81b48b73c 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,53 +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, bool fast); + AudioDecoder (Decoder* parent, std::shared_ptr content, bool fast); - ContentTime position () const; - void emit (AudioStreamPtr stream, boost::shared_ptr, ContentTime); + boost::optional position (std::shared_ptr film) const; + void emit (std::shared_ptr film, AudioStreamPtr stream, std::shared_ptr, dcpomatic::ContentTime, bool time_already_delayed = false); void seek (); void flush (); - ContentTime stream_position (AudioStreamPtr stream) const; + dcpomatic::ContentTime stream_position (std::shared_ptr film, AudioStreamPtr stream) const; - /** @return Number of frames of data that were accepted */ - boost::signals2::signal Data; + boost::signals2::signal Data; private: void silence (int milliseconds); - boost::shared_ptr _content; - /** Frame after the last one that was emitted from Data for each AudioStream */ - std::map _positions; - std::map > _resamplers; + 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