mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 09:10:36 +00:00
navseek: toggle pause/play on space bar
A useful thing to have. https://bugzilla.gnome.org/show_bug.cgi?id=659065
This commit is contained in:
parent
682ae32f6f
commit
352bab2ef7
1 changed files with 19 additions and 0 deletions
|
@ -211,6 +211,23 @@ gst_navseek_segseek (GstNavSeek * navseek)
|
|||
gst_object_unref (peer_pad);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_navseek_toggle_play_pause (GstNavSeek * navseek)
|
||||
{
|
||||
GstStateChangeReturn sret;
|
||||
GstState current, pending, state;
|
||||
|
||||
sret = gst_element_get_state (GST_ELEMENT (navseek), ¤t, &pending, 0);
|
||||
if (sret == GST_STATE_CHANGE_FAILURE)
|
||||
return;
|
||||
|
||||
state = (pending != GST_STATE_VOID_PENDING) ? pending : current;
|
||||
|
||||
gst_element_post_message (GST_ELEMENT (navseek),
|
||||
gst_message_new_request_state (GST_OBJECT (navseek),
|
||||
(state == GST_STATE_PLAYING) ? GST_STATE_PAUSED : GST_STATE_PLAYING));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gst_navseek_handle_src_event (GstPad * pad, GstEvent * event)
|
||||
{
|
||||
|
@ -263,6 +280,8 @@ gst_navseek_handle_src_event (GstPad * pad, GstEvent * event)
|
|||
} else if (strcmp (key, "n") == 0) {
|
||||
/* normal speed */
|
||||
gst_navseek_change_playback_rate (navseek, 1.0);
|
||||
} else if (strcmp (key, "space") == 0) {
|
||||
gst_navseek_toggle_play_pause (navseek);
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue