gpt4 book ai didi

cocoa-touch - CMTime 的时间刻度部分是多少?

转载 作者:行者123 更新时间:2023-12-03 16:13:11 25 4
gpt4 key购买 nike

我一直在查看与创建 CMTime 相关的文档。所有函数(CMTimeMake()CMTimeMakeWithSeconds() 等)都采用名为 preferredTimeSale 的第二个参数。

有人可以向我解释这是什么,以及为什么这样指定吗?

最佳答案

根据opening paragraphs of Apple's CMTime documentation :

A CMTime is represented as a rational number, with a numerator (an int64_t value), and a denominator (an int32_t 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.

因此,如果时间刻度为 4,则每个时间测量单位为四分之一秒。

如果您的时间刻度为 1,则每个时间测量单位为一秒(但这对于您的用户来说可能是一个相当慢的动画)。

Many video formats use a timescale of 600 :

You frequently use a timescale of 600, since this is a common multiple of several commonly-used frame-rates: 24 frames per second (fps) for film, 30 fps for NTSC (used for TV in North America and Japan), and 25 fps for PAL (used for TV in Europe). Using a timescale of 600, you can exactly represent any number of frames in these systems.

关于cocoa-touch - CMTime 的时间刻度部分是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16628658/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com