[英]What kinds of CMTime are invalid?
kCMTimeInvalid is invalid CMTime, but based on Apple document, there are more invalid CMTime, what are they? kCMTimeInvalid是无效的CMTime,但是基于Apple文档,还有更多无效的CMTime,它们是什么? What does CMTime "invalid" means?
CMTime“无效”是什么意思? It's overflow, uninitiated or anything else?
它溢出,未启动还是其他?
https://developer.apple.com/documentation/coremedia/kcmtimeinvalid https://developer.apple.com/documentation/coremedia/kcmtimeinvalid
All fields are 0, so you can calloc or fill with 0's to make lots of them.
所有字段均为0,因此您可以calloc或填充0来制作很多字段。 Do not test against this using (time == kCMTimeInvalid), there are many CMTimes other than this that are also invalid.
不要使用(time == kCMTimeInvalid)对此进行测试,除此以外,还有许多CMTime也是无效的。 Use CMTIME_IS_INVALID(time) instead.
请改用CMTIME_IS_INVALID(time)。
I found some cases when CMTime is invalid: 我发现CMTime无效的一些情况:
When flags(CMTimeFlags) kCMTimeFlags_Valid not set. 当flags(CMTimeFlags)kCMTimeFlags_Valid未设置时。
kCMTimeFlags_Valid Must be set, or the CMTime is considered invalid.
kCMTimeFlags_Valid必须设置,否则CMTime被视为无效。
Some operations of CMTimeAdd CMTimeAdd的一些操作
+infinity + +infinity == +infinity
+无限+ +无限== +无限
-infinity + -infinity == -infinity -无限+-无限==-无限
+infinity + -infinity == invalid +无限+-无限==无效
-infinity + +infinity == invalid -infinity + + infinity ==无效
There are five possible states: 有五种可能的状态:
From the documentation you posted, it says: 从您发布的文档中可以看到:
Use CMTIME_IS_INVALID(time) instead.
请改用CMTIME_IS_INVALID(time)。
From CMTime.h
, it looks like CMTIME_IS_INVALID
is defined as: 从
CMTime.h
,看起来CMTIME_IS_INVALID
定义为:
#define CMTIME_IS_INVALID(time) (! CMTIME_IS_VALID(time))
And CMTIME_IS_VALID
is defined as: 并将
CMTIME_IS_VALID
定义为:
#define CMTIME_IS_VALID(time) ((Boolean)(((time).flags & kCMTimeFlags_Valid) != 0))
So it looks like the only thing that determines if a CMTime
is valid or not is whether the kCMTimeFlags_Valid
flag is set. 因此,似乎唯一确定
CMTime
是否有效的是kCMTimeFlags_Valid
标志是否已设置。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.