mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-11 18:05:37 +00:00
playback/player: gst-play: trivial cleanup
This commit is contained in:
parent
15d62dcfe6
commit
09864feff4
1 changed files with 9 additions and 16 deletions
|
@ -548,15 +548,13 @@ restore_terminal (void)
|
||||||
static void
|
static void
|
||||||
toggle_paused (GstPlay * play)
|
toggle_paused (GstPlay * play)
|
||||||
{
|
{
|
||||||
if (play->desired_state == GST_STATE_PLAYING)
|
if (play->desired_state == GST_STATE_PLAYING) {
|
||||||
play->desired_state = GST_STATE_PAUSED;
|
play->desired_state = GST_STATE_PAUSED;
|
||||||
else
|
|
||||||
play->desired_state = GST_STATE_PLAYING;
|
|
||||||
|
|
||||||
if (play->desired_state == GST_STATE_PLAYING)
|
|
||||||
gst_player_play (play->player);
|
|
||||||
else
|
|
||||||
gst_player_pause (play->player);
|
gst_player_pause (play->player);
|
||||||
|
} else {
|
||||||
|
play->desired_state = GST_STATE_PLAYING;
|
||||||
|
gst_player_play (play->player);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -568,20 +566,15 @@ relative_seek (GstPlay * play, gdouble percent)
|
||||||
|
|
||||||
g_object_get (play->player, "position", &pos, "duration", &dur, NULL);
|
g_object_get (play->player, "position", &pos, "duration", &dur, NULL);
|
||||||
|
|
||||||
if (dur <= 0)
|
if (dur <= 0) {
|
||||||
goto seek_failed;
|
g_print ("\nCould not seek.\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
pos = pos + dur * percent;
|
pos = pos + dur * percent;
|
||||||
if (pos < 0)
|
if (pos < 0)
|
||||||
pos = 0;
|
pos = 0;
|
||||||
gst_player_seek (play->player, pos);
|
gst_player_seek (play->player, pos);
|
||||||
|
|
||||||
return;
|
|
||||||
|
|
||||||
seek_failed:
|
|
||||||
{
|
|
||||||
g_print ("\nCould not seek.\n");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
Loading…
Reference in a new issue