X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Futil.cc;h=90d78b32e42dbf30edcf321fba6adf83e97b2b54;hb=6ebae1c7fd0f1449f95719c69c871cb87f8832bf;hp=74951fc64e1ef9bb076e5959cdd43dddd140e25f;hpb=ca981c8cfa23111e92be329f1c2dfbe3a07b4247;p=dcpomatic.git diff --git a/src/lib/util.cc b/src/lib/util.cc index 74951fc64..90d78b32e 100644 --- a/src/lib/util.cc +++ b/src/lib/util.cc @@ -45,6 +45,7 @@ #include "image.h" #include "text_decoder.h" #include "job_manager.h" +#include "warnings.h" #include #include #include @@ -65,7 +66,9 @@ extern "C" { #include #include #include +DCPOMATIC_DISABLE_WARNINGS #include +DCPOMATIC_ENABLE_WARNINGS #ifdef DCPOMATIC_WINDOWS #include #include @@ -230,6 +233,7 @@ addr2line (void const * const addr) return system(addr2line_cmd); } +DCPOMATIC_DISABLE_WARNINGS /** This is called when C signals occur on Windows (e.g. SIGSEGV) * (NOT C++ exceptions!). We write a backtrace to backtrace_file by dark means. * Adapted from code here: http://spin.atomicobject.com/2013/01/13/exceptions-stack-traces-c/ @@ -286,6 +290,7 @@ exception_handler(struct _EXCEPTION_POINTERS * info) return EXCEPTION_CONTINUE_SEARCH; } +DCPOMATIC_ENABLE_WARNINGS #endif void @@ -356,8 +361,10 @@ dcpomatic_setup () SetUnhandledExceptionFilter(exception_handler); #endif +DCPOMATIC_DISABLE_WARNINGS av_register_all (); avfilter_register_all (); +DCPOMATIC_ENABLE_WARNINGS #ifdef DCPOMATIC_OSX /* Add our library directory to the libltdl search path so that @@ -372,16 +379,16 @@ dcpomatic_setup () #ifdef DCPOMATIC_WINDOWS putenv ("PANGOCAIRO_BACKEND=fontconfig"); - putenv (String::compose("FONTCONFIG_PATH=%1", shared_path().string()).c_str()); + putenv (String::compose("FONTCONFIG_PATH=%1", resources_path().string()).c_str()); #endif #ifdef DCPOMATIC_OSX setenv ("PANGOCAIRO_BACKEND", "fontconfig", 1); - setenv ("FONTCONFIG_PATH", shared_path().string().c_str(), 1); + setenv ("FONTCONFIG_PATH", resources_path().string().c_str(), 1); #endif Pango::init (); - dcp::init (); + dcp::init (tags_path()); #if defined(DCPOMATIC_WINDOWS) || defined(DCPOMATIC_OSX) /* Render something to fontconfig to create its cache */ @@ -818,14 +825,16 @@ audio_channel_types (list mapped, int channels) case dcp::CENTRE: case dcp::LS: case dcp::RS: - case dcp::LC: - case dcp::RC: case dcp::BSL: case dcp::BSR: ++non_lfe; break; case dcp::HI: case dcp::VI: + case dcp::MOTION_DATA: + case dcp::SYNC_SIGNAL: + case dcp::SIGN_LANGUAGE: + case dcp::CHANNEL_COUNT: break; } } @@ -944,7 +953,7 @@ void emit_subtitle_image (ContentTimePeriod period, dcp::SubtitleImage sub, dcp::Size size, shared_ptr decoder) { /* XXX: this is rather inefficient; decoding the image just to get its size */ - FFmpegImageProxy proxy (sub.png_image()); + FFmpegImageProxy proxy (sub.png_image(), VIDEO_RANGE_FULL); shared_ptr image = proxy.image().image; /* set up rect with height and width */ dcpomatic::Rect rect(0, 0, image->size().width / double(size.width), image->size().height / double(size.height)); @@ -1238,7 +1247,7 @@ decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm) } if (!on_chain) { throw KDMError (_("This KDM was not made for DCP-o-matic's decryption certificate."), e.what()); - } else if (on_chain && kdm_subject_name != dc->leaf().subject()) { + } else if (kdm_subject_name != dc->leaf().subject()) { throw KDMError (_("This KDM was made for DCP-o-matic but not for its leaf certificate."), e.what()); } else { throw; @@ -1246,3 +1255,24 @@ decrypt_kdm_with_helpful_error (dcp::EncryptedKDM kdm) } } + +boost::filesystem::path +default_font_file () +{ + boost::filesystem::path liberation_normal; + try { + liberation_normal = resources_path() / "LiberationSans-Regular.ttf"; + if (!boost::filesystem::exists (liberation_normal)) { + /* Hack for unit tests */ + liberation_normal = resources_path() / "fonts" / "LiberationSans-Regular.ttf"; + } + } catch (boost::filesystem::filesystem_error& e) { + + } + + if (!boost::filesystem::exists(liberation_normal)) { + liberation_normal = "/usr/share/fonts/truetype/liberation/LiberationSans-Regular.ttf"; + } + + return liberation_normal; +}