mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 16:08:51 +00:00
gst-play: pick up minus and plus also from navigation events
Makes it easier to test playback rate changes with the video window being in focus. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/928>
This commit is contained in:
parent
e24e366952
commit
078f7874fd
1 changed files with 31 additions and 4 deletions
|
@ -103,6 +103,9 @@ typedef struct
|
||||||
GstPlayTrickMode trick_mode;
|
GstPlayTrickMode trick_mode;
|
||||||
gdouble rate;
|
gdouble rate;
|
||||||
gdouble start_position;
|
gdouble start_position;
|
||||||
|
|
||||||
|
/* keyboard state tracking */
|
||||||
|
gboolean shift_pressed;
|
||||||
} GstPlay;
|
} GstPlay;
|
||||||
|
|
||||||
static gboolean quiet = FALSE;
|
static gboolean quiet = FALSE;
|
||||||
|
@ -498,16 +501,38 @@ play_bus_msg (GstBus * bus, GstMessage * msg, gpointer user_data)
|
||||||
key = GST_PLAY_KB_ARROW_UP;
|
key = GST_PLAY_KB_ARROW_UP;
|
||||||
else if (strcmp (key, "Down") == 0)
|
else if (strcmp (key, "Down") == 0)
|
||||||
key = GST_PLAY_KB_ARROW_DOWN;
|
key = GST_PLAY_KB_ARROW_DOWN;
|
||||||
else if (strcmp (key, "space") == 0 ||
|
else if (strncmp (key, "Shift", 5) == 0) {
|
||||||
strcmp (key, "Space") == 0)
|
play->shift_pressed = TRUE;
|
||||||
key = " ";
|
|
||||||
else if (strlen (key) > 1)
|
|
||||||
break;
|
break;
|
||||||
|
} else if (strcmp (key, "space") == 0 ||
|
||||||
|
strcmp (key, "Space") == 0) {
|
||||||
|
key = " ";
|
||||||
|
} else if (strcmp (key, "minus") == 0) {
|
||||||
|
key = "-";
|
||||||
|
} else if (strcmp (key, "plus") == 0
|
||||||
|
/* TODO: That's not universally correct at all, but still handy */
|
||||||
|
|| (strcmp (key, "equal") == 0 && play->shift_pressed)) {
|
||||||
|
key = "+";
|
||||||
|
} else if (strlen (key) > 1) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
keyboard_cb (key, user_data);
|
keyboard_cb (key, user_data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case GST_NAVIGATION_EVENT_KEY_RELEASE:
|
||||||
|
{
|
||||||
|
const gchar *key;
|
||||||
|
|
||||||
|
if (gst_navigation_event_parse_key_event (ev, &key)) {
|
||||||
|
GST_INFO ("Key release: %s", key);
|
||||||
|
if (strncmp (key, "Shift", 5) == 0) {
|
||||||
|
play->shift_pressed = FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
case GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS:
|
case GST_NAVIGATION_EVENT_MOUSE_BUTTON_PRESS:
|
||||||
{
|
{
|
||||||
gint button;
|
gint button;
|
||||||
|
@ -1325,6 +1350,7 @@ play_cycle_track_selection (GstPlay * play, GstPlayTrackType track_type)
|
||||||
static void
|
static void
|
||||||
print_keyboard_help (void)
|
print_keyboard_help (void)
|
||||||
{
|
{
|
||||||
|
/* *INDENT-OFF* */
|
||||||
static struct
|
static struct
|
||||||
{
|
{
|
||||||
const gchar *key_desc;
|
const gchar *key_desc;
|
||||||
|
@ -1349,6 +1375,7 @@ print_keyboard_help (void)
|
||||||
"s", N_("change subtitle track")}, {
|
"s", N_("change subtitle track")}, {
|
||||||
"0", N_("seek to beginning")}, {
|
"0", N_("seek to beginning")}, {
|
||||||
"k", N_("show keyboard shortcuts")},};
|
"k", N_("show keyboard shortcuts")},};
|
||||||
|
/* *INDENT-ON* */
|
||||||
guint i, chars_to_pad, desc_len, max_desc_len = 0;
|
guint i, chars_to_pad, desc_len, max_desc_len = 0;
|
||||||
|
|
||||||
gst_print ("\n\n%s\n\n", _("Interactive mode - keyboard controls:"));
|
gst_print ("\n\n%s\n\n", _("Interactive mode - keyboard controls:"));
|
||||||
|
|
Loading…
Reference in a new issue