Patch from Aaron Boxer adding initial support for GPU-powered J2K encoding via his...
[dcpomatic.git] / src / lib / transcode_job.cc
index 653040f4c949c91d4279d87f486e1b9e08e75e7d..0e47aa24c4041fab27dab357b91f0653613f5835 100644 (file)
@@ -124,12 +124,7 @@ TranscodeJob::run ()
                DCPOMATIC_ASSERT (_encoder);
                _encoder->go ();
 
-               float fps = 0;
-               if (_finish_time != _start_time) {
-                       fps = _encoder->frames_done() / (_finish_time - _start_time);
-               }
-
-               LOG_GENERAL (N_("Transcode job completed successfully: %1 fps"), dcp::locale_convert<string>(fps, 2, true));
+               LOG_GENERAL(N_("Transcode job completed successfully: %1 fps"), dcp::locale_convert<string>(frames_per_second(), 2, true));
 
                if (dynamic_pointer_cast<DCPEncoder>(_encoder)) {
                        try {
@@ -152,6 +147,14 @@ TranscodeJob::run ()
        }
 }
 
+void TranscodeJob::pause() {
+       _encoder->pause();
+}
+
+void TranscodeJob::resume() {
+       _encoder->resume();
+       Job::resume();
+}
 
 string
 TranscodeJob::status () const
@@ -197,3 +200,15 @@ TranscodeJob::remaining_time () const
        /* Compute approximate proposed length here, as it's only here that we need it */
        return (_film->length().frames_round(_film->video_frame_rate()) - e->frames_done()) / *fps;
 }
+
+
+float
+TranscodeJob::frames_per_second() const
+{
+       if (_finish_time != _start_time) {
+               return _encoder->frames_done() / (_finish_time - _start_time);
+       } else {
+               return 0;
+       }
+}
+