use gst time constants
no more 1000000000000000000000000000000 in code
This commit is contained in:
parent
eaf8a86232
commit
83b3a862e3
2 changed files with 4 additions and 5 deletions
|
@ -243,7 +243,7 @@ class Playbin : GLib.Object {
|
|||
|
||||
this.current_song = song;
|
||||
this.position = 0;
|
||||
this.duration = song.duration * 1000000000 - 1;
|
||||
this.duration = song.duration * Gst.SECOND - 1;
|
||||
this.now_playing (false);
|
||||
}
|
||||
|
||||
|
|
|
@ -134,8 +134,7 @@ class Ui.Window : Adw.ApplicationWindow {
|
|||
// treat 1 nanosecond as a sentinel value
|
||||
return "-";
|
||||
}
|
||||
int64 ms = ns / 1000000;
|
||||
int s = (int) (ms / 1000);
|
||||
int s = (int) (ns / Gst.SECOND);
|
||||
return "%02d:%02d".printf (s/60, s%60);
|
||||
}
|
||||
|
||||
|
@ -203,14 +202,14 @@ class Ui.Window : Adw.ApplicationWindow {
|
|||
|
||||
[GtkCallback] private void seek_backward () {
|
||||
// 10 seconds
|
||||
int64 new_position = position - (int64)10 * 1000 * 1000000;
|
||||
int64 new_position = position - 10 * Gst.SECOND;
|
||||
if (new_position < 0) new_position = 0;
|
||||
this.seek_impl (new_position);
|
||||
}
|
||||
|
||||
[GtkCallback] private void seek_forward () {
|
||||
// 10 seconds
|
||||
int64 new_position = position + (int64)10 * 1000 * 1000000;
|
||||
int64 new_position = position + 10 * Gst.SECOND;
|
||||
if (new_position > this.playbin.duration) new_position = this.playbin.duration;
|
||||
this.seek_impl (new_position);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue