feat(*): subsonic client with avfoundation playback and apple music ui
This commit is contained in:
commit
e5bb559d7f
93 files changed
+7517
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import Foundation
|
||||
|
||||
public struct AudioFormat: Hashable, Codable, Sendable {
|
||||
public enum Codec: String, Codable, Sendable {
|
||||
case flac, alac, wav, mp3, aac, opus, vorbis, eac3
|
||||
}
|
||||
|
||||
public var codec: Codec
|
||||
public var bitrateKbps: Int?
|
||||
public var sampleRate: Int?
|
||||
public var bitDepth: Int?
|
||||
public var channels: Int
|
||||
|
||||
public init(codec: Codec, bitrateKbps: Int? = nil, sampleRate: Int? = nil, bitDepth: Int? = nil, channels: Int = 2) {
|
||||
self.codec = codec
|
||||
self.bitrateKbps = bitrateKbps
|
||||
self.sampleRate = sampleRate
|
||||
self.bitDepth = bitDepth
|
||||
self.channels = channels
|
||||
}
|
||||
|
||||
public var isLossless: Bool {
|
||||
switch codec {
|
||||
case .flac, .alac, .wav: true
|
||||
default: false
|
||||
}
|
||||
}
|
||||
|
||||
public var isHiRes: Bool {
|
||||
isLossless && ((sampleRate ?? 0) > 48000 || (bitDepth ?? 0) > 16 && (sampleRate ?? 0) > 44100)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user