CMTime
/*!
@typedef CMTime
@abstract Rational time value represented as int64/int32.
*/
typedef struct
{
CMTimeValue value; /*! @field value The value of the CMTime. value/timescale = seconds. */
CMTimeScale timescale; /*! @field timescale The timescale of the CMTime. value/timescale = seconds. */
CMTimeFlags flags; /*! @field flags The flags, eg. kCMTimeFlags_Valid, kCMTimeFlags_PositiveInfinity, etc. */
CMTimeEpoch epoch; /*! @field epoch Differentiates between equal timestamps that are actually different because
of looping, multi-item sequencing, etc.
Will be used during comparison: greater epochs happen after lesser ones.
Additions/subtraction is only possible within a single epoch,
however, since epoch length may be unknown/variable. */
} CMTime;
CMTime
是专门针对视频时间的一种数据类型,首先我们探讨一下,有两个视频AB
,A
视频共15帧
,播放速度为5fps
(即每秒播放5帧),那么A的持续时间为3s
,同样有B
视频,共60帧
,播放速率为20fps
,那么B的持续时间也为3s
。既然两个视频都是3s
的持续时长,那我们怎么用一种时间格式表示他们之间的差异,CMTime
就适用于这