summaryrefslogtreecommitdiff
path: root/multimedia/omxplayer/patches
diff options
context:
space:
mode:
authorjmcneill <jmcneill>2015-01-19 20:42:09 +0000
committerjmcneill <jmcneill>2015-01-19 20:42:09 +0000
commit8e379d1b1995ff769680e20f6f48b830ff0600e3 (patch)
treeccf81aa4850802a28bbf66cb378a8d1a0bb1f21c /multimedia/omxplayer/patches
parente1515cbc47f80cf98440b7e78368e334fb734fa6 (diff)
downloadpkgsrc-8e379d1b1995ff769680e20f6f48b830ff0600e3.tar.gz
make tty input handling work
Diffstat (limited to 'multimedia/omxplayer/patches')
-rw-r--r--multimedia/omxplayer/patches/patch-Keyboard.cpp66
-rw-r--r--multimedia/omxplayer/patches/patch-Keyboard.h13
2 files changed, 79 insertions, 0 deletions
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();