diff options
author | jmcneill <jmcneill@pkgsrc.org> | 2015-01-19 20:42:09 +0000 |
---|---|---|
committer | jmcneill <jmcneill@pkgsrc.org> | 2015-01-19 20:42:09 +0000 |
commit | 0b41c81af77d2335e4f19f00b4df960055134631 (patch) | |
tree | ccf81aa4850802a28bbf66cb378a8d1a0bb1f21c /multimedia | |
parent | 22cc6dd6cf3ad45aa05f20d4d99aaccf039f0aa4 (diff) | |
download | pkgsrc-0b41c81af77d2335e4f19f00b4df960055134631.tar.gz |
make tty input handling work
Diffstat (limited to 'multimedia')
-rw-r--r-- | multimedia/omxplayer/distinfo | 4 | ||||
-rw-r--r-- | multimedia/omxplayer/patches/patch-Keyboard.cpp | 66 | ||||
-rw-r--r-- | multimedia/omxplayer/patches/patch-Keyboard.h | 13 |
3 files changed, 82 insertions, 1 deletions
diff --git a/multimedia/omxplayer/distinfo b/multimedia/omxplayer/distinfo index 8d5dbb2deb3..5b397ef5347 100644 --- a/multimedia/omxplayer/distinfo +++ b/multimedia/omxplayer/distinfo @@ -1,8 +1,10 @@ -$NetBSD: distinfo,v 1.2 2015/01/18 23:30:26 jmcneill Exp $ +$NetBSD: distinfo,v 1.3 2015/01/19 20:42:09 jmcneill Exp $ SHA1 (omxplayer-20150118.zip) = 95522df16247bd1ece40cbccac05f9e73f1c1d2a RMD160 (omxplayer-20150118.zip) = 0d3678c8ae71ed3ae507b7f0aaab2a482ee87691 Size (omxplayer-20150118.zip) = 1265704 bytes +SHA1 (patch-Keyboard.cpp) = 92044ce1077bf043553c7631fad5a779f93ff33c +SHA1 (patch-Keyboard.h) = 48d4b5da443b6a1e5b736907b9b660c1afb1f119 SHA1 (patch-Makefile) = fe45c59a7cb1282c48f16bd56be9f64422fa4bf2 SHA1 (patch-Makefile.include) = c78979b5b0e2d76f4e83f80bd6144d5b892eff34 SHA1 (patch-OMXControl.cpp) = 55e3e73b29c1e8cf1999271a0fbf298e3e0eaa8e diff --git a/multimedia/omxplayer/patches/patch-Keyboard.cpp b/multimedia/omxplayer/patches/patch-Keyboard.cpp new file mode 100644 index 00000000000..ad90928f613 --- /dev/null +++ b/multimedia/omxplayer/patches/patch-Keyboard.cpp @@ -0,0 +1,66 @@ +$NetBSD: patch-Keyboard.cpp,v 1.1 2015/01/19 20:42:09 jmcneill Exp $ + +--- Keyboard.cpp.orig 2015-01-12 15:10:50.000000000 +0000 ++++ Keyboard.cpp +@@ -23,7 +23,6 @@ Keyboard::Keyboard() + new_termios = orig_termios; + new_termios.c_lflag &= ~(ICANON | ECHO | ECHOCTL | ECHONL); + new_termios.c_cflag |= HUPCL; +- new_termios.c_cc[VMIN] = 0; + + tcsetattr(STDIN_FILENO, TCSANOW, &new_termios); + } +@@ -74,13 +73,20 @@ void Keyboard::restore_term() + } + } + +-void Keyboard::Sleep(unsigned int dwMilliSeconds) ++int Keyboard::Hit() + { +- struct timespec req; +- req.tv_sec = dwMilliSeconds / 1000; +- req.tv_nsec = (dwMilliSeconds % 1000) * 1000000; ++ struct timeval timeo; ++ fd_set fds; + +- while ( nanosleep(&req, &req) == -1 && errno == EINTR && (req.tv_nsec > 0 || req.tv_sec > 0)); ++ timeo.tv_sec = 0; ++ timeo.tv_usec = 200000; ++ ++ FD_ZERO(&fds); ++ FD_SET(STDIN_FILENO, &fds); ++ ++ select(FD_SETSIZE, &fds, NULL, NULL, &timeo); ++ ++ return FD_ISSET(STDIN_FILENO, &fds); + } + + void Keyboard::Process() +@@ -90,9 +96,16 @@ void Keyboard::Process() + if (conn) + dbus_connection_read_write_dispatch(conn, 0); + int ch[8]; +- int chnum = 0; ++ int chnum, nb; + +- while ((ch[chnum] = getchar()) != EOF) chnum++; ++ if (Hit() == 0) ++ continue; ++ ++ ioctl(STDIN_FILENO, FIONREAD, &nb); ++ ++ for (chnum = 0; chnum < nb && chnum < 8; chnum++) { ++ ch[chnum] = getchar(); ++ } + + if (chnum > 1) ch[0] = ch[chnum - 1] | (ch[chnum - 2] << 8); + +@@ -101,8 +114,6 @@ void Keyboard::Process() + + if (m_keymap[ch[0]] != 0) + send_action(m_keymap[ch[0]]); +- else +- Sleep(20); + } + } + diff --git a/multimedia/omxplayer/patches/patch-Keyboard.h b/multimedia/omxplayer/patches/patch-Keyboard.h new file mode 100644 index 00000000000..4a151cfad4b --- /dev/null +++ b/multimedia/omxplayer/patches/patch-Keyboard.h @@ -0,0 +1,13 @@ +$NetBSD: patch-Keyboard.h,v 1.1 2015/01/19 20:42:09 jmcneill Exp $ + +--- Keyboard.h.orig 2015-01-12 15:10:50.000000000 +0000 ++++ Keyboard.h +@@ -21,7 +21,7 @@ + void Process(); + void setKeymap(std::map<int,int> keymap); + void setDbusName(std::string dbus_name); +- void Sleep(unsigned int dwMilliSeconds); ++ int Hit(); + int getEvent(); + private: + void restore_term(); |