use frame rate and timebase less interchangeably

This commit is contained in:
itsmattkc
2021-04-07 13:08:25 +10:00
parent 898ea25e89
commit bb32048c65
22 changed files with 187 additions and 85 deletions
+8
View File
@@ -281,11 +281,19 @@ int64_t Timecode::time_to_timestamp(const double &time, const rational &timebase
int64_t Timecode::rescale_timestamp(const int64_t &ts, const rational &source, const rational &dest)
{
if (source == dest) {
return ts;
}
return qRound64(static_cast<double>(ts) * source.toDouble() / dest.toDouble());
}
int64_t Timecode::rescale_timestamp_ceil(const int64_t &ts, const rational &source, const rational &dest)
{
if (source == dest) {
return ts;
}
return qCeil(static_cast<double>(ts) * source.toDouble() / dest.toDouble());
}