/*
- Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+ Copyright (C) 2012-2018 Carl Hetherington <cth@carlh.net>
This file is part of DCP-o-matic.
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<AudioDecoder>, public DecoderPart
{
public:
- AudioDecoder (Decoder* parent, boost::shared_ptr<const AudioContent>, boost::shared_ptr<Log> log);
+ AudioDecoder (Decoder* parent, boost::shared_ptr<const AudioContent> content, bool fast);
- boost::optional<ContentTime> position () const;
-
- void set_fast ();
+ boost::optional<dcpomatic::ContentTime> position (boost::shared_ptr<const Film> film) const;
+ void emit (boost::shared_ptr<const Film> film, AudioStreamPtr stream, boost::shared_ptr<const AudioBuffers>, dcpomatic::ContentTime);
+ void seek ();
void flush ();
- void emit (AudioStreamPtr stream, boost::shared_ptr<const AudioBuffers>, ContentTime);
+ dcpomatic::ContentTime stream_position (boost::shared_ptr<const Film> film, AudioStreamPtr stream) const;
+ /** @return Number of frames of data that were accepted */
boost::signals2::signal<void (AudioStreamPtr, ContentAudio)> Data;
private:
- /** An AudioDecoderStream object to manage each stream in _audio_content */
- typedef std::map<AudioStreamPtr, boost::shared_ptr<AudioDecoderStream> > StreamMap;
- StreamMap _streams;
- std::map<AudioStreamPtr, ContentTime> _positions;
+ void silence (int milliseconds);
+
+ boost::shared_ptr<const AudioContent> _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<AudioStreamPtr, Frame> PositionMap;
+ PositionMap _positions;
+ typedef std::map<AudioStreamPtr, boost::shared_ptr<Resampler> > ResamplerMap;
+ ResamplerMap _resamplers;
+
+ bool _fast;
};
#endif