Add fps count to the log on transcode finish (#786).
authorCarl Hetherington <cth@carlh.net>
Thu, 14 Jan 2016 11:18:56 +0000 (11:18 +0000)
committerCarl Hetherington <cth@carlh.net>
Thu, 14 Jan 2016 11:18:56 +0000 (11:18 +0000)
ChangeLog
src/lib/transcode_job.cc

index 9e4f58db8a8400acc8270950073d979ef6849734..c4e711f6a89c8372a1aa0a9f811f58a83f4319d4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2016-01-14  Carl Hetherington  <cth@carlh.net>
 
+       * Add frames-per-second summary to log at the end of
+       a transcode (#786).
+
        * Allow multiple CC addresses for KDM emails (#785).
 
 2016-01-13  Carl Hetherington  <cth@carlh.net>
index 7d11d51a9589c474306068fbafd47f20eb05ed6f..b442d8035a800cd6e8769dc845fba8d06774f675 100644 (file)
@@ -32,6 +32,7 @@
 
 #include "i18n.h"
 
+#define LOG_GENERAL(...) _film->log()->log (String::compose (__VA_ARGS__), LogEntry::TYPE_GENERAL);
 #define LOG_GENERAL_NC(...) _film->log()->log (__VA_ARGS__, LogEntry::TYPE_GENERAL);
 #define LOG_ERROR_NC(...)   _film->log()->log (__VA_ARGS__, LogEntry::TYPE_ERROR);
 
@@ -65,7 +66,8 @@ void
 TranscodeJob::run ()
 {
        try {
-
+               struct timeval start;
+               gettimeofday (&start, 0);
                LOG_GENERAL_NC (N_("Transcode job starting"));
 
                _transcoder.reset (new Transcoder (_film, shared_from_this ()));
@@ -73,7 +75,15 @@ TranscodeJob::run ()
                set_progress (1);
                set_state (FINISHED_OK);
 
-               LOG_GENERAL_NC (N_("Transcode job completed successfully"));
+               struct timeval finish;
+               gettimeofday (&finish, 0);
+
+               float fps = 0;
+               if (finish.tv_sec != start.tv_sec) {
+                       fps = _transcoder->video_frames_out() / (finish.tv_sec - start.tv_sec);
+               }
+
+               LOG_GENERAL (N_("Transcode job completed successfully: %1 fps"), fps);
                _transcoder.reset ();
 
        } catch (...) {