Platforms to show: All Mac Windows Linux Cross-Platform

Back to CMTimeMBS class.

CMTimeMBS.kCMTimeIndefinite as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Predefined time.

Use this constant to initialize an indefinite CMTime (for example, the duration of a live broadcast).
Do not test against this using (time = kCMTimeIndefinite), there are many CMTimes other than this that are also indefinite. Use time.IsIndefinite instead.

CMTimeMBS.kCMTimeInvalid as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Predefined time.
Example
dim t as CMTimeMBS = CMTimeMBS.kCMTimeInvalid
MsgBox "Invalid: "+str(t.IsInvalid)

Use this constant to initialize an invalid CMTime.
All fields are 0. Do not test against this using (time = kCMTimeInvalid), there are many CMTimes other than this that are also invalid. Use time.IsInvalid instead.

CMTimeMBS.kCMTimeNegativeInfinity as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Predefined time.

Use this constant to initialize a CMTime to -infinity.
Do not test against this using (time = kCMTimeNegativeInfinity), there are many CMTimes other than this that are also -infinity. Use time.IsNegativeInfinity instead.

CMTimeMBS.kCMTimePositiveInfinity as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Predefined time.

Use this constant to initialize a CMTime to +infinity.
Do not test against this using (time = kCMTimePositiveInfinity), there are many CMTimes other than this that are also +infinity. Use time.IsPositiveInfinity instead.

CMTimeMBS.kCMTimeZero as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Predefined time.

Use this constant to initialize a CMTime to 0.
Do not test against this using (time = kCMTimeZero), there are many CMTimes other than this that are also 0. Use time.Compare(kCMTimeZero) instead.

Some examples using this method:

CMTimeMBS.Make(value as Int64, timescale as Integer) as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Makes a valid CMTime with value and timescale.
Example
dim t as CMTimeMBS = CMTimeMBS.Make(1234, 600)
MsgBox t.Description

Epoch is implied to be 0.

value: Initializes the value field of the resulting CMTime.
timescale: Initializes the timescale field of the resulting CMTime.

Returns the resulting CMTime

CMTimeMBS.MakeWithEpoch(value as Int64, timescale as Integer, Epoch as Int64) as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Makes a valid CMTime with value, scale and epoch.

value: Initializes the value field of the resulting CMTime.
timescale: Initializes the scale field of the resulting CMTime.
epoch: Initializes the epoch field of the resulting CMTime.

Returns the resulting CMTime.

CMTimeMBS.MakeWithSeconds(seconds as Double, preferredTimeScale as Int32 = 600) as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Makes a CMTime from a Float number of seconds, and a preferred timescale.
Example
dim t as CMTimeMBS = CMTimeMBS.MakeWithSeconds(123.4, 600)
MsgBox t.Description

seconds: Initializes the seconds field of the resulting CMTime.
preferredTimeScale: Initializes the preferredTimeScale field of the resulting CMTime.

Returns the resulting CMTime.

The epoch of the result will be zero. If preferredTimeScale is <= 0, the result will be an invalid CMTime. If the preferred timescale will cause an overflow, the timescale will be halved repeatedly until the overflow goes away, or the timescale is 1. If it still overflows at that point, the result will be +/- infinity. The kCMTimeFlags_HasBeenRounded flag will be set if the result, when converted back to seconds, is not exactly equal to the original seconds value.

Some examples using this method:

CMTimeMBS.Maximum(t1 as CMTimeMBS, t2 as CMTimeMBS) as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the greater of two CMTimes.
Example
dim t1 as new CMTimeMBS(1200, 600)
dim t2 as new CMTimeMBS(70, 30)

dim mi as CMTimeMBS = CMTimeMBS.Minimum(t1,t2)
dim ma as CMTimeMBS = CMTimeMBS.Maximum(t1,t2)

MsgBox "with "+t1.Description+_
" and "+t2.description+_
" the minimum is "+mi.Description+_
" and maximum is "+ma.Description

CMTimeMBS.Minimum(t1 as CMTimeMBS, t2 as CMTimeMBS) as CMTimeMBS

Type Topic Plugin Version macOS Windows Linux iOS Targets
shared method AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
Returns the lesser of two CMTimes.
Example
dim t1 as new CMTimeMBS(1200, 600)
dim t2 as new CMTimeMBS(70, 30)

dim mi as CMTimeMBS = CMTimeMBS.Minimum(t1,t2)
dim ma as CMTimeMBS = CMTimeMBS.Maximum(t1,t2)

MsgBox "with "+t1.Description+_
" and "+t2.description+_
" the minimum is "+mi.Description+_
" and maximum is "+ma.Description

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


The biggest plugin in space...