Du hattest recht mit der Erwartung, nur nicht mit dem Stand: entfernt war er nicht. Was wir gemacht haben, war, ihm Arbeit wegzunehmen — DTS, TrueHD und Vorbis gehen seit Kurzem über das Umpacken beim Server. Übrig blieb er an einer Stelle, `PlaybackDecider.fallback`. Jetzt ist er ganz weg, samt dem 920-MB-Binärpaket. **Was an seine Stelle tritt.** Die Entscheidung sagt nicht mehr, *wer* spielt, sondern *was ankommt*: direkt, umgepackt oder umgerechnet. `PlaybackEngineKind` fällt damit weg, `directPlay` trägt keine Engine mehr, und `PlaybackPolicy` kennt kein `allowsFallbackEngine`. **Das Auffangnetz bleibt, nur anders geknüpft.** Scheiterte das Umpacken am Player, sprang bisher VLC ein — der Server entscheidet erst beim Ausliefern, ob er die Ströme wirklich kopieren kann, und manche Antworten nimmt AVPlayer nicht an. Statt der zweiten Engine rechnet der Server jetzt neu (`fallBackToTranscode`). Teurer für ihn, aber es kommt etwas an, statt einer schwarzen Wand mit einer Fehlernummer. **Offline wäre das ein Rückschritt gewesen** — dort gibt es keinen Server, der einspringt. Deshalb ging der vorige Commit voraus: was heruntergeladen wird, kommt schon in einer Hülle, die der Systemplayer öffnet. Was dadurch überall gilt, auch für Dateien, die bisher bei VLC landeten: Bild-in-Bild, AirPlay, Bedienung im Sperrbildschirm — und dasselbe Verhalten auf dem Apple TV, wo es VLC ohnehin nie gab. Die Attrappe heißt ihren Schalter jetzt `--dts` statt `--vlc`: der Fall ist geblieben, sein Ziel nicht. iOS und tvOS bauen, 494 Tests grün. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
134 lines
5.5 KiB
Swift
134 lines
5.5 KiB
Swift
import SwiftUI
|
||
import FlixyDesign
|
||
import FlixyPlayback
|
||
import MediaKit
|
||
|
||
/// Die aufklappbaren technischen Angaben zu einer Datei.
|
||
///
|
||
/// Zeigt nicht nur, was in der Datei steckt, sondern auch, wie Flixy sie
|
||
/// abspielen wird und warum. Bei der Frage „warum ruckelt das" ist das die
|
||
/// erste Stelle zum Nachsehen — und in Phase 1, wo es noch kein Transcoding
|
||
/// gibt, erklärt es, warum bei manchen Dateien kein Bild-in-Bild angeboten wird.
|
||
struct TechnicalDetails: View {
|
||
let media: MediaVersion
|
||
let part: MediaFile
|
||
@Binding var isExpanded: Bool
|
||
|
||
private var decision: PlaybackDecision {
|
||
PlaybackDecider().decide(profile: media.profile(file: part), policy: .directPlayOnly)
|
||
}
|
||
|
||
var body: some View {
|
||
DisclosureGroup(isExpanded: $isExpanded) {
|
||
VStack(alignment: .leading, spacing: FlixySpacing.snug) {
|
||
row("technical.playbackMethod", playbackMethodLabel)
|
||
if let reason = rationaleLabel {
|
||
row("technical.reason", reason)
|
||
}
|
||
|
||
Divider().overlay(Color.flixySeparator).padding(.vertical, FlixySpacing.tight)
|
||
|
||
if let container = part.container { row("technical.container", container.uppercased()) }
|
||
if let codec = media.videoCodec { row("technical.videoCodec", codec.uppercased()) }
|
||
if let width = media.width, let height = media.height {
|
||
row("technical.resolution", "\(width) × \(height)")
|
||
}
|
||
if let bitrate = media.bitrate {
|
||
row("technical.bitrate", "\(bitrate / 1000) Mbit/s")
|
||
}
|
||
if let size = part.size {
|
||
row("technical.size", size.formatted(.byteCount(style: .file)))
|
||
}
|
||
|
||
if !part.audioStreams.isEmpty {
|
||
Divider().overlay(Color.flixySeparator).padding(.vertical, FlixySpacing.tight)
|
||
ForEach(part.audioStreams) { stream in
|
||
row("technical.audio", trackLabel(stream))
|
||
}
|
||
}
|
||
|
||
if !part.subtitleStreams.isEmpty {
|
||
ForEach(part.subtitleStreams) { stream in
|
||
row("technical.subtitle", trackLabel(stream))
|
||
}
|
||
}
|
||
|
||
if let file = part.file {
|
||
Divider().overlay(Color.flixySeparator).padding(.vertical, FlixySpacing.tight)
|
||
VStack(alignment: .leading, spacing: 2) {
|
||
Text("technical.file")
|
||
.font(.flixyCaption)
|
||
.foregroundStyle(Color.flixyTextMuted)
|
||
Text(file)
|
||
.font(.system(.caption, design: .monospaced))
|
||
.foregroundStyle(Color.flixyTextSecondary)
|
||
.textSelection(.enabled)
|
||
}
|
||
}
|
||
}
|
||
.padding(.top, FlixySpacing.snug)
|
||
} label: {
|
||
Text("technical.title")
|
||
.font(.flixyRowHeader)
|
||
.foregroundStyle(Color.flixyTextPrimary)
|
||
}
|
||
.tint(Color.flixyTextSecondary)
|
||
}
|
||
|
||
private func row(_ label: LocalizedStringKey, _ value: String) -> some View {
|
||
HStack(alignment: .top) {
|
||
Text(label)
|
||
.font(.flixyCaption)
|
||
.foregroundStyle(Color.flixyTextMuted)
|
||
Spacer()
|
||
Text(value)
|
||
.font(.flixyCaption)
|
||
.foregroundStyle(Color.flixyTextSecondary)
|
||
.multilineTextAlignment(.trailing)
|
||
}
|
||
}
|
||
|
||
private func trackLabel(_ stream: MediaStream) -> String {
|
||
stream.displayTitle ?? [stream.language, stream.codec?.uppercased()]
|
||
.compactMap(\.self)
|
||
.joined(separator: " · ")
|
||
}
|
||
|
||
private var playbackMethodLabel: String {
|
||
switch decision.method {
|
||
case .directPlay:
|
||
String(localized: "technical.directPlayNative")
|
||
// **Zwei Fälle unter einem Namen wären eine Lüge.** Umgepackt bleibt
|
||
// das Bild unberührt — der Ton nur dann, wenn AVPlayer ihn kennt.
|
||
case .remux:
|
||
decision.rationale.contains { if case .audioCodecUnsupported = $0 { true } else { false } }
|
||
? String(localized: "technical.remuxAudio")
|
||
: String(localized: "technical.remux")
|
||
case .transcode:
|
||
String(localized: "technical.transcode")
|
||
}
|
||
}
|
||
|
||
/// Der erste Grund, der gegen den Systemplayer sprach — mehrere
|
||
/// aufzuzählen hilft niemandem, es reicht einer.
|
||
private var rationaleLabel: String? {
|
||
for reason in decision.rationale {
|
||
switch reason {
|
||
case .containerUnsupported(let container):
|
||
return String(localized: "technical.reason.container \(container.uppercased())")
|
||
case .videoCodecUnsupported(let codec):
|
||
return String(localized: "technical.reason.videoCodec \(codec.uppercased())")
|
||
case .audioCodecUnsupported(let codec):
|
||
return String(localized: "technical.reason.audioCodec \(codec.uppercased())")
|
||
case .streamsUnknown:
|
||
return String(localized: "technical.reason.unanalyzed")
|
||
case .qualityChosen:
|
||
return String(localized: "technical.reason.chosen")
|
||
case .nativelySupported, .bitrateExceedsLimit, .transcodingUnavailable:
|
||
continue
|
||
}
|
||
}
|
||
return nil
|
||
}
|
||
}
|