Stub player.
[dcpomatic.git] / src / lib / cross.cc
index 831a1a2b2b0c2e1913646834d420c5e53c67b18c..e214019730410a0fbb4627ddf42512fef338926a 100644 (file)
@@ -424,3 +424,25 @@ avio_open_boost (AVIOContext** s, boost::filesystem::path file, int flags)
        return avio_open (s, file.c_str(), flags);
 #endif
 }
+
+#ifdef DCPOMATIC_WINDOWS
+void
+maybe_open_console ()
+{
+       if (Config::instance()->win32_console ()) {
+               AllocConsole();
+
+               HANDLE handle_out = GetStdHandle(STD_OUTPUT_HANDLE);
+               int hCrt = _open_osfhandle((intptr_t) handle_out, _O_TEXT);
+               FILE* hf_out = _fdopen(hCrt, "w");
+               setvbuf(hf_out, NULL, _IONBF, 1);
+               *stdout = *hf_out;
+
+               HANDLE handle_in = GetStdHandle(STD_INPUT_HANDLE);
+               hCrt = _open_osfhandle((intptr_t) handle_in, _O_TEXT);
+               FILE* hf_in = _fdopen(hCrt, "r");
+               setvbuf(hf_in, NULL, _IONBF, 128);
+               *stdin = *hf_in;
+       }
+}
+#endif