summaryrefslogtreecommitdiff
path: root/src/lib/encoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2012-09-22 11:35:36 +0100
committerCarl Hetherington <cth@carlh.net>2012-09-22 11:35:36 +0100
commit266fe11af7f3bdc194cfedf92db7352b7b68be97 (patch)
tree40c7461c82e12ccfa8005decca3c0323c22c27ec /src/lib/encoder.cc
parent3adaba4d25a1c723b0de38679c3a9d86d39eadde (diff)
Improve transcode job progress reporting.
Diffstat (limited to 'src/lib/encoder.cc')
-rw-r--r--src/lib/encoder.cc31
1 files changed, 30 insertions, 1 deletions
diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc
index c8eb24c80..18ccd3f57 100644
--- a/src/lib/encoder.cc
+++ b/src/lib/encoder.cc
@@ -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,27 @@ Encoder::current_frames_per_second () const
return _history_size / (seconds (now) - seconds (_time_history.back ()));
}
+bool
+Encoder::skipping () const
+{
+ boost::mutex::scoped_lock (_history_mutex);
+ return _just_skipped;
+}
+
+int
+Encoder::last_frame () const
+{
+ boost::mutex::scoped_lock (_history_mutex);
+ return _last_frame;
+}
+
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 +88,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;
+}