Fix crash on OS X when chroma subsampling is happening.
[dcpomatic.git] / src / lib / audio_decoder.h
index 68e99608fb2b42c2631d718018a59ebd8af685f5..fcbd8267b6f6a7380dc5356551c68a5d8520d79d 100644 (file)
@@ -1,5 +1,5 @@
 /*
-    Copyright (C) 2012-2016 Carl Hetherington <cth@carlh.net>
+    Copyright (C) 2012-2017 Carl Hetherington <cth@carlh.net>
 
     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,24 +44,20 @@ class Log;
 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);
-
-       boost::optional<ContentTime> position () const;
-       void set_position (AudioStreamPtr stream, ContentTime position);
-
-       void set_fast ();
-       void flush ();
+       AudioDecoder (Decoder* parent, boost::shared_ptr<const AudioContent> content, boost::shared_ptr<Log> log);
 
+       ContentTime position () const;
        void emit (AudioStreamPtr stream, boost::shared_ptr<const AudioBuffers>, ContentTime);
+       void seek ();
+       void flush ();
 
        boost::signals2::signal<void (AudioStreamPtr, ContentAudio)> Data;
 
-       boost::optional<ContentTime> position () const;
-
 private:
-       /** An AudioDecoderStream object to manage each stream in _audio_content */
-       std::map<AudioStreamPtr, boost::shared_ptr<AudioDecoderStream> > _streams;
-       std::map<AudioStreamPtr, ContentTime> _positions;
+       boost::shared_ptr<const AudioContent> _content;
+       /** Frame after the last one that was emitted from Data for each AudioStream */
+       std::map<AudioStreamPtr, Frame> _positions;
+       std::map<AudioStreamPtr, boost::shared_ptr<Resampler> > _resamplers;
 };
 
 #endif