Add support for no-scale of the input video.
[dcpomatic.git] / src / lib / util.cc
index 25fbc130b1be445a3e71df42459f4433970568e1..48b418d37634fe6ecdd41bb507ae6d54830485d5 100644 (file)
@@ -70,6 +70,7 @@ extern "C" {
 #include "ratio.h"
 #include "job.h"
 #include "cross.h"
+#include "video_content.h"
 #ifdef DCPOMATIC_WINDOWS
 #include "stack.hpp"
 #endif
@@ -345,6 +346,7 @@ dcpomatic_setup ()
        libdcp::init ();
        
        Ratio::setup_ratios ();
+       VideoContentScale::setup_scales ();
        DCPContentType::setup_dcp_content_types ();
        Scaler::setup_scalers ();
        Filter::setup_filters ();
@@ -1016,3 +1018,13 @@ entities_to_text (string e)
        boost::algorithm::replace_all (e, "%2F", "/");
        return e;
 }
+
+int64_t
+divide_with_round (int64_t a, int64_t b)
+{
+       if (a % b >= (b / 2)) {
+               return (a + b - 1) / b;
+       } else {
+               return a / b;
+       }
+}