swiftlint autocorrect

This commit is contained in:
shogo4405 2020-01-13 14:18:41 +09:00
parent 93c19312b8
commit c412f7c45e
62 changed files with 172 additions and 172 deletions

View File

@ -5,6 +5,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
var window: UIWindow?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
return true
true
}
}

View File

@ -11,7 +11,7 @@ open class GLHKView: GLKView, NetStreamRenderer {
public static var defaultBackgroundColor: UIColor = .black
open var videoGravity: AVLayerVideoGravity = .resizeAspect
public var videoFormatDescription: CMVideoFormatDescription? {
return currentStream?.mixer.videoIO.formatDescription
currentStream?.mixer.videoIO.formatDescription
}
var position: AVCaptureDevice.Position = .back
var orientation: AVCaptureVideoOrientation = .portrait

View File

@ -7,11 +7,11 @@ open class HKView: UIView {
public static var defaultBackgroundColor: UIColor = .black
override open class var layerClass: AnyClass {
return AVCaptureVideoPreviewLayer.self
AVCaptureVideoPreviewLayer.self
}
override open var layer: AVCaptureVideoPreviewLayer {
return super.layer as! AVCaptureVideoPreviewLayer
super.layer as! AVCaptureVideoPreviewLayer
}
public var videoGravity: AVLayerVideoGravity = .resizeAspect {
@ -21,7 +21,7 @@ open class HKView: UIView {
}
public var videoFormatDescription: CMVideoFormatDescription? {
return currentStream?.mixer.videoIO.formatDescription
currentStream?.mixer.videoIO.formatDescription
}
var orientation: AVCaptureVideoOrientation = .portrait {

View File

@ -8,7 +8,7 @@ import MetalKit
open class MTHKView: MTKView, NetStreamRenderer {
public var videoGravity: AVLayerVideoGravity = .resizeAspect
public var videoFormatDescription: CMVideoFormatDescription? {
return currentStream?.mixer.videoIO.formatDescription
currentStream?.mixer.videoIO.formatDescription
}
var position: AVCaptureDevice.Position = .back

View File

@ -6,7 +6,7 @@ import Foundation
extension NetStream {
open var orientation: AVCaptureVideoOrientation {
get {
return mixer.videoIO.orientation
mixer.videoIO.orientation
}
set {
self.mixer.videoIO.orientation = newValue
@ -20,7 +20,7 @@ extension NetStream {
}
open var zoomFactor: CGFloat {
return self.mixer.videoIO.zoomFactor
self.mixer.videoIO.zoomFactor
}
open func setZoomFactor(_ zoomFactor: CGFloat, ramping: Bool = false, withRate: Float = 2.0) {

View File

@ -59,7 +59,7 @@ open class ScreenCaptureSession: NSObject {
}
}
private var scale: CGFloat {
return enabledScale ? UIScreen.main.scale : 1.0
enabledScale ? UIScreen.main.scale : 1.0
}
private var _pixelBufferPool: CVPixelBufferPool?

View File

@ -23,7 +23,7 @@ open class GLHKView: NSOpenGLView, NetStreamRenderer {
public var videoGravity: AVLayerVideoGravity = .resizeAspect
public var videoFormatDescription: CMVideoFormatDescription? {
return currentStream?.mixer.videoIO.formatDescription
currentStream?.mixer.videoIO.formatDescription
}
var position: AVCaptureDevice.Position = .front
var orientation: AVCaptureVideoOrientation = .portrait

View File

@ -11,7 +11,7 @@ open class HKView: NSView {
}
}
public var videoFormatDescription: CMVideoFormatDescription? {
return currentStream?.mixer.videoIO.formatDescription
currentStream?.mixer.videoIO.formatDescription
}
var position: AVCaptureDevice.Position = .front {

View File

@ -6,7 +6,7 @@ import MetalKit
open class MTHKView: MTKView, NetStreamRenderer {
public var videoGravity: AVLayerVideoGravity = .resizeAspect
public var videoFormatDescription: CMVideoFormatDescription? {
return currentStream?.mixer.videoIO.formatDescription
currentStream?.mixer.videoIO.formatDescription
}
var position: AVCaptureDevice.Position = .back

View File

@ -12,7 +12,7 @@ open class GLHKView: GLKView, NetStreamRenderer {
open var videoGravity: AVLayerVideoGravity = .resizeAspect
public var videoFormatDescription: CMVideoFormatDescription? {
return currentStream?.mixer.videoIO.formatDescription
currentStream?.mixer.videoIO.formatDescription
}
var displayImage: CIImage?
private weak var currentStream: NetStream? {

View File

@ -6,7 +6,7 @@ import MetalKit
open class MTHKView: MTKView, NetStreamRenderer {
public var videoGravity: AVLayerVideoGravity = .resizeAspect
public var videoFormatDescription: CMVideoFormatDescription? {
return currentStream?.mixer.videoIO.formatDescription
currentStream?.mixer.videoIO.formatDescription
}
var displayImage: CIImage?

View File

@ -50,7 +50,7 @@ final class H264Decoder {
var isBaseline = true
private var buffers: [CMSampleBuffer] = []
private var attributes: [NSString: AnyObject] {
return H264Decoder.defaultAttributes
H264Decoder.defaultAttributes
}
private var minimumGroupOfPictures: Int = H264Decoder.defaultMinimumGroupOfPictures
private(set) var status: OSStatus = noErr {

View File

@ -2,6 +2,6 @@ import CoreMedia
extension CMAudioFormatDescription {
var streamBasicDescription: UnsafePointer<AudioStreamBasicDescription>? {
return CMAudioFormatDescriptionGetStreamBasicDescription(self)
CMAudioFormatDescriptionGetStreamBasicDescription(self)
}
}

View File

@ -5,7 +5,7 @@ extension CMBlockBuffer {
@available(tvOS, obsoleted: 13.0)
@available(macOS, obsoleted: 10.15)
var dataLength: Int {
return CMBlockBufferGetDataLength(self)
CMBlockBufferGetDataLength(self)
}
var data: Data? {

View File

@ -3,6 +3,6 @@ import Foundation
extension CMFormatDescription {
func `extension`(by key: String) -> [String: AnyObject]? {
return CMFormatDescriptionGetExtension(self, extensionKey: key as CFString) as? [String: AnyObject]
CMFormatDescriptionGetExtension(self, extensionKey: key as CFString) as? [String: AnyObject]
}
}

View File

@ -3,7 +3,7 @@ import CoreMedia
extension CMSampleBuffer {
var isNotSync: Bool {
get {
return getAttachmentValue(for: kCMSampleAttachmentKey_NotSync) ?? false
getAttachmentValue(for: kCMSampleAttachmentKey_NotSync) ?? false
}
set {
setAttachmentValue(for: kCMSampleAttachmentKey_NotSync, value: newValue)
@ -15,7 +15,7 @@ extension CMSampleBuffer {
@available(macOS, obsoleted: 10.15)
var dataBuffer: CMBlockBuffer? {
get {
return CMSampleBufferGetDataBuffer(self)
CMSampleBufferGetDataBuffer(self)
}
set {
_ = newValue.map {
@ -28,42 +28,42 @@ extension CMSampleBuffer {
@available(tvOS, obsoleted: 13.0)
@available(macOS, obsoleted: 10.15)
var imageBuffer: CVImageBuffer? {
return CMSampleBufferGetImageBuffer(self)
CMSampleBufferGetImageBuffer(self)
}
@available(iOS, obsoleted: 13.0)
@available(tvOS, obsoleted: 13.0)
@available(macOS, obsoleted: 10.15)
var numSamples: CMItemCount {
return CMSampleBufferGetNumSamples(self)
CMSampleBufferGetNumSamples(self)
}
@available(iOS, obsoleted: 13.0)
@available(tvOS, obsoleted: 13.0)
@available(macOS, obsoleted: 10.15)
var duration: CMTime {
return CMSampleBufferGetDuration(self)
CMSampleBufferGetDuration(self)
}
@available(iOS, obsoleted: 13.0)
@available(tvOS, obsoleted: 13.0)
@available(macOS, obsoleted: 10.15)
var formatDescription: CMFormatDescription? {
return CMSampleBufferGetFormatDescription(self)
CMSampleBufferGetFormatDescription(self)
}
@available(iOS, obsoleted: 13.0)
@available(tvOS, obsoleted: 13.0)
@available(macOS, obsoleted: 10.15)
var decodeTimeStamp: CMTime {
return CMSampleBufferGetDecodeTimeStamp(self)
CMSampleBufferGetDecodeTimeStamp(self)
}
@available(iOS, obsoleted: 13.0)
@available(tvOS, obsoleted: 13.0)
@available(macOS, obsoleted: 10.15)
var presentationTimeStamp: CMTime {
return CMSampleBufferGetPresentationTimeStamp(self)
CMSampleBufferGetPresentationTimeStamp(self)
}
// swiftlint:disable discouraged_optional_boolean

View File

@ -6,7 +6,7 @@ extension CMVideoFormatDescription {
@available(tvOS, obsoleted: 13.0)
@available(macOS, obsoleted: 10.15)
var dimensions: CMVideoDimensions {
return CMVideoFormatDescriptionGetDimensions(self)
CMVideoFormatDescriptionGetDimensions(self)
}
static func create(pixelBuffer: CVPixelBuffer) -> CMVideoFormatDescription? {

View File

@ -3,10 +3,10 @@ import Foundation
extension CVPixelBuffer {
var width: Int {
return CVPixelBufferGetWidth(self)
CVPixelBufferGetWidth(self)
}
var height: Int {
return CVPixelBufferGetHeight(self)
CVPixelBufferGetHeight(self)
}
}

View File

@ -2,7 +2,7 @@ import Foundation
extension Data {
var bytes: [UInt8] {
return withUnsafeBytes {
withUnsafeBytes {
guard let pointer = $0.baseAddress?.assumingMemoryBound(to: UInt8.self) else {
return []
}

View File

@ -41,7 +41,7 @@ public protocol FLVTag: CustomDebugStringConvertible {
extension FLVTag {
var headerSize: Int {
return tagType.headerSize
tagType.headerSize
}
init?(data: Data) {
@ -61,7 +61,7 @@ extension FLVTag {
// MARK: CustomDebugStringConvertible
public var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -11,7 +11,7 @@ protocol HTTPRequestCompatible: CustomStringConvertible {
extension HTTPRequestCompatible {
// MARK: CustomStringConvertible
public var description: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -10,7 +10,7 @@ protocol HTTPResponseCompatible: CustomDebugStringConvertible {
extension HTTPResponseCompatible {
// MARK: CustomDebugStringConvertible
public var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -8,7 +8,7 @@ enum HTTPVersion: String {
extension HTTPVersion: CustomStringConvertible {
// MARK: CustomStringConvertible
var description: String {
return rawValue
rawValue
}
}
@ -156,20 +156,20 @@ enum HTTPStatusCode: Int {
extension HTTPStatusCode: CustomStringConvertible {
// MARK: CustomStringConvertible
var description: String {
return "\(rawValue) \(message)"
"\(rawValue) \(message)"
}
}
// MARK: -
open class HTTPService: NetService {
open class var type: String {
return "_http._tcp"
"_http._tcp"
}
open class var defaultPort: Int32 {
return 8080
8080
}
open class var defaultDocument: String {
return """
"""
<!DOCTYPE html>
<html>
<head>

View File

@ -61,7 +61,7 @@ struct AudioSpecificConfig {
}
func audioStreamBasicDescription() -> AudioStreamBasicDescription {
return AudioStreamBasicDescription(
AudioStreamBasicDescription(
mSampleRate: frequency.sampleRate,
mFormatID: kAudioFormatMPEG4AAC,
mFormatFlags: UInt32(type.rawValue),
@ -78,7 +78,7 @@ struct AudioSpecificConfig {
extension AudioSpecificConfig: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -71,7 +71,7 @@ struct AVCConfigurationRecord {
var sequenceParameterSetExt: [[UInt8]] = []
var naluLength: Int32 {
return Int32((lengthSizeMinusOneWithReserved >> 6) + 1)
Int32((lengthSizeMinusOneWithReserved >> 6) + 1)
}
init() {
@ -154,6 +154,6 @@ extension AVCConfigurationRecord: DataConvertible {
extension AVCConfigurationRecord: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -38,7 +38,7 @@ class MP4Box {
}
var leafNode: Bool {
return false
false
}
fileprivate(set) var type: String = "undf"
@ -64,7 +64,7 @@ class MP4Box {
}
func getBoxes(byName: String) -> [MP4Box] {
return []
[]
}
func clear() {
@ -82,7 +82,7 @@ class MP4Box {
extension MP4Box: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}
@ -91,7 +91,7 @@ class MP4ContainerBox: MP4Box {
fileprivate var children: [MP4Box] = []
override var leafNode: Bool {
return false
false
}
override func load(_ file: FileHandle) throws -> UInt32 {
@ -200,7 +200,7 @@ final class MP4TimeToSampleBox: MP4Box {
var sampleDuration: UInt32 = 0
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
init(sampleCount: UInt32, sampleDuration: UInt32) {
@ -437,7 +437,7 @@ final class MP4SampleToChunkBox: MP4Box {
var sampleDescriptionIndex: UInt32 = 0
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
init(firstChunk: UInt32, samplesPerChunk: UInt32, sampleDescriptionIndex: UInt32) {
@ -475,7 +475,7 @@ final class MP4EditListBox: MP4Box {
var mediaRate: UInt32 = 0
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
init(segmentDuration: UInt32, mediaTime: UInt32, mediaRate: UInt32) {
@ -512,7 +512,7 @@ final class MP4Reader: MP4ContainerBox {
private(set) var url: URL
var isEmpty: Bool {
return getBoxes(byName: "mdhd").isEmpty
getBoxes(byName: "mdhd").isEmpty
}
private var fileHandle: FileHandle?
@ -528,11 +528,11 @@ final class MP4Reader: MP4ContainerBox {
}
func seek(toFileOffset: UInt64) {
return fileHandle!.seek(toFileOffset: toFileOffset)
fileHandle!.seek(toFileOffset: toFileOffset)
}
func readData(ofLength: Int) -> Data {
return fileHandle!.readData(ofLength: ofLength)
fileHandle!.readData(ofLength: ofLength)
}
func readData(ofBox: MP4Box) -> Data {
@ -581,19 +581,19 @@ final class MP4TrakReader {
return timerDriver
}()
private var currentOffset: UInt64 {
return UInt64(offset[cursor])
UInt64(offset[cursor])
}
private var currentIsKeyframe: Bool {
return keyframe[cursor] != nil
keyframe[cursor] != nil
}
private var currentDuration: Double {
return Double(totalTimeToSample) * 1000 / Double(timeScale)
Double(totalTimeToSample) * 1000 / Double(timeScale)
}
private var currentTimeToSample: Double {
return Double(timeToSample[cursor]) * 1000 / Double(timeScale)
Double(timeToSample[cursor]) * 1000 / Double(timeScale)
}
private var currentSampleSize: Int {
return Int((sampleSize.count == 1) ? sampleSize[0] : sampleSize[cursor])
Int((sampleSize.count == 1) ? sampleSize[0] : sampleSize[cursor])
}
private var cursor: Int = 0
private var offset: [UInt32] = []
@ -679,7 +679,7 @@ final class MP4TrakReader {
}
private func hasNext() -> Bool {
return cursor + 1 < offset.count
cursor + 1 < offset.count
}
private func next() {
@ -718,6 +718,6 @@ extension MP4TrakReader: TimerDriverDelegate {
extension MP4TrakReader: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -28,7 +28,7 @@ extension NALUnit: DataConvertible {
// MARK: DataConvertible
var data: Data {
get {
return ByteArray()
ByteArray()
.writeUInt8(refIdc << 5 | type.rawValue)
.writeBytes(payload)
.data

View File

@ -121,7 +121,7 @@ extension PESOptionalHeader: DataConvertible {
extension PESOptionalHeader: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}
@ -149,7 +149,7 @@ struct PacketizedElementaryStream: PESPacketHeader {
var payload: Data {
get {
return ByteArray()
ByteArray()
.writeBytes(startCode)
.writeUInt8(streamID)
.writeUInt16(packetLength)
@ -303,6 +303,6 @@ struct PacketizedElementaryStream: PESPacketHeader {
extension PacketizedElementaryStream: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -50,7 +50,7 @@ class ProgramSpecific: PSIPointer, PSITableHeader, PSITableSyntax {
var lastSectionNumber: UInt8 = 0
var tableData: Data {
get {
return Data()
Data()
}
set {
}
@ -129,7 +129,7 @@ extension ProgramSpecific: DataConvertible {
extension ProgramSpecific: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}
@ -253,7 +253,7 @@ extension ElementaryStreamSpecificData: DataConvertible {
// MARK: BytesConvertible
var data: Data {
get {
return ByteArray()
ByteArray()
.writeUInt8(streamType)
.writeUInt16(elementaryPID | 0xe000)
.writeUInt16(ESInfoLength | 0xf000)
@ -277,6 +277,6 @@ extension ElementaryStreamSpecificData: DataConvertible {
extension ElementaryStreamSpecificData: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -91,6 +91,6 @@ extension TSReader: IteratorProtocol {
extension TSReader: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -375,7 +375,7 @@ class TSFileWriter: TSWriter {
}
func getFilePath(_ fileName: String) -> String? {
return files.first { $0.url.absoluteString.contains(fileName) }?.url.path
files.first { $0.url.absoluteString.contains(fileName) }?.url.path
}
private func removeFiles() {

View File

@ -182,7 +182,7 @@ struct TSProgramClockReference {
extension TSPacket: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}
@ -308,7 +308,7 @@ extension TSAdaptationField: DataConvertible {
extension TSAdaptationField: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}
@ -384,6 +384,6 @@ extension TSAdaptationExtensionField: DataConvertible {
extension TSAdaptationExtensionField: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -58,24 +58,24 @@ public class AVMixer {
#if os(iOS)
var preferredVideoStabilizationMode: AVCaptureVideoStabilizationMode {
get { return videoIO.preferredVideoStabilizationMode }
get { videoIO.preferredVideoStabilizationMode }
set { videoIO.preferredVideoStabilizationMode = newValue }
}
#endif
#if os(iOS) || os(macOS)
var fps: Float64 {
get { return videoIO.fps }
get { videoIO.fps }
set { videoIO.fps = newValue }
}
var continuousExposure: Bool {
get { return videoIO.continuousExposure }
get { videoIO.continuousExposure }
set { videoIO.continuousExposure = newValue }
}
var continuousAutofocus: Bool {
get { return videoIO.continuousAutofocus }
get { videoIO.continuousAutofocus }
set { videoIO.continuousAutofocus = newValue }
}
@ -195,7 +195,7 @@ extension AVMixer {
extension AVMixer: Running {
// MARK: Running
public var isRunning: Atomic<Bool> {
return .init(session.isRunning)
.init(session.isRunning)
}
public func startRunning() {
@ -218,7 +218,7 @@ extension AVMixer: Running {
extension AVMixer: Running {
// MARK: Running
public var isRunning: Atomic<Bool> {
return .init(false)
.init(false)
}
public func startRunning() {

View File

@ -147,11 +147,11 @@ final class AudioIOComponent: IOComponent, DisplayLinkedQueueClockReference {
#endif
func registerEffect(_ effect: AudioEffect) -> Bool {
return encoder.effects.insert(effect).inserted
encoder.effects.insert(effect).inserted
}
func unregisterEffect(_ effect: AudioEffect) -> Bool {
return encoder.effects.remove(effect) != nil
encoder.effects.remove(effect) != nil
}
func startDecoding(_ audioEngine: AVAudioEngine?) {

View File

@ -24,7 +24,7 @@ public class SoundSpliter: NSObject {
private var presentationTimeStamp = CMTime.zero
private var minimumByteSize: Int {
return min(.max, sampleData.count)
min(.max, sampleData.count)
}
public func appendSampleBuffer(_ sampleBuffer: CMSampleBuffer) {

View File

@ -20,6 +20,6 @@ public struct SoundTransform {
extension SoundTransform: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
public var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -6,6 +6,6 @@ open class VideoEffect: NSObject {
open var ciContext: CIContext?
open func execute(_ image: CIImage, info: CMSampleBuffer?) -> CIImage {
return image
image
}
}

View File

@ -2,7 +2,7 @@ import Foundation
open class NetService: NSObject {
open var txtData: Data? {
return nil
nil
}
let lockQueue = DispatchQueue(label: "com.haishinkit.HaishinKit.NetService.lock")

View File

@ -20,7 +20,7 @@ open class NetStream: NSObject {
open var context: CIContext? {
get {
return mixer.videoIO.context
mixer.videoIO.context
}
set {
mixer.videoIO.context = newValue
@ -46,7 +46,7 @@ open class NetStream: NSObject {
open var audioSettings: Setting<AudioConverter, AudioConverter.Option> {
get {
return mixer.audioIO.encoder.settings
mixer.audioIO.encoder.settings
}
set {
mixer.audioIO.encoder.settings = newValue
@ -55,7 +55,7 @@ open class NetStream: NSObject {
open var videoSettings: Setting<H264Encoder, H264Encoder.Option> {
get {
return mixer.videoIO.encoder.settings
mixer.videoIO.encoder.settings
}
set {
mixer.videoIO.encoder.settings = newValue
@ -64,7 +64,7 @@ open class NetStream: NSObject {
open var captureSettings: Setting<AVMixer, AVMixer.Option> {
get {
return mixer.settings
mixer.settings
}
set {
mixer.settings = newValue
@ -129,25 +129,25 @@ open class NetStream: NSObject {
}
open func registerVideoEffect(_ effect: VideoEffect) -> Bool {
return mixer.videoIO.lockQueue.sync {
mixer.videoIO.lockQueue.sync {
self.mixer.videoIO.registerEffect(effect)
}
}
open func unregisterVideoEffect(_ effect: VideoEffect) -> Bool {
return mixer.videoIO.lockQueue.sync {
mixer.videoIO.lockQueue.sync {
self.mixer.videoIO.unregisterEffect(effect)
}
}
open func registerAudioEffect(_ effect: AudioEffect) -> Bool {
return mixer.audioIO.lockQueue.sync {
mixer.audioIO.lockQueue.sync {
self.mixer.audioIO.registerEffect(effect)
}
}
open func unregisterAudioEffect(_ effect: AudioEffect) -> Bool {
return mixer.audioIO.lockQueue.sync {
mixer.audioIO.lockQueue.sync {
self.mixer.audioIO.unregisterEffect(effect)
}
}

View File

@ -192,7 +192,7 @@ extension AMF0Serializer: AMFSerializer {
* @see 2.2 Number Type
*/
func serialize(_ value: Double) -> Self {
return writeUInt8(Type.number.rawValue).writeDouble(value)
writeUInt8(Type.number.rawValue).writeDouble(value)
}
func deserialize() throws -> Double {
@ -203,18 +203,18 @@ extension AMF0Serializer: AMFSerializer {
}
func serialize(_ value: Int) -> Self {
return serialize(Double(value))
serialize(Double(value))
}
func deserialize() throws -> Int {
return Int(try deserialize() as Double)
Int(try deserialize() as Double)
}
/**
* @see 2.3 Boolean Type
*/
func serialize(_ value: Bool) -> Self {
return writeBytes(Data([Type.bool.rawValue, value ? 0x01 : 0x00]))
writeBytes(Data([Type.bool.rawValue, value ? 0x01 : 0x00]))
}
func deserialize() throws -> Bool {
@ -285,7 +285,7 @@ extension AMF0Serializer: AMFSerializer {
* @see 2.10 ECMA Array Type
*/
func serialize(_ value: ASArray) -> Self {
return self
self
}
func deserialize() throws -> ASArray {
@ -343,7 +343,7 @@ extension AMF0Serializer: AMFSerializer {
* @see 2.13 Date Type
*/
func serialize(_ value: Date) -> Self {
return writeUInt8(Type.date.rawValue).writeDouble(value.timeIntervalSince1970 * 1000).writeBytes(Data([0x00, 0x00]))
writeUInt8(Type.date.rawValue).writeDouble(value.timeIntervalSince1970 * 1000).writeBytes(Data([0x00, 0x00]))
}
func deserialize() throws -> Date {
@ -359,7 +359,7 @@ extension AMF0Serializer: AMFSerializer {
* @see 2.17 XML Document Type
*/
func serialize(_ value: ASXMLDocument) -> Self {
return writeUInt8(Type.xmlDocument.rawValue).serializeUTF8(value.description, true)
writeUInt8(Type.xmlDocument.rawValue).serializeUTF8(value.description, true)
}
func deserialize() throws -> ASXMLDocument {

View File

@ -28,19 +28,19 @@ final class AMFReference {
}
func indexOf(_ value: [Int32]) -> Int? {
return nil
nil
}
func indexOf(_ value: [UInt32]) -> Int? {
return nil
nil
}
func indexOf(_ value: [Double]) -> Int? {
return nil
nil
}
func indexOf(_ value: [Any?]) -> Int? {
return nil
nil
}
func indexOf(_ value: ASObject) -> Int? {
@ -53,7 +53,7 @@ final class AMFReference {
}
func indexOf(_ value: String) -> Int? {
return strings.firstIndex(of: value)
strings.firstIndex(of: value)
}
}
@ -185,7 +185,7 @@ extension AMF3Serializer: AMFSerializer {
*/
@discardableResult
func serialize(_ value: Bool) -> Self {
return writeUInt8(value ? Type.boolTrue.rawValue: Type.boolFalse.rawValue)
writeUInt8(value ? Type.boolTrue.rawValue: Type.boolFalse.rawValue)
}
func deserialize() throws -> Bool {
@ -204,7 +204,7 @@ extension AMF3Serializer: AMFSerializer {
*/
@discardableResult
func serialize(_ value: Int) -> Self {
return writeUInt8(Type.integer.rawValue).serializeU29(value)
writeUInt8(Type.integer.rawValue).serializeU29(value)
}
func deserialize() throws -> Int {
@ -219,7 +219,7 @@ extension AMF3Serializer: AMFSerializer {
*/
@discardableResult
func serialize(_ value: Double) -> Self {
return writeUInt8(Type.number.rawValue).writeDouble(value)
writeUInt8(Type.number.rawValue).writeDouble(value)
}
func deserialize() throws -> Double {
@ -234,7 +234,7 @@ extension AMF3Serializer: AMFSerializer {
*/
@discardableResult
func serialize(_ value: String) -> Self {
return writeUInt8(Type.string.rawValue).serializeUTF8(value)
writeUInt8(Type.string.rawValue).serializeUTF8(value)
}
func deserialize() throws -> String {
@ -391,11 +391,11 @@ extension AMF3Serializer: AMFSerializer {
*/
@discardableResult
func serialize(_ value: ByteArray) -> Self {
return self
self
}
func deserialize() throws -> ByteArray {
return ByteArray()
ByteArray()
}
/**

View File

@ -6,7 +6,7 @@ public typealias ASObject = [String: Any?]
public final class ASUndefined: NSObject {
override public var description: String {
return "undefined"
"undefined"
}
override fileprivate init() {
@ -49,7 +49,7 @@ public struct ASArray {
private(set) var dict: [String: Any?] = [:]
public var length: Int {
return data.count
data.count
}
public init(count: Int) {
@ -104,14 +104,14 @@ extension ASArray: ExpressibleByArrayLiteral {
extension ASArray: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
public var debugDescription: String {
return data.description
data.description
}
}
extension ASArray: Equatable {
// MARK: Equatable
public static func == (lhs: ASArray, rhs: ASArray) -> Bool {
return (lhs.data.description == rhs.data.description) && (lhs.dict.description == rhs.dict.description)
(lhs.data.description == rhs.data.description) && (lhs.dict.description == rhs.dict.description)
}
}
@ -125,7 +125,7 @@ extension ASArray: Equatable {
*/
public final class ASXMLDocument: NSObject {
override public var description: String {
return data
data
}
private var data: String
@ -143,7 +143,7 @@ public final class ASXMLDocument: NSObject {
*/
public final class ASXML: NSObject {
override public var description: String {
return data
data
}
private var data: String

View File

@ -20,7 +20,7 @@ enum RTMPChunkType: UInt8 {
}
func ready(_ data: Data) -> Bool {
return headerSize + RTMPChunk.getStreamIdSize(data[0]) < data.count
headerSize + RTMPChunk.getStreamIdSize(data[0]) < data.count
}
func toBasicHeader(_ streamId: UInt16) -> Data {
@ -274,6 +274,6 @@ final class RTMPChunk {
extension RTMPChunk: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -82,7 +82,7 @@ open class RTMPConnection: EventDispatcher {
}
func data(_ description: String) -> ASObject {
return [
[
"code": rawValue,
"level": level,
"description": description
@ -153,11 +153,11 @@ open class RTMPConnection: EventDispatcher {
open var pageUrl: String?
/// The time to wait for TCP/IP Handshake done.
open var timeout: Int {
get { return socket.timeout }
get { socket.timeout }
set { socket.timeout = newValue }
}
open var qualityOfService: DispatchQoS {
get { return socket.qualityOfService }
get { socket.qualityOfService }
set { socket.qualityOfService = newValue }
}
/// The name of application.
@ -176,15 +176,15 @@ open class RTMPConnection: EventDispatcher {
open var objectEncoding: RTMPObjectEncoding = RTMPConnection.defaultObjectEncoding
/// The statistics of total incoming bytes.
open var totalBytesIn: Int64 {
return socket.totalBytesIn
socket.totalBytesIn
}
/// The statistics of total outgoing bytes.
open var totalBytesOut: Int64 {
return socket.totalBytesOut
socket.totalBytesOut
}
/// The statistics of total RTMPStream counts.
open var totalStreamsCount: Int {
return streams.count
streams.count
}
/// The statistics of outgoing queue bytes per second.
@objc open private(set) dynamic var previousQueueBytesOut: [Int64] = []

View File

@ -18,7 +18,7 @@ final class RTMPHandshake {
}
func c2packet(_ s0s1packet: Data) -> Data {
return ByteArray()
ByteArray()
.writeBytes(s0s1packet.subdata(in: 1..<5))
.writeInt32(Int32(Date().timeIntervalSince1970 - timestamp))
.writeBytes(s0s1packet.subdata(in: 9..<RTMPHandshake.sigSize + 1))

View File

@ -71,7 +71,7 @@ class RTMPMessage {
extension RTMPMessage: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}
@ -528,7 +528,7 @@ final class RTMPAudioMessage: RTMPMessage {
override var payload: Data {
get {
return super.payload
super.payload
}
set {
if super.payload == newValue {
@ -748,7 +748,7 @@ final class RTMPUserControlMessage: RTMPMessage {
case unknown = 0xFF
var bytes: [UInt8] {
return [0x00, rawValue]
[0x00, rawValue]
}
}

View File

@ -73,7 +73,7 @@ struct RTMPSharedObjectEvent {
extension RTMPSharedObjectEvent: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}
@ -231,6 +231,6 @@ open class RTMPSharedObject: EventDispatcher {
extension RTMPSharedObject: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
public var debugDescription: String {
return data.debugDescription
data.debugDescription
}
}

View File

@ -8,7 +8,7 @@ final class RTMPSocket: NetSocket, RTMPSocketCompatible {
}
}
var timestamp: TimeInterval {
return handshake.timestamp
handshake.timestamp
}
var chunkSizeC: Int = RTMPChunk.defaultSize
var chunkSizeS: Int = RTMPChunk.defaultSize

View File

@ -25,7 +25,7 @@ public struct RTMPStreamInfo {
extension RTMPStreamInfo: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
public var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}
@ -162,7 +162,7 @@ open class RTMPStream: NetStream {
}
func data(_ description: String) -> ASObject {
return [
[
"code": rawValue,
"level": level,
"description": description
@ -192,7 +192,7 @@ open class RTMPStream: NetStream {
public var transition: PlayTransition = .switch
public var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}
@ -224,7 +224,7 @@ open class RTMPStream: NetStream {
/// The number of frames per second being displayed.
@objc open private(set) dynamic var currentFPS: UInt16 = 0
open var soundTransform: SoundTransform {
get { return mixer.audioIO.soundTransform }
get { mixer.audioIO.soundTransform }
set { mixer.audioIO.soundTransform = newValue }
}
/// Incoming audio plays on the stream or not.

View File

@ -28,7 +28,7 @@ final class RTMPTSocket: NSObject, RTMPSocketCompatible {
}
var timestamp: TimeInterval {
return handshake.timestamp
handshake.timestamp
}
var readyState: RTMPSocketReadyState = .uninitialized {

View File

@ -8,7 +8,7 @@ public struct Atomic<A> {
/// Getter for the value.
public var value: A {
return queue.sync { self._value }
queue.sync { self._value }
}
public init(_ value: A) {

View File

@ -87,7 +87,7 @@ open class ByteArray: ByteArrayConvertible {
open var length: Int {
get {
return data.count
data.count
}
set {
switch true {
@ -104,12 +104,12 @@ open class ByteArray: ByteArrayConvertible {
open var position: Int = 0
open var bytesAvailable: Int {
return data.count - position
data.count - position
}
open subscript(i: Int) -> UInt8 {
get {
return data[i]
data[i]
}
set {
data[i] = newValue
@ -128,7 +128,7 @@ open class ByteArray: ByteArrayConvertible {
@discardableResult
open func writeUInt8(_ value: UInt8) -> Self {
return writeBytes(value.data)
writeBytes(value.data)
}
open func readInt8() throws -> Int8 {
@ -143,7 +143,7 @@ open class ByteArray: ByteArrayConvertible {
@discardableResult
open func writeInt8(_ value: Int8) -> Self {
return writeBytes(UInt8(bitPattern: value).data)
writeBytes(UInt8(bitPattern: value).data)
}
open func readUInt16() throws -> UInt16 {
@ -156,7 +156,7 @@ open class ByteArray: ByteArrayConvertible {
@discardableResult
open func writeUInt16(_ value: UInt16) -> Self {
return writeBytes(value.bigEndian.data)
writeBytes(value.bigEndian.data)
}
open func readInt16() throws -> Int16 {
@ -169,7 +169,7 @@ open class ByteArray: ByteArrayConvertible {
@discardableResult
open func writeInt16(_ value: Int16) -> Self {
return writeBytes(value.bigEndian.data)
writeBytes(value.bigEndian.data)
}
open func readUInt24() throws -> UInt32 {
@ -182,7 +182,7 @@ open class ByteArray: ByteArrayConvertible {
@discardableResult
open func writeUInt24(_ value: UInt32) -> Self {
return writeBytes(value.bigEndian.data.subdata(in: 1..<ByteArray.sizeOfInt24 + 1))
writeBytes(value.bigEndian.data.subdata(in: 1..<ByteArray.sizeOfInt24 + 1))
}
open func readUInt32() throws -> UInt32 {
@ -195,7 +195,7 @@ open class ByteArray: ByteArrayConvertible {
@discardableResult
open func writeUInt32(_ value: UInt32) -> Self {
return writeBytes(value.bigEndian.data)
writeBytes(value.bigEndian.data)
}
open func readInt32() throws -> Int32 {
@ -208,7 +208,7 @@ open class ByteArray: ByteArrayConvertible {
@discardableResult
open func writeInt32(_ value: Int32) -> Self {
return writeBytes(value.bigEndian.data)
writeBytes(value.bigEndian.data)
}
open func readDouble() throws -> Double {
@ -221,7 +221,7 @@ open class ByteArray: ByteArrayConvertible {
@discardableResult
open func writeDouble(_ value: Double) -> Self {
return writeBytes(Data(value.data.reversed()))
writeBytes(Data(value.data.reversed()))
}
open func readFloat() throws -> Float {
@ -234,11 +234,11 @@ open class ByteArray: ByteArrayConvertible {
@discardableResult
open func writeFloat(_ value: Float) -> Self {
return writeBytes(Data(value.data.reversed()))
writeBytes(Data(value.data.reversed()))
}
open func readUTF8() throws -> String {
return try readUTF8Bytes(Int(try readUInt16()))
try readUTF8Bytes(Int(try readUInt16()))
}
@discardableResult
@ -261,7 +261,7 @@ open class ByteArray: ByteArrayConvertible {
@discardableResult
open func writeUTF8Bytes(_ value: String) -> Self {
return writeBytes(Data(value.utf8))
writeBytes(Data(value.utf8))
}
open func readBytes(_ length: Int) throws -> Data {
@ -321,6 +321,6 @@ open class ByteArray: ByteArrayConvertible {
extension ByteArray: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
public var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -18,7 +18,7 @@ final class CRC32 {
}
func calculate(_ data: Data) -> UInt32 {
return calculate(data, seed: nil)
calculate(data, seed: nil)
}
func calculate(_ data: Data, seed: UInt32?) -> UInt32 {
@ -33,6 +33,6 @@ final class CRC32 {
extension CRC32: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -2,7 +2,7 @@ import Foundation
struct CircularBuffer<Element> {
var first: Element? {
return buffer[top]
buffer[top]
}
var count: Int {
@ -66,6 +66,6 @@ struct CircularBuffer<Element> {
extension CircularBuffer: CustomStringConvertible {
// MARK: CustomStringConvertible
var description: String {
return buffer.description
buffer.description
}
}

View File

@ -3,11 +3,11 @@ import AVFoundation
#if os(iOS) || os(macOS)
extension AVFrameRateRange {
func clamp(rate: Float64) -> Float64 {
return max(minFrameRate, min(maxFrameRate, rate))
max(minFrameRate, min(maxFrameRate, rate))
}
func contains(rate: Float64) -> Bool {
return (minFrameRate...maxFrameRate) ~= rate
(minFrameRate...maxFrameRate) ~= rate
}
}
@ -45,13 +45,13 @@ extension AVCaptureDevice {
public struct DeviceUtil {
public static func device(withPosition: AVCaptureDevice.Position) -> AVCaptureDevice? {
return AVCaptureDevice.devices().first {
AVCaptureDevice.devices().first {
$0.hasMediaType(.video) && $0.position == withPosition
}
}
public static func device(withLocalizedName: String, mediaType: AVMediaType) -> AVCaptureDevice? {
return AVCaptureDevice.devices().first {
AVCaptureDevice.devices().first {
$0.hasMediaType(mediaType) && $0.localizedName == withLocalizedName
}
}

View File

@ -18,7 +18,7 @@ final class DisplayLinkedQueue: NSObject {
static let defaultPreferredFramesPerSecond = 0
var isPaused: Bool {
get { return displayLink?.isPaused ?? false }
get { displayLink?.isPaused ?? false }
set { displayLink?.isPaused = newValue }
}
var duration: TimeInterval {

View File

@ -68,7 +68,7 @@ open class Event {
extension Event: CustomDebugStringConvertible {
// MARK: CustomDebugStringConvertible
public var debugDescription: String {
return Mirror(reflecting: self).debugDescription
Mirror(reflecting: self).debugDescription
}
}

View File

@ -73,20 +73,20 @@ final class MD5 {
}
func rotateLeft(_ x: UInt32, _ n: UInt32) -> UInt32 {
return ((x << n) & 0xFFFFFFFF) | (x >> (32 - n))
((x << n) & 0xFFFFFFFF) | (x >> (32 - n))
}
var data: Data {
return a.data + b.data + c.data + d.data
a.data + b.data + c.data + d.data
}
}
static func base64(_ message: String) -> String {
return calculate(message).base64EncodedString(options: .lineLength64Characters)
calculate(message).base64EncodedString(options: .lineLength64Characters)
}
static func calculate(_ message: String) -> Data {
return calculate(ByteArray().writeUTF8Bytes(message).data)
calculate(ByteArray().writeUTF8Bytes(message).data)
}
static func calculate(_ data: Data) -> Data {

View File

@ -12,10 +12,10 @@ public struct MachUtil {
}()
public static func nanosToAbs(_ nanos: UInt64) -> UInt64 {
return nanos * UInt64(timebase.denom) / UInt64(timebase.numer)
nanos * UInt64(timebase.denom) / UInt64(timebase.numer)
}
public static func absToNanos(_ abs: UInt64) -> UInt64 {
return abs * UInt64(timebase.numer) / UInt64(timebase.denom)
abs * UInt64(timebase.numer) / UInt64(timebase.denom)
}
}

View File

@ -26,7 +26,7 @@ public class Setting<T: AnyObject, Key: KeyPathRepresentable>: ExpressibleByDict
public subscript(key: Key) -> Any? {
get {
return observer?[keyPath: key.keyPath]
observer?[keyPath: key.keyPath]
}
set {
switch key.keyPath {

View File

@ -46,7 +46,7 @@ public class TimerDriver {
extension TimerDriver: Running {
// MARK: Running
public var isRunning: Atomic<Bool> {
return .init(runloop != nil)
.init(runloop != nil)
}
public func startRunning() {

View File

@ -2,7 +2,7 @@ import AVFoundation
extension CGRect {
var aspectRatio: CGFloat {
return width / height
width / height
}
}