Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
kingslay committed Jan 1, 2024
2 parents 971ac8c + 5641049 commit 529da92
Show file tree
Hide file tree
Showing 54 changed files with 1,233 additions and 777 deletions.
1 change: 1 addition & 0 deletions Demo/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ workspace 'Demo.xcworkspace'
install! 'cocoapods', :generate_multiple_pod_projects => true
def common
pod 'KSPlayer', :path => '../', :testspecs => ['Tests']
pod 'DisplayCriteria', :path => '../'
pod 'Libass', :path => '../FFmpegKit'
pod 'OpenSSL', :path => '../FFmpegKit'
pod 'FFmpegKit', :path => '../FFmpegKit'
Expand Down
6 changes: 0 additions & 6 deletions Demo/SwiftUI/Player.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
/* End PBXBuildFile section */

/* Begin PBXFileReference section */
AC3CAD6228BB88A200AA1C2C /* AVDisplayCriteriaKS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AVDisplayCriteriaKS.h; sourceTree = "<group>"; };
AC3CAD6328BB893500AA1C2C /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; };
AC43F6402A5172830026ECF2 /* FavoriteView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FavoriteView.swift; sourceTree = "<group>"; };
AC43F6432A51916F0026ECF2 /* Model.xcdatamodel */ = {isa = PBXFileReference; lastKnownFileType = wrapper.xcdatamodel; path = Model.xcdatamodel; sourceTree = "<group>"; };
AC43F6652A519D400026ECF2 /* Persistence.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Persistence.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -70,8 +68,6 @@
AC77DFAF26402327001351AE /* Shared */ = {
isa = PBXGroup;
children = (
AC3CAD6228BB88A200AA1C2C /* AVDisplayCriteriaKS.h */,
AC3CAD6328BB893500AA1C2C /* Bridging-Header.h */,
ACEA9FEA298BFC8800FBA74B /* MovieModel.swift */,
AC44E0F929290CBB00617BD3 /* HomeView.swift */,
AC44E0FA29290CBC00617BD3 /* ContentView.swift */,
Expand Down Expand Up @@ -368,7 +364,6 @@
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_OBJC_BRIDGING_HEADER = "Shared/Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,6,7";
};
Expand Down Expand Up @@ -411,7 +406,6 @@
SUPPORTS_MACCATALYST = YES;
SUPPORTS_MAC_DESIGNED_FOR_IPHONE_IPAD = NO;
SUPPORTS_XR_DESIGNED_FOR_IPHONE_IPAD = NO;
SWIFT_OBJC_BRIDGING_HEADER = "Shared/Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = "1,2,3,6,7";
VALIDATE_PRODUCT = YES;
Expand Down
12 changes: 0 additions & 12 deletions Demo/SwiftUI/Shared/Bridging-Header.h

This file was deleted.

29 changes: 1 addition & 28 deletions Demo/SwiftUI/Shared/MovieModel.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,24 +28,6 @@ class MEOptions: KSOptions {
super.process(assetTrack: assetTrack)
}

override func updateVideo(refreshRate: Float, isDovi: Bool, formatDescription: CMFormatDescription?) {
#if os(tvOS) || os(xrOS)
guard let displayManager = UIApplication.shared.windows.first?.avDisplayManager,
displayManager.isDisplayCriteriaMatchingEnabled
else {
return
}
if let formatDescription {
if KSOptions.displayCriteriaFormatDescriptionEnabled, #available(tvOS 17.0, *) {
displayManager.preferredDisplayCriteria = AVDisplayCriteria(refreshRate: refreshRate, formatDescription: formatDescription)
} else {
let dynamicRange = isDovi ? .dolbyVision : formatDescription.dynamicRange
displayManager.preferredDisplayCriteria = AVDisplayCriteria(refreshRate: refreshRate, videoDynamicRange: dynamicRange.rawValue)
}
}
#endif
}

override func isUseDisplayLayer() -> Bool {
MEOptions.isUseDisplayLayer && display == .plane
}
Expand Down Expand Up @@ -335,15 +317,6 @@ extension KSVideoPlayerView {
}
playmodel.save()
model.save()
self.init(url: url, options: options, title: model.name) { layer in
if let layer {
playmodel.duration = Int16(layer.player.duration)
if playmodel.duration > 0 {
playmodel.current = Int16(layer.player.currentPlaybackTime)
}
playmodel.save()
model.save()
}
}
self.init(url: url, options: options, title: model.name)
}
}
6 changes: 0 additions & 6 deletions Demo/demo-tvOS/demo-tvOS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@

/* Begin PBXFileReference section */
055202483CC6922E098C6565 /* Pods-demo-tvOS.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-demo-tvOS.debug.xcconfig"; path = "../Pods/Target Support Files/Pods-demo-tvOS/Pods-demo-tvOS.debug.xcconfig"; sourceTree = "<group>"; };
06D08BDA294DDA7400D919DB /* AVDisplayCriteriaKS.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AVDisplayCriteriaKS.h; sourceTree = "<group>"; };
06D08BDB294DDA9900D919DB /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = "<group>"; };
AC08611420B69A1C00D801FC /* demo-tvOS.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "demo-tvOS.app"; sourceTree = BUILT_PRODUCTS_DIR; };
AC08611E20B69A1C00D801FC /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = "<group>"; };
AC08612020B69A1C00D801FC /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
Expand Down Expand Up @@ -78,8 +76,6 @@
AC08611E20B69A1C00D801FC /* Assets.xcassets */,
AC80333124BA1B54002B3D40 /* Main.storyboard */,
AC08612020B69A1C00D801FC /* Info.plist */,
06D08BDA294DDA7400D919DB /* AVDisplayCriteriaKS.h */,
06D08BDB294DDA9900D919DB /* Bridging-Header.h */,
);
path = "demo-tvOS";
sourceTree = "<group>";
Expand Down Expand Up @@ -362,7 +358,6 @@
PRODUCT_BUNDLE_IDENTIFIER = kintan.player.demo.tvos;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_OBJC_BRIDGING_HEADER = "demo-tvOS/Bridging-Header.h";
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
Expand All @@ -388,7 +383,6 @@
OTHER_CODE_SIGN_FLAGS = "--deep";
PRODUCT_BUNDLE_IDENTIFIER = kintan.player.demo.tvos;
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "demo-tvOS/Bridging-Header.h";
SWIFT_VERSION = 5.0;
TARGETED_DEVICE_FAMILY = 3;
};
Expand Down
21 changes: 0 additions & 21 deletions Demo/demo-tvOS/demo-tvOS/AVDisplayCriteriaKS.h

This file was deleted.

12 changes: 0 additions & 12 deletions Demo/demo-tvOS/demo-tvOS/Bridging-Header.h

This file was deleted.

22 changes: 22 additions & 0 deletions DisplayCriteria.podspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
Pod::Spec.new do |s|
s.name = 'DisplayCriteria'
s.version = '1.1.0'
s.summary = 'Video Player Using Swift, based on AVPlayer,FFmpeg'

s.description = <<-DESC
Video Player Using Swift, based on ffmpeg, support for the horizontal screen, vertical screen, the upper and lower slide to adjust the volume, the screen brightness, or so slide to adjust the playback progress.
DESC

s.homepage = 'https://github.com/kingslay/KSPlayer'
s.authors = { 'kintan' => 'kingslay@icloud.com' }
s.license = 'MIT'
s.source = { :git => 'https://github.com/kingslay/KSPlayer.git', :tag => s.version.to_s }

s.ios.deployment_target = '13.0'
s.osx.deployment_target = '10.15'
# s.watchos.deployment_target = '2.0'
s.tvos.deployment_target = '13.0'
s.static_framework = true
s.source_files = 'Sources/DisplayCriteria/**/*'
s.frameworks = 'AVFoundation'
end
2 changes: 1 addition & 1 deletion FFmpegKit
Submodule FFmpegKit updated 3828 files
1 change: 1 addition & 0 deletions KSPlayer.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ Pod::Spec.new do |s|
ss.ios.frameworks = 'UIKit'
ss.tvos.frameworks = 'UIKit'
ss.osx.frameworks = 'AppKit'
ss.dependency 'DisplayCriteria'
end
#ffmpeg播放内核
s.subspec 'MEPlayer' do |ss|
Expand Down
16 changes: 12 additions & 4 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// swift-tools-version:5.7
// swift-tools-version:5.9
import Foundation
import PackageDescription
let package = Package(
name: "KSPlayer",
defaultLocalization: "en",
platforms: [.macOS(.v10_15),
// .visionOS(.v1),
.iOS(.v13), .tvOS(.v13)],
platforms: [.macOS(.v10_15), .macCatalyst(.v13), .iOS(.v13), .tvOS(.v13),
.visionOS(.v1)],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
Expand All @@ -24,17 +23,26 @@ let package = Package(
.product(name: "FFmpegKit", package: "FFmpegKit"),
// .product(name: "Libass", package: "FFmpegKit"),
// .product(name: "Libmpv", package: "FFmpegKit"),
"DisplayCriteria",
],
resources: [.process("Metal/Shaders.metal")]
),
.target(
name: "DisplayCriteria"
),
.testTarget(
name: "KSPlayerTests",
dependencies: ["KSPlayer"],
resources: [.process("Resources")]
),
]
)

var ffmpegKitPath = FileManager.default.currentDirectoryPath + "/FFmpegKit"
if !FileManager.default.fileExists(atPath: ffmpegKitPath) {
ffmpegKitPath = FileManager.default.currentDirectoryPath + "../FFmpegKit"
}

if !FileManager.default.fileExists(atPath: ffmpegKitPath) {
ffmpegKitPath = FileManager.default.currentDirectoryPath + "/KSPlayer/FFmpegKit"
}
Expand Down
59 changes: 0 additions & 59 deletions Package@swift-5.9.swift

This file was deleted.

3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ English | [简体中文](./README_CN.md)
- [x] De-interlace auto detect
- [x] Spatial Audio
- [x] 360° panorama video.
- [x] libsmbclient protocol

## Requirements

Expand Down Expand Up @@ -53,8 +54,8 @@ Make sure to use the latest version **cocoapods 1.10.1+**, which can be installe
target 'ProjectName' do
use_frameworks!
pod 'KSPlayer',:git => 'https://github.com/kingslay/KSPlayer.git', :branch => 'develop'
pod 'DisplayCriteria',:git => 'https://github.com/kingslay/KSPlayer.git', :branch => 'develop'
pod 'FFmpegKit',:git => 'https://github.com/kingslay/FFmpegKit.git', :branch => 'main'
pod 'OpenSSL',:git => 'https://github.com/kingslay/FFmpegKit.git', :branch => 'main'
pod 'Libass',:git => 'https://github.com/kingslay/FFmpegKit.git', :branch => 'main'
end
```
Expand Down
1 change: 1 addition & 0 deletions Sources/DisplayCriteria/DisplayCriteria.m
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,3 @@
@end
#endif
#endif /* AVDisplayCriteriaKS_h */

19 changes: 10 additions & 9 deletions Sources/KSPlayer/AVPlayer/KSAVPlayer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ public class KSAVPlayer {
public private(set) var duration: TimeInterval = 0
public private(set) var fileSize: Double = 0
public private(set) var playableTime: TimeInterval = 0
public let chapters: [Chapter] = []
public var playbackRate: Float = 1 {
didSet {
if playbackState == .playing {
Expand Down Expand Up @@ -511,12 +512,12 @@ class AVMediaPlayerTrack: MediaPlayerTrack {
let formatDescription: CMFormatDescription?
let description: String
private let track: AVPlayerItemTrack
let nominalFrameRate: Float
var nominalFrameRate: Float
let trackID: Int32
let rotation: Int16 = 0
let bitRate: Int64
let name: String
let language: String?
let languageCode: String?
let mediaType: AVFoundation.AVMediaType
let isImageSubtitle = false
var dovi: DOVIDecoderConfigurationRecord?
Expand All @@ -535,21 +536,21 @@ class AVMediaPlayerTrack: MediaPlayerTrack {
self.track = track
trackID = track.assetTrack?.trackID ?? 0
mediaType = track.assetTrack?.mediaType ?? .video
#if os(xrOS)
name = track.assetTrack?.languageCode ?? ""
language = track.assetTrack?.extendedLanguageTag
languageCode = track.assetTrack?.languageCode
nominalFrameRate = track.assetTrack?.nominalFrameRate ?? 24.0
bitRate = Int64(track.assetTrack?.estimatedDataRate ?? 0)
#if os(xrOS)
isPlayable = false
#else
name = track.assetTrack?.languageCode ?? ""
language = track.assetTrack?.extendedLanguageTag
nominalFrameRate = track.assetTrack?.nominalFrameRate ?? 24.0
bitRate = Int64(track.assetTrack?.estimatedDataRate ?? 0)
isPlayable = track.assetTrack?.isPlayable ?? false
#endif
// swiftlint:disable force_cast
formatDescription = (track.assetTrack?.formatDescriptions.first as! CMFormatDescription)
if let first = track.assetTrack?.formatDescriptions.first {
formatDescription = first as! CMFormatDescription
} else {
formatDescription = nil
}
// swiftlint:enable force_cast
description = (formatDescription?.mediaSubType ?? .boxed).rawValue.string
#if os(xrOS)
Expand Down
Loading

0 comments on commit 529da92

Please sign in to comment.