mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-10-03 01:02:19 +00:00
tools: gst-play: keep configured playback rate and trick mode when seeking
Instead of resetting rate to 1.0
This commit is contained in:
parent
4a472fe7a7
commit
83463b2061
1 changed files with 15 additions and 7 deletions
|
@ -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_about_to_finish (GstElement * playbin, gpointer user_data);
|
||||||
static void play_reset (GstPlay * play);
|
static void play_reset (GstPlay * play);
|
||||||
static void play_set_relative_volume (GstPlay * play, gdouble volume_step);
|
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* */
|
/* *INDENT-OFF* */
|
||||||
static void gst_play_printf (const gchar * format, ...) G_GNUC_PRINTF (1, 2);
|
static void gst_play_printf (const gchar * format, ...) G_GNUC_PRINTF (1, 2);
|
||||||
|
@ -694,9 +696,8 @@ relative_seek (GstPlay * play, gdouble percent)
|
||||||
} else {
|
} else {
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
pos = 0;
|
pos = 0;
|
||||||
if (!gst_element_seek_simple (play->playbin, GST_FORMAT_TIME,
|
|
||||||
GST_SEEK_FLAG_FLUSH | GST_SEEK_FLAG_KEY_UNIT, pos))
|
play_do_seek (play, pos, play->rate, play->trick_mode);
|
||||||
goto seek_failed;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
@ -711,10 +712,6 @@ static gboolean
|
||||||
play_set_rate_and_trick_mode (GstPlay * play, gdouble rate,
|
play_set_rate_and_trick_mode (GstPlay * play, gdouble rate,
|
||||||
GstPlayTrickMode mode)
|
GstPlayTrickMode mode)
|
||||||
{
|
{
|
||||||
GstSeekFlags seek_flags;
|
|
||||||
GstQuery *query;
|
|
||||||
GstEvent *seek;
|
|
||||||
gboolean seekable = FALSE;
|
|
||||||
gint64 pos = -1;
|
gint64 pos = -1;
|
||||||
|
|
||||||
g_return_val_if_fail (rate != 0, FALSE);
|
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))
|
if (!gst_element_query_position (play->playbin, GST_FORMAT_TIME, &pos))
|
||||||
return FALSE;
|
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);
|
query = gst_query_new_seeking (GST_FORMAT_TIME);
|
||||||
if (!gst_element_query (play->playbin, query)) {
|
if (!gst_element_query (play->playbin, query)) {
|
||||||
gst_query_unref (query);
|
gst_query_unref (query);
|
||||||
|
|
Loading…
Reference in a new issue