Platforms to show: All Mac Windows Linux Cross-Platform

Back to CMTimeMBS class.

CMTimeMBS.AbsoluteValue as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the absolute value of a CMTime.

Same as the argument time, with sign inverted if negative.

CMTimeMBS.Add(other as CMTimeMBS) as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the sum of two CMTimes.

self: CMTime to be added.
other: Another CMTime to be added.
Returns the sum of the two CMTimes (addend1 + addend2).

If the operands both have the same timescale, the timescale of the result will be the same as the operands' timescale. If the operands have different timescales, the timescale of the result will be the least common multiple of the operands' timescales. If that LCM timescale is greater than kCMTimeMaxTimescale, the result timescale will be kCMTimeMaxTimescale, and default rounding will be applied when converting the result to this timescale. If the result value overflows, the result timescale will be repeatedly halved until the result value no longer overflows. Again, default rounding will be applied when converting the result to this timescale. If the result value still overflows when timescale == 1, then the result will be either positive or negative infinity, depending on the direction of the overflow.

If any rounding occurs for any reason, the result's kCMTimeFlags_HasBeenRounded flag will be set. This flag will also be set if either of the operands has kCMTimeFlags_HasBeenRounded set. If either of the operands is invalid, the result will be invalid. If the operands are valid, but just one operand is infinite, the result will be similarly infinite. If the operands are valid, and both are infinite, the results will be as follows:

+infinity + +infinity == +infinity
-infinity + -infinity == -infinity

+infinity + -infinity == invalid

-infinity + +infinity == invalid

If the operands are valid, not infinite, and either or both is indefinite, the result will be indefinite. If the two operands are numeric (i.e.. valid, not infinite, not indefinite), but have different nonzero epochs, the result will be invalid. If they have the same nonzero epoch, the result will have epoch zero (a duration). Times in different epochs cannot be added or subtracted, because epoch length is unknown. Times in epoch zero are considered to be durations and can be added to times in other epochs. Times in different epochs can be compared, however, because numerically greater epochs always occur after numerically lesser epochs.

CMTimeMBS.Compare(other as CMTimeMBS) as Integer

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the numerical relationship of two CMTimes.

self: First CMTime in comparison.
other: Second CMTime in comparison.

Returns the numerical relationship of the two CMTimes.

-1 is returned if time1 is less than time2.
1 is returned if time1 is greater than time2.
0 is returned if time1 and time2 are equal.

If the two CMTimes are numeric (i.e.. not invalid, infinite, or indefinite), and have different epochs, it is considered that times in numerically larger epochs are always greater than times in numerically smaller epochs. Since this routine will be used to sort lists by time, it needs to give all values (even invalid and indefinite ones) a strict ordering to guarantee that sort algorithms terminate safely. The order chosen is somewhat arbitrary: -infinity < all finite values < indefinite < +infinity < invalid

Invalid CMTimes are considered to be equal to other invalid CMTimes, and greater than any other CMTime. Positive infinity is considered to be less than any invalid CMTime, equal to itself, and greater than any other CMTime. An indefinite CMTime is considered to be less than any invalid CMTime, less than positive infinity, equal to itself, and greater than any other CMTime. Negative infinity is considered to be equal to itself, and less than any other CMTime.

CMTimeMBS.Constructor(Value as Int64, Timescale as Integer, Flags as Integer = 1, Epoch as Int64 = 0)

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a new time object with the given field values.
Example
dim t as new CMTimeMBS(1200, 600)
MsgBox t.Description

CMTimeMBS.ConvertScale(newTimescale as Integer, RoundingMethod as Integer = 1) as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns a new CMTime containing the source CMTime converted to a new timescale (rounding as requested).
Example
dim t as CMTimeMBS = CMTimeMBS.MakeWithSeconds(123.4, 600)
dim u as CMTimeMBS = t.ConvertScale(300, t.kCMTimeRoundingMethod_Default)
MsgBox t.Description+EndOfLine+u.Description

self: Source CMTime.
newTimescale: The timescale to which the source CMTime is converted.
RoundingMethod: The requested rounding method.

Returns the converted CMTime.
If the value needs to be rounded, the kCMTimeFlags_HasBeenRounded flag will be set. See constants for a discussion of the various rounding methods available. If the source time is non-numeric (i.e.. infinite, indefinite, invalid), the result will be similarly non-numeric.

CMTimeMBS.Description as string

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Creates a description of the time.
Example
dim t as new CMTimeMBS(1200, 600)
MsgBox t.Description

CMTimeMBS.Multiply(multiplier as Integer) as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the product of a CMTime and a 32-bit integer.
Example
dim t as new CMTimeMBS(1200, 600)
MsgBox str(T.Seconds)+" seconds"
t = t.Multiply(2)
MsgBox str(T.Seconds)+" seconds"

self: The CMTime that will be multiplied.
multiplier: A 32-bit integer. CMTime time and multiplier will be multiplied.

Returns the product of the CMTime and the 32-bit integer.

The result will have the same timescale as the CMTime operand. If the result value overflows, the result timescale will be repeatedly halved until the result value no longer overflows. Again, default rounding will be applied when converting the result to this timescale. If the result value still overflows when timescale == 1, then the result will be either positive or negative infinity, depending on the direction of the overflow. If any rounding occurs for any reason, the result's kCMTimeFlags_HasBeenRounded flag will be set. This flag will also be set if the CMTime operand has kCMTimeFlags_HasBeenRounded set. If the CMTime operand is invalid, the result will be invalid. If the CMTime operand is valid, but infinite, the result will be infinite, and of an appropriate sign, give the signs of both operands. If the CMTime operand is valid, but indefinite, the result will be indefinite.

CMTimeMBS.MultiplyByFloat(multiplier as Double) as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the product of a CMTime and a 64-bit float.
Example
dim t as new CMTimeMBS(1200, 600)
MsgBox str(T.Seconds)+" seconds"
t = t.MultiplyByFloat(2.0)
MsgBox str(T.Seconds)+" seconds"

time: The CMTime that will be multiplied.
multiplier: A 64-bit float. CMTime time and multiplier will be multiplied.

Returns the product of the CMTime and the 64-bit float.

The result will initially have the same timescale as the CMTime operand. If the result timescale is less than 65536, it will be repeatedly doubled until it is at least 65536. If the result value overflows, the result timescale will be repeatedly halved until the result value no longer overflows. Again, default rounding will be applied when converting the result to this timescale. If the result value still overflows when timescale == 1, then the result will be either positive or negative infinity, depending on the direction of the overflow. If any rounding occurs for any reason, the result's kCMTimeFlags_HasBeenRounded flag will be set. This flag will also be set if the CMTime operand has kCMTimeFlags_HasBeenRounded set. If the CMTime operand is invalid, the result will be invalid. If the CMTime operand is valid, but infinite, the result will be infinite, and of an appropriate sign, given the signs of both operands. If the CMTime operand is valid, but indefinite, the result will be indefinite.

CMTimeMBS.Show

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Prints a description of the CMTime.
Example
dim t as new CMTimeMBS(1200, 600)
t.show

CMTimeMBS.Subtract(other as CMTimeMBS) as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the difference of two CMTimes.

self: The CMTime from which the subtrahend will be subtracted.
other: The CMTime that will be subtracted from the minuend.

Returns the difference of the two CMTimes (minuend - subtrahend).

If the operands both have the same timescale, the timescale of the result will be the same as the operands' timescale. If the operands have different timescales, the timescale of the result will be the least common multiple of the operands' timescales. If that LCM timescale is greater than kCMTimeMaxTimescale, the result timescale will be kCMTimeMaxTimescale, and default rounding will be applied when converting the result to this timescale.

If the result value overflows, the result timescale will be repeatedly halved until the result value no longer overflows. Again, default rounding will be applied when converting the result to this timescale. If the result value still overflows when timescale = 1, then the result will be either positive or negative infinity, depending on the direction of the overflow.

If any rounding occurs for any reason, the result's kCMTimeFlags_HasBeenRounded flag will be set. This flag will also be set if either of the operands has kCMTimeFlags_HasBeenRounded set. If either of the operands is invalid, the result will be invalid. If the operands are valid, but just one operand is infinite, the result will be similarly infinite. If the operands are valid, and both are infinite, the results will be as follows:

+infinity - +infinity == invalid
-infinity - -infinity == invalid
+infinity - -infinity == +infinity
-infinity - +infinity == -infinity

If the operands are valid, not infinite, and either or both is indefinite, the result will be indefinite. If the two operands are numeric (i.e.. valid, not infinite, not indefinite), but have different nonzero epochs, the result will be invalid. If they have the same nonzero epoch, the result will have epoch zero (a duration). Times in different epochs cannot be added or subtracted, because epoch length is unknown. Times in epoch zero are considered to be durations and can be subtracted from times in other epochs. Times in different epochs can be compared, however, because numerically greater epochs always occur after numerically lesser epochs.

The items on this page are in the following plugins: MBS AVFoundation Plugin.


The biggest plugin in space...