After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 689809 - osxvideosink: inconsistent keyboard navigation events
osxvideosink: inconsistent keyboard navigation events
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
0.10.31
Other Mac OS
: Normal normal
: 1.0.6
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-12-06 20:38 UTC by Alexey Chernov
Modified: 2013-01-31 11:22 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Patch addressing key input problems in osxvideosink (10.25 KB, patch)
2012-12-08 12:12 UTC, Alexey Chernov
needs-work Details | Review
Refreshed patch for a problem (9.27 KB, patch)
2013-01-18 22:43 UTC, Alexey Chernov
committed Details | Review

Description Alexey Chernov 2012-12-06 20:38:14 UTC
Keyboard GstNavigation events sent from osxvideosink quite inconsistent with ones in Linux and Windows (e.g., from xvimagesink or d3dvideosink):
- only alphanumeric keys are sent properly with one possible char, Space, Return, cursor keys are ignored
- single press on modifier keys (e.g. Shift, Ctrl, Alt, Command) are not captured

I got a patch addressing the problem, it makes the situation similar to xvimagesink and d3dvideosink examples. I hope to add it tomorrow and maybe discuss it here as it looks quite ugly due to necessity of convertion between keycodes and keynames right in the element (I didn't manage to find any reliable way to do it in Mac OS X though I'm not so experienced with this OS, its API and Objective C language.
Comment 1 Alexey Chernov 2012-12-08 12:11:03 UTC
As promised, I submit a patch addressing key input problem in osxvideosink. Again, thanks to my employer, Neoshpere LLC, for permission to make it public.

Unfortunately, the patch is quite big due to gst_keycode_to_keyname() function. I think it could be more reasonable to include a cross-platform version of such a function to somewhere like GstNavigation module and only use this function from multiple sinks. The problem is that things which are quite straightforward, for example, on X server and Xlib, on Mac are so confusing due to different approach to user's input. If there were a unified function to convert keycode (which are so much platform-independent) to exact GStreamer key names (which are GStreamer-specific), then it would be better both for sink and application developers.
Comment 2 Alexey Chernov 2012-12-08 12:12:29 UTC
Created attachment 231031 [details] [review]
Patch addressing key input problems in osxvideosink

It's against latest upstream revision of osxvideo.
Comment 3 Sebastian Dröge (slomo) 2013-01-16 10:42:43 UTC
Review of attachment 231031 [details] [review]:

::: gst-plugins-good/sys/osxvideo/cocoawindow.m
@@ +91,3 @@
+
+static
+gchar* gst_keycode_to_keyname(gint16 keycode)

Could you change this to return a const gchar* (no g_strdup(), no g_free() below).

Also is this going to work with combination key presses like ctrl+c? And are you sure there is no function in OSX anywhere to do this conversion?
Comment 4 Alexey Chernov 2013-01-16 13:21:00 UTC
Yes, sure, I'll change return type.

No, I am completely not sure that there's no system conversion functions, there's apparently several ones, so maybe someone would propose better way to do it.

The main problem is that GstNavigation expected to provide platform-independent string on keypress/keyrelease. If we get x(v)imagesink as a reference, it separately sends modifier keys (as to ctrl+c it will return ctrl-press while pressing c would be grabbed by console to exit the program), all the alpha keys are only lowercase, there're some standard names for Enter, Esc and so on. What's more, the meaning for some keys really depends on OS (like Alt and Option). So I think it would be better to have some common function somewhere in GstNavigation interface to convert scan-code to GstNavigation-related platform-independent string and then all this code will go to this function.
Comment 5 Sebastian Dröge (slomo) 2013-01-16 13:36:30 UTC
Yeah, x(v)imagesink should be seen as the reference implementation here for everything not in the documentation (not great but....).

Considering that I think your patch is fine, except for the unnecessary g_strdup() and g_free()
Comment 6 Alexey Chernov 2013-01-18 22:43:29 UTC
Created attachment 233806 [details] [review]
Refreshed patch for a problem

Thanks, Sebastian. Here's an updated patch, I must be getting mad when coding the previous version, thank you so much for corrections. I've also rebased the patch on top of updated git version and make it in preferred git format-patch style.
Comment 7 Sebastian Dröge (slomo) 2013-01-31 10:47:26 UTC
commit 3e54bb53ef51c2d553eb5570ec207f301bbe93da
Author: Alexey Chernov <achernov@neosphere.com>
Date:   Fri Jan 18 21:08:12 2013 +0400

    osxvideosink: Make GstNavigation key input events in osxvideosink compatible with x(v)imagesink ones
Comment 8 Alexey Chernov 2013-01-31 11:22:53 UTC
Thanks, Sebastian.