本文整理汇总了C++中TextTrackCue::startTime方法的典型用法代码示例。如果您正苦于以下问题:C++ TextTrackCue::startTime方法的具体用法?C++ TextTrackCue::startTime怎么用?C++ TextTrackCue::startTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextTrackCue
的用法示例。
在下文中一共展示了TextTrackCue::startTime方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: hasCue
bool TextTrack::hasCue(VTTCue* cue, VTTCue::CueMatchRules match)
{
if (cue->startTime() < 0 || cue->endTime() < 0)
return false;
if (!m_cues || !m_cues->length())
return false;
size_t searchStart = 0;
size_t searchEnd = m_cues->length();
while (1) {
ASSERT(searchStart <= m_cues->length());
ASSERT(searchEnd <= m_cues->length());
TextTrackCue* existingCue;
// Cues in the TextTrackCueList are maintained in start time order.
if (searchStart == searchEnd) {
if (!searchStart)
return false;
// If there is more than one cue with the same start time, back up to first one so we
// consider all of them.
while (searchStart >= 2 && cue->startTime() == m_cues->item(searchStart - 2)->startTime())
--searchStart;
bool firstCompare = true;
while (1) {
if (!firstCompare)
++searchStart;
firstCompare = false;
if (searchStart > m_cues->length())
return false;
existingCue = m_cues->item(searchStart - 1);
if (!cue->isRenderable())
continue;
if (!existingCue || cue->startTime() > existingCue->startTime())
return false;
if (!toVTTCue(existingCue)->isEqual(*cue, match))
continue;
return true;
}
}
size_t index = (searchStart + searchEnd) / 2;
existingCue = m_cues->item(index);
if (cue->startTime() < existingCue->startTime() || (match != VTTCue::IgnoreDuration && cue->startTime() == existingCue->startTime() && cue->endTime() > existingCue->endTime()))
searchEnd = index;
else
searchStart = index + 1;
}
ASSERT_NOT_REACHED();
return false;
}
示例2:
bool TextTrackCue::operator==(const TextTrackCue& cue) const
{
if (cueType() != cue.cueType())
return false;
if (m_endTime != cue.endTime())
return false;
if (m_startTime != cue.startTime())
return false;
if (m_content != cue.text())
return false;
if (m_settings != cue.cueSettings())
return false;
if (m_id != cue.id())
return false;
if (m_textPosition != cue.position())
return false;
if (m_linePosition != cue.line())
return false;
if (m_cueSize != cue.size())
return false;
if (align() != cue.align())
return false;
return true;
}
示例3: isEqual
bool TextTrackCue::isEqual(const TextTrackCue& cue, CueMatchRules match) const
{
if (cueType() != cue.cueType())
return false;
if (match != IgnoreDuration && m_endTime != cue.endTime())
return false;
if (m_startTime != cue.startTime())
return false;
if (m_content != cue.text())
return false;
if (m_settings != cue.cueSettings())
return false;
if (m_id != cue.id())
return false;
if (m_textPosition != cue.position())
return false;
if (m_linePosition != cue.line())
return false;
if (m_cueSize != cue.size())
return false;
if (align() != cue.align())
return false;
return true;
}
示例4: hasCue
bool TextTrack::hasCue(TextTrackCue* cue, TextTrackCue::CueMatchRules match)
{
if (cue->startTime() < 0 || cue->endTime() < 0)
return false;
if (!m_cues || !m_cues->length())
return false;
size_t searchStart = 0;
size_t searchEnd = m_cues->length();
while (1) {
ASSERT(searchStart <= m_cues->length());
ASSERT(searchEnd <= m_cues->length());
TextTrackCue* existingCue;
// Cues in the TextTrackCueList are maintained in start time order.
if (searchStart == searchEnd) {
if (!searchStart)
return false;
// If there is more than one cue with the same start time, back up to first one so we
// consider all of them.
while (searchStart >= 2 && cue->hasEquivalentStartTime(*m_cues->item(searchStart - 2)))
--searchStart;
bool firstCompare = true;
while (1) {
if (!firstCompare)
++searchStart;
firstCompare = false;
if (searchStart > m_cues->length())
return false;
existingCue = m_cues->item(searchStart - 1);
if (!existingCue)
return false;
if (existingCue->doesExtendCue(*cue)) {
existingCue->setEndTime(cue->endTime(), IGNORE_EXCEPTION);
return true;
}
if (cue->startTime() > (existingCue->startTime() + startTimeVariance()))
return false;
if (existingCue->isEqual(*cue, match))
return true;
}
}
size_t index = (searchStart + searchEnd) / 2;
existingCue = m_cues->item(index);
if ((cue->startTime() + startTimeVariance()) < existingCue->startTime() || (match != TextTrackCue::IgnoreDuration && cue->hasEquivalentStartTime(*existingCue) && cue->endTime() > existingCue->endTime()))
searchEnd = index;
else
searchStart = index + 1;
}
ASSERT_NOT_REACHED();
return false;
}