Port ffprobe fix for OS X.
authorCarl Hetherington <cth@carlh.net>
Sat, 27 Jul 2013 18:40:36 +0000 (19:40 +0100)
committerCarl Hetherington <cth@carlh.net>
Sat, 27 Jul 2013 18:40:36 +0000 (19:40 +0100)
platform/osx/make_dmg.sh
src/lib/cross.cc

index ab4d3624eb5f6ebbe6b472d07c326111c23e4d06..da943faef7ea0e6a1929b796977c1fd0bce98d65 100644 (file)
@@ -47,6 +47,7 @@ universal_copy $ROOT lib/libavcodec*.dylib $WORK/$libs
 universal_copy $ROOT lib/libswscale*.dylib $WORK/$libs
 universal_copy $ROOT lib/libpostproc*.dylib $WORK/$libs
 universal_copy $ROOT lib/libswresample*.dylib $WORK/$libs
+universal_copy $ROOT bin/ffprobe $WORK/$macos
 universal_copy $ENV lib/libboost_system.dylib $WORK/$libs
 universal_copy $ENV lib/libboost_filesystem.dylib $WORK/$libs
 universal_copy $ENV lib/libboost_thread.dylib $WORK/$libs
index 5ecbedf6eaaf49bcb505a5139236a7e5e41954d9..61ec8de5e07f3fae30830ab77d3fdf6b6585f19f 100644 (file)
@@ -33,6 +33,7 @@
 #endif
 #ifdef DCPOMATIC_OSX
 #include <sys/sysctl.h>
+#include <mach-o/dyld.h>
 #endif
 
 using std::pair;
@@ -179,11 +180,30 @@ run_ffprobe (boost::filesystem::path content, boost::filesystem::path out, share
        CloseHandle (process_info.hProcess);
        CloseHandle (process_info.hThread);
        CloseHandle (child_stderr_read);
-#else
+#endif
+
+#ifdef DCPOMATIC_LINUX 
        string ffprobe = "ffprobe \"" + content.string() + "\" 2> \"" + out.string() + "\"";
        log->log (String::compose ("Probing with %1", ffprobe));
+        system (ffprobe.c_str ());
+#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 ();
+       path /= "ffprobe";
+       
+       string ffprobe = path.string() + " \"" + content.string() + "\" 2> \"" + out.string() + "\"";
+       log->log (String::compose ("Probing with %1", ffprobe));
        system (ffprobe.c_str ());
-#endif 
+#endif
 }
 
 list<pair<string, string> >