@@ -10,19 +10,19 @@ import OpenTimelineIO_objc
1010public struct RationalTime : CustomStringConvertible , Equatable {
1111 public var value : Double { return cxxRationalTime. value }
1212 public var rate : Double { return cxxRationalTime. rate }
13-
13+
1414 public var description : String {
1515 return " RationalTime( \( value) , \( rate) ) "
1616 }
17-
17+
1818 public init ( value: Double = 0 , rate: Double = 1 ) {
1919 cxxRationalTime = CxxRationalTime ( value: value, rate: rate)
2020 }
21-
21+
2222 public func isInvalidTime( ) -> Bool {
2323 return rate <= 0
2424 }
25-
25+
2626 public func rescaled( to newRate: Double ) -> RationalTime {
2727 return withUnsafePointer ( to: self . cxxRationalTime) {
2828 RationalTime ( rational_time_rescaled_to ( $0, newRate) ) ;
@@ -55,11 +55,16 @@ public struct RationalTime: CustomStringConvertible, Equatable {
5555 return RationalTime ( rational_time_duration_from_start_end_time ( startTime. cxxRationalTime,
5656 endTime. cxxRationalTime) )
5757 }
58-
58+
59+ @available ( * , deprecated, renamed: " isSmpteTimecodeRate " )
5960 static public func isValidTimecodeRate( _ inRate: Double ) -> Bool {
6061 return rational_time_is_valid_timecode_rate ( inRate)
6162 }
62-
63+
64+ static public func isSmpteTimecodeRate( _ inRate: Double ) -> Bool {
65+ return rational_time_is_smpte_timecode_rate ( inRate)
66+ }
67+
6368 static public func from( frame: Double , rate inRate: Double ) -> RationalTime {
6469 return RationalTime ( value: floor ( frame) , rate: inRate)
6570 }
@@ -71,27 +76,27 @@ public struct RationalTime: CustomStringConvertible, Equatable {
7176 static public func from( seconds: Double ) -> RationalTime {
7277 return RationalTime ( value: seconds, rate: 1 )
7378 }
74-
79+
7580 static public func from( timecode: String , rate inRate: Double ) throws -> RationalTime {
7681 return try OpentimeError . returnOrThrow { RationalTime ( rational_time_from_timecode ( timecode, inRate, & $0) ) }
7782 }
78-
83+
7984 static public func from( timestring: String , rate inRate: Double ) throws -> RationalTime {
8085 return try OpentimeError . returnOrThrow { RationalTime ( rational_time_from_timestring ( timestring, inRate, & $0) ) }
8186 }
82-
87+
8388 public func toFrames( ) -> Int {
8489 return Int ( value)
8590 }
86-
91+
8792 public func toFrames( rate inRate: Double ) -> Int {
8893 return Int ( valueRescaled ( to: inRate) )
8994 }
90-
95+
9196 public func toSeconds( ) -> Double {
9297 return valueRescaled ( to: 1 )
9398 }
94-
99+
95100 public func toTimecode( rate inRate: Double ) throws -> String {
96101 return try OpentimeError . returnOrThrow { rational_time_to_timecode ( cxxRationalTime, inRate, & $0) }
97102 }
@@ -115,7 +120,7 @@ public struct RationalTime: CustomStringConvertible, Equatable {
115120 static public prefix func - ( lhs: RationalTime ) -> RationalTime {
116121 return RationalTime ( value: - lhs. value, rate: - lhs. rate)
117122 }
118-
123+
119124 static public func + ( lhs: RationalTime , rhs: RationalTime ) -> RationalTime {
120125 return RationalTime ( rational_time_add ( lhs. cxxRationalTime, rhs. cxxRationalTime) )
121126 }
@@ -151,7 +156,6 @@ public struct RationalTime: CustomStringConvertible, Equatable {
151156 internal init ( _ cxxRationalTime: CxxRationalTime ) {
152157 self . cxxRationalTime = cxxRationalTime
153158 }
154-
159+
155160 internal let cxxRationalTime : CxxRationalTime
156161}
157-
0 commit comments