OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 24 matching lines...) Expand all Loading... |
35 #include "core/events/EventTarget.h" | 35 #include "core/events/EventTarget.h" |
36 #include "core/html/HTMLMediaSource.h" | 36 #include "core/html/HTMLMediaSource.h" |
37 #include "core/html/URLRegistry.h" | 37 #include "core/html/URLRegistry.h" |
38 #include "modules/mediasource/SourceBuffer.h" | 38 #include "modules/mediasource/SourceBuffer.h" |
39 #include "modules/mediasource/SourceBufferList.h" | 39 #include "modules/mediasource/SourceBufferList.h" |
40 #include "public/platform/WebMediaSource.h" | 40 #include "public/platform/WebMediaSource.h" |
41 #include "wtf/PassOwnPtr.h" | 41 #include "wtf/PassOwnPtr.h" |
42 #include "wtf/Vector.h" | 42 #include "wtf/Vector.h" |
43 | 43 |
44 namespace blink { | 44 namespace blink { |
45 class WebSourceBuffer; | |
46 } | |
47 | |
48 namespace blink { | |
49 | 45 |
50 class ExceptionState; | 46 class ExceptionState; |
51 class GenericEventQueue; | 47 class GenericEventQueue; |
| 48 class WebSourceBuffer; |
52 | 49 |
53 class MediaSource FINAL | 50 class MediaSource FINAL |
54 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<MediaSour
ce> | 51 : public RefCountedGarbageCollectedWillBeGarbageCollectedFinalized<MediaSour
ce> |
55 , public HTMLMediaSource | 52 , public HTMLMediaSource |
56 , public ActiveDOMObject | 53 , public ActiveDOMObject |
57 , public EventTargetWithInlineData { | 54 , public EventTargetWithInlineData { |
58 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M
ediaSource>); | 55 DEFINE_EVENT_TARGET_REFCOUNTING_WILL_BE_REMOVED(RefCountedGarbageCollected<M
ediaSource>); |
59 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaSource); | 56 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(MediaSource); |
60 public: | 57 public: |
61 static const AtomicString& openKeyword(); | 58 static const AtomicString& openKeyword(); |
62 static const AtomicString& closedKeyword(); | 59 static const AtomicString& closedKeyword(); |
63 static const AtomicString& endedKeyword(); | 60 static const AtomicString& endedKeyword(); |
64 | 61 |
65 static MediaSource* create(ExecutionContext*); | 62 static MediaSource* create(ExecutionContext*); |
66 virtual ~MediaSource(); | 63 virtual ~MediaSource(); |
67 | 64 |
68 // MediaSource.idl methods | 65 // MediaSource.idl methods |
69 SourceBufferList* sourceBuffers() { return m_sourceBuffers.get(); } | 66 SourceBufferList* sourceBuffers() { return m_sourceBuffers.get(); } |
70 SourceBufferList* activeSourceBuffers() { return m_activeSourceBuffers.get()
; } | 67 SourceBufferList* activeSourceBuffers() { return m_activeSourceBuffers.get()
; } |
71 SourceBuffer* addSourceBuffer(const String& type, ExceptionState&); | 68 SourceBuffer* addSourceBuffer(const String& type, ExceptionState&); |
72 void removeSourceBuffer(SourceBuffer*, ExceptionState&); | 69 void removeSourceBuffer(SourceBuffer*, ExceptionState&); |
73 void setDuration(double, ExceptionState&); | 70 void setDuration(double, ExceptionState&); |
74 const AtomicString& readyState() const { return m_readyState; } | 71 const AtomicString& readyState() const { return m_readyState; } |
75 void endOfStream(const AtomicString& error, ExceptionState&); | 72 void endOfStream(const AtomicString& error, ExceptionState&); |
76 void endOfStream(ExceptionState&); | 73 void endOfStream(ExceptionState&); |
77 static bool isTypeSupported(const String& type); | 74 static bool isTypeSupported(const String& type); |
78 | 75 |
79 // HTMLMediaSource | 76 // HTMLMediaSource |
80 virtual bool attachToElement(HTMLMediaElement*) OVERRIDE; | 77 virtual bool attachToElement(HTMLMediaElement*) OVERRIDE; |
81 virtual void setWebMediaSourceAndOpen(PassOwnPtr<blink::WebMediaSource>) OVE
RRIDE; | 78 virtual void setWebMediaSourceAndOpen(PassOwnPtr<WebMediaSource>) OVERRIDE; |
82 virtual void close() OVERRIDE; | 79 virtual void close() OVERRIDE; |
83 virtual bool isClosed() const OVERRIDE; | 80 virtual bool isClosed() const OVERRIDE; |
84 virtual double duration() const OVERRIDE; | 81 virtual double duration() const OVERRIDE; |
85 virtual PassRefPtrWillBeRawPtr<TimeRanges> buffered() const OVERRIDE; | 82 virtual PassRefPtrWillBeRawPtr<TimeRanges> buffered() const OVERRIDE; |
86 #if !ENABLE(OILPAN) | 83 #if !ENABLE(OILPAN) |
87 virtual void refHTMLMediaSource() OVERRIDE { ref(); } | 84 virtual void refHTMLMediaSource() OVERRIDE { ref(); } |
88 virtual void derefHTMLMediaSource() OVERRIDE { deref(); } | 85 virtual void derefHTMLMediaSource() OVERRIDE { deref(); } |
89 #endif | 86 #endif |
90 | 87 |
91 // EventTarget interface | 88 // EventTarget interface |
(...skipping 19 matching lines...) Expand all Loading... |
111 void clearWeakMembers(Visitor*); | 108 void clearWeakMembers(Visitor*); |
112 | 109 |
113 private: | 110 private: |
114 explicit MediaSource(ExecutionContext*); | 111 explicit MediaSource(ExecutionContext*); |
115 | 112 |
116 void setReadyState(const AtomicString&); | 113 void setReadyState(const AtomicString&); |
117 void onReadyStateChange(const AtomicString&, const AtomicString&); | 114 void onReadyStateChange(const AtomicString&, const AtomicString&); |
118 | 115 |
119 bool isUpdating() const; | 116 bool isUpdating() const; |
120 | 117 |
121 PassOwnPtr<blink::WebSourceBuffer> createWebSourceBuffer(const String& type,
const Vector<String>& codecs, ExceptionState&); | 118 PassOwnPtr<WebSourceBuffer> createWebSourceBuffer(const String& type, const
Vector<String>& codecs, ExceptionState&); |
122 void scheduleEvent(const AtomicString& eventName); | 119 void scheduleEvent(const AtomicString& eventName); |
123 void endOfStreamInternal(const blink::WebMediaSource::EndOfStreamStatus, Exc
eptionState&); | 120 void endOfStreamInternal(const WebMediaSource::EndOfStreamStatus, ExceptionS
tate&); |
124 | 121 |
125 // Implements the duration change algorithm. | 122 // Implements the duration change algorithm. |
126 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#duration-change-algorithm | 123 // https://dvcs.w3.org/hg/html-media/raw-file/default/media-source/media-sou
rce.html#duration-change-algorithm |
127 void durationChangeAlgorithm(double newDuration); | 124 void durationChangeAlgorithm(double newDuration); |
128 | 125 |
129 OwnPtr<blink::WebMediaSource> m_webMediaSource; | 126 OwnPtr<WebMediaSource> m_webMediaSource; |
130 AtomicString m_readyState; | 127 AtomicString m_readyState; |
131 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 128 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; |
132 RawPtrWillBeWeakMember<HTMLMediaElement> m_attachedElement; | 129 RawPtrWillBeWeakMember<HTMLMediaElement> m_attachedElement; |
133 | 130 |
134 Member<SourceBufferList> m_sourceBuffers; | 131 Member<SourceBufferList> m_sourceBuffers; |
135 Member<SourceBufferList> m_activeSourceBuffers; | 132 Member<SourceBufferList> m_activeSourceBuffers; |
136 | 133 |
137 bool m_isAddedToRegistry; | 134 bool m_isAddedToRegistry; |
138 }; | 135 }; |
139 | 136 |
140 } // namespace blink | 137 } // namespace blink |
141 | 138 |
142 #endif | 139 #endif |
OLD | NEW |