feat(player): add playback speed control (<, >, P keys)

This commit is contained in:
accusys
2026-03-19 02:17:33 +08:00
parent 7eee097e55
commit e0f61f0983

View File

@@ -394,6 +394,18 @@ fn run(config: &Config) -> Result<()> {
player_state.pan_x = 0.0;
player_state.pan_y = 0.0;
}
sdl2::keyboard::Keycode::Comma | sdl2::keyboard::Keycode::Less => {
player_state.speed = (player_state.speed / 1.5).max(0.25);
info!("Speed: {:.2}x", player_state.speed);
}
sdl2::keyboard::Keycode::Period | sdl2::keyboard::Keycode::Greater => {
player_state.speed = (player_state.speed * 1.5).min(4.0);
info!("Speed: {:.2}x", player_state.speed);
}
sdl2::keyboard::Keycode::P => {
player_state.speed = 1.0;
info!("Speed: 1.0x");
}
_ => {}
}
}
@@ -631,13 +643,10 @@ fn run(config: &Config) -> Result<()> {
player_state.fps
);
let line2 = format!(
"[S]ub {} [Y]olo {} [C]hunks [M]ute Zoom{:.1}x [F]ullscreen [`]Reset",
if player_state.show_subtitle {
"ON"
} else {
"OFF"
},
"[S]ub {} [Y]olo {} [C]hunks [M]ute Spd{:.2}x Zoom{:.1}x [F]ullscreen [H]Help",
if player_state.show_subtitle { "ON" } else { "OFF" },
if player_state.show_yolo { "ON" } else { "OFF" },
player_state.speed,
player_state.zoom
);