From 9e124e8ce2eb7a9faeb91b33169ab1ae4912afb0 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 29 Aug 2013 14:25:31 +0100 Subject: Better progress reporting during MXF hashing (#184). --- src/lib/encoder.cc | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/lib/encoder.cc') 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 f, shared_ptr 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); -- cgit v1.2.3