diff options
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/ab_transcode_job.cc | 1 | ||||
| -rw-r--r-- | src/lib/cross.cc | 46 | ||||
| -rw-r--r-- | src/lib/cross.h | 1 | ||||
| -rw-r--r-- | src/lib/film.cc | 1 | ||||
| -rw-r--r-- | src/lib/image.cc | 14 | ||||
| -rw-r--r-- | src/lib/imagemagick_content.h | 4 | ||||
| -rw-r--r-- | src/lib/player.cc | 1 | ||||
| -rw-r--r-- | src/lib/util.cc | 32 | ||||
| -rw-r--r-- | src/lib/util.h | 1 |
9 files changed, 66 insertions, 35 deletions
diff --git a/src/lib/ab_transcode_job.cc b/src/lib/ab_transcode_job.cc index bdde8a405..a29e78776 100644 --- a/src/lib/ab_transcode_job.cc +++ b/src/lib/ab_transcode_job.cc @@ -22,6 +22,7 @@ #include "film.h" #include "ab_transcoder.h" #include "config.h" +#include "log.h" #include "i18n.h" diff --git a/src/lib/cross.cc b/src/lib/cross.cc index f232f1779..ffd44eb02 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -17,6 +17,8 @@ */ +#include <fstream> +#include <boost/algorithm/string.hpp> #include "cross.h" #ifdef DCPOMATIC_POSIX #include <unistd.h> @@ -24,6 +26,13 @@ #ifdef DCPOMATIC_WINDOWS #include "windows.h" #endif +#ifdef DCPOMATIC_OSX +#include <sys/sysctl.h> +#endif + +using std::pair; +using std::ifstream; +using std::string; void dcpomatic_sleep (int s) @@ -35,3 +44,40 @@ dcpomatic_sleep (int s) Sleep (s * 1000); #endif } + +/** @return A pair containing CPU model name and the number of processors */ +pair<string, int> +cpu_info () +{ + pair<string, int> info; + info.second = 0; + +#ifdef DCPOMATIC_LINUX + ifstream f ("/proc/cpuinfo"); + while (f.good ()) { + string l; + getline (f, l); + if (boost::algorithm::starts_with (l, "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, "processor")) { + ++info.second; + } + } +#endif + +#ifdef DCPOMATIC_OSX + size_t N = sizeof (info.second); + sysctlbyname ("hw.ncpu", &info.second, &N, 0, 0); + char buffer[64]; + N = sizeof (buffer); + if (sysctlbyname ("machdep.cpu.brand_string", buffer, &N, 0, 0) == 0) { + info.first = buffer; + } +#endif + + return info; +} + diff --git a/src/lib/cross.h b/src/lib/cross.h index 00457c968..d185286b1 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -22,3 +22,4 @@ #endif void dcpomatic_sleep (int); +extern std::pair<std::string, int> cpu_info (); diff --git a/src/lib/film.cc b/src/lib/film.cc index ef29d35fd..75ec700e0 100644 --- a/src/lib/film.cc +++ b/src/lib/film.cc @@ -54,6 +54,7 @@ #include "sndfile_content.h" #include "dcp_content_type.h" #include "ratio.h" +#include "cross.h" #include "i18n.h" diff --git a/src/lib/image.cc b/src/lib/image.cc index bba7d6be5..17c969cf2 100644 --- a/src/lib/image.cc +++ b/src/lib/image.cc @@ -248,11 +248,11 @@ void Image::make_black () { /* U/V black value for 8-bit colour */ - static uint8_t const eight_bit_uv = (1 << 7) - 1; + static uint8_t const eight_bit_uv = (1 << 7) - 1; /* U/V black value for 9-bit colour */ - static uint16_t const nine_bit_uv = (1 << 8) - 1; + static uint16_t const nine_bit_uv = (1 << 8) - 1; /* U/V black value for 10-bit colour */ - static uint16_t const ten_bit_uv = (1 << 9) - 1; + static uint16_t const ten_bit_uv = (1 << 9) - 1; /* U/V black value for 16-bit colour */ static uint16_t const sixteen_bit_uv = (1 << 15) - 1; @@ -265,6 +265,14 @@ Image::make_black () memset (data()[2], eight_bit_uv, lines(2) * stride()[2]); break; + case PIX_FMT_YUVJ420P: + case PIX_FMT_YUVJ422P: + case PIX_FMT_YUVJ444P: + memset (data()[0], 0, lines(0) * stride()[0]); + memset (data()[1], eight_bit_uv + 1, lines(1) * stride()[1]); + memset (data()[2], eight_bit_uv + 1, lines(2) * stride()[2]); + break; + case PIX_FMT_YUV422P9LE: case PIX_FMT_YUV444P9LE: yuv_16_black (nine_bit_uv); diff --git a/src/lib/imagemagick_content.h b/src/lib/imagemagick_content.h index 8ed6b0873..d7673d870 100644 --- a/src/lib/imagemagick_content.h +++ b/src/lib/imagemagick_content.h @@ -17,8 +17,8 @@ */ -#ifndef DVDOMATIC_IMAGEMAGICK_CONTENT_H -#define DVDOMATIC_IMAGEMAGICK_CONTENT_H +#ifndef DCPOMATIC_IMAGEMAGICK_CONTENT_H +#define DCPOMATIC_IMAGEMAGICK_CONTENT_H #include <boost/enable_shared_from_this.hpp> #include "video_content.h" diff --git a/src/lib/player.cc b/src/lib/player.cc index 757f9bbce..85b4cbd4f 100644 --- a/src/lib/player.cc +++ b/src/lib/player.cc @@ -17,6 +17,7 @@ */ +#include <stdint.h> #include "player.h" #include "film.h" #include "ffmpeg_decoder.h" diff --git a/src/lib/util.cc b/src/lib/util.cc index 71a21105b..eda0d0236 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 @@ -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; @@ -276,7 +276,7 @@ LONG WINAPI exception_handler(struct _EXCEPTION_POINTERS *) void dcpomatic_setup () { -#ifdef DVDOMATIC_WINDOWS +#ifdef DCPOMATIC_WINDOWS backtrace_file /= g_get_user_config_dir (); backtrace_file /= "backtrace.txt"; SetUnhandledExceptionFilter(exception_handler); @@ -715,32 +715,6 @@ video_frames_to_audio_frames (ContentVideoFrame v, float audio_sample_rate, floa return ((int64_t) v * audio_sample_rate / frames_per_second); } -/** @return A pair containing CPU model name and the number of processors */ -pair<string, int> -cpu_info () -{ - pair<string, int> 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) { diff --git a/src/lib/util.h b/src/lib/util.h index be70eb259..42514a12c 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -153,7 +153,6 @@ private: }; extern int64_t video_frames_to_audio_frames (ContentVideoFrame v, float audio_sample_rate, float frames_per_second); -extern std::pair<std::string, int> cpu_info (); class LocaleGuard { |
