pkgsrc-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[pkgsrc/trunk]: pkgsrc/multimedia/omxplayer make tty input handling work
details: https://anonhg.NetBSD.org/pkgsrc/rev/b462e57ace25
branches: trunk
changeset: 644924:b462e57ace25
user: jmcneill <jmcneill%pkgsrc.org@localhost>
date: Mon Jan 19 20:42:09 2015 +0000
description:
make tty input handling work
diffstat:
multimedia/omxplayer/distinfo | 4 +-
multimedia/omxplayer/patches/patch-Keyboard.cpp | 66 +++++++++++++++++++++++++
multimedia/omxplayer/patches/patch-Keyboard.h | 13 ++++
3 files changed, 82 insertions(+), 1 deletions(-)
diffs (102 lines):
diff -r 7ce1e98b5e07 -r b462e57ace25 multimedia/omxplayer/distinfo
--- a/multimedia/omxplayer/distinfo Mon Jan 19 20:37:21 2015 +0000
+++ b/multimedia/omxplayer/distinfo Mon Jan 19 20:42:09 2015 +0000
@@ -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 -r 7ce1e98b5e07 -r b462e57ace25 multimedia/omxplayer/patches/patch-Keyboard.cpp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/multimedia/omxplayer/patches/patch-Keyboard.cpp Mon Jan 19 20:42:09 2015 +0000
@@ -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 -r 7ce1e98b5e07 -r b462e57ace25 multimedia/omxplayer/patches/patch-Keyboard.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/multimedia/omxplayer/patches/patch-Keyboard.h Mon Jan 19 20:42:09 2015 +0000
@@ -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();
Home |
Main Index |
Thread Index |
Old Index