Various Doxygen fixes.
[dcpomatic.git] / src / lib / transcode_job.cc
index 5e41253b8fe7c96cc8811a51a9091b438df3bf2a..17108c27887917fd7ae11dfd94c688ba707980c2 100644 (file)
@@ -28,9 +28,7 @@
 #include "film.h"
 #include "transcoder.h"
 #include "log.h"
-#include "safe_stringstream.h"
 #include "compose.hpp"
-#include <boost/make_shared.hpp>
 #include <iostream>
 #include <iomanip>
 
@@ -45,10 +43,8 @@ using std::fixed;
 using std::setprecision;
 using std::cout;
 using boost::shared_ptr;
-using boost::make_shared;
 
-/** @param s Film to use.
- */
+/** @param film Film to use */
 TranscodeJob::TranscodeJob (shared_ptr<const Film> film)
        : Job (film)
 {
@@ -92,7 +88,7 @@ TranscodeJob::run ()
                _transcoder.reset ();
 
                if (_film->upload_after_make_dcp ()) {
-                       shared_ptr<Job> job = make_shared<UploadJob> (_film);
+                       shared_ptr<Job> job (new UploadJob (_film));
                        JobManager::instance()->add (job);
                }
 
@@ -109,23 +105,28 @@ TranscodeJob::status () const
                return Job::status ();
        }
 
-       float const fps = _transcoder->current_encoding_rate ();
-       if (fps == 0) {
-               return Job::status ();
-       }
-
-       SafeStringStream s;
 
-       s << Job::status ();
-
-       if (!finished () && !_transcoder->finishing ()) {
-               /// 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");
+       char buffer[256];
+       if (finished() || _transcoder->finishing()) {
+               strncpy (buffer, Job::status().c_str(), 256);
+       } else {
+               snprintf (
+                       buffer, sizeof(buffer), "%s; %d/%" PRId64 " frames",
+                       Job::status().c_str(),
+                       _transcoder->video_frames_enqueued(),
+                       _film->length().frames_round (_film->video_frame_rate ())
+                       );
+
+               float const fps = _transcoder->current_encoding_rate ();
+               if (fps) {
+                       char fps_buffer[64];
+                       /// TRANSLATORS: fps here is an abbreviation for frames per second
+                       snprintf (fps_buffer, sizeof(fps_buffer), _("; %.1f fps"), fps);
+                       strncat (buffer, fps_buffer, strlen(buffer) - 1);
+               }
        }
 
-       return s.str ();
+       return buffer;
 }
 
 /** @return Approximate remaining time in seconds */
@@ -135,10 +136,13 @@ TranscodeJob::remaining_time () const
        /* _transcoder might be destroyed by the job-runner thread */
        shared_ptr<Transcoder> 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) {