summaryrefslogtreecommitdiffstats
path: root/osdep/getch2.h
diff options
context:
space:
mode:
authorUoti Urpala <uau@mplayer2.org>2012-04-06 14:24:26 +0300
committerUoti Urpala <uau@mplayer2.org>2012-04-06 14:34:56 +0300
commitb93ed278362185ff980e0ce8f4ab3029f8fe395f (patch)
treeb0915d50baa17cc7ab94180421f8837f7b5b3ee4 /osdep/getch2.h
parent87ae9d3e45ef6e331b34fa92ac1d0c68495f5379 (diff)
downloadmpv-b93ed278362185ff980e0ce8f4ab3029f8fe395f.tar.bz2
mpv-b93ed278362185ff980e0ce8f4ab3029f8fe395f.tar.xz
input: stop trying to read terminal input on EOF
Stop trying to read terminal input if a read attempt returns EOF. The most important case where this matters is when someone runs the player with stdin redirected from /dev/null and without specifying --no-consolecontrols. This used to cause 100% CPU load while paused, as select() would continuously trigger on stdin (the need for --no-consolecontrols was not apparent to people with older mplayer versions, as input reading was less efficient and latencies like hardcoded sleeps kept CPU use well below 100%). Now this will only cause a "Dead key input" error message.
Diffstat (limited to 'osdep/getch2.h')
-rw-r--r--osdep/getch2.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/osdep/getch2.h b/osdep/getch2.h
index 8fb346d4f7..458881c15f 100644
--- a/osdep/getch2.h
+++ b/osdep/getch2.h
@@ -24,6 +24,8 @@
#ifndef MPLAYER_GETCH2_H
#define MPLAYER_GETCH2_H
+#include <stdbool.h>
+
#include "config.h"
/* Screen size. Initialized by load_termcap() and get_screen_size() */
@@ -45,7 +47,7 @@ void getch2_disable(void);
/* Read a character or a special key code (see keycodes.h) */
struct mp_fifo;
-void getch2(struct mp_fifo *fifo);
+bool getch2(struct mp_fifo *fifo);
#ifdef CONFIG_ICONV
/**