summaryrefslogtreecommitdiff
path: root/src/lib/cross.cc
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2017-05-12 21:17:09 +0100
committerCarl Hetherington <cth@carlh.net>2017-05-12 21:17:09 +0100
commita1dfa9a33c72c1e9534593bc37de636fd7ddd28e (patch)
tree001f4fd68e7aaaeaa01afeef6569e45fe0e81837 /src/lib/cross.cc
parent6baf89931d836f112ea275ea2d6d3b1547efdd45 (diff)
Try to fix windows build failure (#1071).
Diffstat (limited to 'src/lib/cross.cc')
-rw-r--r--src/lib/cross.cc18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/cross.cc b/src/lib/cross.cc
index 454fe044c..a484d1738 100644
--- a/src/lib/cross.cc
+++ b/src/lib/cross.cc
@@ -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>
@@ -406,3 +409,18 @@ thread_id ()
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.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_boost (s, file.c_str(), flags);
+ delete[] utf8;
+ return r;
+#else
+ return avio_open_boost (s, file.c_str(), flags);
+#endif
+}