Allow specification of subtitle language even if DVD-o-matic isn't providing the...
[dcpomatic.git] / src / lib / util.cc
index c332790a65b2f455aa60e041caf37f05d646e1ce..1c4347233965279203a494dbde8fde06141b9ed8 100644 (file)
@@ -69,9 +69,6 @@ extern "C" {
 #ifdef DCPOMATIC_WINDOWS
 #include "stack.hpp"
 #endif
-#ifdef DCPOMATIC_OSX
-#include <ltdl.h>
-#endif
 
 #include "i18n.h"
 
@@ -288,7 +285,7 @@ dcpomatic_setup ()
        */
        boost::filesystem::path lib = app_contents ();
        lib /= "lib";
-       lt_dladdsearchdir (lib.c_str ());
+       setenv ("LTDL_LIBRARY_PATH", lib.c_str (), 1);
 #endif 
 
        libdcp::init ();
@@ -885,3 +882,12 @@ make_signer ()
        return shared_ptr<const libdcp::Signer> (new libdcp::Signer (chain, signer_key));
 }
 
+libdcp::Size
+fit_ratio_within (float ratio, libdcp::Size full_frame)
+{
+       if (ratio < full_frame.ratio ()) {
+               return libdcp::Size (full_frame.height * ratio, full_frame.height);
+       }
+       
+       return libdcp::Size (full_frame.width, full_frame.width / ratio);
+}