Platforms to show: All Mac Windows Linux Cross-Platform

CMTimeMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class AVFoundation MBS AVFoundation Plugin 13.2 ✅ Yes ❌ No ❌ No ✅ Yes All
CMTime is a class representing times (either timestamps or durations).
Example
dim t as new CMTimeMBS(1200, 600)
MsgBox t.Description

A CMTime is represented as a rational number, with a numerator (an int64 value), and a denominator (an int32 timescale). Conceptually, the timescale specifies the fraction of a second each unit in the numerator occupies. Thus if the timescale is 4, each unit represents a quarter of a second; if the timescale is 10, each unit represents a tenth of a second, and so on. In addition to a simple time value, a CMTime can represent non-numeric values: +infinity, -infinity, and indefinite. Using a flag CMTime indicates whether the time been rounded at some point.

CMTimes contain an epoch number, which is usually set to 0, but can be used to distinguish unrelated timelines: for example, it could be incremented each time through a presentation loop, to differentiate between time N in loop 0 from time N in loop 1.

Additional functions for managing dates and times are described in Time Utilities Reference. Note that CMTime is designed for media timelines whereas functions in Time Utilities Reference are designed for working with wall-clock time in Core Foundation framework; see also AV Foundation Constants Reference.

Constants

Constant Value Description
kCMTimeMaxTimescale &h7fffffff A constant to define the maximum timescale.

Flags

Constant Value Description
kCMTimeFlags_HasBeenRounded 2 Indicates that the time has been rounded.
kCMTimeFlags_ImpliedValueFlagsMask 28 Indicates that the time is +infinity, -infinity, or indefinite.
Use this value with bitwiseAnd on the flags.
kCMTimeFlags_Indefinite 16 Indicates that the time is indefinite.
kCMTimeFlags_NegativeInfinity 8 Indicates that the time is -infinity.
kCMTimeFlags_PositiveInfinity 4 Indicates that the time is +infinity.
kCMTimeFlags_Valid 1 Indicates that the time is valid.

Rounding Methods

Constant Value Description
kCMTimeRoundingMethod_Default 1 Synonym for kCMTimeRoundingMethod_RoundHalfAwayFromZero.
kCMTimeRoundingMethod_QuickTime 4 Use kCMTimeRoundingMethod_RoundTowardZero if converting from larger to smaller scale (that is, from more precision to less precision), but use kCMTimeRoundingMethod_RoundAwayFromZero if converting from smaller to larger scale (i.e. from less precision to more precision). more
kCMTimeRoundingMethod_RoundAwayFromZero 3 Round away from zero if abs(fraction) is > 0.
kCMTimeRoundingMethod_RoundHalfAwayFromZero 1 Round towards zero if abs(fraction) is < 0.5, away from 0 if abs(fraction) is >= 0.5.
kCMTimeRoundingMethod_RoundTowardNegativeInfinity 6 Round towards -infinity if fraction is not 0.
kCMTimeRoundingMethod_RoundTowardPositiveInfinity 5 Round towards +infinity if fraction is not 0.
kCMTimeRoundingMethod_RoundTowardZero 2 Round towards zero if fraction is not 0.

This class has no sub classes.

Some methods using this class:

Some properties using for this class:

Some events using this class:

Some examples using this class:

Blog Entries

Xojo Developer Magazine


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


CMTimeMappingMBS   -   CMTimeRangeMBS


The biggest plugin in space...