Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

CMTimeMBS class

Type Topic Plugin Version macOS Windows Linux Console & Web iOS
class AVFoundation MBS AVFoundation Plugin 13.2 Yes No No Yes, macOS only No
Function: CMTime is a class representing times (either timestamps or durations).
Example:
dim t as new CMTimeMBS(1200, 600)
MsgBox t.Description
Notes:
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.

Feedback, Comments & Corrections

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).
Also, never round a negative number down to 0; always return the smallest magnitude negative CMTime in this case (-1/newTimescale).
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 for this class:

Some examples which use this class:


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


CMTimeMappingMBS   -   CMTimeRangeMBS





Links
MBS FileMaker Plugins