当前位置: 首页>>代码示例>>C++>>正文


C++ TextTrackCueList类代码示例

本文整理汇总了C++中TextTrackCueList的典型用法代码示例。如果您正苦于以下问题:C++ TextTrackCueList类的具体用法?C++ TextTrackCueList怎么用?C++ TextTrackCueList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TextTrackCueList类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: collectActiveCues

void TextTrackCueList::collectActiveCues(TextTrackCueList& activeCues) const
{
    activeCues.clear();
    for (auto& cue : m_list) {
        if (cue->isActive())
            activeCues.add(cue);
    }
}
开发者ID:alexanderbill,项目名称:blink-crosswalk,代码行数:8,代码来源:TextTrackCueList.cpp

示例2: DCHECK

unsigned TextTrackCue::cueIndex() {
  // This method can only be called on cues while they are associated with
  // a(n enabled) track (and hence that track's list of cues should exist.)
  DCHECK(track() && track()->cues());
  TextTrackCueList* cueList = track()->cues();
  if (!cueList->isCueIndexValid(m_cueIndex))
    cueList->validateCueIndexes();
  return m_cueIndex;
}
开发者ID:mirror,项目名称:chromium,代码行数:9,代码来源:TextTrackCue.cpp

示例3:

void
TextTrackManager::AddCues(TextTrack* aTextTrack)
{
  TextTrackCueList* cueList = aTextTrack->GetCues();
  if (cueList) {
    bool dummy;
    for (uint32_t i = 0; i < cueList->Length(); ++i) {
      mNewCues->AddCue(*cueList->IndexedGetter(i, dummy));
    }
  }
}
开发者ID:PatMart,项目名称:gecko-dev,代码行数:11,代码来源:TextTrackManager.cpp

示例4: ensureTextTrackCueList

void TextTrack::addListOfCues(HeapVector<Member<TextTrackCue>>& listOfNewCues)
{
    TextTrackCueList* cues = ensureTextTrackCueList();

    for (auto& newCue : listOfNewCues) {
        newCue->setTrack(this);
        cues->add(newCue);
    }

    if (cueTimeline() && mode() != disabledKeyword())
        cueTimeline()->addCues(this, cues);
}
开发者ID:astojilj,项目名称:chromium-crosswalk,代码行数:12,代码来源:TextTrack.cpp

示例5: DispatchTimeMarchesOn

void
TextTrackManager::AddCues(TextTrack* aTextTrack)
{
  if (!mNewCues) {
    return;
  }

  TextTrackCueList* cueList = aTextTrack->GetCues();
  if (cueList) {
    bool dummy;
    for (uint32_t i = 0; i < cueList->Length(); ++i) {
      mNewCues->AddCue(*cueList->IndexedGetter(i, dummy));
    }
    DispatchTimeMarchesOn();
  }
}
开发者ID:gcp,项目名称:gecko-dev,代码行数:16,代码来源:TextTrackManager.cpp

示例6: WEBVTT_LOG

void TextTrackManager::AddCues(TextTrack* aTextTrack) {
  if (!mNewCues) {
    WEBVTT_LOG("AddCues mNewCues is null");
    return;
  }

  TextTrackCueList* cueList = aTextTrack->GetCues();
  if (cueList) {
    bool dummy;
    WEBVTT_LOGV("AddCues, CuesNum=%d", cueList->Length());
    for (uint32_t i = 0; i < cueList->Length(); ++i) {
      mNewCues->AddCue(*cueList->IndexedGetter(i, dummy));
    }
    TimeMarchesOn();
  }
}
开发者ID:jasonLaster,项目名称:gecko-dev,代码行数:16,代码来源:TextTrackManager.cpp

示例7: NS_ASSERTION

// https://html.spec.whatwg.org/multipage/embedded-content.html#time-marches-on
void
TextTrackManager::TimeMarchesOn()
{
  NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
  WEBVTT_LOG("TimeMarchesOn");
  mTimeMarchesOnDispatched = false;

  // Early return if we don't have any TextTracks or shutting down.
  if (!mTextTracks || mTextTracks->Length() == 0 || mShutdown) {
    return;
  }

  nsISupports* parentObject =
    mMediaElement->OwnerDoc()->GetParentObject();
  if (NS_WARN_IF(!parentObject)) {
    return;
  }
  nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(parentObject);

  if (mMediaElement &&
      (!(mMediaElement->GetPlayedOrSeeked()) || mMediaElement->Seeking())) {
    WEBVTT_LOG("TimeMarchesOn seeking or post return");
    return;
  }

  // Step 3.
  double currentPlaybackTime = mMediaElement->CurrentTime();
  bool hasNormalPlayback = !mHasSeeked;
  mHasSeeked = false;
  WEBVTT_LOG("TimeMarchesOn mLastTimeMarchesOnCalled %lf currentPlaybackTime %lf hasNormalPlayback %d"
      , mLastTimeMarchesOnCalled, currentPlaybackTime, hasNormalPlayback);

  // Step 1, 2.
  RefPtr<TextTrackCueList> currentCues =
    new TextTrackCueList(window);
  RefPtr<TextTrackCueList> otherCues =
    new TextTrackCueList(window);
  bool dummy;
  for (uint32_t index = 0; index < mTextTracks->Length(); ++index) {
    TextTrack* ttrack = mTextTracks->IndexedGetter(index, dummy);
    if (ttrack && dummy) {
      // TODO: call GetCueListByTimeInterval on mNewCues?
      ttrack->UpdateActiveCueList();
      TextTrackCueList* activeCueList = ttrack->GetActiveCues();
      if (activeCueList) {
        for (uint32_t i = 0; i < activeCueList->Length(); ++i) {
          currentCues->AddCue(*((*activeCueList)[i]));
        }
      }
    }
  }
  WEBVTT_LOGV("TimeMarchesOn currentCues %d", currentCues->Length());
  // Populate otherCues with 'non-active" cues.
  if (hasNormalPlayback) {
    if (currentPlaybackTime < mLastTimeMarchesOnCalled) {
      // TODO: Add log and find the root cause why the
      // playback position goes backward.
      mLastTimeMarchesOnCalled = currentPlaybackTime;
    }
    media::Interval<double> interval(mLastTimeMarchesOnCalled,
                                     currentPlaybackTime);
    otherCues = mNewCues->GetCueListByTimeInterval(interval);;
  } else {
    // Seek case. Put the mLastActiveCues into otherCues.
    otherCues = mLastActiveCues;
  }
  for (uint32_t i = 0; i < currentCues->Length(); ++i) {
    TextTrackCue* cue = (*currentCues)[i];
    otherCues->RemoveCue(*cue);
  }
  WEBVTT_LOGV("TimeMarchesOn otherCues %d", otherCues->Length());
  // Step 4.
  RefPtr<TextTrackCueList> missedCues = new TextTrackCueList(window);
  if (hasNormalPlayback) {
    for (uint32_t i = 0; i < otherCues->Length(); ++i) {
      TextTrackCue* cue = (*otherCues)[i];
      if (cue->StartTime() >= mLastTimeMarchesOnCalled &&
          cue->EndTime() <= currentPlaybackTime) {
        missedCues->AddCue(*cue);
      }
    }
  }
  WEBVTT_LOGV("TimeMarchesOn missedCues %d", missedCues->Length());
  // Step 5. Empty now.
  // TODO: Step 6: fire timeupdate?

  // Step 7. Abort steps if condition 1, 2, 3 are satisfied.
  // 1. All of the cues in current cues have their active flag set.
  // 2. None of the cues in other cues have their active flag set.
  // 3. Missed cues is empty.
  bool c1 = true;
  for (uint32_t i = 0; i < currentCues->Length(); ++i) {
    if (!(*currentCues)[i]->GetActive()) {
      c1 = false;
      break;
    }
  }
  bool c2 = true;
  for (uint32_t i = 0; i < otherCues->Length(); ++i) {
//.........这里部分代码省略.........
开发者ID:alphan102,项目名称:gecko-dev,代码行数:101,代码来源:TextTrackManager.cpp

示例8: LessThan

  bool LessThan(SimpleTextTrackEvent* aOne, SimpleTextTrackEvent* aTwo) const
  {
    // TimeMarchesOn step 13.1.
    if (aOne->mTime < aTwo->mTime) {
      return true;
    } else if (aOne->mTime > aTwo->mTime) {
      return false;
    }

    // TimeMarchesOn step 13.2 text track cue order.
    // TextTrack position in TextTrackList
    TextTrack* t1 = aOne->mTrack;
    TextTrack* t2 = aTwo->mTrack;
    MOZ_ASSERT(t1, "CompareSimpleTextTrackEvents t1 is null");
    MOZ_ASSERT(t2, "CompareSimpleTextTrackEvents t2 is null");
    if (t1 != t2) {
      TextTrackList* tList= t1->GetTextTrackList();
      MOZ_ASSERT(tList, "CompareSimpleTextTrackEvents tList is null");
      nsTArray<RefPtr<TextTrack>>& textTracks = tList->GetTextTrackArray();
      auto index1 = textTracks.IndexOf(t1);
      auto index2 = textTracks.IndexOf(t2);
      if (index1 < index2) {
        return true;
      } else if (index1 > index2) {
        return false;
      }
    }

    MOZ_ASSERT(t1 == t2, "CompareSimpleTextTrackEvents t1 != t2");
    // c1 and c2 are both belongs to t1.
    TextTrackCue* c1 = aOne->mCue;
    TextTrackCue* c2 = aTwo->mCue;
    if (c1 != c2) {
      if (c1->StartTime() < c2->StartTime()) {
        return true;
      } else if (c1->StartTime() > c2->StartTime()) {
        return false;
      }
      if (c1->EndTime() < c2->EndTime()) {
        return true;
      } else if (c1->EndTime() > c2->EndTime()) {
        return false;
      }

      TextTrackCueList* cueList = t1->GetCues();
      nsTArray<RefPtr<TextTrackCue>>& cues = cueList->GetCuesArray();
      auto index1 = cues.IndexOf(c1);
      auto index2 = cues.IndexOf(c2);
      if (index1 < index2) {
        return true;
      } else if (index1 > index2) {
        return false;
      }
    }

    // TimeMarchesOn step 13.3.
    if (aOne->mName.EqualsLiteral("enter") ||
        aTwo->mName.EqualsLiteral("exit")) {
      return true;
    }
    return false;
  }
开发者ID:yrliou,项目名称:gecko-dev,代码行数:62,代码来源:TextTrackManager.cpp


注:本文中的TextTrackCueList类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。