Skip to content

Commit

Permalink
add video type #528
Browse files Browse the repository at this point in the history
  • Loading branch information
kingslay committed Nov 13, 2023
1 parent 957383c commit af9da4b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion FFmpegKit
15 changes: 15 additions & 0 deletions Sources/KSPlayer/AVPlayer/PlayerDefines.swift
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,21 @@ public enum DynamicRange: Int32 {
#endif
}

extension DynamicRange: CustomStringConvertible {
public var description: String {
switch self {
case .sdr:
return "SDR"
case .hdr10:
return "HDR10"
case .hlg:
return "HDR"
case .dolbyVision:
return "Dolby Vision"
}
}
}

extension DynamicRange {
var colorPrimaries: CFString {
switch self {
Expand Down
2 changes: 1 addition & 1 deletion Sources/KSPlayer/MEPlayer/MEPlayerItem.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ final class MEPlayerItem {
lazy var dynamicInfo = DynamicInfo { [weak self] in
toDictionary(self?.formatCtx?.pointee.metadata)
} bytesRead: { [weak self] in
self?.formatCtx?.pointee.pb.pointee.bytes_read ?? 0
self?.formatCtx?.pointee.pb?.pointee.bytes_read ?? 0
} audioBitrate: { [weak self] in
Int(8 * (self?.audioTrack?.bitrate ?? 0))
} videoBitrate: { [weak self] in
Expand Down
3 changes: 2 additions & 1 deletion Sources/KSPlayer/SwiftUI/KSVideoPlayerView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -503,8 +503,9 @@ struct VideoSettingView: View {
Text(track.description).tag(track.trackID as Int32?)
}
} label: {
Label("Video track", systemImage: "video.fill")
Label("Video Track", systemImage: "video.fill")
}
LabeledContent("Video Type", value: (videoTracks.first { $0.isEnabled }?.dynamicRange ?? .sdr).description)
}
Picker(selection: Binding {
subtitleModel.selectedSubtitleInfo?.subtitleID
Expand Down

0 comments on commit af9da4b

Please sign in to comment.