Remove unused variable.
[dcpomatic.git] / src / lib / encoder.cc
index c8eb24c807ab6264d442b9ddcf7fd5d8c27a97e3..62ba922daffc5c66f881afe11ee9cc8e63a7765b 100644 (file)
@@ -36,6 +36,8 @@ Encoder::Encoder (shared_ptr<const FilmState> s, shared_ptr<const Options> o, Lo
        : _fs (s)
        , _opt (o)
        , _log (l)
+       , _just_skipped (false)
+       , _last_frame (0)
 {
 
 }
@@ -58,10 +60,32 @@ Encoder::current_frames_per_second () const
        return _history_size / (seconds (now) - seconds (_time_history.back ()));
 }
 
+/** @return true if the last frame to be processed was skipped as it already existed */
+bool
+Encoder::skipping () const
+{
+       boost::mutex::scoped_lock (_history_mutex);
+       return _just_skipped;
+}
+
+/** @return Index of last frame to be successfully encoded */
+int
+Encoder::last_frame () const
+{
+       boost::mutex::scoped_lock (_history_mutex);
+       return _last_frame;
+}
+
+/** Should be called when a frame has been encoded successfully.
+ *  @param n Frame index.
+ */
 void
-Encoder::frame_done ()
+Encoder::frame_done (int n)
 {
        boost::mutex::scoped_lock lock (_history_mutex);
+       _just_skipped = false;
+       _last_frame = n;
+       
        struct timeval tv;
        gettimeofday (&tv, 0);
        _time_history.push_front (tv);
@@ -69,3 +93,13 @@ Encoder::frame_done ()
                _time_history.pop_back ();
        }
 }
+
+/** Called by a subclass when it has just skipped the processing
+    of a frame because it has already been done.
+*/
+void
+Encoder::frame_skipped ()
+{
+       boost::mutex::scoped_lock lock (_history_mutex);
+       _just_skipped = true;
+}