From 5e08d15b2105ee6a4cfc3504291b81d2358c5f49 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Mon, 15 Aug 2022 00:16:02 +0200 Subject: [PATCH] Remove best resolution setting --- Model/QualityProfile.swift | 4 ++-- Shared/Defaults.swift | 12 ++---------- Shared/Settings/QualityProfileForm.swift | 4 ++-- 3 files changed, 6 insertions(+), 14 deletions(-) diff --git a/Model/QualityProfile.swift b/Model/QualityProfile.swift index bf6e437b..993a60a2 100644 --- a/Model/QualityProfile.swift +++ b/Model/QualityProfile.swift @@ -4,7 +4,7 @@ import Foundation struct QualityProfile: Hashable, Identifiable, Defaults.Serializable { static var bridge = QualityProfileBridge() static var defaultProfile = Self(id: "default", backend: .mpv, resolution: .hd720p60, formats: [.stream]) - static var highQualityProfile = Self(id: "highQuality", backend: .mpv, resolution: .best, formats: [.webm, .mp4, .av1, .avc1]) + static var highQualityProfile = Self(id: "highQuality", backend: .mpv, resolution: .hd2160p60, formats: [.webm, .mp4, .av1, .avc1]) enum Format: String, CaseIterable, Identifiable, Defaults.Serializable { case hls @@ -65,7 +65,7 @@ struct QualityProfile: Hashable, Identifiable, Defaults.Serializable { return true } - let resolutionMatch = !stream.resolution.isNil && (resolution == .best || (resolution.value >= stream.resolution)) + let resolutionMatch = !stream.resolution.isNil && resolution.value >= stream.resolution if resolutionMatch, formats.contains(.stream), stream.kind == .stream { return true diff --git a/Shared/Defaults.swift b/Shared/Defaults.swift index ce40925f..6dd7438c 100644 --- a/Shared/Defaults.swift +++ b/Shared/Defaults.swift @@ -120,7 +120,6 @@ extension Defaults.Keys { } enum ResolutionSetting: String, CaseIterable, Defaults.Serializable { - case best case hd2160p60 case hd2160p30 case hd1440p60 @@ -134,19 +133,12 @@ enum ResolutionSetting: String, CaseIterable, Defaults.Serializable { case sd240p30 case sd144p30 - var value: Stream.Resolution { - switch self { - case .best: - return .hd2160p60 - default: - return Stream.Resolution(rawValue: rawValue)! - } + var value: Stream.Resolution! { + .init(rawValue: rawValue) } var description: String { switch self { - case .best: - return "Best available quality" case .hd2160p60: return "4K, 60fps" case .hd2160p30: diff --git a/Shared/Settings/QualityProfileForm.swift b/Shared/Settings/QualityProfileForm.swift index 70e38868..bae10afe 100644 --- a/Shared/Settings/QualityProfileForm.swift +++ b/Shared/Settings/QualityProfileForm.swift @@ -11,7 +11,7 @@ struct QualityProfileForm: View { @State private var name = "" @State private var backend = PlayerBackendType.mpv - @State private var resolution = ResolutionSetting.best + @State private var resolution = ResolutionSetting.hd1080p60 @State private var formats = [QualityProfile.Format]() var qualityProfile: QualityProfile! { @@ -270,7 +270,7 @@ struct QualityProfileForm: View { func isResolutionDisabled(_ resolution: ResolutionSetting) -> Bool { guard backend == .appleAVPlayer else { return false } - return resolution != .best && resolution.value.height > 720 + return resolution.value.height > 720 } func initializeForm() {