X-Git-Url: https://main.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Futil.cc;h=305aae4f8211a500104b2b034609915390a267fe;hb=25d55759c94adba96336edf6780cee7138c2ec21;hp=71a21105b6ec2f6e9eb38096fbbf0ce36bb2dcba;hpb=883d885dc8690519d205c8baa275385af8a39f4b;p=dcpomatic.git diff --git a/src/lib/util.cc b/src/lib/util.cc index 71a21105b..305aae4f8 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -61,7 +61,7 @@ extern "C" { #include "sound_processor.h" #include "config.h" #include "ratio.h" -#ifdef DVDOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS #include "stack.hpp" #endif @@ -91,8 +91,8 @@ using boost::lexical_cast; using boost::optional; using libdcp::Size; -boost::thread::id ui_thread; -boost::filesystem::path backtrace_file; +static boost::thread::id ui_thread; +static boost::filesystem::path backtrace_file; /** Convert some number of seconds to a string representation * in hours, minutes and seconds. @@ -260,7 +260,7 @@ seconds (struct timeval t) return t.tv_sec + (double (t.tv_usec) / 1e6); } -#ifdef DVDOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS LONG WINAPI exception_handler(struct _EXCEPTION_POINTERS *) { dbg::stack s; @@ -270,13 +270,13 @@ LONG WINAPI exception_handler(struct _EXCEPTION_POINTERS *) } #endif -/** Call the required functions to set up DVD-o-matic's static arrays, etc. +/** 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 DVDOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS backtrace_file /= g_get_user_config_dir (); backtrace_file /= "backtrace.txt"; SetUnhandledExceptionFilter(exception_handler); @@ -338,18 +338,6 @@ dcpomatic_setup_gettext_i18n (string lang) #endif } -/** @param start Start position for the crop within the image. - * @param size Size of the cropped area. - * @return FFmpeg crop filter string. - */ -string -crop_string (Position start, libdcp::Size size) -{ - stringstream s; - s << N_("crop=") << size.width << N_(":") << size.height << N_(":") << start.x << N_(":") << start.y; - return s.str (); -} - /** @param s A string. * @return Parts of the string split at spaces, except when a space is within quotation marks. */ @@ -469,23 +457,6 @@ dcp_audio_frame_rate (int fs) return 96000; } -/** @param index Colour LUT index. - * @return Human-readable name. - */ -string -colour_lut_index_to_name (int index) -{ - switch (index) { - case 0: - return _("sRGB"); - case 1: - return _("Rec 709"); - } - - assert (false); - return N_(""); -} - Socket::Socket (int timeout) : _deadline (_io_service) , _socket (_io_service) @@ -710,37 +681,11 @@ ensure_ui_thread () * @return Equivalent number of audio frames for `v'. */ int64_t -video_frames_to_audio_frames (ContentVideoFrame v, float audio_sample_rate, float frames_per_second) +video_frames_to_audio_frames (VideoContent::Frame v, float audio_sample_rate, float frames_per_second) { return ((int64_t) v * audio_sample_rate / frames_per_second); } -/** @return A pair containing CPU model name and the number of processors */ -pair -cpu_info () -{ - pair info; - info.second = 0; - -#ifdef DCPOMATIC_POSIX - ifstream f (N_("/proc/cpuinfo")); - while (f.good ()) { - string l; - getline (f, l); - if (boost::algorithm::starts_with (l, N_("model name"))) { - string::size_type const c = l.find (':'); - if (c != string::npos) { - info.first = l.substr (c + 2); - } - } else if (boost::algorithm::starts_with (l, N_("processor"))) { - ++info.second; - } - } -#endif - - return info; -} - string audio_channel_name (int c) {