mirror of
https://github.com/RustAudio/rodio
synced 2025-01-07 09:18:44 +00:00
use From<f64> instead of custom time_from_duration
remove now unused time_from_duration Co-authored-by: naglis <827324+naglis@users.noreply.github.com>
This commit is contained in:
parent
7357f191b8
commit
8c774628fe
1 changed files with 1 additions and 14 deletions
|
@ -159,7 +159,7 @@ impl Source for SymphoniaDecoder {
|
||||||
let time = self.total_duration.expect("if guarentees this is Some");
|
let time = self.total_duration.expect("if guarentees this is Some");
|
||||||
skip_back_a_tiny_bit(time) // some decoders can only seek to just before the end
|
skip_back_a_tiny_bit(time) // some decoders can only seek to just before the end
|
||||||
} else {
|
} else {
|
||||||
time_from_duration(pos)
|
pos.as_secs_f64().into()
|
||||||
};
|
};
|
||||||
|
|
||||||
self.format.seek(
|
self.format.seek(
|
||||||
|
@ -173,19 +173,6 @@ impl Source for SymphoniaDecoder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn time_from_duration(dur: Duration) -> Time {
|
|
||||||
let frac = if dur.subsec_nanos() == 0 {
|
|
||||||
0f64
|
|
||||||
} else {
|
|
||||||
let res = dur.subsec_nanos() as f64 / 1_000_000_000.0;
|
|
||||||
res
|
|
||||||
};
|
|
||||||
Time {
|
|
||||||
seconds: dur.as_secs(),
|
|
||||||
frac,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn skip_back_a_tiny_bit(
|
fn skip_back_a_tiny_bit(
|
||||||
Time {
|
Time {
|
||||||
mut seconds,
|
mut seconds,
|
||||||
|
|
Loading…
Reference in a new issue