Bump version
[libdcp.git] / src / util.cc
index fd76e556b464d32520417ca5c664fc4ac0a929c7..2b3a6c8defac8567cb80593e180fc631924c670b 100644 (file)
 #include "argb_frame.h"
 #include "lut.h"
 
-using namespace std;
-using namespace boost;
+using std::string;
+using std::stringstream;
+using std::min;
+using std::max;
+using boost::shared_ptr;
 using namespace libdcp;
 
 string
@@ -51,9 +54,9 @@ libdcp::make_uuid ()
 }
 
 string
-libdcp::make_digest (string filename, sigc::signal1<void, float>* progress)
+libdcp::make_digest (string filename, boost::signals2::signal<void (float)>* progress)
 {
-       int const file_size = filesystem::file_size (filename);
+       int const file_size = boost::filesystem::file_size (filename);
        
        Kumu::FileReader reader;
        if (ASDCP_FAILURE (reader.OpenRead (filename.c_str ()))) {
@@ -135,7 +138,7 @@ libdcp::content_kind_from_string (string type)
                return TRANSITIONAL;
        } else if (type == "rating") {
                return RATING;
-       } else if (type == "teaser") {
+       } else if (type == "teaser" || type == "Teaser") {
                return TEASER;
        } else if (type == "policy") {
                return POLICY;
@@ -186,8 +189,8 @@ libdcp::decompress_j2k (uint8_t* data, int64_t size, int reduce)
 
        opj_cio_close (cio);
 
-       image->x1 /= pow (2, reduce);
-       image->y1 /= pow (2, reduce);
+       image->x1 = rint (float(image->x1) / pow (2, reduce));
+       image->y1 = rint (float(image->y1) / pow (2, reduce));
        return image;
 }
 
@@ -252,3 +255,15 @@ libdcp::xyz_to_rgb (opj_image_t* xyz_frame)
 
        return argb_frame;
 }
+
+bool
+libdcp::empty_or_white_space (string s)
+{
+       for (size_t i = 0; i < s.length(); ++i) {
+               if (s[i] != ' ' && s[i] != '\n' && s[i] != '\t') {
+                       return false;
+               }
+       }
+
+       return true;
+}