mirror of
https://github.com/yattee/yattee.git
synced 2026-05-13 19:05:03 +00:00
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:
@@ -92,17 +92,21 @@ extension QualitySelectorView {
|
||||
}
|
||||
|
||||
/// Recommended video streams (hardware-decodable codecs).
|
||||
/// When `allowSoftwareDecodedFormats` is ON, all video streams are considered recommended.
|
||||
var recommendedVideoStreams: [Stream] {
|
||||
videoStreams.filter { (stream: Stream) -> Bool in
|
||||
if stream.url.isFileURL { return true }
|
||||
if stream.isMuxed { return true }
|
||||
if allowSoftwareDecodedFormats { return true }
|
||||
return !requiresSoftwareDecode(stream.videoCodec)
|
||||
}
|
||||
}
|
||||
|
||||
/// Other video streams (software decode required).
|
||||
/// Empty when `allowSoftwareDecodedFormats` is ON — those streams are now recommended.
|
||||
var otherVideoStreams: [Stream] {
|
||||
videoStreams.filter { (stream: Stream) -> Bool in
|
||||
if allowSoftwareDecodedFormats { return [] }
|
||||
return videoStreams.filter { (stream: Stream) -> Bool in
|
||||
if stream.url.isFileURL { return false }
|
||||
if stream.isMuxed { return false }
|
||||
return requiresSoftwareDecode(stream.videoCodec)
|
||||
|
||||
@@ -71,6 +71,12 @@ struct QualitySelectorView: View {
|
||||
appEnvironment?.settingsManager.showAdvancedStreamDetails ?? false
|
||||
}
|
||||
|
||||
/// Whether the user has opted in to software-decoded formats during auto-selection.
|
||||
/// When enabled, software-decoded streams are treated as recommended (no split).
|
||||
var allowSoftwareDecodedFormats: Bool {
|
||||
appEnvironment?.settingsManager.allowSoftwareDecodedFormats ?? false
|
||||
}
|
||||
|
||||
// MARK: - Computed Properties
|
||||
|
||||
/// Available tabs based on streams
|
||||
|
||||
@@ -38,7 +38,10 @@ private struct QualitySection: View {
|
||||
@Bindable var settings: SettingsManager
|
||||
|
||||
var body: some View {
|
||||
SettingsFormSection("settings.playback.video.header") {
|
||||
SettingsFormSection(
|
||||
"settings.playback.video.header",
|
||||
footer: "settings.playback.quality.allowSoftwareDecoded.footer"
|
||||
) {
|
||||
PlatformMenuPicker(
|
||||
String(localized: "settings.playback.quality.preferred"),
|
||||
selection: $settings.preferredQuality
|
||||
@@ -58,6 +61,11 @@ private struct QualitySection: View {
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Toggle(
|
||||
String(localized: "settings.playback.quality.allowSoftwareDecoded"),
|
||||
isOn: $settings.allowSoftwareDecodedFormats
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user