Guides and Sample Code Developer
Search

CoreMedia Changes for Swift

CoreMedia

Declaration
From
struct CMBlockBufferCustomBlockSource {
    var version: UInt32
    var AllocateBlock: ((UnsafeMutableRawPointer?, Int) -> UnsafeMutableRawPointer?)?
    var FreeBlock: ((UnsafeMutableRawPointer?, UnsafeMutableRawPointer, Int) -> Swift.Void)?
    var refCon: UnsafeMutableRawPointer?
    init()
    init(version version: UInt32, AllocateBlock AllocateBlock: (@escaping (UnsafeMutableRawPointer?, Int) -> UnsafeMutableRawPointer?)?, FreeBlock FreeBlock: (@escaping (UnsafeMutableRawPointer?, UnsafeMutableRawPointer, Int) -> Swift.Void)?, refCon refCon: UnsafeMutableRawPointer?)
}
To
struct CMBlockBufferCustomBlockSource {
    var version: UInt32
    var AllocateBlock: ((UnsafeMutableRawPointer?, Int) -> UnsafeMutableRawPointer?)?
    var FreeBlock: ((UnsafeMutableRawPointer?, UnsafeMutableRawPointer, Int) -> Swift.Void)?
    var refCon: UnsafeMutableRawPointer?
    init()
    init(version version: UInt32, AllocateBlock AllocateBlock: ((UnsafeMutableRawPointer?, Int) -> UnsafeMutableRawPointer?)?, FreeBlock FreeBlock: ((UnsafeMutableRawPointer?, UnsafeMutableRawPointer, Int) -> Swift.Void)?, refCon refCon: UnsafeMutableRawPointer?)
}

Declaration
From
init(version version: UInt32, AllocateBlock AllocateBlock: (@escaping (UnsafeMutableRawPointer?, Int) -> UnsafeMutableRawPointer?)?, FreeBlock FreeBlock: (@escaping (UnsafeMutableRawPointer?, UnsafeMutableRawPointer, Int) -> Swift.Void)?, refCon refCon: UnsafeMutableRawPointer?)
To
init(version version: UInt32, AllocateBlock AllocateBlock: ((UnsafeMutableRawPointer?, Int) -> UnsafeMutableRawPointer?)?, FreeBlock FreeBlock: ((UnsafeMutableRawPointer?, UnsafeMutableRawPointer, Int) -> Swift.Void)?, refCon refCon: UnsafeMutableRawPointer?)

Declaration
From
struct CMTime {
    var value: CMTimeValue
    var timescale: CMTimeScale
    var flags: CMTimeFlags
    var epoch: CMTimeEpoch
    init()
    init(value value: CMTimeValue, timescale timescale: CMTimeScale, flags flags: CMTimeFlags, epoch epoch: CMTimeEpoch)
    init(seconds seconds: Double, preferredTimescale preferredTimescale: CMTimeScale)
    init(value value: CMTimeValue, timescale timescale: CMTimeScale)
    var isValid: Bool { get }
    var isPositiveInfinity: Bool { get }
    var isNegativeInfinity: Bool { get }
    var isIndefinite: Bool { get }
    var isNumeric: Bool { get }
    var hasBeenRounded: Bool { get }
    var seconds: Double { get }
    func convertScale(_ newTimescale: Int32, method method: CMTimeRoundingMethod) -> CMTime
}
extension CMTime {
    init(seconds seconds: Double, preferredTimescale preferredTimescale: CMTimeScale)
    init(value value: CMTimeValue, timescale timescale: CMTimeScale)
}
extension CMTime {
    var isValid: Bool { get }
    var isPositiveInfinity: Bool { get }
    var isNegativeInfinity: Bool { get }
    var isIndefinite: Bool { get }
    var isNumeric: Bool { get }
    var hasBeenRounded: Bool { get }
    var seconds: Double { get }
    func convertScale(_ newTimescale: Int32, method method: CMTimeRoundingMethod) -> CMTime
}
extension CMTime : Equatable, Comparable {
}
To
struct CMTime {
    var value: CMTimeValue
    var timescale: CMTimeScale
    var flags: CMTimeFlags
    var epoch: CMTimeEpoch
    init()
    init(value value: CMTimeValue, timescale timescale: CMTimeScale, flags flags: CMTimeFlags, epoch epoch: CMTimeEpoch)
    init(seconds seconds: Double, preferredTimescale preferredTimescale: CMTimeScale)
    init(value value: CMTimeValue, timescale timescale: CMTimeScale)
    var isValid: Bool { get }
    var isPositiveInfinity: Bool { get }
    var isNegativeInfinity: Bool { get }
    var isIndefinite: Bool { get }
    var isNumeric: Bool { get }
    var hasBeenRounded: Bool { get }
    var seconds: Double { get }
    func convertScale(_ newTimescale: Int32, method method: CMTimeRoundingMethod) -> CMTime
}
extension CMTime {
}
extension CMTime {
    init(seconds seconds: Double, preferredTimescale preferredTimescale: CMTimeScale)
    init(value value: CMTimeValue, timescale timescale: CMTimeScale)
}
extension CMTime {
    var isValid: Bool { get }
    var isPositiveInfinity: Bool { get }
    var isNegativeInfinity: Bool { get }
    var isIndefinite: Bool { get }
    var isNumeric: Bool { get }
    var hasBeenRounded: Bool { get }
    var seconds: Double { get }
    func convertScale(_ newTimescale: Int32, method method: CMTimeRoundingMethod) -> CMTime
}
extension CMTime : Equatable, Comparable {
}

Declaration
From
struct CMTimeMapping {
    var source: CMTimeRange
    var target: CMTimeRange
    init()
    init(source source: CMTimeRange, target target: CMTimeRange)
}
To
struct CMTimeMapping {
    var source: CMTimeRange
    var target: CMTimeRange
    init()
    init(source source: CMTimeRange, target target: CMTimeRange)
}
extension CMTimeMapping {
}

Declaration
From
struct CMTimeRange {
    var start: CMTime
    var duration: CMTime
    init()
    init(start start: CMTime, duration duration: CMTime)
    init(start start: CMTime, end end: CMTime)
    var isValid: Bool { get }
    var isIndefinite: Bool { get }
    var isEmpty: Bool { get }
    var end: CMTime { get }
    func union(_ otherRange: CMTimeRange) -> CMTimeRange
    func intersection(_ otherRange: CMTimeRange) -> CMTimeRange
    func containsTime(_ time: CMTime) -> Bool
    func containsTimeRange(_ range: CMTimeRange) -> Bool
}
extension CMTimeRange {
    init(start start: CMTime, end end: CMTime)
    var isValid: Bool { get }
    var isIndefinite: Bool { get }
    var isEmpty: Bool { get }
    var end: CMTime { get }
    func union(_ otherRange: CMTimeRange) -> CMTimeRange
    func intersection(_ otherRange: CMTimeRange) -> CMTimeRange
    func containsTime(_ time: CMTime) -> Bool
    func containsTimeRange(_ range: CMTimeRange) -> Bool
}
extension CMTimeRange : Equatable {
}
To
struct CMTimeRange {
    var start: CMTime
    var duration: CMTime
    init()
    init(start start: CMTime, duration duration: CMTime)
    init(start start: CMTime, end end: CMTime)
    var isValid: Bool { get }
    var isIndefinite: Bool { get }
    var isEmpty: Bool { get }
    var end: CMTime { get }
    func union(_ otherRange: CMTimeRange) -> CMTimeRange
    func intersection(_ otherRange: CMTimeRange) -> CMTimeRange
    func containsTime(_ time: CMTime) -> Bool
    func containsTimeRange(_ range: CMTimeRange) -> Bool
}
extension CMTimeRange {
}
extension CMTimeRange {
    init(start start: CMTime, end end: CMTime)
    var isValid: Bool { get }
    var isIndefinite: Bool { get }
    var isEmpty: Bool { get }
    var end: CMTime { get }
    func union(_ otherRange: CMTimeRange) -> CMTimeRange
    func intersection(_ otherRange: CMTimeRange) -> CMTimeRange
    func containsTime(_ time: CMTime) -> Bool
    func containsTimeRange(_ range: CMTimeRange) -> Bool
}
extension CMTimeRange : Equatable {
}

Declaration
From
func CMBufferQueueSetValidationCallback(_ queue: CMBufferQueue, _ validationCallback: CoreMedia.CMBufferValidationCallback, _ validationRefCon: UnsafeMutableRawPointer?) -> OSStatus
To
func CMBufferQueueSetValidationCallback(_ queue: CMBufferQueue, _ validationCallback: @escaping CoreMedia.CMBufferValidationCallback, _ validationRefCon: UnsafeMutableRawPointer?) -> OSStatus

Declaration
From
func CMSampleBufferSetInvalidateCallback(_ sbuf: CMSampleBuffer, _ invalidateCallback: CoreMedia.CMSampleBufferInvalidateCallback, _ invalidateRefCon: UInt64) -> OSStatus
To
func CMSampleBufferSetInvalidateCallback(_ sbuf: CMSampleBuffer, _ invalidateCallback: @escaping CoreMedia.CMSampleBufferInvalidateCallback, _ invalidateRefCon: UInt64) -> OSStatus

Declaration
From
func CMSampleBufferSetInvalidateHandler(_ sbuf: CMSampleBuffer, _ invalidateHandler: CoreMedia.CMSampleBufferInvalidateHandler) -> OSStatus
To
func CMSampleBufferSetInvalidateHandler(_ sbuf: CMSampleBuffer, _ invalidateHandler: @escaping CoreMedia.CMSampleBufferInvalidateHandler) -> OSStatus

Feedback