More OS X debug.
[dcpomatic.git] / src / lib / encoder.cc
index 29fe64e26c993d6f17336e38669a990945032b45..35ebfb52e1fc089d88383e5d0558b6719fa4f3c9 100644 (file)
@@ -52,6 +52,7 @@ Encoder::Encoder (shared_ptr<const Film> f, shared_ptr<Job> j)
        : _film (f)
        , _job (j)
        , _video_frames_out (0)
+       , _state (TRANSCODING)
        , _terminate (false)
 {
        _have_a_real_frame[EYES_BOTH] = false;
@@ -125,6 +126,11 @@ Encoder::process_end ()
                }
        }
 
+       {
+               boost::mutex::scoped_lock lm (_state_mutex);
+               _state = HASHING;
+       }
+               
        _writer->finish ();
        _writer.reset ();
 }      
@@ -135,7 +141,7 @@ Encoder::process_end ()
 float
 Encoder::current_encoding_rate () const
 {
-       boost::mutex::scoped_lock lock (_history_mutex);
+       boost::mutex::scoped_lock lock (_state_mutex);
        if (int (_time_history.size()) < _history_size) {
                return 0;
        }
@@ -150,7 +156,7 @@ Encoder::current_encoding_rate () const
 int
 Encoder::video_frames_out () const
 {
-       boost::mutex::scoped_lock (_history_mutex);
+       boost::mutex::scoped_lock (_state_mutex);
        return _video_frames_out;
 }
 
@@ -160,7 +166,7 @@ Encoder::video_frames_out () const
 void
 Encoder::frame_done ()
 {
-       boost::mutex::scoped_lock lock (_history_mutex);
+       boost::mutex::scoped_lock lock (_state_mutex);
        
        struct timeval tv;
        gettimeofday (&tv, 0);
@@ -171,7 +177,7 @@ Encoder::frame_done ()
 }
 
 void
-Encoder::process_video (shared_ptr<const Image> image, Eyes eyes, bool same)
+Encoder::process_video (shared_ptr<const Image> image, Eyes eyes, ColourConversion conversion, bool same)
 {
        boost::mutex::scoped_lock lock (_mutex);
 
@@ -205,7 +211,7 @@ Encoder::process_video (shared_ptr<const Image> image, Eyes eyes, bool same)
                TIMING ("adding to queue of %1", _queue.size ());
                _queue.push_back (shared_ptr<DCPVideoFrame> (
                                          new DCPVideoFrame (
-                                                 image, _video_frames_out, eyes, _film->video_frame_rate(),
+                                                 image, _video_frames_out, eyes, conversion, _film->video_frame_rate(),
                                                  _film->j2k_bandwidth(), _film->log()
                                                  )
                                          ));