diff --git a/assets/icons/128x128/quince.png b/assets/icons/128x128/quince.png
index 3047679..26a606d 100644
Binary files a/assets/icons/128x128/quince.png and b/assets/icons/128x128/quince.png differ
diff --git a/assets/icons/16x16/quince.png b/assets/icons/16x16/quince.png
index fc4b772..713f5e2 100644
Binary files a/assets/icons/16x16/quince.png and b/assets/icons/16x16/quince.png differ
diff --git a/assets/icons/256x256/quince.png b/assets/icons/256x256/quince.png
index eed5a4b..a3b04df 100644
Binary files a/assets/icons/256x256/quince.png and b/assets/icons/256x256/quince.png differ
diff --git a/assets/icons/32x32/quince.png b/assets/icons/32x32/quince.png
index 3be693d..e02c7ae 100644
Binary files a/assets/icons/32x32/quince.png and b/assets/icons/32x32/quince.png differ
diff --git a/assets/icons/48x48/quince.png b/assets/icons/48x48/quince.png
index 47bdce3..a2225d3 100644
Binary files a/assets/icons/48x48/quince.png and b/assets/icons/48x48/quince.png differ
diff --git a/assets/icons/64x64/quince.png b/assets/icons/64x64/quince.png
index a0c774f..0fb07d0 100644
Binary files a/assets/icons/64x64/quince.png and b/assets/icons/64x64/quince.png differ
diff --git a/assets/quince.svg b/assets/quince.svg
index 6c1072c..991ad82 100644
--- a/assets/quince.svg
+++ b/assets/quince.svg
@@ -1,4 +1,4 @@
diff --git a/docs/STATUS.md b/docs/STATUS.md
index 69456ab..51637b0 100644
--- a/docs/STATUS.md
+++ b/docs/STATUS.md
@@ -39,6 +39,14 @@ Version 0.1.0, first build (2026-11-26).
- Smoke-tested: the AppImage plays the test clip with hardware decoding; the Windows build plays it under wine; the
installer installs per user to `AppData\Local\Programs\Quince` with a Start menu entry.
+## Icon and stream quality (2026-12-01)
+- Icon: the play triangle sat about 14 px right of the shape's centre; it is centred now (a small optical nudge
+ right) and a little larger. PNGs in `assets/icons/` and `packaging/quince.ico` regenerated from the SVG.
+- Online videos get a Quality menu (right-click menu and the Video menu): Best, each height the stream offers
+ (read from yt-dlp's answer that mpv keeps), and Sound only. Picking one remembers it (same setting as Settings >
+ Playback > Links) and reloads the stream where it was. Checked in a hidden run on a YouTube link: 4K → 480p, and
+ 480p → 360p at 5:24 carried on from 5:24. Sizes not in Settings' list (1440p, 360p) show there as the next one down.
+
## Not done
- No release published yet: the packages are in `dist/`, notes in `docs/releases/0.1.0.md`.
- Windows: screensaver inhibit is D-Bus only, so it does nothing there; seek previews need ffmpeg on PATH. Not tried
diff --git a/packaging/quince.ico b/packaging/quince.ico
index c472ae8..21aea36 100644
Binary files a/packaging/quince.ico and b/packaging/quince.ico differ
diff --git a/src/app.rs b/src/app.rs
index 280e8e9..88ccaa1 100644
--- a/src/app.rs
+++ b/src/app.rs
@@ -1,6 +1,6 @@
//! The app: owns mpv, the settings and the theme, turns input and clicks into `Act`s and applies them.
-use crate::config::{ColourFrom, Settings};
+use crate::config::{self, ColourFrom, Settings};
use crate::inhibit::Inhibitor;
use crate::motion::{self, spring};
use crate::mpv::{self, Happened, Player};
@@ -60,6 +60,8 @@ pub enum Act {
Cmd(Vec),
/// Set an mpv property (mpv parses the value).
Set(String, String),
+ /// Quality for online videos ("best", a height, "audio"): remembered, and the playing video reloads where it is.
+ Quality(String),
TogglePause,
Seek(f64),
SeekBy(f64),
@@ -122,6 +124,8 @@ pub struct App {
pub dialog: Dialog,
pub settings_page: usize,
pub url_text: String,
+ /// A quality switch set mpv's `start`; put it back when the file has loaded.
+ restore_start: bool,
last_move: f64,
pending_click: Option,
swallow_click: bool,
@@ -164,6 +168,7 @@ impl App {
dialog: Dialog::None,
settings_page: 0,
url_text: String::new(),
+ restore_start: false,
last_move: 0.0,
pending_click: None,
swallow_click: false,
@@ -348,6 +353,22 @@ impl App {
}
}
}
+ Act::Quality(q) => {
+ self.settings.ytdl_quality = q.clone();
+ self.settings.save();
+ if let Some(p) = &self.player {
+ p.set("ytdl-format", self.settings.ytdl_format().as_str());
+ if p.state.loaded() && p.state.path.contains("://") {
+ // Play the same entry again from here; the start time is undone once it has loaded.
+ // An older resume point for this link would win over `start`, so it goes first.
+ p.set("start", format!("{:.3}", p.state.time.max(0.0)).as_str());
+ p.cmd(&["delete-watch-later-config"]);
+ p.cmd(&["playlist-play-index", "current"]);
+ self.restore_start = true;
+ }
+ }
+ self.osd(ctx, format!("Quality: {}", config::quality_label(&q)), None);
+ }
Act::TogglePause => {
if let Some(p) = &self.player {
if p.state.eof && !p.state.pause {
@@ -463,6 +484,9 @@ impl App {
match h {
Happened::StartFile => {}
Happened::FileLoaded => {
+ if std::mem::take(&mut self.restore_start) {
+ self.player.as_ref().unwrap().set("start", "none");
+ }
self.loading = None;
self.video_seed = None;
self.sample_at = None;
@@ -752,7 +776,7 @@ impl App {
"error": self.startup_error,
"idle": s.idle, "pause": s.pause, "time": s.time, "duration": s.duration, "title": s.title,
"width": s.width, "height": s.height, "tracks": s.tracks.len(), "chapters": s.chapters.len(),
- "playlist": s.playlist.len(), "hwdec": s.hwdec_current, "volume": s.volume,
+ "playlist": s.playlist.len(), "stream_heights": s.stream_heights, "path": s.path, "hwdec": s.hwdec_current, "volume": s.volume,
"sheet": format!("{:?}", self.sheet), "dialog": format!("{:?}", self.dialog), "menu": self.menu.as_ref().map(|m| format!("{:?}", m.1)),
"toasts": self.toasts.iter().map(|t| t.text.clone()).collect::>(),
"dark": self.theme.dark, "primary": format!("{:?}", self.theme.primary),
diff --git a/src/config.rs b/src/config.rs
index 796ec2f..01e0f0d 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -159,11 +159,11 @@ impl Settings {
pub fn ytdl_format(&self) -> String {
match self.ytdl_quality.as_str() {
- "2160" | "1440" | "1080" | "720" | "480" => {
- format!("bestvideo[height<=?{0}]+bestaudio/best[height<=?{0}]", self.ytdl_quality)
- }
"audio" => "bestaudio/best".into(),
- _ => String::new(),
+ q => match q.parse::() {
+ Ok(h) => format!("bestvideo[height<=?{h}]+bestaudio/best[height<=?{h}]"),
+ Err(_) => String::new(),
+ },
}
}
@@ -185,6 +185,24 @@ pub const MOTIONS: [&str; 4] = ["off", "reduced", "normal", "lively"];
pub const QUALITIES: [(&str, &str); 6] =
[("best", "Best"), ("2160", "4K"), ("1080", "1080p"), ("720", "720p"), ("480", "480p"), ("audio", "Sound only")];
+/// Which of QUALITIES to show as chosen; a height picked from the Quality menu shows as the nearest one at or below it.
+pub fn quality_index(q: &str) -> usize {
+ if let Some(i) = QUALITIES.iter().position(|x| x.0 == q) {
+ return i;
+ }
+ let Ok(h) = q.parse::() else { return 0 };
+ QUALITIES.iter().position(|x| x.0.parse::().is_ok_and(|v| v <= h)).unwrap_or(QUALITIES.len() - 2)
+}
+
+/// How a quality setting reads in menus: "Best", "720p", "4K", "Sound only".
+pub fn quality_label(q: &str) -> String {
+ match q.parse::() {
+ Ok(2160) => "4K".into(),
+ Ok(h) => format!("{h}p"),
+ Err(_) => QUALITIES.iter().find(|x| x.0 == q).map_or("Best", |x| x.1).into(),
+ }
+}
+
fn desktop_wants_less_motion() -> bool {
static ASKED: std::sync::OnceLock = std::sync::OnceLock::new();
*ASKED.get_or_init(ask_desktop_motion)
diff --git a/src/mpv.rs b/src/mpv.rs
index 9b52630..0db80c9 100644
--- a/src/mpv.rs
+++ b/src/mpv.rs
@@ -168,6 +168,24 @@ impl Entry {
}
}
+/// The video heights in mpv's copy of yt-dlp's answer (`{"stdout": "", ...}`), tallest first.
+pub fn stream_heights(result: &str) -> Vec {
+ let Ok(outer) = serde_json::from_str::(result) else { return vec![] };
+ let Some(Ok(info)) = outer["stdout"].as_str().map(serde_json::from_str::) else { return vec![] };
+ let mut v: Vec = info["formats"]
+ .as_array()
+ .into_iter()
+ .flatten()
+ .filter(|f| f["vcodec"].as_str().is_some_and(|c| c != "none"))
+ .filter_map(|f| f["height"].as_u64())
+ .map(|h| h as u32)
+ .filter(|&h| h >= 144)
+ .collect();
+ v.sort_unstable_by(|a, b| b.cmp(a));
+ v.dedup();
+ v
+}
+
/// The file name of a path or URL, without the folder.
pub fn display_name(path: &str) -> String {
if path.contains("://") {
@@ -239,6 +257,8 @@ pub struct State {
pub panscan: f64,
pub devices: Vec,
pub audio_channels: String,
+ /// Picture heights an online video offers (from yt-dlp), tallest first; empty for local files.
+ pub stream_heights: Vec,
}
#[derive(Clone, Debug, Default, Deserialize)]
@@ -511,7 +531,14 @@ impl Player {
while let Some(ev) = self.mpv.wait_event(0.0) {
match ev {
Ok(Event::PropertyChange { name, change, .. }) => apply(&mut self.state, name, change),
- Ok(Event::FileLoaded) => out.push(Happened::FileLoaded),
+ Ok(Event::FileLoaded) => {
+ self.state.stream_heights = if self.state.path.contains("://") {
+ self.get_str("user-data/mpv/ytdl/json-subprocess-result").map(|j| stream_heights(&j)).unwrap_or_default()
+ } else {
+ vec![]
+ };
+ out.push(Happened::FileLoaded)
+ }
Ok(Event::StartFile) => out.push(Happened::StartFile),
Ok(Event::EndFile(_)) => out.push(Happened::EndFile),
Err(e) => out.push(Happened::Error(err_words(&e))),
@@ -787,6 +814,14 @@ mod tests {
fn names_and_tracks_read_well() {
assert_eq!(display_name("/home/a/Films/The Film (2020).mkv"), "The Film (2020).mkv");
assert_eq!(display_name("https://example.com/v/My%20clip.mp4?x=1"), "My clip.mp4");
+ }
+
+ #[test]
+ fn heights_from_ytdl() {
+ let inner = r#"{"formats":[{"height":1080,"vcodec":"vp9"},{"height":720,"vcodec":"avc1"},{"height":1080,"vcodec":"av01"},{"vcodec":"none","acodec":"opus"},{"height":90,"vcodec":"none"},{"height":27,"vcodec":"images"}]}"#;
+ let outer = serde_json::json!({ "stdout": inner, "status": 0 }).to_string();
+ assert_eq!(stream_heights(&outer), vec![1080, 720]);
+ assert!(stream_heights("{}").is_empty());
assert_eq!(trim_num(23.976, 3), "23.976");
assert_eq!(trim_num(48.0, 1), "48");
let t: Vec