mpv/osdep
James Ross-Gowan 30bbcd6452 win32: fix console output with raw stdio functions
reopen_console_handle() was never properly tested because mpv overrides
printf in most source files. Turns out that when there's no console on
startup, the CRT sets the fds of stdout and stderr to -2, so the old
method of using dup2 to manipulate these fds didn't work. As far as I
can tell, the only way to give stdout and stderr valid fds is to use
freopen, so this uses freopen to set them both to the console output.
This also uses dup2 to change STDOUT_FILENO and STDERR_FILENO, so low-
level functions like isatty still work.

Note that this means fileno(stdout) != STDOUT_FILENO. I don't think this
will cause any problems.

This should fix MPV_LEAK_REPORT on the Windows console.
2015-12-06 02:37:38 +11:00
..
ar Remove trailing whitespaces 2015-05-15 11:02:44 +02:00
win32 win32: pthread: don't play dirty tricks for mutex init 2015-07-27 22:59:38 +02:00
atomics.h atomics: cleanup HAVE_ATOMICS define 2015-08-13 23:34:14 +02:00
compiler.h Move compat/ and bstr/ directory contents somewhere else 2014-08-29 12:31:52 +02:00
endian.h audio: drop swapped-endian audio formats 2014-09-23 23:09:25 +02:00
glob-win.c
io.c win32: revert wchar_t changes 2015-08-01 21:09:11 +02:00
io.h win32: revert wchar_t changes 2015-08-01 21:09:11 +02:00
macosx_application.h build: move main-fn files to osdep 2015-05-02 18:59:58 +02:00
macosx_application.m osx: never expose input_ctx from EventsResponder 2015-05-26 22:39:04 +02:00
macosx_application_objc.h cocoa: always compile OSX application code with cocoa 2015-05-02 18:09:56 +02:00
macosx_compat.h cocoa: fix compilation on OS X 10.8 2014-07-14 07:21:44 +02:00
macosx_events.h Update license headers 2015-04-13 12:10:01 +02:00
macosx_events.m input: add append argument to file drop event 2015-08-30 05:28:24 -07:00
macosx_events_objc.h osx: never expose input_ctx from EventsResponder 2015-05-26 22:39:04 +02:00
macosx_versions.h cocoa: fix compilation on OS X 10.8 2014-07-14 07:21:44 +02:00
main-fn-cocoa.c build: move main-fn files to osdep 2015-05-02 18:59:58 +02:00
main-fn-unix.c build: move main-fn files to osdep 2015-05-02 18:59:58 +02:00
main-fn-win.c win32: move platform specifics to osdep 2015-05-02 18:59:58 +02:00
main-fn.h build: move main-fn files to osdep 2015-05-02 18:59:58 +02:00
mpv.exe.manifest win32: fix/change application name 2015-02-09 20:44:09 +01:00
mpv.rc Update license headers 2015-04-13 12:10:01 +02:00
path-macosx.m path: make mp_path_join accept normal C strings 2015-05-09 15:26:47 +02:00
path-unix.c path: add resolving desktop path to platform-specific paths 2015-05-01 21:51:10 +02:00
path-win.c win32: revert wchar_t changes 2015-08-01 21:09:11 +02:00
path.h path: update path descriptions 2015-05-02 16:14:51 +02:00
semaphore.h osdep: hack to fix build with low quality pthreads-w32 headers 2014-09-20 04:18:40 +02:00
semaphore_osx.c osdep/semaphore_osx.c: Include osdep/semaphore.h before #ifdef 2014-09-10 17:22:20 +09:00
subprocess-posix.c subprocess, lua: export whether the process was killed by us 2015-06-27 21:08:55 +02:00
subprocess-win.c win32: revert wchar_t changes 2015-08-01 21:09:11 +02:00
subprocess.c subprocess: move implementation for deatched subprocesses 2015-04-15 22:43:02 +02:00
subprocess.h subprocess, lua: export whether the process was killed by us 2015-06-27 21:08:55 +02:00
terminal-unix.c terminal: disable terminal foreground state polling 2015-08-01 21:30:16 +02:00
terminal-win.c win32: fix console output with raw stdio functions 2015-12-06 02:37:38 +11:00
terminal.h Update license headers 2015-04-13 12:10:01 +02:00
threads.c threads: use utility+POSIX functions instead of weird wrappers 2015-05-11 23:44:36 +02:00
threads.h threads: use utility+POSIX functions instead of weird wrappers 2015-05-11 23:44:36 +02:00
timer-darwin.c
timer-linux.c Update license headers 2015-04-13 12:10:01 +02:00
timer-win2.c win32: use QueryPerformanceCounter for timing 2015-07-04 15:54:14 +02:00
timer.c timer: fix a corner case on clock changes 2015-07-04 17:24:10 +02:00
timer.h threads: use utility+POSIX functions instead of weird wrappers 2015-05-11 23:44:36 +02:00
w32_keyboard.c Revert "win32: add mappings for some special keys" 2015-06-24 15:14:38 +02:00
w32_keyboard.h
win32-console-wrapper.c win32: only attach to the console from mpv.com 2015-04-11 14:34:33 +10:00