X-Git-Url: https://main.carlh.net/gitweb/?p=dcpomatic.git;a=blobdiff_plain;f=src%2Flib%2Ftranscode_job.cc;h=4eb2b1d290d6c6ed7d8c29adc7de2cd9c1e46f49;hp=7144f70d5127242fd7dca122e94713f1b761d2ff;hb=b1dc9c3a2f7e55c9afc5bf2d5b465371b048e14f;hpb=a8a0dfd1b21de6c0facf965ab119833ff6f790bf diff --git a/src/lib/transcode_job.cc b/src/lib/transcode_job.cc index 7144f70d5..4eb2b1d29 100644 --- a/src/lib/transcode_job.cc +++ b/src/lib/transcode_job.cc @@ -28,7 +28,6 @@ #include "film.h" #include "transcoder.h" #include "log.h" -#include "safe_stringstream.h" #include "compose.hpp" #include #include @@ -112,18 +111,21 @@ TranscodeJob::status () const return Job::status (); } - SafeStringStream s; - - s << Job::status (); - - if (!finished () && !_transcoder->finishing ()) { + char buffer[256]; + if (finished() || _transcoder->finishing()) { + strncpy (buffer, Job::status().c_str(), 256); + } else { /// TRANSLATORS: fps here is an abbreviation for frames per second - s << "; " << _transcoder->video_frames_enqueued() << "/" - << _film->length().frames_round (_film->video_frame_rate ()) << " " << _("frames") << "; " - << fixed << setprecision (1) << fps << " " << _("fps"); + snprintf ( + buffer, sizeof(buffer), "%s; %d/%" PRId64 " frames; %.1f fps", + Job::status().c_str(), + _transcoder->video_frames_enqueued(), + _film->length().frames_round (_film->video_frame_rate ()), + fps + ); } - return s.str (); + return buffer; } /** @return Approximate remaining time in seconds */ @@ -133,10 +135,13 @@ TranscodeJob::remaining_time () const /* _transcoder might be destroyed by the job-runner thread */ shared_ptr t = _transcoder; - if (!t) { - return 0; + if (!t || t->finishing()) { + /* We aren't doing any actual encoding so just use the job's guess */ + return Job::remaining_time (); } + /* We're encoding so guess based on the current encoding rate */ + float fps = t->current_encoding_rate (); if (fps == 0) {