Skip every other frame with 50fps sources.
[dcpomatic.git] / src / lib / check_hashes_job.cc
index 88233ab665805c34b60328895375ba3a67c1ae5c..d1483933d3e0172707cf20772f3defe9781855dc 100644 (file)
@@ -27,6 +27,7 @@
 #include "ab_transcode_job.h"
 #include "transcode_job.h"
 #include "film.h"
+#include "exceptions.h"
 
 using std::string;
 using std::stringstream;
@@ -52,9 +53,14 @@ CheckHashesJob::run ()
 {
        _bad = 0;
 
-       int const N = _film->dcp_length ();
+       if (!_film->dcp_length()) {
+               throw EncodeError ("cannot check hashes of a DCP with unknown length");
+       }
+       
+       int const N = _film->dcp_length().get();
+       DCPFrameRate const dfr = dcp_frame_rate (_film->frames_per_second ());
        
-       for (int i = 0; i < N; ++i) {
+       for (int i = 0; i < N; i += dfr.skip) {
                string const j2k_file = _opt->frame_out_path (i, false);
                string const hash_file = j2k_file + ".md5";
 
@@ -78,7 +84,7 @@ CheckHashesJob::run ()
                        }
                }
 
-               set_progress (float (i) / _film->length());
+               set_progress (float (i) / N);
        }
 
        if (_bad) {