diff --git a/HaishinKit.podspec b/HaishinKit.podspec index e512819a1..e598d2a8b 100644 --- a/HaishinKit.podspec +++ b/HaishinKit.podspec @@ -1,9 +1,9 @@ Pod::Spec.new do |s| s.name = "HaishinKit" - s.version = "1.5.7" + s.version = "1.6.0" s.summary = "Camera and Microphone streaming library via RTMP, HLS for iOS, macOS and tvOS." - s.swift_version = "5.7" + s.swift_version = "5.8" s.description = <<-DESC HaishinKit. Camera and Microphone streaming library via RTMP, HLS for iOS, macOS and tvOS. @@ -15,16 +15,16 @@ Pod::Spec.new do |s| s.authors = { "shogo4405" => "shogo4405@gmail.com" } s.source = { :git => "https://github.com/shogo4405/HaishinKit.swift.git", :tag => "#{s.version}" } - s.ios.deployment_target = "11.0" + s.ios.deployment_target = "12.0" s.ios.source_files = "Platforms/iOS/*.{h,swift}" s.osx.deployment_target = "10.13" s.osx.source_files = "Platforms/iOS/*.{h,swift}" - s.tvos.deployment_target = "11.0" + s.tvos.deployment_target = "12.0" s.tvos.source_files = "Platforms/iOS/*.{h,swift}" s.source_files = "Sources/**/*.swift" - s.dependency 'Logboard', '~> 2.3.1' + s.dependency 'Logboard', '~> 2.4.1' end diff --git a/HaishinKit.xcodeproj/project.pbxproj b/HaishinKit.xcodeproj/project.pbxproj index 32c6ad1e3..fc9cf9273 100644 --- a/HaishinKit.xcodeproj/project.pbxproj +++ b/HaishinKit.xcodeproj/project.pbxproj @@ -138,6 +138,7 @@ 2EC97B7327880FF400D8BE32 /* Views.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EC97B6F27880FF400D8BE32 /* Views.swift */; }; 2EC97B7427880FF400D8BE32 /* MTHKSwiftUiView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2EC97B7027880FF400D8BE32 /* MTHKSwiftUiView.swift */; }; BC0394562AA8A384006EDE38 /* Logboard.xcframework in Frameworks */ = {isa = PBXBuildFile; fileRef = BC34DFD125EBB12C005F975A /* Logboard.xcframework */; }; + BC03945F2AA8AFF5006EDE38 /* ExpressibleByIntegerLiteral+ExtensionTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC03945E2AA8AFF5006EDE38 /* ExpressibleByIntegerLiteral+ExtensionTests.swift */; }; BC0BF4F22985FA9000D72CB4 /* HaishinKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2945CBBD1B4BE66000104112 /* HaishinKit.framework */; }; BC0BF4F529866FDE00D72CB4 /* IOMixerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC0BF4F429866FDE00D72CB4 /* IOMixerTests.swift */; }; BC0D236D26331BAB001DDA0C /* DataBuffer.swift in Sources */ = {isa = PBXBuildFile; fileRef = BC0D236C26331BAB001DDA0C /* DataBuffer.swift */; }; @@ -527,6 +528,7 @@ 2EC97B6E27880FF400D8BE32 /* OnTapGestureView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = OnTapGestureView.swift; sourceTree = ""; }; 2EC97B6F27880FF400D8BE32 /* Views.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Views.swift; sourceTree = ""; }; 2EC97B7027880FF400D8BE32 /* MTHKSwiftUiView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MTHKSwiftUiView.swift; sourceTree = ""; }; + BC03945E2AA8AFF5006EDE38 /* ExpressibleByIntegerLiteral+ExtensionTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ExpressibleByIntegerLiteral+ExtensionTests.swift"; sourceTree = ""; }; BC0BF4F429866FDE00D72CB4 /* IOMixerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IOMixerTests.swift; sourceTree = ""; }; BC0D236C26331BAB001DDA0C /* DataBuffer.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = DataBuffer.swift; sourceTree = ""; }; BC11023D2917C35B00D48035 /* CVPixelBufferPool+Extension.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CVPixelBufferPool+Extension.swift"; sourceTree = ""; }; @@ -959,16 +961,17 @@ 29798E5A1CE60E5300F5CBD0 /* Tests */ = { isa = PBXGroup; children = ( + 29798E5D1CE60E5300F5CBD0 /* Info.plist */, + 295018211FFA1C9D00358E10 /* CMAudioSampleBufferTestUtil.swift */, + 294637A71EC89BC9008EEC71 /* Config.swift */, 291C2AD11CE9FF3E006F042B /* Asset */, 295018191FFA196800358E10 /* Codec */, - 294637A71EC89BC9008EEC71 /* Config.swift */, 291C2AD21CE9FF48006F042B /* Core */, + BC03945D2AA8AFDD006EDE38 /* Extension */, BC1DC5022A02893600E928ED /* FLV */, - 29798E5D1CE60E5300F5CBD0 /* Info.plist */, BC0BF4F329866FB700D72CB4 /* Media */, 291C2ACF1CE9FF2B006F042B /* MPEG */, 291C2ACE1CE9FF25006F042B /* RTMP */, - 295018211FFA1C9D00358E10 /* CMAudioSampleBufferTestUtil.swift */, 291C2AD01CE9FF33006F042B /* Util */, ); path = Tests; @@ -1133,6 +1136,14 @@ path = View; sourceTree = ""; }; + BC03945D2AA8AFDD006EDE38 /* Extension */ = { + isa = PBXGroup; + children = ( + BC03945E2AA8AFF5006EDE38 /* ExpressibleByIntegerLiteral+ExtensionTests.swift */, + ); + path = Extension; + sourceTree = ""; + }; BC0BF4F329866FB700D72CB4 /* Media */ = { isa = PBXGroup; children = ( @@ -1810,6 +1821,7 @@ BCCBCE9B29A9D96A0095B51C /* NALUnitReaderTests.swift in Sources */, 290EA8A11DFB61B100053022 /* RTMPChunkTests.swift in Sources */, 290EA89F1DFB61B100053022 /* AMF0SerializerTests.swift in Sources */, + BC03945F2AA8AFF5006EDE38 /* ExpressibleByIntegerLiteral+ExtensionTests.swift in Sources */, 290EA8AA1DFB61E700053022 /* CRC32Tests.swift in Sources */, 035AFA042263868E009DD0BB /* RTMPStreamTests.swift in Sources */, 290686031DFDB7A7008EB7ED /* RTMPConnectionTests.swift in Sources */, diff --git a/Sources/Extension/ExpressibleByIntegerLiteral+Extension.swift b/Sources/Extension/ExpressibleByIntegerLiteral+Extension.swift index f28be0e61..18e73618b 100644 --- a/Sources/Extension/ExpressibleByIntegerLiteral+Extension.swift +++ b/Sources/Extension/ExpressibleByIntegerLiteral+Extension.swift @@ -2,8 +2,9 @@ import Foundation extension ExpressibleByIntegerLiteral { var data: Data { - var value: Self = self - return Data(bytes: &value, count: MemoryLayout.size) + return withUnsafePointer(to: self) { value in + return Data(bytes: UnsafeRawPointer(value), count: MemoryLayout.size) + } } init(data: Data) { diff --git a/Tests/Extension/ExpressibleByIntegerLiteral+ExtensionTests.swift b/Tests/Extension/ExpressibleByIntegerLiteral+ExtensionTests.swift new file mode 100644 index 000000000..4f4b43ba1 --- /dev/null +++ b/Tests/Extension/ExpressibleByIntegerLiteral+ExtensionTests.swift @@ -0,0 +1,30 @@ +import Foundation +import XCTest + +@testable import HaishinKit + +final class ExpressibleByIntegerLiteralTests: XCTestCase { + func testInt32() { + XCTAssertEqual(Int32.min.bigEndian.data, Data([128, 0, 0, 0])) + XCTAssertEqual(Int32(32).bigEndian.data, Data([0, 0, 0, 32])) + XCTAssertEqual(Int32.max.bigEndian.data, Data([127, 255, 255, 255])) + } + + func testUInt32() { + XCTAssertEqual(UInt32.min.bigEndian.data, Data([0, 0, 0, 0])) + XCTAssertEqual(UInt32(32).bigEndian.data, Data([0, 0, 0, 32])) + XCTAssertEqual(UInt32.max.bigEndian.data, Data([255, 255, 255, 255])) + } + + func testInt64() { + XCTAssertEqual(Int64.min.bigEndian.data, Data([128, 0, 0, 0, 0, 0, 0, 0])) + XCTAssertEqual(Int64(32).bigEndian.data, Data([0, 0, 0, 0, 0, 0, 0, 32])) + XCTAssertEqual(Int64.max.bigEndian.data, Data([127,255,255, 255, 255, 255, 255, 255])) + } + + func testUInt64() { + XCTAssertEqual(UInt64.min.bigEndian.data, Data([0, 0, 0, 0, 0, 0, 0, 0])) + XCTAssertEqual(UInt64(32).bigEndian.data, Data([0, 0, 0, 0, 0, 0, 0, 32])) + XCTAssertEqual(UInt64.max.bigEndian.data, Data([255, 255, 255, 255, 255, 255, 255, 255])) + } +}