if (_state == FINISHED_OK || _state == FINISHED_ERROR || _state == FINISHED_CANCELLED) {
_ran_for = elapsed_time ();
finished = true;
+ _sub_name.clear ();
}
}
s << Job::status ();
- if (!finished ()) {
- s << "; " << fixed << setprecision (1) << fps << N_(" ") << _("frames per second");
+ if (!finished () && !_transcoder->finishing ()) {
+ s << "; " << fixed << setprecision (1) << fps << " " << _("frames per second");
}
return s.str ();
: _job (j)
, _player (f->make_player ())
, _encoder (new Encoder (f, j))
+ , _finishing (false)
{
_player->Video.connect (bind (video_proxy, _encoder, _1, _2, _3, _4));
_player->Audio.connect (bind (audio_proxy, _encoder, _1));
{
_encoder->process_begin ();
while (!_player->pass ()) {}
+
+ _finishing = true;
_encoder->process_end ();
}
float current_encoding_rate () const;
int video_frames_out () const;
+ /** @return true if we are in the process of calling Encoder::process_end */
+ bool finishing () const {
+ return _finishing;
+ }
+
private:
/** A Job that is running this Transcoder, or 0 */
boost::shared_ptr<Job> _job;
boost::shared_ptr<Player> _player;
boost::shared_ptr<Encoder> _encoder;
+ bool _finishing;
};
private:
+ void update_job_name ()
+ {
+ string n = "<b>" + _job->name () + "</b>";
+ if (!_job->sub_name().empty ()) {
+ n += "\n" + _job->sub_name ();
+ }
+
+ if (n != _last_name) {
+ _name->SetLabelMarkup (std_to_wx (n));
+ _last_name = n;
+ }
+ }
+
void progress ()
{
float const p = _job->progress ();
if (p >= 0) {
checked_set (_message, _job->status ());
- string const n = "<b>" + _job->name () + "</b>\n" + _job->sub_name ();
- if (n != _last_name) {
- _name->SetLabelMarkup (std_to_wx (n));
- _last_name = n;
- }
+ update_job_name ();
int const pp = min (100.0f, p * 100);
_gauge->SetValue (pp);
}
void finished ()
{
checked_set (_message, _job->status ());
+ update_job_name ();
+
if (!_job->finished_cancelled ()) {
_gauge->SetValue (100);
}