Beispiel #1
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;
}
Beispiel #2
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;
}
Beispiel #3
0
bool AudioTrack::isValidKind(const AtomicString& kind) const
{
    return (kind == alternativeKeyword())
        || (kind == descriptionsKeyword())
        || (kind == mainKeyword())
        || (kind == mainDescriptionsKeyword())
        || (kind == translationKeyword())
        || (kind == commentaryKeyword());
}
Beispiel #4
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;
}
Beispiel #5
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;
}
Beispiel #6
0
TextTrack::TextTrack(ScriptExecutionContext* context, TextTrackClient* client, const AtomicString& kind, const AtomicString& id, const AtomicString& label, const AtomicString& language, TextTrackType type)
    : TrackBase(TrackBase::TextTrack, id, label, language)
    , m_scriptExecutionContext(context)
    , m_client(client)
    , m_trackType(type)
    , m_trackIndex(invalidTrackIndex)
    , m_renderedTrackIndex(invalidTrackIndex)
{
    if (kind == captionsKeyword())
        m_kind = Kind::Captions;
    else if (kind == chaptersKeyword())
        m_kind = Kind::Chapters;
    else if (kind == descriptionsKeyword())
        m_kind = Kind::Descriptions;
    else if (kind == forcedKeyword())
        m_kind = Kind::Forced;
    else if (kind == metadataKeyword())
        m_kind = Kind::Metadata;
}
Beispiel #7
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();
}