summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorTim-Philipp Müller <tim@centricular.com>2015-05-24 18:58:21 +0100
committerTim-Philipp Müller <tim@centricular.com>2015-05-24 18:58:51 +0100
commit83463b206184fa0d5930017c1b488869c77f0ac0 (patch)
tree04c01775017bb476a97335d2b15adb344a90037e /tools
parent4a472fe7a781ac987a2eef1c532f56f9b7c8afdf (diff)
tools: gst-play: keep configured playback rate and trick mode when seeking
Instead of resetting rate to 1.0
Diffstat (limited to 'tools')
-rw-r--r--tools/gst-play.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/tools/gst-play.c b/tools/gst-play.c
index 4e955d0d3..f2b8ad615 100644
--- a/tools/gst-play.c
+++ b/tools/gst-play.c
@@ -91,6 +91,8 @@ static gboolean play_timeout (gpointer user_data);
static void play_about_to_finish (GstElement * playbin, gpointer user_data);
static void play_reset (GstPlay * play);
static void play_set_relative_volume (GstPlay * play, gdouble volume_step);
+static gboolean play_do_seek (GstPlay * play, gint64 pos, gdouble rate,
+ GstPlayTrickMode mode);
/* *INDENT-OFF* */
static void gst_play_printf (const gchar * format, ...) G_GNUC_PRINTF (1, 2);
@@ -694,9 +696,8 @@ relative_seek (GstPlay * play, gdouble percent)
} else {
if (pos < 0)
pos = 0;
- if (!gst_element_seek_simple (play->playbin, GST_FORMAT_TIME,
- GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, pos))
- goto seek_failed;
+
+ play_do_seek (play, pos, play->rate, play->trick_mode);
}
return;
@@ -711,10 +712,6 @@ static gboolean
play_set_rate_and_trick_mode (GstPlay * play, gdouble rate,
GstPlayTrickMode mode)
{
- GstSeekFlags seek_flags;
- GstQuery *query;
- GstEvent *seek;
- gboolean seekable = FALSE;
gint64 pos = -1;
g_return_val_if_fail (rate != 0, FALSE);
@@ -722,6 +719,17 @@ play_set_rate_and_trick_mode (GstPlay * play, gdouble rate,
if (!gst_element_query_position (play->playbin, GST_FORMAT_TIME, &pos))
return FALSE;
+ return play_do_seek (play, pos, rate, mode);
+}
+
+static gboolean
+play_do_seek (GstPlay * play, gint64 pos, gdouble rate, GstPlayTrickMode mode)
+{
+ GstSeekFlags seek_flags;
+ GstQuery *query;
+ GstEvent *seek;
+ gboolean seekable = FALSE;
+
query = gst_query_new_seeking (GST_FORMAT_TIME);
if (!gst_element_query (play->playbin, query)) {
gst_query_unref (query);