mirror of
https://github.com/librespot-org/librespot.git
synced 2024-11-08 16:45:43 +00:00
Merge remote-tracking branch 'origin/dev' into blocking_sink_events
This commit is contained in:
commit
667e559340
3 changed files with 11 additions and 1 deletions
|
@ -30,6 +30,7 @@ pub struct PlayerConfig {
|
||||||
pub bitrate: Bitrate,
|
pub bitrate: Bitrate,
|
||||||
pub normalisation: bool,
|
pub normalisation: bool,
|
||||||
pub normalisation_pregain: f32,
|
pub normalisation_pregain: f32,
|
||||||
|
pub gapless: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for PlayerConfig {
|
impl Default for PlayerConfig {
|
||||||
|
@ -38,6 +39,7 @@ impl Default for PlayerConfig {
|
||||||
bitrate: Bitrate::default(),
|
bitrate: Bitrate::default(),
|
||||||
normalisation: false,
|
normalisation: false,
|
||||||
normalisation_pregain: 0.0,
|
normalisation_pregain: 0.0,
|
||||||
|
gapless: true,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1102,6 +1102,9 @@ impl PlayerInternal {
|
||||||
play: bool,
|
play: bool,
|
||||||
position_ms: u32,
|
position_ms: u32,
|
||||||
) {
|
) {
|
||||||
|
if !self.config.gapless {
|
||||||
|
self.ensure_sink_stopped();
|
||||||
|
}
|
||||||
// emit the correct player event
|
// emit the correct player event
|
||||||
match self.state {
|
match self.state {
|
||||||
PlayerState::Playing {
|
PlayerState::Playing {
|
||||||
|
|
|
@ -182,6 +182,11 @@ fn setup(args: &[String]) -> Setup {
|
||||||
"",
|
"",
|
||||||
"autoplay",
|
"autoplay",
|
||||||
"autoplay similar songs when your music ends.",
|
"autoplay similar songs when your music ends.",
|
||||||
|
)
|
||||||
|
.optflag(
|
||||||
|
"",
|
||||||
|
"disable-gapless",
|
||||||
|
"disable gapless playback.",
|
||||||
);
|
);
|
||||||
|
|
||||||
let matches = match opts.parse(&args[1..]) {
|
let matches = match opts.parse(&args[1..]) {
|
||||||
|
@ -314,9 +319,9 @@ fn setup(args: &[String]) -> Setup {
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|bitrate| Bitrate::from_str(bitrate).expect("Invalid bitrate"))
|
.map(|bitrate| Bitrate::from_str(bitrate).expect("Invalid bitrate"))
|
||||||
.unwrap_or(Bitrate::default());
|
.unwrap_or(Bitrate::default());
|
||||||
|
|
||||||
PlayerConfig {
|
PlayerConfig {
|
||||||
bitrate: bitrate,
|
bitrate: bitrate,
|
||||||
|
gapless: !matches.opt_present("disable-gapless"),
|
||||||
normalisation: matches.opt_present("enable-volume-normalisation"),
|
normalisation: matches.opt_present("enable-volume-normalisation"),
|
||||||
normalisation_pregain: matches
|
normalisation_pregain: matches
|
||||||
.opt_str("normalisation-pregain")
|
.opt_str("normalisation-pregain")
|
||||||
|
|
Loading…
Reference in a new issue