Example #1
0
PassRefPtr<PlatformTextTrack> TextTrack::platformTextTrack()
{
    if (m_platformTextTrack)
        return m_platformTextTrack;

    PlatformTextTrack::TrackKind platformKind = PlatformTextTrack::Caption;
    if (kind() == subtitlesKeyword())
        platformKind = PlatformTextTrack::Subtitle;
    else if (kind() == captionsKeyword())
        platformKind = PlatformTextTrack::Caption;
    else if (kind() == descriptionsKeyword())
        platformKind = PlatformTextTrack::Description;
    else if (kind() == chaptersKeyword())
        platformKind = PlatformTextTrack::Chapter;
    else if (kind() == metadataKeyword())
        platformKind = PlatformTextTrack::MetaData;
    else if (kind() == forcedKeyword())
        platformKind = PlatformTextTrack::Forced;

    PlatformTextTrack::TrackType type = PlatformTextTrack::OutOfBand;
    if (m_trackType == TrackElement)
        type = PlatformTextTrack::OutOfBand;
    else if (m_trackType == AddTrack)
        type = PlatformTextTrack::Script;
    else if (m_trackType == InBand)
        type = PlatformTextTrack::InBand;

    m_platformTextTrack = PlatformTextTrack::create(this, label(), language(), platformKind, type, uniqueId());

    return m_platformTextTrack;
}
Example #2
0
PassRefPtr<PlatformTextTrack> TextTrack::platformTextTrack()
{
    if (m_platformTextTrack)
        return m_platformTextTrack;

    PlatformTextTrack::TrackKind kind = PlatformTextTrack::Caption;
    if (m_kind == subtitlesKeyword())
        kind = PlatformTextTrack::Subtitle;
    else if (m_kind == captionsKeyword())
        kind = PlatformTextTrack::Caption;
    else if (m_kind == descriptionsKeyword())
        kind = PlatformTextTrack::Description;
    else if (m_kind == chaptersKeyword())
        kind = PlatformTextTrack::Chapter;
    else if (m_kind == metadataKeyword())
        kind = PlatformTextTrack::MetaData;

    PlatformTextTrack::TrackType type = PlatformTextTrack::OutOfBand;
    if (m_trackType == TrackElement)
        type = PlatformTextTrack::OutOfBand;
    else if (m_trackType == AddTrack)
        type = PlatformTextTrack::Script;
    else if (m_trackType == InBand)
        type = PlatformTextTrack::InBand;

    m_platformTextTrack = PlatformTextTrack::create(this, m_label, m_language, kind, type);

    return m_platformTextTrack;
}
AtomicString TextTrack::kind() const
{
    AtomicString kind = TrackBase::kind();
    if (!m_manualSelectionMode || kind != forcedKeyword())
        return kind;

    return subtitlesKeyword();
}
Example #4
0
bool VideoTrack::isValidKind(const AtomicString& kind) const
{
    return (kind == alternativeKeyword())
        || (kind == captionsKeyword())
        || (kind == mainKeyword())
        || (kind == signKeyword())
        || (kind == subtitlesKeyword())
        || (kind == commentaryKeyword());
}
Example #5
0
LoadableTextTrack::LoadableTextTrack(HTMLTrackElement* track)
    : TextTrack(subtitlesKeyword(),
                emptyAtom,
                emptyAtom,
                emptyAtom,
                TrackElement),
      m_trackElement(track) {
  DCHECK(m_trackElement);
}
Example #6
0
bool TextTrack::isRendered()
{
    if (kind() != captionsKeyword() && kind() != subtitlesKeyword() && kind() != forcedKeyword())
        return false;

    if (m_mode != showingKeyword())
        return false;

    return true;
}
Example #7
0
bool TextTrack::isRendered()
{
    if (m_kind != captionsKeyword() && m_kind != subtitlesKeyword())
        return false;

    if (m_mode != showingKeyword() && !m_showingByDefault)
        return false;

    return true;
}
Example #8
0
const AtomicString& TextTrack::kindKeyword() const
{
    switch (m_kind) {
    case Kind::Captions:
        return captionsKeyword();
    case Kind::Chapters:
        return chaptersKeyword();
    case Kind::Descriptions:
        return descriptionsKeyword();
    case Kind::Forced:
        return forcedKeyword();
    case Kind::Metadata:
        return metadataKeyword();
    case Kind::Subtitles:
        return subtitlesKeyword();
    }
    ASSERT_NOT_REACHED();
    return subtitlesKeyword();
}
Example #9
0
void TextTrack::setKind(const AtomicString& kind)
{
    String oldKind = m_kind;

    if (isValidKindKeyword(kind))
        m_kind = kind;
    else
        m_kind = subtitlesKeyword();

    if (m_client && oldKind != m_kind)
        m_client->textTrackKindChanged(this);
}
Example #10
0
void TextTrack::setKind(const AtomicString& newKind)
{
    AtomicString oldKind = kind();
    TrackBase::setKind(newKind);

    // If kind changes from visual to non-visual and mode is 'showing', then force mode to 'hidden'.
    // FIXME: This is not per spec. crbug.com/460923
    if (oldKind != kind() && mode() == showingKeyword()) {
        if (kind() != captionsKeyword() && kind() != subtitlesKeyword())
            setMode(hiddenKeyword());
    }
}
Example #11
0
bool TextTrack::isValidKindKeyword(const AtomicString& value)
{
    if (equalIgnoringCase(value, subtitlesKeyword()))
        return true;
    if (equalIgnoringCase(value, captionsKeyword()))
        return true;
    if (equalIgnoringCase(value, descriptionsKeyword()))
        return true;
    if (equalIgnoringCase(value, chaptersKeyword()))
        return true;
    if (equalIgnoringCase(value, metadataKeyword()))
        return true;

    return false;
}
Example #12
0
bool TextTrack::isValidKindKeyword(const AtomicString& value)
{
    if (value == subtitlesKeyword())
        return true;
    if (value == captionsKeyword())
        return true;
    if (value == descriptionsKeyword())
        return true;
    if (value == chaptersKeyword())
        return true;
    if (value == metadataKeyword())
        return true;

    return false;
}
Example #13
0
bool VideoTrack::isValidKind(const AtomicString& value) const
{
    if (value == alternativeKeyword())
        return true;
    if (value == captionsKeyword())
        return true;
    if (value == mainKeyword())
        return true;
    if (value == signKeyword())
        return true;
    if (value == subtitlesKeyword())
        return true;
    if (value == commentaryKeyword())
        return true;

    return false;
}