Fix rounding of timecodes in at least some cases (#323).
[dcpomatic.git] / src / lib / encoder.h
index 9875a179b45152407b73ffeead41317a670f4de1..e0ee2d41480f3fbf7b413cf0e974a96a4967c735 100644 (file)
@@ -37,6 +37,7 @@ extern "C" {
 }
 #include "util.h"
 #include "config.h"
+#include "cross.h"
 
 class Image;
 class AudioBuffers;
@@ -47,6 +48,7 @@ class EncodedData;
 class Writer;
 class Job;
 class ServerFinder;
+class PlayerImage;
 
 /** @class Encoder
  *  @brief Encoder to J2K and WAV for DCP.
@@ -55,10 +57,10 @@ class ServerFinder;
  *  is supplied as uncompressed PCM in blocks of various sizes.
  */
 
-class Encoder : public boost::noncopyable
+class Encoder : public boost::noncopyable, public ExceptionStore
 {
 public:
-       Encoder (boost::shared_ptr<const Film> f, boost::shared_ptr<Job>);
+       Encoder (boost::shared_ptr<const Film> f, boost::weak_ptr<Job>);
        virtual ~Encoder ();
 
        /** Called to indicate that a processing run is about to begin */
@@ -68,7 +70,7 @@ public:
         *  @param i Video frame image.
         *  @param same true if i is the same as the last time we were called.
         */
-       void process_video (boost::shared_ptr<const Image> i, Eyes eyes, ColourConversion, bool same);
+       void process_video (boost::shared_ptr<PlayerImage> i, Eyes eyes, ColourConversion, bool same);
 
        /** Call with some audio data */
        void process_audio (boost::shared_ptr<const AudioBuffers>);
@@ -90,7 +92,7 @@ private:
 
        /** Film that we are encoding */
        boost::shared_ptr<const Film> _film;
-       boost::shared_ptr<Job> _job;
+       boost::weak_ptr<Job> _job;
 
        /** Mutex for _time_history and _last_frame */
        mutable boost::mutex _state_mutex;
@@ -112,6 +114,7 @@ private:
        boost::condition _condition;
 
        boost::shared_ptr<Writer> _writer;
+       Waker _waker;
 };
 
 #endif