Basic grunt-work, untested and unfinished, but it compiles.
[dcpomatic.git] / src / lib / audio_decoder.h
index 315cd94e49a34531023961a421784653d6c88802..a777592c258f282b0e1dc73384f6174128a4881a 100644 (file)
@@ -28,7 +28,9 @@
 #include "decoder.h"
 #include "content_audio.h"
 #include "audio_stream.h"
+#include "decoder_part.h"
 #include <boost/enable_shared_from_this.hpp>
+#include <boost/signals2.hpp>
 
 class AudioBuffers;
 class AudioContent;
@@ -38,31 +40,24 @@ class Log;
 /** @class AudioDecoder.
  *  @brief Parent class for audio decoders.
  */
-class AudioDecoder : public boost::enable_shared_from_this<AudioDecoder>
+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);
 
-       /** Try to fetch some audio from a specific place in this content.
-        *  @param frame Frame to start from (after resampling, if applicable)
-        *  @param length Frames to get (after resampling, if applicable)
-        *  @param accurate true to try hard to return frames from exactly `frame', false if we don't mind nearby frames.
-        *  @return Time-stamped audio data which may or may not be from the location (and of the length) requested.
-        */
-       ContentAudio get (AudioStreamPtr stream, Frame time, Frame length, bool accurate);
-
-       void set_ignore ();
        void set_fast ();
-
-       void give (AudioStreamPtr stream, boost::shared_ptr<const AudioBuffers>, ContentTime);
        void flush ();
-       void seek (ContentTime t, bool accurate);
+
+       void emit (AudioStreamPtr stream, boost::shared_ptr<const AudioBuffers>, ContentTime);
+
+       boost::signals2::signal<void (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;
-       bool _ignore;
-       bool _fast;
+       typedef std::map<AudioStreamPtr, boost::shared_ptr<AudioDecoderStream> > StreamMap;
+       StreamMap _streams;
 };
 
 #endif