Skip to content

Commit

Permalink
Suppress Warnigns.
Browse files Browse the repository at this point in the history
  • Loading branch information
shogo4405 committed Jun 11, 2024
1 parent d400ee5 commit f306b73
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
3 changes: 1 addition & 2 deletions SRTHaishinKit/SRTSocket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import HaishinKit
import libsrt
import Logboard

private let kSRTSocket_defaultOptions: [SRTSocketOption: Any] = [:]
private let kSRTSOcket_payloadSize: Int = 1316

protocol SRTSocketDelegate: AnyObject {
Expand Down Expand Up @@ -71,7 +70,7 @@ final class SRTSocket<T: SRTSocketDelegate> {
}
}

func open(_ addr: sockaddr_in, mode: SRTMode, options: [SRTSocketOption: Any] = kSRTSocket_defaultOptions) throws {
func open(_ addr: sockaddr_in, mode: SRTMode, options: [SRTSocketOption: Any] = [:]) throws {
guard socket == SRT_INVALID_SOCK else {
return
}
Expand Down
10 changes: 4 additions & 6 deletions SRTHaishinKit/SRTSocketOption.swift
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
import Foundation
import libsrt

private let enummapTranstype: [String: Any] = [
"live": SRTT_LIVE,
"file": SRTT_FILE
]

public enum SRTSocketOption: String, Sendable {
static func from(uri: URL?) -> [SRTSocketOption: Any] {
guard let uri = uri else {
Expand Down Expand Up @@ -360,7 +355,10 @@ public enum SRTSocketOption: String, Sendable {
var valmap: [String: Any]? {
switch self {
case .transtype:
return enummapTranstype
return [
"live": SRTT_LIVE,
"file": SRTT_FILE
]
default:
return nil
}
Expand Down
12 changes: 4 additions & 8 deletions Sources/IO/IOStreamRecorder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ public final class IOStreamRecorder {
/// Failed to finish writing the AVAssetWriter.
case failedToFinishWriting(error: (any Swift.Error)?)
}

/// The default output settings for a recording.
public static let defaultSettings: [AVMediaType: [String: Any]] = [
/// Specifies the delegate.
public weak var delegate: (any IOStreamRecorderDelegate)?
/// Specifies the recorder settings.
public var settings: [AVMediaType: [String: Any]] = [
.audio: [
AVFormatIDKey: Int(kAudioFormatMPEG4AAC),
AVSampleRateKey: 0,
Expand All @@ -39,11 +40,6 @@ public final class IOStreamRecorder {
AVVideoWidthKey: 0
]
]

/// Specifies the delegate.
public weak var delegate: (any IOStreamRecorderDelegate)?
/// Specifies the recorder settings.
public var settings: [AVMediaType: [String: Any]] = IOStreamRecorder.defaultSettings
/// Specifies the file name. nil will generate a unique file name.
public var fileName: String?
/// The running indicies whether recording or not.
Expand Down
2 changes: 1 addition & 1 deletion Sources/RTMP/RTMPStream.swift
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ open class RTMPStream: IOStream {
}

/// The type of publish options.
public enum HowToPublish: String {
public enum HowToPublish: String, Sendable {
/// Publish with server-side recording.
case record
/// Publish with server-side recording which is to append file if exists.
Expand Down
3 changes: 2 additions & 1 deletion Sources/Util/DeviceUtil.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@ import UIKit
/// The namespace of DeviceUtil.
public enum DeviceUtil {
/// Looks up the AVCaptureVideoOrientation by a Notification.
@MainActor
public static func videoOrientation(by notification: Notification) -> AVCaptureVideoOrientation? {
guard let device: UIDevice = notification.object as? UIDevice else {
guard let device = notification.object as? UIDevice else {
return nil
}
return videoOrientation(by: device.orientation)
Expand Down

0 comments on commit f306b73

Please sign in to comment.