OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple 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 | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 14 matching lines...) Expand all Loading... | |
25 | 25 |
26 #ifndef HTMLMediaElement_h | 26 #ifndef HTMLMediaElement_h |
27 #define HTMLMediaElement_h | 27 #define HTMLMediaElement_h |
28 | 28 |
29 #include "core/CoreExport.h" | 29 #include "core/CoreExport.h" |
30 #include "core/dom/ActiveDOMObject.h" | 30 #include "core/dom/ActiveDOMObject.h" |
31 #include "core/events/GenericEventQueue.h" | 31 #include "core/events/GenericEventQueue.h" |
32 #include "core/html/HTMLElement.h" | 32 #include "core/html/HTMLElement.h" |
33 #include "core/html/track/TextTrack.h" | 33 #include "core/html/track/TextTrack.h" |
34 #include "platform/Supplementable.h" | 34 #include "platform/Supplementable.h" |
35 #include "platform/graphics/media/MediaPlayer.h" | 35 #include "platform/audio/AudioSourceProvider.h" |
36 #include "public/platform/WebAudioSourceProviderClient.h" | |
36 #include "public/platform/WebMediaPlayerClient.h" | 37 #include "public/platform/WebMediaPlayerClient.h" |
37 #include "public/platform/WebMimeRegistry.h" | 38 #include "public/platform/WebMimeRegistry.h" |
38 | 39 |
39 namespace blink { | 40 namespace blink { |
40 class WebInbandTextTrack; | 41 class WebInbandTextTrack; |
41 class WebLayer; | 42 class WebLayer; |
42 } | 43 } |
43 | 44 |
44 namespace blink { | 45 namespace blink { |
45 | 46 |
(...skipping 12 matching lines...) Expand all Loading... | |
58 class MediaController; | 59 class MediaController; |
59 class MediaControls; | 60 class MediaControls; |
60 class MediaError; | 61 class MediaError; |
61 class HTMLMediaSource; | 62 class HTMLMediaSource; |
62 class TextTrackContainer; | 63 class TextTrackContainer; |
63 class TextTrackList; | 64 class TextTrackList; |
64 class TimeRanges; | 65 class TimeRanges; |
65 class URLRegistry; | 66 class URLRegistry; |
66 class VideoTrackList; | 67 class VideoTrackList; |
67 | 68 |
68 // FIXME: The inheritance from MediaPlayerClient here should be private inherita nce. | 69 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupple mentable<HTMLMediaElement>, public WebMediaPlayerClient, public ActiveDOMObject { |
69 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so it | |
70 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. | |
71 | |
72 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupple mentable<HTMLMediaElement>, public MediaPlayerClient, public ActiveDOMObject { | |
73 DEFINE_WRAPPERTYPEINFO(); | 70 DEFINE_WRAPPERTYPEINFO(); |
74 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement); | 71 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement); |
75 WILL_BE_USING_PRE_FINALIZER(HTMLMediaElement, dispose); | 72 WILL_BE_USING_PRE_FINALIZER(HTMLMediaElement, dispose); |
76 public: | 73 public: |
77 static WebMimeRegistry::SupportsType supportsType(const ContentType&, const String& keySystem = String()); | 74 static WebMimeRegistry::SupportsType supportsType(const ContentType&, const String& keySystem = String()); |
78 | 75 |
79 static void setMediaStreamRegistry(URLRegistry*); | 76 static void setMediaStreamRegistry(URLRegistry*); |
80 static bool isMediaStreamURL(const String& url); | 77 static bool isMediaStreamURL(const String& url); |
81 | 78 |
82 DECLARE_VIRTUAL_TRACE(); | 79 DECLARE_VIRTUAL_TRACE(); |
83 #if ENABLE(WEB_AUDIO) | 80 #if ENABLE(WEB_AUDIO) |
84 void clearWeakMembers(Visitor*); | 81 void clearWeakMembers(Visitor*); |
85 #endif | 82 #endif |
86 WebMediaPlayer* webMediaPlayer() const { return m_player ? m_player->webMedi aPlayer() : 0; } | 83 WebMediaPlayer* webMediaPlayer() const |
84 { | |
85 return m_webMediaPlayer.get(); | |
86 } | |
87 | 87 |
88 virtual bool hasVideo() const { return false; } | 88 virtual bool hasVideo() const { return false; } |
89 bool hasAudio() const; | 89 bool hasAudio() const; |
90 | 90 |
91 bool supportsSave() const; | 91 bool supportsSave() const; |
92 | 92 |
93 WebLayer* platformLayer() const; | 93 WebLayer* platformLayer() const; |
94 | 94 |
95 enum DelayedActionType { | 95 enum DelayedActionType { |
96 LoadMediaResource = 1 << 0, | 96 LoadMediaResource = 1 << 0, |
97 LoadTextTrackResource = 1 << 1, | 97 LoadTextTrackResource = 1 << 1, |
98 TextTrackChangesNotification = 1 << 2 | 98 TextTrackChangesNotification = 1 << 2 |
99 }; | 99 }; |
100 void scheduleDelayedAction(DelayedActionType); | 100 void scheduleDelayedAction(DelayedActionType); |
101 | 101 |
102 bool hasRemoteRoutes() const { return m_remoteRoutesAvailable; } | 102 bool hasRemoteRoutes() const { return m_remoteRoutesAvailable; } |
103 bool isPlayingRemotely() const { return m_playingRemotely; } | 103 bool isPlayingRemotely() const { return m_playingRemotely; } |
104 | 104 |
105 // error state | 105 // error state |
106 PassRefPtrWillBeRawPtr<MediaError> error() const; | 106 PassRefPtrWillBeRawPtr<MediaError> error() const; |
107 | 107 |
108 // network state | 108 // network state |
109 void setSrc(const AtomicString&); | 109 void setSrc(const AtomicString&); |
110 const KURL& currentSrc() const { return m_currentSrc; } | 110 const KURL& currentSrc() const { return m_currentSrc; } |
111 | 111 |
112 enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO _SOURCE }; | 112 enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO _SOURCE }; |
113 NetworkState networkState() const; | 113 NetworkState networkState() const; |
114 | 114 |
115 String preload() const; | 115 String preload() const; |
116 MediaPlayer::Preload effectivePreloadType() const; | 116 WebMediaPlayer::Preload effectivePreloadType() const; |
117 void setPreload(const AtomicString&); | 117 void setPreload(const AtomicString&); |
118 | 118 |
119 PassRefPtrWillBeRawPtr<TimeRanges> buffered() const; | 119 PassRefPtrWillBeRawPtr<TimeRanges> buffered() const; |
120 void load(); | 120 void load(); |
121 String canPlayType(const String& mimeType, const String& keySystem = String( )) const; | 121 String canPlayType(const String& mimeType, const String& keySystem = String( )) const; |
122 | 122 |
123 // ready state | 123 // ready state |
124 enum ReadyState { HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTUR E_DATA, HAVE_ENOUGH_DATA }; | 124 enum ReadyState { HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTUR E_DATA, HAVE_ENOUGH_DATA }; |
125 ReadyState readyState() const; | 125 ReadyState readyState() const; |
126 bool seeking() const; | 126 bool seeking() const; |
(...skipping 18 matching lines...) Expand all Loading... | |
145 void pause(); | 145 void pause(); |
146 void requestRemotePlayback(); | 146 void requestRemotePlayback(); |
147 void requestRemotePlaybackControl(); | 147 void requestRemotePlaybackControl(); |
148 | 148 |
149 // statistics | 149 // statistics |
150 unsigned webkitAudioDecodedByteCount() const; | 150 unsigned webkitAudioDecodedByteCount() const; |
151 unsigned webkitVideoDecodedByteCount() const; | 151 unsigned webkitVideoDecodedByteCount() const; |
152 | 152 |
153 // media source extensions | 153 // media source extensions |
154 void closeMediaSource(); | 154 void closeMediaSource(); |
155 void durationChanged(double duration, bool requestSeek); | 155 void mediaPlayerDurationChanged(double duration, bool requestSeek); |
philipj_slow
2015/07/01 13:49:19
It doesn't look like this name change is necessary
Srirama
2015/07/03 12:59:02
Done.
| |
156 | 156 |
157 // controls | 157 // controls |
158 bool shouldShowControls() const; | 158 bool shouldShowControls() const; |
159 double volume() const; | 159 double volume() const; |
160 void setVolume(double, ExceptionState&); | 160 void setVolume(double, ExceptionState&); |
161 bool muted() const; | 161 bool muted() const; |
162 void setMuted(bool); | 162 void setMuted(bool); |
163 | 163 |
164 // play/pause toggling that uses the media controller if present. togglePlay StateWillPlay() is | 164 // play/pause toggling that uses the media controller if present. togglePlay StateWillPlay() is |
165 // true if togglePlayState() will call play() or unpause() on the media elem ent or controller. | 165 // true if togglePlayState() will call play() or unpause() on the media elem ent or controller. |
166 bool togglePlayStateWillPlay() const; | 166 bool togglePlayStateWillPlay() const; |
167 void togglePlayState(); | 167 void togglePlayState(); |
168 | 168 |
169 AudioTrackList& audioTracks(); | 169 AudioTrackList& audioTracks(); |
170 void audioTrackChanged(); | 170 void audioTrackChanged(); |
171 | 171 |
172 VideoTrackList& videoTracks(); | 172 VideoTrackList& videoTracks(); |
173 void selectedVideoTrackChanged(WebMediaPlayer::TrackId*); | 173 void selectedVideoTrackChanged(WebMediaPlayer::TrackId*); |
174 | 174 |
175 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, con st AtomicString& label, const AtomicString& language, ExceptionState&); | 175 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, con st AtomicString& label, const AtomicString& language, ExceptionState&); |
176 | 176 |
177 TextTrackList* textTracks(); | 177 TextTrackList* textTracks(); |
178 CueTimeline& cueTimeline(); | 178 CueTimeline& cueTimeline(); |
179 | 179 |
180 void addTextTrack(TextTrack*); | 180 void mediaPlayerAddTextTrack(TextTrack*); |
philipj_slow
2015/07/01 13:49:19
I tried undoing these name changes and it compiles
Srirama
2015/07/03 12:59:02
Done.
| |
181 void removeTextTrack(TextTrack*); | 181 void mediaPlayerRemoveTextTrack(TextTrack*); |
182 void textTracksChanged(); | 182 void textTracksChanged(); |
183 void notifyMediaPlayerOfTextTrackChanges(); | 183 void notifyMediaPlayerOfTextTrackChanges(); |
184 | 184 |
185 // Implements the "forget the media element's media-resource-specific tracks " algorithm in the HTML5 spec. | 185 // Implements the "forget the media element's media-resource-specific tracks " algorithm in the HTML5 spec. |
186 void forgetResourceSpecificTracks(); | 186 void forgetResourceSpecificTracks(); |
187 | 187 |
188 void didAddTrackElement(HTMLTrackElement*); | 188 void didAddTrackElement(HTMLTrackElement*); |
189 void didRemoveTrackElement(HTMLTrackElement*); | 189 void didRemoveTrackElement(HTMLTrackElement*); |
190 | 190 // FIXME: Remove this when prepareAndLoadMediaPlayer() does not depend on it . |
191 WebMediaPlayer::TrackId addAudioTrack(const String& id, WebMediaPlayerClient ::AudioTrackKind, const AtomicString& label, const AtomicString& language, bool enabled); | 191 virtual KURL mediaPlayerPosterURL() { return KURL(); } |
philipj_slow
2015/07/01 13:49:19
This FIXME doesn't seem like it's actually going t
Srirama
2015/07/03 12:59:02
Done.
| |
192 void removeAudioTrack(WebMediaPlayer::TrackId); | |
193 WebMediaPlayer::TrackId addVideoTrack(const String& id, WebMediaPlayerClient ::VideoTrackKind, const AtomicString& label, const AtomicString& language, bool selected); | |
194 void removeVideoTrack(WebMediaPlayer::TrackId); | |
195 | |
196 virtual void mediaPlayerDidAddTextTrack(WebInbandTextTrack*) override final; | |
197 virtual void mediaPlayerDidRemoveTextTrack(WebInbandTextTrack*) override fin al; | |
198 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d epend on it. | |
199 virtual KURL mediaPlayerPosterURL() override { return KURL(); } | |
200 | 192 |
201 void honorUserPreferencesForAutomaticTextTrackSelection(); | 193 void honorUserPreferencesForAutomaticTextTrackSelection(); |
202 | 194 |
203 bool textTracksAreReady() const; | 195 bool textTracksAreReady() const; |
204 enum VisibilityChangeAssumption { | 196 enum VisibilityChangeAssumption { |
205 AssumeNoVisibleChange, | 197 AssumeNoVisibleChange, |
206 AssumeVisibleChange | 198 AssumeVisibleChange |
207 }; | 199 }; |
208 void configureTextTrackDisplay(VisibilityChangeAssumption); | 200 void configureTextTrackDisplay(VisibilityChangeAssumption); |
209 void updateTextTrackDisplay(); | 201 void updateTextTrackDisplay(); |
210 double lastSeekTime() const { return m_lastSeekTime; } | 202 double lastSeekTime() const { return m_lastSeekTime; } |
211 void textTrackReadyStateChanged(TextTrack*); | 203 void textTrackReadyStateChanged(TextTrack*); |
212 | 204 |
213 void textTrackModeChanged(TextTrack*); | 205 void textTrackModeChanged(TextTrack*); |
214 | 206 |
215 // EventTarget function. | 207 // EventTarget function. |
216 // Both Node (via HTMLElement) and ActiveDOMObject define this method, which | 208 // Both Node (via HTMLElement) and ActiveDOMObject define this method, which |
217 // causes an ambiguity error at compile time. This class's constructor | 209 // causes an ambiguity error at compile time. This class's constructor |
218 // ensures that both implementations return document, so return the result | 210 // ensures that both implementations return document, so return the result |
219 // of one of them here. | 211 // of one of them here. |
220 using HTMLElement::executionContext; | 212 using HTMLElement::executionContext; |
221 | 213 |
222 bool hasSingleSecurityOrigin() const { return !m_player || (webMediaPlayer() && webMediaPlayer()->hasSingleSecurityOrigin()); } | 214 bool hasSingleSecurityOrigin() const { return webMediaPlayer() && webMediaPl ayer()->hasSingleSecurityOrigin(); } |
223 | 215 |
224 bool isFullscreen() const; | 216 bool isFullscreen() const; |
225 void enterFullscreen(); | 217 void enterFullscreen(); |
226 void exitFullscreen(); | 218 void exitFullscreen(); |
227 | 219 |
228 bool hasClosedCaptions() const; | 220 bool hasClosedCaptions() const; |
229 bool closedCaptionsVisible() const; | 221 bool closedCaptionsVisible() const; |
230 void setClosedCaptionsVisible(bool); | 222 void setClosedCaptionsVisible(bool); |
231 | 223 |
232 void remoteRouteAvailabilityChanged(bool); | |
233 void connectedToRemoteDevice(); | |
234 void disconnectedFromRemoteDevice(); | |
235 | |
236 // Returns the MediaControls, or null if they have not been added yet. | 224 // Returns the MediaControls, or null if they have not been added yet. |
237 // Note that this can be non-null even if there is no controls attribute. | 225 // Note that this can be non-null even if there is no controls attribute. |
238 MediaControls* mediaControls() const; | 226 MediaControls* mediaControls() const; |
239 | 227 |
240 // Notifies the media element that the media controls became visible, so | 228 // Notifies the media element that the media controls became visible, so |
241 // that text track layout may be updated to avoid overlapping them. | 229 // that text track layout may be updated to avoid overlapping them. |
242 void mediaControlsDidBecomeVisible(); | 230 void mediaControlsDidBecomeVisible(); |
243 | 231 |
244 void sourceWasRemoved(HTMLSourceElement*); | 232 void sourceWasRemoved(HTMLSourceElement*); |
245 void sourceWasAdded(HTMLSourceElement*); | 233 void sourceWasAdded(HTMLSourceElement*); |
246 | 234 |
247 // ActiveDOMObject functions. | 235 // ActiveDOMObject functions. |
248 virtual bool hasPendingActivity() const override final; | 236 virtual bool hasPendingActivity() const override final; |
249 virtual void contextDestroyed() override final; | 237 virtual void contextDestroyed() override final; |
250 | 238 |
251 #if ENABLE(WEB_AUDIO) | 239 #if ENABLE(WEB_AUDIO) |
252 AudioSourceProviderClient* audioSourceNode() { return m_audioSourceNode; } | 240 AudioSourceProviderClient* audioSourceNode() { return m_audioSourceNode; } |
253 void setAudioSourceNode(AudioSourceProviderClient*); | 241 void setAudioSourceNode(AudioSourceProviderClient*); |
254 | 242 |
255 AudioSourceProvider* audioSourceProvider(); | 243 AudioSourceProvider* audioSourceProvider() { return &m_audioSourceProvider; } |
256 #endif | 244 #endif |
257 | 245 |
258 enum InvalidURLAction { DoNothing, Complain }; | 246 enum InvalidURLAction { DoNothing, Complain }; |
259 bool isSafeToLoadURL(const KURL&, InvalidURLAction); | 247 bool isSafeToLoadURL(const KURL&, InvalidURLAction); |
260 | 248 |
261 // Checks to see if current media data is CORS-same-origin as the | 249 // Checks to see if current media data is CORS-same-origin as the |
262 // specified origin. | 250 // specified origin. |
263 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; | 251 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; |
264 | 252 |
265 MediaController* controller() const; | 253 MediaController* controller() const; |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
329 virtual void defaultEventHandler(Event*) override final; | 317 virtual void defaultEventHandler(Event*) override final; |
330 | 318 |
331 // ActiveDOMObject functions. | 319 // ActiveDOMObject functions. |
332 virtual void stop() override final; | 320 virtual void stop() override final; |
333 | 321 |
334 virtual void updateDisplayState() { } | 322 virtual void updateDisplayState() { } |
335 | 323 |
336 void setReadyState(ReadyState); | 324 void setReadyState(ReadyState); |
337 void setNetworkState(WebMediaPlayer::NetworkState); | 325 void setNetworkState(WebMediaPlayer::NetworkState); |
338 | 326 |
339 virtual void mediaPlayerNetworkStateChanged() override final; | 327 virtual void networkStateChanged() override final; |
340 virtual void mediaPlayerReadyStateChanged() override final; | 328 virtual void readyStateChanged() override final; |
341 virtual void mediaPlayerTimeChanged() override final; | 329 virtual void timeChanged() override final; |
342 virtual void mediaPlayerDurationChanged() override final; | 330 virtual void repaint() override final; |
343 virtual void mediaPlayerPlaybackStateChanged() override final; | 331 virtual void durationChanged() override final; |
332 virtual void sizeChanged() override final; | |
333 virtual void playbackStateChanged() override final; | |
334 | |
335 virtual void setWebLayer(WebLayer*) override final; | |
336 virtual WebMediaPlayer::TrackId addAudioTrack(const WebString&, WebMediaPlay erClient::AudioTrackKind, const WebString&, const WebString&, bool) override fin al; | |
337 virtual void removeAudioTrack(WebMediaPlayer::TrackId) override final; | |
338 virtual WebMediaPlayer::TrackId addVideoTrack(const WebString&, WebMediaPlay erClient::VideoTrackKind, const WebString&, const WebString&, bool) override fin al; | |
339 virtual void removeVideoTrack(WebMediaPlayer::TrackId) override final; | |
340 virtual void addTextTrack(WebInbandTextTrack*) override final; | |
341 virtual void removeTextTrack(WebInbandTextTrack*) override final; | |
342 virtual void mediaSourceOpened(WebMediaSource*) override final; | |
344 virtual void mediaPlayerRequestSeek(double) override final; | 343 virtual void mediaPlayerRequestSeek(double) override final; |
345 virtual void mediaPlayerRepaint() override final; | 344 virtual void remoteRouteAvailabilityChanged(bool) override final; |
346 virtual void mediaPlayerSizeChanged() override final; | 345 virtual void connectedToRemoteDevice() override final; |
347 virtual void mediaPlayerSetWebLayer(WebLayer*) override final; | 346 virtual void disconnectedFromRemoteDevice() override final; |
348 virtual void mediaPlayerMediaSourceOpened(WebMediaSource*) override final; | |
349 | 347 |
350 void loadTimerFired(Timer<HTMLMediaElement>*); | 348 void loadTimerFired(Timer<HTMLMediaElement>*); |
351 void progressEventTimerFired(Timer<HTMLMediaElement>*); | 349 void progressEventTimerFired(Timer<HTMLMediaElement>*); |
352 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); | 350 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); |
353 void startPlaybackProgressTimer(); | 351 void startPlaybackProgressTimer(); |
354 void startProgressEventTimer(); | 352 void startProgressEventTimer(); |
355 void stopPeriodicTimers(); | 353 void stopPeriodicTimers(); |
356 | 354 |
357 void seek(double time); | 355 void seek(double time); |
358 void finishSeek(); | 356 void finishSeek(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
450 // addAudioTrack() and addVideoTrack(). | 448 // addAudioTrack() and addVideoTrack(). |
451 // FIXME: Remove this once all WebMediaPlayer implementations properly repor t their track info. | 449 // FIXME: Remove this once all WebMediaPlayer implementations properly repor t their track info. |
452 void createPlaceholderTracksIfNecessary(); | 450 void createPlaceholderTracksIfNecessary(); |
453 | 451 |
454 // Sets the selected/enabled tracks if they aren't set before we initially | 452 // Sets the selected/enabled tracks if they aren't set before we initially |
455 // transition to HAVE_METADATA. | 453 // transition to HAVE_METADATA. |
456 void selectInitialTracksIfNecessary(); | 454 void selectInitialTracksIfNecessary(); |
457 | 455 |
458 void audioTracksTimerFired(Timer<HTMLMediaElement>*); | 456 void audioTracksTimerFired(Timer<HTMLMediaElement>*); |
459 | 457 |
458 void prepareAndLoadMediaPlayer(const WTF::String& url); | |
philipj_slow
2015/07/01 13:49:19
The WTF:: prefix ought not be needed here.
Srirama
2015/07/03 12:59:02
Removed the function
| |
459 | |
460 Timer<HTMLMediaElement> m_loadTimer; | 460 Timer<HTMLMediaElement> m_loadTimer; |
461 Timer<HTMLMediaElement> m_progressEventTimer; | 461 Timer<HTMLMediaElement> m_progressEventTimer; |
462 Timer<HTMLMediaElement> m_playbackProgressTimer; | 462 Timer<HTMLMediaElement> m_playbackProgressTimer; |
463 Timer<HTMLMediaElement> m_audioTracksTimer; | 463 Timer<HTMLMediaElement> m_audioTracksTimer; |
464 RefPtrWillBeMember<TimeRanges> m_playedTimeRanges; | 464 RefPtrWillBeMember<TimeRanges> m_playedTimeRanges; |
465 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 465 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; |
466 | 466 |
467 double m_playbackRate; | 467 double m_playbackRate; |
468 double m_defaultPlaybackRate; | 468 double m_defaultPlaybackRate; |
469 NetworkState m_networkState; | 469 NetworkState m_networkState; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
505 WaitingForStopDelayingLoadEventTask, | 505 WaitingForStopDelayingLoadEventTask, |
506 // The load is the deferred, and waiting for a triggering event. | 506 // The load is the deferred, and waiting for a triggering event. |
507 WaitingForTrigger, | 507 WaitingForTrigger, |
508 // The load is deferred, and waiting for the task to set the | 508 // The load is deferred, and waiting for the task to set the |
509 // delaying-the-load-event flag, after which the load will be executed. | 509 // delaying-the-load-event flag, after which the load will be executed. |
510 ExecuteOnStopDelayingLoadEventTask | 510 ExecuteOnStopDelayingLoadEventTask |
511 }; | 511 }; |
512 DeferredLoadState m_deferredLoadState; | 512 DeferredLoadState m_deferredLoadState; |
513 Timer<HTMLMediaElement> m_deferredLoadTimer; | 513 Timer<HTMLMediaElement> m_deferredLoadTimer; |
514 | 514 |
515 OwnPtr<MediaPlayer> m_player; | 515 OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
516 WebLayer* m_webLayer; | 516 WebLayer* m_webLayer; |
517 | 517 |
518 MediaPlayer::Preload m_preload; | 518 WebMediaPlayer::Preload m_preload; |
519 | 519 |
520 DisplayMode m_displayMode; | 520 DisplayMode m_displayMode; |
521 | 521 |
522 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; | 522 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; |
523 | 523 |
524 // Cached time value. Only valid when ready state is HAVE_METADATA or | 524 // Cached time value. Only valid when ready state is HAVE_METADATA or |
525 // higher, otherwise the current time is assumed to be zero. | 525 // higher, otherwise the current time is assumed to be zero. |
526 mutable double m_cachedTime; | 526 mutable double m_cachedTime; |
527 | 527 |
528 double m_fragmentEndTime; | 528 double m_fragmentEndTime; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
569 RefPtrWillBeMember<TextTrackList> m_textTracks; | 569 RefPtrWillBeMember<TextTrackList> m_textTracks; |
570 WillBeHeapVector<RefPtrWillBeMember<TextTrack>> m_textTracksWhenResourceSele ctionBegan; | 570 WillBeHeapVector<RefPtrWillBeMember<TextTrack>> m_textTracksWhenResourceSele ctionBegan; |
571 | 571 |
572 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; | 572 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; |
573 | 573 |
574 #if ENABLE(WEB_AUDIO) | 574 #if ENABLE(WEB_AUDIO) |
575 // This is a weak reference, since m_audioSourceNode holds a reference to us . | 575 // This is a weak reference, since m_audioSourceNode holds a reference to us . |
576 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem. | 576 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem. |
577 GC_PLUGIN_IGNORE("http://crbug.com/404577") | 577 GC_PLUGIN_IGNORE("http://crbug.com/404577") |
578 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; | 578 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; |
579 | |
580 // AudioClientImpl wraps an AudioSourceProviderClient. | |
581 // When the audio format is known, Chromium calls setFormat(). | |
582 | |
583 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm pl>, public WebAudioSourceProviderClient { | |
584 public: | |
585 explicit AudioClientImpl(AudioSourceProviderClient* client) | |
586 : m_client(client) | |
587 { | |
588 } | |
589 | |
590 virtual ~AudioClientImpl() { } | |
591 | |
592 // WebAudioSourceProviderClient | |
593 virtual void setFormat(size_t numberOfChannels, float sampleRate) overri de; | |
594 | |
595 DECLARE_TRACE(); | |
596 | |
597 private: | |
598 Member<AudioSourceProviderClient> m_client; | |
599 }; | |
600 | |
601 // AudioSourceProviderImpl wraps a WebAudioSourceProvider. | |
602 // provideInput() calls into Chromium to get a rendered audio stream. | |
603 | |
604 class AudioSourceProviderImpl final : public AudioSourceProvider { | |
605 public: | |
606 AudioSourceProviderImpl() | |
607 : m_webAudioSourceProvider(0) | |
608 { | |
609 } | |
610 | |
611 virtual ~AudioSourceProviderImpl() { } | |
612 | |
613 // Wraps the given WebAudioSourceProvider. | |
614 void wrap(WebAudioSourceProvider*); | |
615 | |
616 // AudioSourceProvider | |
617 virtual void setClient(AudioSourceProviderClient*) override; | |
618 virtual void provideInput(AudioBus*, size_t framesToProcess) override; | |
619 | |
620 private: | |
621 WebAudioSourceProvider* m_webAudioSourceProvider; | |
622 Persistent<AudioClientImpl> m_client; | |
623 Mutex provideInputLock; | |
624 }; | |
625 | |
626 AudioSourceProviderImpl m_audioSourceProvider; | |
579 #endif | 627 #endif |
580 | 628 |
581 friend class MediaController; | 629 friend class MediaController; |
582 RefPtrWillBeMember<MediaController> m_mediaController; | 630 RefPtrWillBeMember<MediaController> m_mediaController; |
583 | 631 |
584 friend class Internals; | 632 friend class Internals; |
585 friend class TrackDisplayUpdateScope; | 633 friend class TrackDisplayUpdateScope; |
586 | 634 |
587 static URLRegistry* s_mediaStreamRegistry; | 635 static URLRegistry* s_mediaStreamRegistry; |
588 }; | 636 }; |
589 | 637 |
590 inline bool isHTMLMediaElement(const HTMLElement& element) | 638 inline bool isHTMLMediaElement(const HTMLElement& element) |
591 { | 639 { |
592 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 640 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
593 } | 641 } |
594 | 642 |
595 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 643 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
596 | 644 |
597 } // namespace blink | 645 } // namespace blink |
598 | 646 |
599 #endif // HTMLMediaElement_h | 647 #endif // HTMLMediaElement_h |
OLD | NEW |