Ignore HMAC discrepencies when reading DCPs.
[dcpomatic.git] / src / lib / util.h
index a6b010e43a6011c9e256af37e2489b79173cc609..013eabe120678c415f28e176a115ed729a12eae3 100644 (file)
@@ -118,7 +118,7 @@ extern size_t utf8_strlen (std::string s);
 extern std::string day_of_week_to_string (boost::gregorian::greg_weekday d);
 extern void emit_subtitle_image (dcpomatic::ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size size, std::shared_ptr<TextDecoder> decoder);
 extern bool show_jobs_on_console (bool progress);
-extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, boost::function<void (float)>);
+extern void copy_in_bits (boost::filesystem::path from, boost::filesystem::path to, std::function<void (float)>);
 extern dcp::Size scale_for_display (dcp::Size s, dcp::Size display_container, dcp::Size film_container);
 extern dcp::DecryptedKDM decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm);
 extern boost::filesystem::path default_font_file ();
@@ -150,4 +150,12 @@ list_to_vector (std::list<T> v)
 extern double db_to_linear (double db);
 extern double linear_to_db (double linear);
 
+
+template <class T>
+T clamp (T val, T minimum, T maximum)
+{
+       return std::max(std::min(val, maximum), minimum);
+}
+
+
 #endif