diff options
| author | Carl Hetherington <cth@carlh.net> | 2017-08-02 17:25:38 +0100 |
|---|---|---|
| committer | Carl Hetherington <cth@carlh.net> | 2017-08-14 21:07:48 +0100 |
| commit | 86765a617035e0283c20c9f2696909743e618156 (patch) | |
| tree | 9134dd73b0cb0761533b7b798d8cb3b6ebfd2200 /src/lib | |
| parent | 7a3f4f1b6411f7d15bf00e863fb5e70a5d930dd8 (diff) | |
Stub player.
Diffstat (limited to 'src/lib')
| -rw-r--r-- | src/lib/cross.cc | 22 | ||||
| -rw-r--r-- | src/lib/cross.h | 3 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/lib/cross.cc b/src/lib/cross.cc index 831a1a2b2..e21401973 100644 --- a/src/lib/cross.cc +++ b/src/lib/cross.cc @@ -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 diff --git a/src/lib/cross.h b/src/lib/cross.h index 02839eb68..8c1df998b 100644 --- a/src/lib/cross.h +++ b/src/lib/cross.h @@ -45,6 +45,9 @@ extern boost::filesystem::path openssl_path (); #ifdef DCPOMATIC_OSX extern boost::filesystem::path app_contents (); #endif +#ifdef DCPOMATIC_WINDOWS +extern void maybe_open_console (); +#endif extern boost::filesystem::path shared_path (); extern FILE * fopen_boost (boost::filesystem::path, std::string); extern int dcpomatic_fseek (FILE *, int64_t, int); |
