增加注解

This commit is contained in:
JinJiangHuang
2026-03-01 22:23:38 +08:00
parent 99a8cc799b
commit ee8c71dcd4
23 changed files with 374 additions and 24 deletions
+18
View File
@@ -2,11 +2,14 @@ import Foundation
///
enum PlayerEngine: Int, CaseIterable, Identifiable {
/// AVPlayer
case system = 0
/// VLC VLCKitSPM
case vlc = 10
var id: Int { rawValue }
/// UI
var title: String {
switch self {
case .system:
@@ -16,6 +19,7 @@ enum PlayerEngine: Int, CaseIterable, Identifiable {
}
}
/// VLC
static var isVLCAvailable: Bool {
#if canImport(VLCKitSPM)
return true
@@ -24,6 +28,8 @@ enum PlayerEngine: Int, CaseIterable, Identifiable {
#endif
}
///
/// VLC
static var availableEngines: [PlayerEngine] {
var engines: [PlayerEngine] = [.system]
if isVLCAvailable {
@@ -32,6 +38,7 @@ enum PlayerEngine: Int, CaseIterable, Identifiable {
return engines
}
///
static func fromStoredValue(_ rawValue: Int) -> PlayerEngine {
guard let engine = PlayerEngine(rawValue: rawValue) else {
return .system
@@ -47,8 +54,11 @@ enum PlayerEngine: Int, CaseIterable, Identifiable {
///
enum VideoDecodeMode: Int, CaseIterable, Identifiable {
///
case auto = 0
///
case hardware = 1
///
case software = 2
var id: Int { rawValue }
@@ -69,6 +79,7 @@ enum VideoDecodeMode: Int, CaseIterable, Identifiable {
}
/// VLC
/// `avcodec-hw`
var vlcHardwareDecodeOption: String? {
switch self {
case .auto:
@@ -84,8 +95,11 @@ enum VideoDecodeMode: Int, CaseIterable, Identifiable {
/// VLC
enum VLCBufferMode: Int, CaseIterable, Identifiable {
///
case lowLatency = 0
///
case balanced = 1
///
case smooth = 2
var id: Int { rawValue }
@@ -111,6 +125,10 @@ enum VLCBufferMode: Int, CaseIterable, Identifiable {
self == .lowLatency
}
/// /
/// - Parameters:
/// - isLive:
/// - Returns: network/live/file
func cacheConfig(isLive: Bool) -> (network: Int, live: Int, file: Int) {
switch self {
case .lowLatency: