X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Futil.cc;h=77d66d07763f967cc436bb14883604f9dd4b2621;hb=e0adfd85dd7987ee2b77eea7f6d3c13885729a38;hp=dad094b6ee750e76d6697dd7663f865572f1b0d3;hpb=c6b2624c1965740fa7b5d2230baf20156ff34151;p=dcpomatic.git diff --git a/src/lib/util.cc b/src/lib/util.cc index dad094b6e..77d66d077 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -35,17 +35,19 @@ #include "md5_digester.h" #include "audio_processor.h" #include "safe_stringstream.h" +#include "compose.hpp" #include -#include #include #include #include +extern "C" { +#include +#include +} #include #include #include #include -#include -#include #include #include #ifdef DCPOMATIC_WINDOWS @@ -281,18 +283,10 @@ terminate () abort(); } -/** Call the required functions to set up DCP-o-matic's static arrays, etc. - * Must be called from the UI thread, if there is one. - */ void -dcpomatic_setup () +dcpomatic_setup_path_encoding () { #ifdef DCPOMATIC_WINDOWS - boost::filesystem::path p = g_get_user_config_dir (); - p /= "backtrace.txt"; - set_backtrace_file (p); - SetUnhandledExceptionFilter(exception_handler); - /* Dark voodoo which, I think, gets boost::filesystem::path to correctly convert UTF-8 strings to paths, and also paths back to UTF-8 strings (on path::string()). @@ -308,6 +302,20 @@ dcpomatic_setup () std::locale::global (boost::locale::generator().generate ("")); boost::filesystem::path::imbue (std::locale ()); #endif +} + +/** Call the required functions to set up DCP-o-matic's static arrays, etc. + * Must be called from the UI thread, if there is one. + */ +void +dcpomatic_setup () +{ +#ifdef DCPOMATIC_WINDOWS + boost::filesystem::path p = g_get_user_config_dir (); + p /= "backtrace.txt"; + set_backtrace_file (p); + SetUnhandledExceptionFilter(exception_handler); +#endif avfilter_register_all (); @@ -532,10 +540,10 @@ dcp::Size fit_ratio_within (float ratio, dcp::Size full_frame) { if (ratio < full_frame.ratio ()) { - return dcp::Size (rint (full_frame.height * ratio), full_frame.height); + return dcp::Size (lrintf (full_frame.height * ratio), full_frame.height); } - return dcp::Size (full_frame.width, rint (full_frame.width / ratio)); + return dcp::Size (full_frame.width, lrintf (full_frame.width / ratio)); } void * @@ -548,22 +556,6 @@ wrapped_av_malloc (size_t s) return p; } -FFmpegSubtitlePeriod -subtitle_period (AVSubtitle const & sub) -{ - ContentTime const packet_time = ContentTime::from_seconds (static_cast (sub.pts) / AV_TIME_BASE); - - if (sub.end_display_time == static_cast (-1)) { - /* End time is not known */ - return FFmpegSubtitlePeriod (packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3)); - } - - return FFmpegSubtitlePeriod ( - packet_time + ContentTime::from_seconds (sub.start_display_time / 1e3), - packet_time + ContentTime::from_seconds (sub.end_display_time / 1e3) - ); -} - map split_get_request (string url) {