summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2015-04-29 15:44:59 +0100
committerTim-Philipp Müller <tim@centricular.com>2015-04-29 15:47:46 +0100
commit5a8d1d22469a522dc5dcf0cde01cc7a3ae31aac5 (patch)
treee964494bd5930320e5169bb137b57d38998abbfb /tools
parent44e571c5e9d599c8a52e41164e77509993db5664 (diff)
downloadgst-plugins-base-5a8d1d22469a522dc5dcf0cde01cc7a3ae31aac5.tar.gz
gst-plugins-base-5a8d1d22469a522dc5dcf0cde01cc7a3ae31aac5.tar.xz
gst-play: add some more key navigation mappings
And don't feed multi-character key descriptors to the event handler, it won't be what it expects.
Diffstat (limited to 'tools')
-rw-r--r--tools/gst-play.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/gst-play.c b/tools/gst-play.c
index 3e90e7c1b..8d2bfe9d7 100644
--- a/tools/gst-play.c
+++ b/tools/gst-play.c
@@ -376,17 +376,30 @@ play_bus_msg (GstBus * bus, GstMessage * msg, gpointer user_data)
GstNavigationMessageType mtype = gst_navigation_message_get_type (msg);
if (mtype == GST_NAVIGATION_MESSAGE_EVENT) {
GstEvent *ev;
+
if (gst_navigation_message_parse_event (msg, &ev)) {
GstNavigationEventType e_type = gst_navigation_event_get_type (ev);
switch (e_type) {
case GST_NAVIGATION_EVENT_KEY_PRESS:
{
const gchar *key;
+
if (gst_navigation_event_parse_key_event (ev, &key)) {
+ GST_INFO ("Key press: %s", key);
+
if (strcmp (key, "Left") == 0)
key = GST_PLAY_KB_ARROW_LEFT;
else if (strcmp (key, "Right") == 0)
key = GST_PLAY_KB_ARROW_RIGHT;
+ else if (strcmp (key, "Up") == 0)
+ key = GST_PLAY_KB_ARROW_UP;
+ else if (strcmp (key, "Down") == 0)
+ key = GST_PLAY_KB_ARROW_DOWN;
+ else if (strcmp (key, "space") == 0)
+ key = " ";
+ else if (strlen (key) > 1)
+ break;
+
keyboard_cb (key, user_data);
}
break;