: _fs (s)
, _opt (o)
, _log (l)
+ , _just_skipped (false)
+ , _last_frame (0)
{
}
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);
_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;
+}