Label local-file video quality from mpv track info instead of Unknown

Streams built for local folder files carry no resolution/codec/fps
metadata (unknowable before demux), so the quality selector labeled
them "Unknown". Use the video track mpv reports (demux-w/h/fps, codec)
to fill those fields into a display-only copy of the stream — the
Video row and summary now show e.g. "720p · 30fps" with a codec badge.
Selection and tap handling keep using the original stream.
This commit is contained in:
Arkadiusz Fal
2026-07-29 22:50:50 +02:00
parent 67ed8c322b
commit 9e546e29ee
10 changed files with 69 additions and 3 deletions

View File

@@ -85,6 +85,13 @@ final class PlayerService {
embeddedSubtitleTracks.first(where: \.isSelected)?.trackID
}
/// The video track mpv currently plays. Used to label local-file streams,
/// whose Stream carries no resolution/codec/fps metadata before demux.
var primaryEmbeddedVideoTrack: MPVTrack? {
let videoTracks = embeddedTracks.filter { $0.type == .video && !$0.isExternal && !$0.isAlbumArt }
return videoTracks.first(where: \.isSelected) ?? videoTracks.first
}
/// Embedded-track picks that should survive same-video reloads
/// (quality switch, audio-mode toggle, buffer-stall retry).
private var desiredEmbeddedAudioTrackID: Int?