gst-play: stash current playback rate in app structure

https://bugzilla.gnome.org/show_bug.cgi?id=745174
This commit is contained in:
Tim-Philipp Müller 2015-02-26 10:20:20 +00:00
parent c243f386c9
commit 0c8967348f

View file

@ -65,6 +65,8 @@ typedef struct
/* configuration */ /* configuration */
gboolean gapless; gboolean gapless;
gdouble rate;
} GstPlay; } GstPlay;
static gboolean quiet = FALSE; static gboolean quiet = FALSE;
@ -163,6 +165,8 @@ play_new (gchar ** uris, const gchar * audio_sink, const gchar * video_sink,
if (initial_volume != -1) if (initial_volume != -1)
play_set_relative_volume (play, initial_volume - 1.0); play_set_relative_volume (play, initial_volume - 1.0);
play->rate = 1.0;
return play; return play;
} }
@ -676,7 +680,6 @@ static void
keyboard_cb (const gchar * key_input, gpointer user_data) keyboard_cb (const gchar * key_input, gpointer user_data)
{ {
GstPlay *play = (GstPlay *) user_data; GstPlay *play = (GstPlay *) user_data;
static gdouble rate = 1.0;
switch (g_ascii_tolower (key_input[0])) { switch (g_ascii_tolower (key_input[0])) {
case ' ': case ' ':
@ -696,16 +699,16 @@ keyboard_cb (const gchar * key_input, gpointer user_data)
play_prev (play); play_prev (play);
break; break;
case '+': case '+':
rate += 0.5; play->rate += 0.5;
change_rate (play, rate); change_rate (play, play->rate);
break; break;
case '-': case '-':
rate -= 0.5; play->rate -= 0.5;
change_rate (play, rate); change_rate (play, play->rate);
break; break;
case 'd': case 'd':
rate *= -1.0; play->rate *= -1.0;
change_rate (play, rate); change_rate (play, play->rate);
break; break;
case 27: /* ESC */ case 27: /* ESC */
if (key_input[1] == '\0') { if (key_input[1] == '\0') {