本文整理汇总了C++中TextTrack类的典型用法代码示例。如果您正苦于以下问题:C++ TextTrack类的具体用法?C++ TextTrack怎么用?C++ TextTrack使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TextTrack类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: getTrackIndex
int TextTrackList::getTrackIndex(TextTrack& textTrack)
{
if (is<LoadableTextTrack>(textTrack))
return downcast<LoadableTextTrack>(textTrack).trackElementIndex();
if (textTrack.trackType() == TextTrack::AddTrack)
return m_elementTracks.size() + m_addTrackTracks.find(&textTrack);
if (textTrack.trackType() == TextTrack::InBand)
return m_elementTracks.size() + m_addTrackTracks.size() + m_inbandTracks.find(&textTrack);
ASSERT_NOT_REACHED();
return -1;
}
开发者ID:caiolima,项目名称:webkit,代码行数:15,代码来源:TextTrackList.cpp
示例17: removeCueCallback
static v8::Handle<v8::Value> removeCueCallback(const v8::Arguments& args)
{
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
TextTrack* imp = V8TextTrack::toNative(args.Holder());
ExceptionCode ec = 0;
{
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->removeCue(cue, ec);
if (UNLIKELY(ec))
goto fail;
return v8Undefined();
}
fail:
return setDOMException(ec, args.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:16,代码来源:V8TextTrack.cpp
示例18: dispatchEventCallback
static v8::Handle<v8::Value> dispatchEventCallback(const v8::Arguments& args)
{
if (args.Length() < 1)
return throwNotEnoughArgumentsError(args.GetIsolate());
TextTrack* imp = V8TextTrack::toNative(args.Holder());
ExceptionCode ec = 0;
{
V8TRYCATCH(Event*, evt, V8Event::HasInstance(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined)) ? V8Event::toNative(v8::Handle<v8::Object>::Cast(MAYBE_MISSING_PARAMETER(args, 0, DefaultIsUndefined))) : 0);
bool result = imp->dispatchEvent(evt, ec);
if (UNLIKELY(ec))
goto fail;
return v8Boolean(result, args.GetIsolate());
}
fail:
return setDOMException(ec, args.GetIsolate());
}
开发者ID:sanyaade-embedded-systems,项目名称:armhf-node-webkit,代码行数:16,代码来源:V8TextTrack.cpp
示例19: switch
void TextTrackList::invalidateTrackIndexesAfterTrack(TextTrack& track)
{
Vector<RefPtr<TrackBase>>* tracks = nullptr;
switch (track.trackType()) {
case TextTrack::TrackElement:
tracks = &m_elementTracks;
for (auto& addTrack : m_addTrackTracks)
downcast<TextTrack>(addTrack.get())->invalidateTrackIndex();
for (auto& inbandTrack : m_inbandTracks)
downcast<TextTrack>(inbandTrack.get())->invalidateTrackIndex();
break;
case TextTrack::AddTrack:
tracks = &m_addTrackTracks;
for (auto& inbandTrack : m_inbandTracks)
downcast<TextTrack>(inbandTrack.get())->invalidateTrackIndex();
break;
case TextTrack::InBand:
tracks = &m_inbandTracks;
break;
default:
ASSERT_NOT_REACHED();
}
size_t index = tracks->find(&track);
if (index == notFound)
return;
for (size_t i = index; i < tracks->size(); ++i)
downcast<TextTrack>(*tracks->at(index)).invalidateTrackIndex();
}
开发者ID:caiolima,项目名称:webkit,代码行数:31,代码来源:TextTrackList.cpp
示例20: ENABLE
void MediaControlClosedCaptionsTrackListElement::updateDisplay()
{
#if ENABLE(VIDEO_TRACK)
DEFINE_STATIC_LOCAL(AtomicString, selectedClassValue, ("selected", AtomicString::ConstructFromLiteral));
if (!mediaController()->hasClosedCaptions())
return;
HTMLMediaElement* mediaElement = toParentMediaElement(this);
if (!mediaElement)
return;
TextTrackList* trackList = mediaElement->textTracks();
if (!trackList || !trackList->length())
return;
if (m_trackListHasChanged)
rebuildTrackListMenu();
bool captionsVisible = mediaElement->closedCaptionsVisible();
for (unsigned i = 0, length = m_menuItems.size(); i < length; ++i) {
RefPtr<Element> trackItem = m_menuItems[i];
int trackIndex = trackListIndexForElement(trackItem.get());
if (trackIndex != HTMLMediaElement::textTracksIndexNotFound()) {
if (trackIndex == HTMLMediaElement::textTracksOffIndex()) {
if (captionsVisible)
trackItem->classList()->remove(selectedClassValue, ASSERT_NO_EXCEPTION);
else
trackItem->classList()->add(selectedClassValue, ASSERT_NO_EXCEPTION);
} else {
TextTrack* track = trackList->item(trackIndex);
if (!track)
continue;
if (track->mode() == TextTrack::showingKeyword())
trackItem->classList()->add(selectedClassValue, ASSERT_NO_EXCEPTION);
else
trackItem->classList()->remove(selectedClassValue, ASSERT_NO_EXCEPTION);
}
}
}
#endif
}
开发者ID:,项目名称:,代码行数:43,代码来源:
注:本文中的TextTrack类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论