Skip to content

Commit

Permalink
Migration mediaType.
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed Apr 6, 2024
1 parent 850fadc commit 134d64e
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 35 deletions.
2 changes: 1 addition & 1 deletion Examples/iOS/Preference.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
struct Preference {
static var defaultInstance = Preference()

var uri: String? = "rtmp://192.168.1.4/live"
var uri: String? = "rtmp://192.168.1.10/live"
var streamName: String? = "live"
}
4 changes: 0 additions & 4 deletions HaishinKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
291619661E7EFB09009FB344 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 291619621E7EFA2A009FB344 /* Main.storyboard */; };
291619691E7EFEA8009FB344 /* CameraIngestViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291619671E7EFE4E009FB344 /* CameraIngestViewController.swift */; };
2916196A1E7EFF38009FB344 /* Preference.swift in Sources */ = {isa = PBXBuildFile; fileRef = 291468161E581C7D00E619BA /* Preference.swift */; };
2916196C1E7F0768009FB344 /* CMFormatDescription+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2916196B1E7F0768009FB344 /* CMFormatDescription+Extension.swift */; };
2917CB662104CA2800F6823A /* AudioSpecificConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2917CB652104CA2800F6823A /* AudioSpecificConfigTests.swift */; };
291F4E381CF206E600F59C51 /* Icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 291F4E361CF206E200F59C51 /* Icon.png */; };
2923A1F31D63004E0019FBCD /* VisualEffect.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2965436A1D62FEB700734698 /* VisualEffect.swift */; };
Expand Down Expand Up @@ -465,7 +464,6 @@
2915EC531D85BDF100621092 /* ReplayKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = ReplayKit.framework; path = System/Library/Frameworks/ReplayKit.framework; sourceTree = SDKROOT; };
291619631E7EFA2A009FB344 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = "<group>"; };
291619671E7EFE4E009FB344 /* CameraIngestViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = CameraIngestViewController.swift; sourceTree = "<group>"; };
2916196B1E7F0768009FB344 /* CMFormatDescription+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "CMFormatDescription+Extension.swift"; sourceTree = "<group>"; };
2917CB652104CA2800F6823A /* AudioSpecificConfigTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AudioSpecificConfigTests.swift; sourceTree = "<group>"; };
291F4E361CF206E200F59C51 /* Icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Icon.png; sourceTree = "<group>"; };
29205CBD1E461F4E009D3FFF /* Main.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = Main.storyboard; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1173,7 +1171,6 @@
BC2828AE2AA322E400741013 /* AVFrameRateRange+Extension.swift */,
29EA87E51E79A2780043A5F8 /* CMAudioFormatDescription+Extension.swift */,
29EA87E91E79A3B70043A5F8 /* CMBlockBuffer+Extension.swift */,
2916196B1E7F0768009FB344 /* CMFormatDescription+Extension.swift */,
29EA87DE1E79A0810043A5F8 /* CMSampleBuffer+Extension.swift */,
BC04A2D52AD2D95500C87A3E /* CMTime+Extension.swift */,
29EA87E11E79A1E90043A5F8 /* CMVideoFormatDescription+Extension.swift */,
Expand Down Expand Up @@ -1886,7 +1883,6 @@
BC7C56B7299E579F00C41A9B /* AudioCodecSettings.swift in Sources */,
29B876AC1CD70B2800FC07DA /* AMF3Serializer.swift in Sources */,
BC31DBD22A653D1600C4DEA3 /* IOAudioMonitor.swift in Sources */,
2916196C1E7F0768009FB344 /* CMFormatDescription+Extension.swift in Sources */,
BCB976DF26107B5600C9A649 /* TSField.swift in Sources */,
BC11024A2925147300D48035 /* IOCaptureUnit.swift in Sources */,
29B876921CD70AFE00FC07DA /* IOMixer.swift in Sources */,
Expand Down
6 changes: 3 additions & 3 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import PackageDescription
let package = Package(
name: "HaishinKit",
platforms: [
.iOS(.v12),
.tvOS(.v12),
.iOS(.v13),
.tvOS(.v13),
.visionOS(.v1),
.macOS(.v10_13),
.macOS(.v10_15),
.macCatalyst(.v14)
],
products: [
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,8 +136,8 @@ open HaishinKit.xcodeproj
### OS
|-|iOS|tvOS|macOS|visionOS|watchOS|
|:----|:----:|:----:|:----:|:----:|:----:|
|HaishinKit|12.0+|12.0+|10.13+|1.0+|-|
|SRTHaishinKit|12.0+|-|13.0+|-|-|
|HaishinKit|13.0+|13.0+|10.15+|1.0+|-|
|SRTHaishinKit|13.0+|-|13.0+|-|-|

### Cocoa Keys
Please contains Info.plist.
Expand Down
2 changes: 1 addition & 1 deletion Sources/Codec/VideoCodec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ final class VideoCodec<T: VideoCodecDelegate> {
var attributes: [NSString: AnyObject] = [:]
if let inputFormat {
// Specify the pixel format of the uncompressed video.
attributes[kCVPixelBufferPixelFormatTypeKey] = inputFormat._mediaSubType as CFNumber
attributes[kCVPixelBufferPixelFormatTypeKey] = inputFormat.mediaType.rawValue as CFNumber
}
return attributes.isEmpty ? nil : attributes
case .decompression:
Expand Down
9 changes: 1 addition & 8 deletions Sources/Extension/AVCaptureDevice.Format+Extension.swift
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import AVFoundation
import Foundation

#if os(iOS)
extension AVCaptureDevice.Format {
@available(iOS, obsoleted: 13.0)
var isMultiCamSupported: Bool {
return false
}
}
#elseif os(macOS)
#if os(macOS)
extension AVCaptureDevice.Format {
var isMultiCamSupported: Bool {
return true
Expand Down
12 changes: 0 additions & 12 deletions Sources/Extension/CMFormatDescription+Extension.swift

This file was deleted.

6 changes: 3 additions & 3 deletions Sources/IO/IOStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -364,12 +364,12 @@ open class IOStream: NSObject {
/// Append a CMSampleBuffer.
/// - Warning: This method can't use attachCamera or attachAudio method at the same time.
public func append(_ sampleBuffer: CMSampleBuffer, channel: UInt8 = 0) {
switch sampleBuffer.formatDescription?._mediaType {
case kCMMediaType_Audio:
switch sampleBuffer.formatDescription?.mediaType {
case .audio?:
mixer.audioIO.lockQueue.async {
self.mixer.audioIO.append(sampleBuffer, channel: channel)
}
case kCMMediaType_Video:
case .video?:
mixer.videoIO.lockQueue.async {
self.mixer.videoIO.append(sampleBuffer, channel: channel)
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/IO/IOStreamRecorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public final class IOStreamRecorder {
guard isRunning.value else {
return
}
let mediaType: AVMediaType = (sampleBuffer.formatDescription?._mediaType == kCMMediaType_Video) ? .video : .audio
let mediaType: AVMediaType = (sampleBuffer.formatDescription?.mediaType == .video) ? .video : .audio
lockQueue.async {
guard
let writer = self.writer,
Expand Down

0 comments on commit 134d64e

Please sign in to comment.