summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-10-14 17:50:25 +0100
committerCarl Hetherington <cth@carlh.net>2013-10-14 17:50:25 +0100
commit877227c50d5f48f0de5d64352d11afc2e0db696f (patch)
treeb2b54cd6f6e25b70a92f98f95a7866038347f24b /src
parent05a1936fcdca53c23496fd1341f5a9fb27738380 (diff)
parent601001cc7abb3e69ae363dfde7c98c8ff4848b95 (diff)
Merge branch '1.0' of ssh://carlh.dyndns.org/home/carl/git/dvdomatic into 1.0
Diffstat (limited to 'src')
-rw-r--r--src/lib/cross.cc34
-rw-r--r--src/lib/cross.h3
-rw-r--r--src/lib/util.cc9
3 files changed, 37 insertions, 9 deletions
diff --git a/src/lib/cross.cc b/src/lib/cross.cc
index 47f07cf9d..ac94e8015 100644
--- a/src/lib/cross.cc
+++ b/src/lib/cross.cc
@@ -35,6 +35,7 @@
#include <sys/sysctl.h>
#include <mach-o/dyld.h>
#endif
+#include "exceptions.h"
using std::pair;
using std::list;
@@ -114,6 +115,28 @@ cpu_info ()
return info;
}
+#ifdef DCPOMATIC_OSX
+/** @return Path of the Contents directory in the .app */
+boost::filesystem::path
+app_contents ()
+{
+ uint32_t size = 1024;
+ char buffer[size];
+ if (_NSGetExecutablePath (buffer, &size)) {
+ throw StringError ("_NSGetExecutablePath failed");
+ }
+
+ boost::filesystem::path path (buffer);
+ path = boost::filesystem::canonical (path);
+ std::cout << "start " << path << "\n";
+ path = path.parent_path ();
+ std::cout << "then " << path << "\n";
+ path = path.parent_path ();
+ std::cout << "and then " << path << "\n";
+ return path;
+}
+#endif
+
void
run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, shared_ptr<Log> log)
{
@@ -189,15 +212,8 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, share
#endif
#ifdef DCPOMATIC_OSX
- uint32_t size = 1024;
- char buffer[size];
- if (_NSGetExecutablePath (buffer, &size)) {
- log->log ("_NSGetExecutablePath failed");
- return;
- }
-
- boost::filesystem::path path (buffer);
- path.remove_filename ();
+ boost::filesystem::path path = app_contents();
+ path /= "MacOS";
path /= "ffprobe";
string ffprobe = path.string() + " \"" + content.string() + "\" 2> \"" + out.string() + "\"";
diff --git a/src/lib/cross.h b/src/lib/cross.h
index c3bb20b47..1fe34edbe 100644
--- a/src/lib/cross.h
+++ b/src/lib/cross.h
@@ -30,3 +30,6 @@ extern std::string cpu_info ();
extern void run_ffprobe (boost::filesystem::path, boost::filesystem::path, boost::shared_ptr<Log>);
extern std::list<std::pair<std::string, std::string> > mount_info ();
extern boost::filesystem::path openssl_path ();
+#ifdef DCPOMATIC_OSX
+extern boost::filesystem::path app_contents ();
+#endif
diff --git a/src/lib/util.cc b/src/lib/util.cc
index 4b780e1b7..b13d905bf 100644
--- a/src/lib/util.cc
+++ b/src/lib/util.cc
@@ -279,6 +279,15 @@ dcpomatic_setup ()
avfilter_register_all ();
+#ifdef DCPOMATIC_OSX
+ /* Add our lib directory to the libltdl search path so that
+ xmlsec can find xmlsec1-openssl.
+ */
+ boost::filesystem::path lib = app_contents ();
+ lib /= "lib";
+ setenv ("LTDL_LIBRARY_PATH", lib.c_str (), 1);
+#endif
+
libdcp::init ();
Ratio::setup_ratios ();