Add Content::set_paths().
[dcpomatic.git] / src / lib / cross.cc
index b33fa80ac81d3da7e235ded347a0088aabb744f8..831a1a2b2b0c2e1913646834d420c5e53c67b18c 100644 (file)
@@ -22,6 +22,9 @@
 #include "compose.hpp"
 #include "log.h"
 #include "exceptions.h"
+extern "C" {
+#include <libavformat/avio.h>
+}
 #include <boost/algorithm/string.hpp>
 #ifdef DCPOMATIC_LINUX
 #include <unistd.h>
@@ -397,8 +400,27 @@ start_batch_converter (boost::filesystem::path dcpomatic)
 #endif
 }
 
-int
+uint64_t
 thread_id ()
 {
-       return (int) pthread_self ();
+#ifdef DCPOMATIC_WINDOWS
+       return (uint64_t) GetCurrentThreadId ();
+#else
+       return (uint64_t) pthread_self ();
+#endif
+}
+
+int
+avio_open_boost (AVIOContext** s, boost::filesystem::path file, int flags)
+{
+#ifdef DCPOMATIC_WINDOWS
+       int const length = (file.string().length() + 1) * 2;
+       char* utf8 = new char[length];
+       WideCharToMultiByte (CP_UTF8, 0, file.c_str(), -1, utf8, length, 0, 0);
+       int const r = avio_open (s, utf8, flags);
+       delete[] utf8;
+       return r;
+#else
+       return avio_open (s, file.c_str(), flags);
+#endif
 }