Add Allow Software-Decoded Formats playback setting

Lets the auto stream selector pick formats whose codec isn't hardware
decoded on the current device. Defaults off; when on, 4K VP9/AV1 can be
auto-selected on Apple TV models without those decoders. Software-decoded
streams also move into the Recommended section so the selection stays
visible without enabling advanced stream details.
This commit is contained in:
Arkadiusz Fal
2026-05-07 18:00:14 +02:00
parent 823faee012
commit 16477641ab
8 changed files with 70 additions and 7 deletions

View File

@@ -25,6 +25,7 @@ enum SettingsKey: String, CaseIterable {
case preferredSubtitlesLanguage
case resumeAction
case tvOSMenuButtonClosesVideo
case allowSoftwareDecodedFormats
// SponsorBlock
case sponsorBlockEnabled
@@ -129,7 +130,7 @@ enum SettingsKey: String, CaseIterable {
/// in both UserDefaults and iCloud, so each platform family syncs independently.
var isPlatformSpecific: Bool {
switch self {
case .preferredQuality, .cellularQuality, .macPlayerMode, .listStyle,
case .preferredQuality, .cellularQuality, .allowSoftwareDecodedFormats, .macPlayerMode, .listStyle,
// Home layout different UI paradigms per platform
.homeShortcutOrder, .homeShortcutVisibility, .homeShortcutLayout,
.homeSectionOrder, .homeSectionVisibility, .homeSectionItemsLimit, .homeSectionLayout,

View File

@@ -75,6 +75,20 @@ extension SettingsManager {
}
}
/// When enabled, the auto stream selector will consider video formats whose codec
/// is not hardware-decodable on this device. Disabled by default. Useful on Apple TV
/// where 4K VP9/AV1 is otherwise excluded from auto-selection.
var allowSoftwareDecodedFormats: Bool {
get {
if let cached = _allowSoftwareDecodedFormats { return cached }
return bool(for: .allowSoftwareDecodedFormats, default: false)
}
set {
_allowSoftwareDecodedFormats = newValue
set(newValue, for: .allowSoftwareDecodedFormats)
}
}
/// Preferred audio language code (e.g., "en", "de", "ja").
/// When set, audio streams in this language will be auto-selected and shown first.
/// nil means no preference (use original/default audio).

View File

@@ -40,6 +40,7 @@ final class SettingsManager {
var _playerVolume: Float?
var _resumeAction: ResumeAction?
var _tvOSMenuButtonClosesVideo: Bool?
var _allowSoftwareDecodedFormats: Bool?
// SponsorBlock
var _sponsorBlockEnabled: Bool?
@@ -413,6 +414,7 @@ final class SettingsManager {
_playerVolume = nil
_resumeAction = nil
_tvOSMenuButtonClosesVideo = nil
_allowSoftwareDecodedFormats = nil
_sponsorBlockEnabled = nil
_sponsorBlockCategories = nil
_sponsorBlockAPIURL = nil