X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2Flib%2Fcross.cc;h=831a1a2b2b0c2e1913646834d420c5e53c67b18c;hb=refs%2Ftags%2Fv2.11.8;hp=a213436a3c3f973aafccb83e7a800aa07b417fc1;hpb=b2919cca15877349b26389219abaf9dbdd4d26ac;p=dcpomatic.git diff --git a/src/lib/cross.cc b/src/lib/cross.cc index a213436a3..831a1a2b2 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 +} #include #ifdef DCPOMATIC_LINUX #include @@ -397,12 +400,27 @@ start_batch_converter (boost::filesystem::path dcpomatic) #endif } -int +uint64_t thread_id () { #ifdef DCPOMATIC_WINDOWS - return (int) GetCurrentThreadId (); + 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 (int) pthread_self (); + return avio_open (s, file.c_str(), flags); #endif }