Factor out key-value code.
[dcpomatic.git] / src / lib / j2k_wav_encoder.h
index 656af8321321940471f84ef2731724c59c6fa9ca..87068ad3df05c4e1592f2e352f0ee4b11b05a1d4 100644 (file)
 #include <boost/thread/condition.hpp>
 #include <boost/thread/mutex.hpp>
 #include <boost/thread.hpp>
+#ifdef HAVE_SWRESAMPLE
+extern "C" {
+#include <libswresample/swresample.h>
+}
+#endif
 #include <sndfile.h>
 #include "encoder.h"
 
-class Server;
+class ServerDescription;
 class DCPVideoFrame;
 class Image;
 class Log;
+class Subtitle;
 
 /** @class J2KWAVEncoder
  *  @brief An encoder which writes JPEG2000 and WAV files.
@@ -43,17 +49,22 @@ public:
        J2KWAVEncoder (boost::shared_ptr<const FilmState>, boost::shared_ptr<const Options>, Log *);
        ~J2KWAVEncoder ();
 
-       void process_begin ();
-       void process_video (boost::shared_ptr<Image>, int);
+       void process_begin (int64_t audio_channel_layout, AVSampleFormat audio_sample_format);
+       void process_video (boost::shared_ptr<Image>, int, boost::shared_ptr<Subtitle>);
        void process_audio (uint8_t *, int);
        void process_end ();
 
-private:       
+private:
 
-       void encoder_thread (Server *);
+       void write_audio (uint8_t* data, int size);
+       void encoder_thread (ServerDescription *);
        void close_sound_files ();
        void terminate_worker_threads ();
 
+#if HAVE_SWRESAMPLE    
+       SwrContext* _swr_context;
+#endif 
+
        std::vector<SNDFILE*> _sound_files;
        int _deinterleave_buffer_size;
        uint8_t* _deinterleave_buffer;