diff options
Diffstat (limited to 'Source/WebCore/html/track/TrackBase.h')
-rw-r--r-- | Source/WebCore/html/track/TrackBase.h | 49 |
1 files changed, 29 insertions, 20 deletions
diff --git a/Source/WebCore/html/track/TrackBase.h b/Source/WebCore/html/track/TrackBase.h index 509f7a61f..16d162a13 100644 --- a/Source/WebCore/html/track/TrackBase.h +++ b/Source/WebCore/html/track/TrackBase.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2011 Apple Inc. All rights reserved. + * Copyright (C) 2011-2017 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -10,10 +10,10 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR @@ -23,13 +23,11 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef TrackBase_h -#define TrackBase_h +#pragma once #if ENABLE(VIDEO_TRACK) -#include "EventTarget.h" -#include <wtf/RefCounted.h> +#include <wtf/text/AtomicString.h> namespace WebCore { @@ -51,17 +49,17 @@ public: virtual AtomicString id() const { return m_id; } virtual void setId(const AtomicString& id) { m_id = id; } - AtomicString kind() const { return m_kind; } - virtual void setKind(const AtomicString&); - AtomicString label() const { return m_label; } void setLabel(const AtomicString& label) { m_label = label; } + AtomicString validBCP47Language() const; AtomicString language() const { return m_language; } - virtual void setLanguage(const AtomicString& language) { m_language = language; } + virtual void setLanguage(const AtomicString&); virtual void clearClient() = 0; + virtual int uniqueId() const { return m_uniqueId; } + #if ENABLE(MEDIA_SOURCE) SourceBuffer* sourceBuffer() const { return m_sourceBuffer; } void setSourceBuffer(SourceBuffer* buffer) { m_sourceBuffer = buffer; } @@ -72,26 +70,37 @@ public: protected: TrackBase(Type, const AtomicString& id, const AtomicString& label, const AtomicString& language); - virtual bool isValidKind(const AtomicString&) const = 0; - virtual const AtomicString& defaultKindKeyword() const = 0; - - void setKindInternal(const AtomicString&); - - HTMLMediaElement* m_mediaElement; + HTMLMediaElement* m_mediaElement { nullptr }; #if ENABLE(MEDIA_SOURCE) - SourceBuffer* m_sourceBuffer; + SourceBuffer* m_sourceBuffer { nullptr }; #endif private: Type m_type; + int m_uniqueId; AtomicString m_id; - AtomicString m_kind; AtomicString m_label; AtomicString m_language; + AtomicString m_validBCP47Language; +}; + +class MediaTrackBase : public TrackBase { +public: + const AtomicString& kind() const { return m_kind; } + virtual void setKind(const AtomicString&); + +protected: + MediaTrackBase(Type, const AtomicString& id, const AtomicString& label, const AtomicString& language); + + void setKindInternal(const AtomicString&); + +private: + virtual bool isValidKind(const AtomicString&) const = 0; + + AtomicString m_kind; }; } // namespace WebCore #endif -#endif // TrackBase_h |