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


C++ TextTrack类代码示例

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


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

示例1: ensureTextTrackCueList

void TextTrack::addCue(PassRefPtr<TextTrackCue> prpCue)
{
    if (!prpCue)
        return;

    RefPtr<TextTrackCue> cue = prpCue;

    // TODO(93143): Add spec-compliant behavior for negative time values.
    if (std::isnan(cue->startTime()) || std::isnan(cue->endTime()) || cue->startTime() < 0 || cue->endTime() < 0)
        return;

    // 4.8.10.12.5 Text track API

    // The addCue(cue) method of TextTrack objects, when invoked, must run the following steps:

    // 1. If the given cue is in a text track list of cues, then remove cue from that text track
    // list of cues.
    TextTrack* cueTrack = cue->track();
    if (cueTrack && cueTrack != this)
        cueTrack->removeCue(cue.get(), ASSERT_NO_EXCEPTION);

    // 2. Add cue to the method's TextTrack object's text track's text track list of cues.
    cue->setTrack(this);
    ensureTextTrackCueList()->add(cue);
    
    if (m_client)
        m_client->textTrackAddCue(this, cue.get());
}
开发者ID:fmalita,项目名称:webkit,代码行数:28,代码来源:TextTrack.cpp

示例2: oncuechangeAttrSetter

static void oncuechangeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    TextTrack* imp = V8TextTrack::toNative(info.Holder());
    transferHiddenDependency(info.Holder(), imp->oncuechange(), value, V8TextTrack::eventListenerCacheIndex);
    imp->setOncuechange(V8DOMWrapper::getEventListener(value, true, ListenerFindOrCreate));
    return;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:7,代码来源:V8TextTrack.cpp

示例3: modeAttrSetter

static void modeAttrSetter(v8::Local<v8::String> name, v8::Local<v8::Value> value, const v8::AccessorInfo& info)
{
    TextTrack* imp = V8TextTrack::toNative(info.Holder());
    V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, v, value);
    imp->setMode(v);
    return;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:7,代码来源:V8TextTrack.cpp

示例4: textTrackSelectionScore

static int textTrackSelectionScore(const TextTrack& track)
{
    if (track.kind() != TextTrack::captionsKeyword() && track.kind() != TextTrack::subtitlesKeyword())
        return 0;

    return textTrackLanguageSelectionScore(track);
}
开发者ID:dstockwell,项目名称:blink,代码行数:7,代码来源:AutomaticTrackSelection.cpp

示例5: ensureVTTRegionList

void TextTrack::addRegion(PassRefPtr<VTTRegion> prpRegion)
{
    if (!prpRegion)
        return;

    RefPtr<VTTRegion> region = prpRegion;
    VTTRegionList* regionList = ensureVTTRegionList();

    // 1. If the given region is in a text track list of regions, then remove
    // region from that text track list of regions.
    TextTrack* regionTrack = region->track();
    if (regionTrack && regionTrack != this)
        regionTrack->removeRegion(region.get(), ASSERT_NO_EXCEPTION);

    // 2. If the method's TextTrack object's text track list of regions contains
    // a region with the same identifier as region replace the values of that
    // region's width, height, anchor point, viewport anchor point and scroll
    // attributes with those of region.
    VTTRegion* existingRegion = regionList->getRegionById(region->id());
    if (existingRegion) {
        existingRegion->updateParametersFromRegion(region.get());
        return;
    }

    // Otherwise: add region to the method's TextTrack object's text track
    // list of regions.
    region->setTrack(this);
    regionList->add(region);
}
开发者ID:kamihouse,项目名称:webkit,代码行数:29,代码来源:TextTrack.cpp

示例6: PerformTrackSelection

void
TextTrackManager::HonorUserPreferencesForTrackSelection()
{
  if (performedTrackSelection) {
    return;
  }

  TextTrackKind ttKinds[] = { TextTrackKind::Captions,
                              TextTrackKind::Subtitles };

  // Steps 1 - 3: Perform automatic track selection for different TextTrack
  // Kinds.
  PerformTrackSelection(ttKinds, ArrayLength(ttKinds));
  PerformTrackSelection(TextTrackKind::Descriptions);
  PerformTrackSelection(TextTrackKind::Chapters);

  // Step 4: Set all TextTracks with a kind of metadata that are disabled
  // to hidden.
  for (uint32_t i = 0; i < mTextTracks->Length(); i++) {
    TextTrack* track = (*mTextTracks)[i];
    if (track->Kind() == TextTrackKind::Metadata && TrackIsDefault(track) &&
        track->Mode() == TextTrackMode::Disabled) {
      track->SetMode(TextTrackMode::Hidden);
    }
  }

  performedTrackSelection = true;
}
开发者ID:PatMart,项目名称:gecko-dev,代码行数:28,代码来源:TextTrackManager.cpp

示例7: mediaElement

void MediaControls::showTextTrackAtIndex(unsigned indexToEnable) {
  TextTrackList* trackList = mediaElement().textTracks();
  if (indexToEnable >= trackList->length())
    return;
  TextTrack* track = trackList->anonymousIndexedGetter(indexToEnable);
  if (track && track->canBeRendered())
    track->setMode(TextTrack::showingKeyword());
}
开发者ID:,项目名称:,代码行数:8,代码来源:

示例8: addCueCallback

static v8::Handle<v8::Value> addCueCallback(const v8::Arguments& args)
{
    if (args.Length() < 1)
        return throwNotEnoughArgumentsError(args.GetIsolate());
    TextTrack* imp = V8TextTrack::toNative(args.Holder());
    V8TRYCATCH(TextTrackCue*, cue, V8TextTrackCue::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8TextTrackCue::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
    imp->addCue(cue);
    return v8Undefined();
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:9,代码来源:V8TextTrack.cpp

示例9:

void
TextTrackManager::GetTextTracksOfKind(TextTrackKind aTextTrackKind,
                                      nsTArray<TextTrack*>& aTextTracks)
{
  for (uint32_t i = 0; i < mTextTracks->Length(); i++) {
    TextTrack* textTrack = (*mTextTracks)[i];
    if (textTrack->Kind() == aTextTrackKind) {
      aTextTracks.AppendElement(textTrack);
    }
  }
}
开发者ID:PatMart,项目名称:gecko-dev,代码行数:11,代码来源:TextTrackManager.cpp

示例10: activeCuesAttrGetter

static v8::Handle<v8::Value> activeCuesAttrGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
{
    TextTrack* imp = V8TextTrack::toNative(info.Holder());
    RefPtr<TextTrackCueList> result = imp->activeCues();
    v8::Handle<v8::Value> wrapper = result.get() ? v8::Handle<v8::Value>(DOMDataStore::getWrapper(result.get(), info.GetIsolate())) : v8Undefined();
    if (wrapper.IsEmpty()) {
        wrapper = toV8(result.get(), info.Holder(), info.GetIsolate());
        if (!wrapper.IsEmpty())
            V8DOMWrapper::setNamedHiddenReference(info.Holder(), "activeCues", wrapper);
    }
    return wrapper;
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:12,代码来源:V8TextTrack.cpp

示例11: textTrackLanguageSelectionScore

static int textTrackLanguageSelectionScore(const TextTrack& track)
{
    if (track.language().isEmpty())
        return 0;

    Vector<AtomicString> languages = userPreferredLanguages();
    size_t languageMatchIndex = indexOfBestMatchingLanguageInList(track.language(), languages);
    if (languageMatchIndex >= languages.size())
        return 0;

    return languages.size() - languageMatchIndex;
}
开发者ID:dstockwell,项目名称:blink,代码行数:12,代码来源:AutomaticTrackSelection.cpp

示例12:

void
TextTrackManager::PopulatePendingList()
{
  uint32_t len = mTextTracks->Length();
  bool dummy;
  for (uint32_t index = 0; index < len; ++index) {
    TextTrack* ttrack = mTextTracks->IndexedGetter(index, dummy);
    if (ttrack && ttrack->Mode() != TextTrackMode::Disabled &&
        ttrack->ReadyState() == HTMLTrackElement::LOADING) {
      mPendingTextTracks->AddTextTrack(ttrack);
    }
  }
}
开发者ID:Gabuzo,项目名称:mozilla-central,代码行数:13,代码来源:TextTrackManager.cpp

示例13: ASSERT_GC_OBJECT_INHERITS

void JSTextTrack::visitChildren(JSCell* cell, SlotVisitor& visitor)
{
    JSTextTrack* jsTextTrack = jsCast<JSTextTrack*>(cell);
    ASSERT_GC_OBJECT_INHERITS(jsTextTrack, &s_info);
    COMPILE_ASSERT(StructureFlags & OverridesVisitChildren, OverridesVisitChildrenWithoutSettingFlag);
    ASSERT(jsTextTrack->structure()->typeInfo().overridesVisitChildren());
    Base::visitChildren(jsTextTrack, visitor);

    TextTrack* textTrack = static_cast<TextTrack*>(jsTextTrack->impl());
    visitor.addOpaqueRoot(root(textTrack));

    textTrack->visitJSEventListeners(visitor);
}
开发者ID:venkatarajasekhar,项目名称:Qt,代码行数:13,代码来源:JSTextTrackCustom.cpp

示例14: anonymousIndexedGetter

TextTrack* TextTrackList::getTrackById(const AtomicString& id) {
  // 4.8.10.12.5 Text track API
  // The getTrackById(id) method must return the first TextTrack in the
  // TextTrackList object whose id IDL attribute would return a value equal
  // to the value of the id argument.
  for (unsigned i = 0; i < length(); ++i) {
    TextTrack* track = anonymousIndexedGetter(i);
    if (String(track->id()) == id)
      return track;
  }

  // When no tracks match the given argument, the method must return null.
  return 0;
}
开发者ID:mirror,项目名称:chromium,代码行数:14,代码来源:TextTrackList.cpp

示例15: CompareTextTracks

void
TextTrackManager::PopulatePendingList()
{
  uint32_t len = mTextTracks->Length();
  bool dummy;
  for (uint32_t index = 0; index < len; ++index) {
    TextTrack* ttrack = mTextTracks->IndexedGetter(index, dummy);
    if (ttrack && ttrack->Mode() != TextTrackMode::Disabled &&
        ttrack->ReadyState() == TextTrackReadyState::Loading) {
      mPendingTextTracks->AddTextTrack(ttrack,
                                       CompareTextTracks(mMediaElement));
    }
  }
}
开发者ID:PatMart,项目名称:gecko-dev,代码行数:14,代码来源:TextTrackManager.cpp


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