X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Futil.cc;h=051a4bb25ec9e0b84fe6aa0d890ed4bf6f88f469;hb=72b11d5eb036651b6ff68edf3ed270e8fc52960f;hp=1f5b29101de78c7657a2341623590eed7b3ad92f;hpb=e0c524cbc4f006a4319c3ce8aa7625f9d70d054a;p=dcpomatic.git diff --git a/src/lib/util.cc b/src/lib/util.cc index 1f5b29101..051a4bb25 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -49,9 +49,6 @@ extern "C" { #include } #include -#ifdef DCPOMATIC_GRAPHICS_MAGICK -#include -#endif #include #include #include @@ -104,6 +101,7 @@ using dcp::locale_convert; * in during App::onInit(). */ string program_name; +bool is_batch_converter = false; static boost::thread::id ui_thread; static boost::filesystem::path backtrace_file; @@ -156,18 +154,27 @@ seconds_to_approximate_hms (int s) string ap; - bool const hours = h > 0; - bool const minutes = h < 6 && m > 0; - bool const seconds = h == 0 && m < 10 && s > 0; + bool hours = h > 0; + bool minutes = h < 6 && m > 0; + bool seconds = h == 0 && m < 10 && s > 0; - if (hours) { - if (m > 30 && !minutes) { - /// TRANSLATORS: h here is an abbreviation for hours - ap += locale_convert(h + 1) + _("h"); - } else { - /// TRANSLATORS: h here is an abbreviation for hours - ap += locale_convert(h) + _("h"); + if (m > 30 && !minutes) { + /* round up the hours */ + ++h; + } + if (s > 30 && !seconds) { + /* round up the minutes */ + ++m; + if (m == 60) { + m = 0; + minutes = false; + ++h; } + } + + if (hours) { + /// TRANSLATORS: h here is an abbreviation for hours + ap += locale_convert(h) + _("h"); if (minutes || seconds) { ap += N_(" "); @@ -175,14 +182,8 @@ seconds_to_approximate_hms (int s) } if (minutes) { - /* Minutes */ - if (s > 30 && !seconds) { - /// TRANSLATORS: m here is an abbreviation for minutes - ap += locale_convert(m + 1) + _("m"); - } else { - /// TRANSLATORS: m here is an abbreviation for minutes - ap += locale_convert(m) + _("m"); - } + /// TRANSLATORS: m here is an abbreviation for minutes + ap += locale_convert(m) + _("m"); if (seconds) { ap += N_(" "); @@ -345,11 +346,11 @@ dcpomatic_setup () avfilter_register_all (); #ifdef DCPOMATIC_OSX - /* Add our lib directory to the libltdl search path so that + /* Add our library directory to the libltdl search path so that xmlsec can find xmlsec1-openssl. */ boost::filesystem::path lib = app_contents (); - lib /= "lib"; + lib /= "Frameworks"; setenv ("LTDL_LIBRARY_PATH", lib.c_str (), 1); #endif @@ -368,10 +369,6 @@ dcpomatic_setup () curl_global_init (CURL_GLOBAL_ALL); -#ifdef DCPOMATIC_GRAPHICS_MAGICK - Magick::InitializeMagick (0); -#endif - ui_thread = boost::this_thread::get_id (); } @@ -573,7 +570,8 @@ valid_image_file (boost::filesystem::path f) return ( ext == ".tif" || ext == ".tiff" || ext == ".jpg" || ext == ".jpeg" || ext == ".png" || ext == ".bmp" || ext == ".tga" || ext == ".dpx" || - ext == ".j2c" || ext == ".j2k" || ext == ".jp2" + ext == ".j2c" || ext == ".j2k" || ext == ".jp2" || ext == ".exr" || + ext == ".jpf" ); } @@ -717,7 +715,7 @@ careful_string_filter (string s) */ string out; - string const allowed = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_%."; + string const allowed = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-_%.+"; for (size_t i = 0; i < s.size(); ++i) { if (allowed.find (s[i]) != string::npos) { out += s[i]; @@ -774,3 +772,13 @@ remap (shared_ptr input, int output_channels, AudioMapping m return mapped; } + +Eyes +increment_eyes (Eyes e) +{ + if (e == EYES_LEFT) { + return EYES_RIGHT; + } + + return EYES_LEFT; +}