diff --git a/gst/debugutils/gstnavseek.c b/gst/debugutils/gstnavseek.c index c7b674dbdc..5dedf604e5 100644 --- a/gst/debugutils/gstnavseek.c +++ b/gst/debugutils/gstnavseek.c @@ -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;