Cleanup: extract TranscodeJob::frames_per_second().
authorCarl Hetherington <cth@carlh.net>
Fri, 25 Aug 2023 23:43:22 +0000 (01:43 +0200)
committerCarl Hetherington <cth@carlh.net>
Fri, 25 Aug 2023 23:43:22 +0000 (01:43 +0200)
src/lib/transcode_job.cc
src/lib/transcode_job.h

index 653040f4c949c91d4279d87f486e1b9e08e75e7d..1b2d2ddd5a7d1d7c946c2bfb7f876a64fad378ef 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 {
@@ -197,3 +192,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;
+       }
+}
+
index 8b145e362333279e97daec904e61757f8cb832fb..b05b20a1693373b33cc9b6416f37aef53fa1b5ae 100644 (file)
@@ -65,6 +65,7 @@ public:
 
 private:
        virtual void post_transcode () {}
+       float frames_per_second() const;
 
        int remaining_time () const override;