本文整理汇总了C++中MediaTime::isPositiveInfinite方法的典型用法代码示例。如果您正苦于以下问题:C++ MediaTime::isPositiveInfinite方法的具体用法?C++ MediaTime::isPositiveInfinite怎么用?C++ MediaTime::isPositiveInfinite使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MediaTime
的用法示例。
在下文中一共展示了MediaTime::isPositiveInfinite方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: compare
MediaTime::ComparisonFlags MediaTime::compare(const MediaTime& rhs, bool fuzzy) const
{
if ((isPositiveInfinite() && rhs.isPositiveInfinite())
|| (isNegativeInfinite() && rhs.isNegativeInfinite())
|| (isInvalid() && rhs.isInvalid())
|| (isIndefinite() && rhs.isIndefinite()))
return EqualTo;
if (isInvalid())
return GreaterThan;
if (rhs.isInvalid())
return LessThan;
if (rhs.isNegativeInfinite() || isPositiveInfinite())
return GreaterThan;
if (rhs.isPositiveInfinite() || isNegativeInfinite())
return LessThan;
if (isIndefinite())
return GreaterThan;
if (rhs.isIndefinite())
return LessThan;
if (hasDoubleValue() && rhs.hasDoubleValue()) {
if (m_timeValueAsDouble == rhs.m_timeValueAsDouble)
return EqualTo;
if (fuzzy && fabs(m_timeValueAsDouble - rhs.m_timeValueAsDouble) <= fuzzinessThreshold().toDouble())
return EqualTo;
return m_timeValueAsDouble < rhs.m_timeValueAsDouble ? LessThan : GreaterThan;
}
MediaTime a = *this;
MediaTime b = rhs;
if (a.hasDoubleValue())
a.setTimeScale(DefaultTimeScale);
if (b.hasDoubleValue())
b.setTimeScale(DefaultTimeScale);
int64_t rhsWhole = b.m_timeValue / b.m_timeScale;
int64_t lhsWhole = a.m_timeValue / a.m_timeScale;
if (lhsWhole > rhsWhole)
return GreaterThan;
if (lhsWhole < rhsWhole)
return LessThan;
int64_t rhsRemain = b.m_timeValue % b.m_timeScale;
int64_t lhsRemain = a.m_timeValue % a.m_timeScale;
int64_t lhsFactor = lhsRemain * b.m_timeScale;
int64_t rhsFactor = rhsRemain * a.m_timeScale;
if (lhsFactor == rhsFactor)
return EqualTo;
return lhsFactor > rhsFactor ? GreaterThan : LessThan;
}
示例2: updateDataCue
void InbandDataTextTrack::updateDataCue(InbandTextTrackPrivate*, const MediaTime& start, const MediaTime& inEnd, PassRefPtr<SerializedPlatformRepresentation> prpPlatformValue)
{
MediaTime end = inEnd;
RefPtr<SerializedPlatformRepresentation> platformValue = prpPlatformValue;
auto iter = m_incompleteCueMap.find(platformValue.get());
if (iter == m_incompleteCueMap.end())
return;
RefPtr<DataCue> cue = iter->value;
if (!cue)
return;
cue->willChange();
if (end.isPositiveInfinite() && mediaElement())
end = mediaElement()->durationMediaTime();
else
m_incompleteCueMap.remove(platformValue.get());
LOG(Media, "InbandDataTextTrack::updateDataCue: was start=%s, end=%s, will be start=%s, end=%s\n", toString(cue->startTime()).utf8().data(), toString(cue->endTime()).utf8().data(), toString(start).utf8().data(), toString(end).utf8().data());
cue->setStartTime(start);
cue->setEndTime(end);
cue->didChange();
}
示例3: invalidTime
MediaTime MediaTime::operator-(const MediaTime& rhs) const
{
if (rhs.isInvalid() || isInvalid())
return invalidTime();
if (rhs.isIndefinite() || isIndefinite())
return indefiniteTime();
if (isPositiveInfinite() && rhs.isPositiveInfinite())
return invalidTime();
if (isNegativeInfinite() && rhs.isNegativeInfinite())
return invalidTime();
if (isPositiveInfinite() || rhs.isNegativeInfinite())
return positiveInfiniteTime();
if (isNegativeInfinite() || rhs.isPositiveInfinite())
return negativeInfiniteTime();
if (hasDoubleValue() && rhs.hasDoubleValue())
return MediaTime::createWithDouble(m_timeValueAsDouble - rhs.m_timeValueAsDouble);
MediaTime a = *this;
MediaTime b = rhs;
if (a.hasDoubleValue())
a.setTimeScale(DefaultTimeScale);
else if (b.hasDoubleValue())
b.setTimeScale(DefaultTimeScale);
int32_t commonTimeScale;
if (!leastCommonMultiple(this->m_timeScale, rhs.m_timeScale, commonTimeScale) || commonTimeScale > MaximumTimeScale)
commonTimeScale = MaximumTimeScale;
a.setTimeScale(commonTimeScale);
b.setTimeScale(commonTimeScale);
while (!safeSub(a.m_timeValue, b.m_timeValue, a.m_timeValue)) {
if (commonTimeScale == 1)
return a.m_timeValue > 0 ? positiveInfiniteTime() : negativeInfiniteTime();
commonTimeScale /= 2;
a.setTimeScale(commonTimeScale);
b.setTimeScale(commonTimeScale);
}
return a;
}
示例4: abs
MediaTime abs(const MediaTime& rhs)
{
if (rhs.isInvalid())
return MediaTime::invalidTime();
if (rhs.isNegativeInfinite() || rhs.isPositiveInfinite())
return MediaTime::positiveInfiniteTime();
MediaTime val = rhs;
val.m_timeValue *= signum(rhs.m_timeScale) * signum(rhs.m_timeValue);
return val;
}
示例5: compare
MediaTime::ComparisonFlags MediaTime::compare(const MediaTime& rhs) const
{
if ((isPositiveInfinite() && rhs.isPositiveInfinite())
|| (isNegativeInfinite() && rhs.isNegativeInfinite())
|| (isInvalid() && rhs.isInvalid())
|| (isIndefinite() && rhs.isIndefinite()))
return EqualTo;
if (isInvalid())
return GreaterThan;
if (rhs.isInvalid())
return LessThan;
if (rhs.isNegativeInfinite() || isPositiveInfinite())
return GreaterThan;
if (rhs.isPositiveInfinite() || isNegativeInfinite())
return LessThan;
if (isIndefinite())
return GreaterThan;
if (rhs.isIndefinite())
return LessThan;
int64_t rhsWhole = rhs.m_timeValue / rhs.m_timeScale;
int64_t lhsWhole = m_timeValue / m_timeScale;
if (lhsWhole > rhsWhole)
return GreaterThan;
if (lhsWhole < rhsWhole)
return LessThan;
int64_t rhsRemain = rhs.m_timeValue % rhs.m_timeScale;
int64_t lhsRemain = m_timeValue % m_timeScale;
int64_t lhsFactor = lhsRemain * rhs.m_timeScale;
int64_t rhsFactor = rhsRemain * m_timeScale;
if (lhsFactor == rhsFactor)
return EqualTo;
return lhsFactor > rhsFactor ? GreaterThan : LessThan;
}
示例6: addDataCue
void InbandMetadataTextTrackPrivateAVF::addDataCue(const MediaTime& start, const MediaTime& end, PassRefPtr<SerializedPlatformRepresentation> prpCueData, const String& type)
{
ASSERT(cueFormat() == Data);
if (!client())
return;
RefPtr<SerializedPlatformRepresentation> cueData = prpCueData;
m_currentCueStartTime = start;
if (end.isPositiveInfinite())
m_incompleteCues.append(IncompleteMetaDataCue { cueData.get(), start });
client()->addDataCue(this, start, end, cueData, type);
}
示例7: addDataCue
void InbandDataTextTrack::addDataCue(InbandTextTrackPrivate*, const MediaTime& start, const MediaTime& end, PassRefPtr<SerializedPlatformRepresentation> prpPlatformValue, const String& type)
{
RefPtr<SerializedPlatformRepresentation> platformValue = prpPlatformValue;
if (m_incompleteCueMap.find(platformValue.get()) != m_incompleteCueMap.end())
return;
auto cue = DataCue::create(*scriptExecutionContext(), start, end, platformValue.copyRef(), type);
if (hasCue(cue.ptr(), TextTrackCue::IgnoreDuration)) {
LOG(Media, "InbandDataTextTrack::addDataCue ignoring already added cue: start=%s, end=%s\n", toString(cue->startTime()).utf8().data(), toString(cue->endTime()).utf8().data());
return;
}
if (end.isPositiveInfinite() && mediaElement()) {
cue->setEndTime(mediaElement()->durationMediaTime());
m_incompleteCueMap.add(WTFMove(platformValue), cue.copyRef());
}
addCue(WTFMove(cue), ASSERT_NO_EXCEPTION);
}
示例8: invalidTime
MediaTime MediaTime::operator-(const MediaTime& rhs) const
{
if (rhs.isInvalid() || isInvalid())
return invalidTime();
if (rhs.isIndefinite() || isIndefinite())
return indefiniteTime();
if (isPositiveInfinite()) {
if (rhs.isPositiveInfinite())
return invalidTime();
return positiveInfiniteTime();
}
if (isNegativeInfinite()) {
if (rhs.isNegativeInfinite())
return invalidTime();
return negativeInfiniteTime();
}
int32_t commonTimeScale;
if (!leastCommonMultiple(this->m_timeScale, rhs.m_timeScale, commonTimeScale) || commonTimeScale > MaximumTimeScale)
commonTimeScale = MaximumTimeScale;
MediaTime a = *this;
MediaTime b = rhs;
a.setTimeScale(commonTimeScale);
b.setTimeScale(commonTimeScale);
while (!safeSub(a.m_timeValue, b.m_timeValue, a.m_timeValue)) {
if (commonTimeScale == 1)
return a.m_timeValue > 0 ? positiveInfiniteTime() : negativeInfiniteTime();
commonTimeScale /= 2;
a.setTimeScale(commonTimeScale);
b.setTimeScale(commonTimeScale);
}
return a;
}