2013-08-29 Carl Hetherington <cth@carlh.net>
+ * Fix stuck-at-99% progress meters (#184).
+
* Version 1.01beta1 released.
2013-08-29 Carl Hetherington <cth@carlh.net>
: _film (f)
, _job (j)
, _video_frames_out (0)
+ , _state (TRANSCODING)
, _terminate (false)
{
_have_a_real_frame[EYES_BOTH] = false;
}
}
+ {
+ boost::mutex::scoped_lock lm (_state_mutex);
+ _state = HASHING;
+ }
+
_writer->finish ();
_writer.reset ();
}
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;
}
int
Encoder::video_frames_out () const
{
- boost::mutex::scoped_lock (_history_mutex);
+ boost::mutex::scoped_lock (_state_mutex);
return _video_frames_out;
}
void
Encoder::frame_done ()
{
- boost::mutex::scoped_lock lock (_history_mutex);
+ boost::mutex::scoped_lock lock (_state_mutex);
struct timeval tv;
gettimeofday (&tv, 0);
float current_encoding_rate () const;
int video_frames_out () const;
+ enum State {
+ TRANSCODING,
+ HASHING
+ };
+
+ State state () const {
+ boost::mutex::scoped_lock lm (_state_mutex);
+ return _state;
+ }
+
private:
void frame_done ();
boost::shared_ptr<const Film> _film;
boost::shared_ptr<Job> _job;
- /** Mutex for _time_history and _last_frame */
- mutable boost::mutex _history_mutex;
+ /** Mutex for _time_history, _last_frame and _state */
+ mutable boost::mutex _state_mutex;
/** List of the times of completion of the last _history_size frames;
first is the most recently completed.
*/
/** Number of video frames written for the DCP so far */
int _video_frames_out;
+ State _state;
bool _have_a_real_frame[EYES_COUNT];
bool _terminate;
s << Job::status ();
if (!finished ()) {
- s << N_("; ") << fixed << setprecision (1) << fps << N_(" ") << _("frames per second");
+ if (_transcoder->state() == Encoder::TRANSCODING) {
+ s << "; " << fixed << setprecision (1) << fps << N_(" ") << _("frames per second");
+ } else {
+ /* TRANSLATORS: this means `computing a hash' as in a digest of a block of data */
+ s << "; " << _("hashing");
+ }
}
return s.str ();
{
return _encoder->video_frames_out ();
}
+
+Encoder::State
+Transcoder::state () const
+{
+ return _encoder->state ();
+}
*/
#include "types.h"
-
-/** @file src/transcoder.h
- *
- * A decoder is selected according to the content type, and the encoder can be specified
- * as a parameter to the constructor.
- */
+#include "encoder.h"
class Film;
class Job;
class VideoFilter;
class Player;
-/** @class Transcoder
- *
- * A decoder is selected according to the content type, and the encoder can be specified
- * as a parameter to the constructor.
- */
+/** @class Transcoder */
class Transcoder : public boost::noncopyable
{
public:
void go ();
float current_encoding_rate () const;
+ Encoder::State state () const;
int video_frames_out () const;
private:
_sound_asset_writer = _sound_asset->start_write (_film->interop ());
_thread = new boost::thread (boost::bind (&Writer::thread, this));
+
+ _job->descend (0.9);
}
void
)
));
+ /* Compute the digests for the assets now so that we can keep track of progress.
+ We did _job->descend (0.9) in our constructor */
+ _job->ascend ();
+
+ _job->descend (0.1);
+ _picture_asset->compute_digest (boost::bind (&Job::set_progress, _job.get(), _1));
+ _job->ascend ();
+
+ _job->descend (0.1);
+ _sound_asset->compute_digest (boost::bind (&Job::set_progress, _job.get(), _1));
+ _job->ascend ();
+
libdcp::XMLMetadata meta = Config::instance()->dcp_metadata ();
meta.set_issue_date_now ();
dcp.write_xml (_film->interop (), meta);