Remove unused variable.
[dcpomatic.git] / src / lib / transcode_job.cc
index 652a184419892164acc816b299db7fcfe95b0356..e1ba82359357ec203ff7e7ff12a10f9557caa8ad 100644 (file)
@@ -48,9 +48,7 @@ TranscodeJob::TranscodeJob (shared_ptr<const FilmState> s, shared_ptr<const Opti
 string
 TranscodeJob::name () const
 {
-       stringstream s;
-       s << "Transcode " << _fs->name;
-       return s.str ();
+       return String::compose ("Transcode %1", _fs->name);
 }
 
 void
@@ -70,15 +68,11 @@ TranscodeJob::run ()
 
        } catch (std::exception& e) {
 
-               stringstream s;
                set_progress (1);
                set_state (FINISHED_ERROR);
-
-               s << "Transcode job failed (" << e.what() << ")";
-               _log->log (s.str ());
+               _log->log (String::compose ("Transcode job failed (%1)", e.what()));
 
                throw;
-
        }
 }
 
@@ -88,13 +82,30 @@ TranscodeJob::status () const
        if (!_encoder) {
                return "0%";
        }
+
+       if (_encoder->skipping () && !finished ()) {
+               return "skipping already-encoded frames";
+       }
+               
        
        float const fps = _encoder->current_frames_per_second ();
        if (fps == 0) {
                return Job::status ();
        }
-               
+
        stringstream s;
-       s << Job::status () << "; about " << fixed << setprecision (1) << fps << " frames per second.";
+
+       s << Job::status () << "; " << fixed << setprecision (1) << fps << " frames per second";
        return s.str ();
 }
+
+int
+TranscodeJob::remaining_time () const
+{
+       float fps = _encoder->current_frames_per_second ();
+       if (fps == 0) {
+               return 0;
+       }
+
+       return ((_fs->dcp_length() - _encoder->last_frame()) / fps);
+}