mirror of
https://github.com/HaishinKit/HaishinKit.swift.git
synced 2026-05-07 20:12:28 +00:00
16 lines
391 B
Swift
16 lines
391 B
Swift
import AVFoundation
|
|
import Foundation
|
|
|
|
extension CMTime {
|
|
func makeAudioTime() -> AVAudioTime {
|
|
return .init(sampleTime: value, atRate: Double(timescale))
|
|
}
|
|
|
|
func convertTime(from: CMClock?, to: CMClock? = CMClockGetHostTimeClock()) -> CMTime {
|
|
guard let from, let to else {
|
|
return self
|
|
}
|
|
return from.convertTime(self, to: to)
|
|
}
|
|
}
|