예제 #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;
}
예제 #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;
}
예제 #3
0
bool TextTrack::isMainProgramContent() const
{
    // "Main program" content is intrinsic to the presentation of the media file, regardless of locale. Content such as
    // directors commentary is not "main program" because it is not essential for the presentation. HTML5 doesn't have
    // a way to express this in a machine-reable form, it is typically done with the track label, so we assume that caption
    // tracks are main content and all other track types are not.
    return kind() == captionsKeyword();
}
예제 #4
0
bool VideoTrack::isValidKind(const AtomicString& kind) const
{
    return (kind == alternativeKeyword())
        || (kind == captionsKeyword())
        || (kind == mainKeyword())
        || (kind == signKeyword())
        || (kind == subtitlesKeyword())
        || (kind == commentaryKeyword());
}
예제 #5
0
bool TextTrack::isRendered()
{
    if (kind() != captionsKeyword() && kind() != subtitlesKeyword() && kind() != forcedKeyword())
        return false;

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

    return true;
}
예제 #6
0
파일: TextTrack.cpp 프로젝트: dog-god/iptv
bool TextTrack::isRendered()
{
    if (m_kind != captionsKeyword() && m_kind != subtitlesKeyword())
        return false;

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

    return true;
}
예제 #7
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());
    }
}
예제 #8
0
파일: TextTrack.cpp 프로젝트: dog-god/iptv
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;
}
예제 #9
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;
}
예제 #10
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;
}
예제 #11
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;
}
예제 #12
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();
}