Skip to content

Commit

Permalink
Refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
eerimoq committed Apr 20, 2024
1 parent e45f60f commit a1e1e79
Show file tree
Hide file tree
Showing 9 changed files with 2 additions and 40 deletions.
4 changes: 0 additions & 4 deletions Moblin.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@
0359F8B22BD3DA61005BFDA8 /* VTSessionOption.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359F8142BD3DA5F005BFDA8 /* VTSessionOption.swift */; };
0359F8B32BD3DA61005BFDA8 /* AudioStreamBasicDescription+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359F8162BD3DA5F005BFDA8 /* AudioStreamBasicDescription+Extension.swift */; };
0359F8B42BD3DA61005BFDA8 /* AVAudioPCMBuffer+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359F8172BD3DA5F005BFDA8 /* AVAudioPCMBuffer+Extension.swift */; };
0359F8B52BD3DA61005BFDA8 /* AVAudioTime+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359F8182BD3DA5F005BFDA8 /* AVAudioTime+Extension.swift */; };
0359F8B62BD3DA61005BFDA8 /* AVCaptureDevice.Format+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359F8192BD3DA5F005BFDA8 /* AVCaptureDevice.Format+Extension.swift */; };
0359F8B72BD3DA61005BFDA8 /* AVCaptureDevice+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359F81A2BD3DA5F005BFDA8 /* AVCaptureDevice+Extension.swift */; };
0359F8B82BD3DA61005BFDA8 /* AVCaptureSession.Preset+Extension.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0359F81B2BD3DA5F005BFDA8 /* AVCaptureSession.Preset+Extension.swift */; };
Expand Down Expand Up @@ -443,7 +442,6 @@
0359F8142BD3DA5F005BFDA8 /* VTSessionOption.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = VTSessionOption.swift; sourceTree = "<group>"; };
0359F8162BD3DA5F005BFDA8 /* AudioStreamBasicDescription+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AudioStreamBasicDescription+Extension.swift"; sourceTree = "<group>"; };
0359F8172BD3DA5F005BFDA8 /* AVAudioPCMBuffer+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AVAudioPCMBuffer+Extension.swift"; sourceTree = "<group>"; };
0359F8182BD3DA5F005BFDA8 /* AVAudioTime+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AVAudioTime+Extension.swift"; sourceTree = "<group>"; };
0359F8192BD3DA5F005BFDA8 /* AVCaptureDevice.Format+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AVCaptureDevice.Format+Extension.swift"; sourceTree = "<group>"; };
0359F81A2BD3DA5F005BFDA8 /* AVCaptureDevice+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AVCaptureDevice+Extension.swift"; sourceTree = "<group>"; };
0359F81B2BD3DA5F005BFDA8 /* AVCaptureSession.Preset+Extension.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "AVCaptureSession.Preset+Extension.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1093,7 +1091,6 @@
children = (
0359F8162BD3DA5F005BFDA8 /* AudioStreamBasicDescription+Extension.swift */,
0359F8172BD3DA5F005BFDA8 /* AVAudioPCMBuffer+Extension.swift */,
0359F8182BD3DA5F005BFDA8 /* AVAudioTime+Extension.swift */,
0359F8192BD3DA5F005BFDA8 /* AVCaptureDevice.Format+Extension.swift */,
0359F81A2BD3DA5F005BFDA8 /* AVCaptureDevice+Extension.swift */,
0359F81B2BD3DA5F005BFDA8 /* AVCaptureSession.Preset+Extension.swift */,
Expand Down Expand Up @@ -2167,7 +2164,6 @@
0359F8F52BD3DA61005BFDA8 /* RTMPStreamInfo.swift in Sources */,
0359F8C12BD3DA61005BFDA8 /* ExpressibleByIntegerLiteral+Extension.swift in Sources */,
0325D0BE2BB3DDD6007EE85B /* KickChannel.swift in Sources */,
0359F8B52BD3DA61005BFDA8 /* AVAudioTime+Extension.swift in Sources */,
0359F8AC2BD3DA61005BFDA8 /* AudioCodecOutputSettings.swift in Sources */,
035D37282AB0EBB500045B92 /* IconAndTextView.swift in Sources */,
0359F8AB2BD3DA61005BFDA8 /* AudioCodec.swift in Sources */,
Expand Down
11 changes: 0 additions & 11 deletions Moblin/HaishinKit/Sources/Extension/AVAudioTime+Extension.swift

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ import AVFoundation
import Foundation

extension AVFrameRateRange {
func clamp(rate: Float64) -> Float64 {
max(minFrameRate, min(maxFrameRate, rate))
}

func contains(frameRate: Float64) -> Bool {
(minFrameRate ... maxFrameRate) ~= frameRate
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,4 @@ extension CMBlockBuffer {
}
return Data(bytes: buffer!, count: length)
}

@discardableResult
func copyDataBytes(to buffer: UnsafeMutableRawPointer) -> OSStatus {
return CMBlockBufferCopyDataBytes(self, atOffset: 0, dataLength: dataLength, destination: buffer)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,4 @@ extension ExpressibleByIntegerLiteral {
var value: Self = self
return Data(bytes: &value, count: MemoryLayout<Self>.size)
}

init(data: Slice<Data>) {
self.init(data: Data(data))
}
}
2 changes: 1 addition & 1 deletion Moblin/HaishinKit/Sources/FLV/FLVAudioCodec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ enum FLVAudioCodec: UInt8 {
}
}

public var headerSize: Int {
var headerSize: Int {
switch self {
case .aac:
return 2
Expand Down
9 changes: 0 additions & 9 deletions Moblin/HaishinKit/Sources/MPEG/ADTS.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@ struct ADTSHeader: Equatable {
var profile: UInt8 = 0
var sampleFrequencyIndex: UInt8 = 0
var channelConfiguration: UInt8 = 0
var originalOrCopy = false
var home = false
var copyrightIdBit = false
var copyrightIdStart = false
var aacFrameLength: UInt16 = 0

init() {}

Expand Down Expand Up @@ -65,12 +61,7 @@ struct ADTSHeader: Equatable {
profile = newValue[2] >> 6 & 0b11
sampleFrequencyIndex = (newValue[2] >> 2) & 0b0000_1111
channelConfiguration = ((newValue[2] & 0b1) << 2) | newValue[3] >> 6
originalOrCopy = (newValue[3] & 0b0010_0000) == 0b0010_0000
home = (newValue[3] & 0b0001_0000) == 0b0001_0000
copyrightIdBit = (newValue[3] & 0b0000_1000) == 0b0000_1000
copyrightIdStart = (newValue[3] & 0b0000_0100) == 0b0000_0100
aacFrameLength = UInt16(newValue[3] & 0b0000_0011) << 11 | UInt16(newValue[4]) << 3 |
UInt16(newValue[5] >> 5)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ struct AVCDecoderConfigurationRecord: DecoderConfigurationRecord {
self.data = data
}

public func makeFormatDescription(_ formatDescriptionOut: UnsafeMutablePointer<CMFormatDescription?>)
func makeFormatDescription(_ formatDescriptionOut: UnsafeMutablePointer<CMFormatDescription?>)
-> OSStatus
{
return pictureParameterSets[0].withUnsafeBytes { (ppsBuffer: UnsafeRawBufferPointer) -> OSStatus in
Expand Down
1 change: 0 additions & 1 deletion Moblin/HaishinKit/Sources/Media/IOVideoUnit.swift
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,6 @@ public final class IOVideoUnit: NSObject {

lazy var codec: VideoCodec = .init(lockQueue: lockQueue)
weak var mixer: IOMixer?
var muted = false
private var effects: [VideoEffect] = []
private var pendingAfterAttachEffects: [VideoEffect]?

Expand Down

0 comments on commit a1e1e79

Please sign in to comment.