summaryrefslogtreecommitdiff
path: root/src/lib/encoder.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-08-29 14:25:31 +0100
committerCarl Hetherington <cth@carlh.net>2013-08-29 14:25:31 +0100
commit9e124e8ce2eb7a9faeb91b33169ab1ae4912afb0 (patch)
treedce175e929d64c6562b60a43138d41dfdd3da6d1 /src/lib/encoder.cc
parent86880ddcedaf39522a92a3a63d2a5df48fdf2284 (diff)
Better progress reporting during MXF hashing (#184).
Diffstat (limited to 'src/lib/encoder.cc')
-rw-r--r--src/lib/encoder.cc12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/lib/encoder.cc b/src/lib/encoder.cc
index ea175f1f4..35ebfb52e 100644
--- a/src/lib/encoder.cc
+++ b/src/lib/encoder.cc
@@ -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);