Another try at sorting out the thorny question of timing.
[dcpomatic.git] / src / lib / sndfile_decoder.h
index e16eab6731e2f23d4bc32e9f4e6dfd1a8c2fced7..77fa6d17734da4096757dae504a759c9925e0e8b 100644 (file)
 #include <sndfile.h>
 #include "decoder.h"
 #include "audio_decoder.h"
-#include "stream.h"
 
-class SndfileStream : public AudioStream
-{
-public:
-       SndfileStream (int sample_rate, int64_t layout)
-               : AudioStream (sample_rate, layout)
-       {}
-                              
-       std::string to_string () const;
-
-       static boost::shared_ptr<SndfileStream> create ();
-       static boost::shared_ptr<SndfileStream> create (std::string t, boost::optional<int> v);
-
-private:
-       friend class stream_test;
-       
-       SndfileStream ();
-       SndfileStream (std::string t, boost::optional<int> v);
-};
+class SndfileContent;
 
 class SndfileDecoder : public AudioDecoder
 {
 public:
-       SndfileDecoder (boost::shared_ptr<Film>, DecodeOptions);
+       SndfileDecoder (boost::shared_ptr<const Film>, boost::shared_ptr<const SndfileContent>);
+       ~SndfileDecoder ();
+
+       void pass ();
+       bool done () const;
 
-       bool pass ();
+       int audio_channels () const;
+       AudioContent::Frame audio_length () const;
+       int audio_frame_rate () const;
 
 private:
-       std::vector<SNDFILE*> open_files (sf_count_t &);
-       void close_files (std::vector<SNDFILE*> const &);
+       boost::shared_ptr<const SndfileContent> _sndfile_content;
+       SNDFILE* _sndfile;
+       SF_INFO _info;
+       AudioContent::Frame _done;
+       AudioContent::Frame _remaining;
+       float* _deinterleave_buffer;
 };