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 16 matching lines...) Expand all Loading... |
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 // FIXME: The inheritance from MediaPlayerClient here should be private inherita
nce. |
69 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so
it | 70 // 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 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. |
71 | 72 |
72 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupple
mentable<HTMLMediaElement>, public MediaPlayerClient, public ActiveDOMObject { | 73 class CORE_EXPORT HTMLMediaElement : public HTMLElement, public WillBeHeapSupple
mentable<HTMLMediaElement>, public WebMediaPlayerClient, public ActiveDOMObject
{ |
73 DEFINE_WRAPPERTYPEINFO(); | 74 DEFINE_WRAPPERTYPEINFO(); |
74 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement); | 75 WILL_BE_USING_GARBAGE_COLLECTED_MIXIN(HTMLMediaElement); |
75 public: | 76 public: |
76 static blink::WebMimeRegistry::SupportsType supportsType(const ContentType&,
const String& keySystem = String()); | 77 static blink::WebMimeRegistry::SupportsType supportsType(const ContentType&,
const String& keySystem = String()); |
77 | 78 |
78 static void setMediaStreamRegistry(URLRegistry*); | 79 static void setMediaStreamRegistry(URLRegistry*); |
79 static bool isMediaStreamURL(const String& url); | 80 static bool isMediaStreamURL(const String& url); |
80 | 81 |
81 DECLARE_VIRTUAL_TRACE(); | 82 DECLARE_VIRTUAL_TRACE(); |
82 #if ENABLE(WEB_AUDIO) | 83 #if ENABLE(WEB_AUDIO) |
83 void clearWeakMembers(Visitor*); | 84 void clearWeakMembers(Visitor*); |
84 #endif | 85 #endif |
85 blink::WebMediaPlayer* webMediaPlayer() const { return m_player ? m_player->
webMediaPlayer() : 0; } | 86 blink::WebMediaPlayer* webMediaPlayer() const { return m_webMediaPlayer.get(
); } |
86 | 87 |
87 virtual bool hasVideo() const { return false; } | 88 virtual bool hasVideo() const { return false; } |
88 bool hasAudio() const; | 89 bool hasAudio() const; |
89 | 90 |
90 bool supportsSave() const; | 91 bool supportsSave() const; |
91 | 92 |
92 blink::WebLayer* platformLayer() const; | 93 blink::WebLayer* platformLayer() const; |
93 | 94 |
94 enum DelayedActionType { | 95 enum DelayedActionType { |
95 LoadMediaResource = 1 << 0, | 96 LoadMediaResource = 1 << 0, |
96 LoadTextTrackResource = 1 << 1, | 97 LoadTextTrackResource = 1 << 1, |
97 TextTrackChangesNotification = 1 << 2 | 98 TextTrackChangesNotification = 1 << 2 |
98 }; | 99 }; |
99 void scheduleDelayedAction(DelayedActionType); | 100 void scheduleDelayedAction(DelayedActionType); |
100 | 101 |
101 bool hasRemoteRoutes() const { return m_remoteRoutesAvailable; } | 102 bool hasRemoteRoutes() const { return m_remoteRoutesAvailable; } |
102 bool isPlayingRemotely() const { return m_playingRemotely; } | 103 bool isPlayingRemotely() const { return m_playingRemotely; } |
103 | 104 |
104 // error state | 105 // error state |
105 PassRefPtrWillBeRawPtr<MediaError> error() const; | 106 PassRefPtrWillBeRawPtr<MediaError> error() const; |
106 | 107 |
107 // network state | 108 // network state |
108 void setSrc(const AtomicString&); | 109 void setSrc(const AtomicString&); |
109 const KURL& currentSrc() const { return m_currentSrc; } | 110 const KURL& currentSrc() const { return m_currentSrc; } |
110 | 111 |
111 enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO
_SOURCE }; | 112 enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO
_SOURCE }; |
112 NetworkState networkState() const; | 113 NetworkState networkState() const; |
113 | 114 |
114 String preload() const; | 115 String preload() const; |
115 MediaPlayer::Preload preloadType() const { return m_preload; } | 116 WebMediaPlayer::Preload preloadType() const { return m_preload; } |
116 void setPreload(const AtomicString&); | 117 void setPreload(const AtomicString&); |
117 | 118 |
118 PassRefPtrWillBeRawPtr<TimeRanges> buffered() const; | 119 PassRefPtrWillBeRawPtr<TimeRanges> buffered() const; |
119 void load(); | 120 void load(); |
120 String canPlayType(const String& mimeType, const String& keySystem = String(
)) const; | 121 String canPlayType(const String& mimeType, const String& keySystem = String(
)) const; |
121 | 122 |
122 // ready state | 123 // ready state |
123 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 }; |
124 ReadyState readyState() const; | 125 ReadyState readyState() const; |
125 bool seeking() const; | 126 bool seeking() const; |
(...skipping 18 matching lines...) Expand all Loading... |
144 void pause(); | 145 void pause(); |
145 void requestRemotePlayback(); | 146 void requestRemotePlayback(); |
146 void requestRemotePlaybackControl(); | 147 void requestRemotePlaybackControl(); |
147 | 148 |
148 // statistics | 149 // statistics |
149 unsigned webkitAudioDecodedByteCount() const; | 150 unsigned webkitAudioDecodedByteCount() const; |
150 unsigned webkitVideoDecodedByteCount() const; | 151 unsigned webkitVideoDecodedByteCount() const; |
151 | 152 |
152 // media source extensions | 153 // media source extensions |
153 void closeMediaSource(); | 154 void closeMediaSource(); |
154 void durationChanged(double duration, bool requestSeek); | 155 void mediaPlayerDurationChanged(double duration, bool requestSeek); |
| 156 |
| 157 virtual void networkStateChanged() override final; |
| 158 virtual void readyStateChanged() override final; |
| 159 virtual void timeChanged() override final; |
| 160 virtual void repaint() override final; |
| 161 virtual void durationChanged() override final; |
| 162 virtual void sizeChanged() override final; |
| 163 virtual void playbackStateChanged() override final; |
| 164 |
| 165 virtual void keyAdded(const WebString& keySystem, const WebString& sessionId
) override final; |
| 166 virtual void keyError(const WebString& keySystem, const WebString& sessionId
, MediaKeyErrorCode, unsigned short systemCode) override final; |
| 167 virtual void keyMessage(const WebString& keySystem, const WebString& session
Id, const unsigned char* message, unsigned messageLength, const WebURL& defaultU
RL) override final; |
| 168 virtual void encrypted(WebEncryptedMediaInitDataType, const unsigned char* i
nitData, unsigned initDataLength) override final; |
| 169 virtual void didBlockPlaybackWaitingForKey() override final; |
| 170 virtual void didResumePlaybackBlockedForKey() override final; |
| 171 virtual void setWebLayer(blink::WebLayer*) override final; |
| 172 virtual blink::WebMediaPlayer::TrackId addAudioTrack(const WebString&, blink
::WebMediaPlayerClient::AudioTrackKind, const WebString&, const WebString&, bool
) override final; |
| 173 virtual void removeAudioTrack(blink::WebMediaPlayer::TrackId) override final
; |
| 174 virtual blink::WebMediaPlayer::TrackId addVideoTrack(const WebString&, blink
::WebMediaPlayerClient::VideoTrackKind, const WebString&, const WebString&, bool
) override final; |
| 175 virtual void removeVideoTrack(blink::WebMediaPlayer::TrackId) override final
; |
| 176 virtual void addTextTrack(blink::WebInbandTextTrack*) override final; |
| 177 virtual void removeTextTrack(blink::WebInbandTextTrack*) override final; |
| 178 virtual void mediaSourceOpened(blink::WebMediaSource*) override final; |
| 179 virtual void requestFullscreen() override final; |
| 180 virtual void requestSeek(double) override final; |
| 181 virtual void remoteRouteAvailabilityChanged(bool) override final; |
| 182 virtual void connectedToRemoteDevice() override final; |
| 183 virtual void disconnectedFromRemoteDevice() override final; |
| 184 |
155 | 185 |
156 // controls | 186 // controls |
157 bool shouldShowControls() const; | 187 bool shouldShowControls() const; |
158 double volume() const; | 188 double volume() const; |
159 void setVolume(double, ExceptionState&); | 189 void setVolume(double, ExceptionState&); |
160 bool muted() const; | 190 bool muted() const; |
161 void setMuted(bool); | 191 void setMuted(bool); |
162 | 192 |
163 // play/pause toggling that uses the media controller if present. togglePlay
StateWillPlay() is | 193 // play/pause toggling that uses the media controller if present. togglePlay
StateWillPlay() is |
164 // true if togglePlayState() will call play() or unpause() on the media elem
ent or controller. | 194 // true if togglePlayState() will call play() or unpause() on the media elem
ent or controller. |
165 bool togglePlayStateWillPlay() const; | 195 bool togglePlayStateWillPlay() const; |
166 void togglePlayState(); | 196 void togglePlayState(); |
167 | 197 |
168 AudioTrackList& audioTracks(); | 198 AudioTrackList& audioTracks(); |
169 void audioTrackChanged(); | 199 void audioTrackChanged(); |
170 | 200 |
171 VideoTrackList& videoTracks(); | 201 VideoTrackList& videoTracks(); |
172 void selectedVideoTrackChanged(blink::WebMediaPlayer::TrackId*); | 202 void selectedVideoTrackChanged(blink::WebMediaPlayer::TrackId*); |
173 | 203 |
174 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, con
st AtomicString& label, const AtomicString& language, ExceptionState&); | 204 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, con
st AtomicString& label, const AtomicString& language, ExceptionState&); |
175 | 205 |
176 TextTrackList* textTracks(); | 206 TextTrackList* textTracks(); |
177 CueTimeline& cueTimeline(); | 207 CueTimeline& cueTimeline(); |
178 | 208 |
179 void addTextTrack(TextTrack*); | 209 void mediaPlayerAddTextTrack(TextTrack*); |
180 void removeTextTrack(TextTrack*); | 210 void mediaPlayerRemoveTextTrack(TextTrack*); |
181 void textTracksChanged(); | 211 void textTracksChanged(); |
182 void notifyMediaPlayerOfTextTrackChanges(); | 212 void notifyMediaPlayerOfTextTrackChanges(); |
183 | 213 |
184 // Implements the "forget the media element's media-resource-specific tracks
" algorithm in the HTML5 spec. | 214 // Implements the "forget the media element's media-resource-specific tracks
" algorithm in the HTML5 spec. |
185 void forgetResourceSpecificTracks(); | 215 void forgetResourceSpecificTracks(); |
186 | 216 |
187 void didAddTrackElement(HTMLTrackElement*); | 217 void didAddTrackElement(HTMLTrackElement*); |
188 void didRemoveTrackElement(HTMLTrackElement*); | 218 void didRemoveTrackElement(HTMLTrackElement*); |
189 | 219 |
190 blink::WebMediaPlayer::TrackId addAudioTrack(const String& id, blink::WebMed
iaPlayerClient::AudioTrackKind, const AtomicString& label, const AtomicString& l
anguage, bool enabled); | 220 // cleanup |
191 void removeAudioTrack(blink::WebMediaPlayer::TrackId); | |
192 blink::WebMediaPlayer::TrackId addVideoTrack(const String& id, blink::WebMed
iaPlayerClient::VideoTrackKind, const AtomicString& label, const AtomicString& l
anguage, bool selected); | |
193 void removeVideoTrack(blink::WebMediaPlayer::TrackId); | |
194 | |
195 virtual void mediaPlayerDidAddTextTrack(blink::WebInbandTextTrack*) override
final; | |
196 virtual void mediaPlayerDidRemoveTextTrack(blink::WebInbandTextTrack*) overr
ide final; | |
197 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d
epend on it. | 221 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d
epend on it. |
198 virtual KURL mediaPlayerPosterURL() override { return KURL(); } | 222 virtual KURL mediaPlayerPosterURL() { return KURL(); } |
199 | 223 |
200 void honorUserPreferencesForAutomaticTextTrackSelection(); | 224 void honorUserPreferencesForAutomaticTextTrackSelection(); |
201 | 225 |
202 bool textTracksAreReady() const; | 226 bool textTracksAreReady() const; |
203 enum VisibilityChangeAssumption { | 227 enum VisibilityChangeAssumption { |
204 AssumeNoVisibleChange, | 228 AssumeNoVisibleChange, |
205 AssumeVisibleChange | 229 AssumeVisibleChange |
206 }; | 230 }; |
207 void configureTextTrackDisplay(VisibilityChangeAssumption); | 231 void configureTextTrackDisplay(VisibilityChangeAssumption); |
208 void updateTextTrackDisplay(); | 232 void updateTextTrackDisplay(); |
209 double lastSeekTime() const { return m_lastSeekTime; } | 233 double lastSeekTime() const { return m_lastSeekTime; } |
210 void textTrackReadyStateChanged(TextTrack*); | 234 void textTrackReadyStateChanged(TextTrack*); |
211 | 235 |
212 void textTrackModeChanged(TextTrack*); | 236 void textTrackModeChanged(TextTrack*); |
213 | 237 |
214 // EventTarget function. | 238 // EventTarget function. |
215 // Both Node (via HTMLElement) and ActiveDOMObject define this method, which | 239 // Both Node (via HTMLElement) and ActiveDOMObject define this method, which |
216 // causes an ambiguity error at compile time. This class's constructor | 240 // causes an ambiguity error at compile time. This class's constructor |
217 // ensures that both implementations return document, so return the result | 241 // ensures that both implementations return document, so return the result |
218 // of one of them here. | 242 // of one of them here. |
219 using HTMLElement::executionContext; | 243 using HTMLElement::executionContext; |
220 | 244 |
221 bool hasSingleSecurityOrigin() const { return !m_player || (webMediaPlayer()
&& webMediaPlayer()->hasSingleSecurityOrigin()); } | 245 bool hasSingleSecurityOrigin() const { return webMediaPlayer() && webMediaPl
ayer()->hasSingleSecurityOrigin(); } |
222 | 246 |
223 bool isFullscreen() const; | 247 bool isFullscreen() const; |
224 void enterFullscreen(); | 248 void enterFullscreen(); |
225 void exitFullscreen(); | 249 void exitFullscreen(); |
226 | 250 |
227 bool hasClosedCaptions() const; | 251 bool hasClosedCaptions() const; |
228 bool closedCaptionsVisible() const; | 252 bool closedCaptionsVisible() const; |
229 void setClosedCaptionsVisible(bool); | 253 void setClosedCaptionsVisible(bool); |
230 | 254 |
231 void remoteRouteAvailabilityChanged(bool); | |
232 void connectedToRemoteDevice(); | |
233 void disconnectedFromRemoteDevice(); | |
234 | |
235 // Returns the MediaControls, or null if they have not been added yet. | 255 // Returns the MediaControls, or null if they have not been added yet. |
236 // Note that this can be non-null even if there is no controls attribute. | 256 // Note that this can be non-null even if there is no controls attribute. |
237 MediaControls* mediaControls() const; | 257 MediaControls* mediaControls() const; |
238 | 258 |
239 // Notifies the media element that the media controls became visible, so | 259 // Notifies the media element that the media controls became visible, so |
240 // that text track layout may be updated to avoid overlapping them. | 260 // that text track layout may be updated to avoid overlapping them. |
241 void mediaControlsDidBecomeVisible(); | 261 void mediaControlsDidBecomeVisible(); |
242 | 262 |
243 void sourceWasRemoved(HTMLSourceElement*); | 263 void sourceWasRemoved(HTMLSourceElement*); |
244 void sourceWasAdded(HTMLSourceElement*); | 264 void sourceWasAdded(HTMLSourceElement*); |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 virtual void defaultEventHandler(Event*) override final; | 343 virtual void defaultEventHandler(Event*) override final; |
324 | 344 |
325 // ActiveDOMObject functions. | 345 // ActiveDOMObject functions. |
326 virtual void stop() override final; | 346 virtual void stop() override final; |
327 | 347 |
328 virtual void updateDisplayState() { } | 348 virtual void updateDisplayState() { } |
329 | 349 |
330 void setReadyState(ReadyState); | 350 void setReadyState(ReadyState); |
331 void setNetworkState(blink::WebMediaPlayer::NetworkState); | 351 void setNetworkState(blink::WebMediaPlayer::NetworkState); |
332 | 352 |
333 virtual void mediaPlayerNetworkStateChanged() override final; | 353 // cleanup |
| 354 /*virtual void mediaPlayerNetworkStateChanged() override final; |
334 virtual void mediaPlayerReadyStateChanged() override final; | 355 virtual void mediaPlayerReadyStateChanged() override final; |
335 virtual void mediaPlayerTimeChanged() override final; | 356 virtual void mediaPlayerTimeChanged() override final; |
336 virtual void mediaPlayerDurationChanged() override final; | 357 virtual void mediaPlayerDurationChanged() override final; |
337 virtual void mediaPlayerPlaybackStateChanged() override final; | 358 virtual void mediaPlayerPlaybackStateChanged() override final; |
338 virtual void mediaPlayerRequestFullscreen() override final; | 359 virtual void mediaPlayerRequestFullscreen() override final; |
339 virtual void mediaPlayerRequestSeek(double) override final; | 360 virtual void mediaPlayerRequestSeek(double) override final; |
340 virtual void mediaPlayerRepaint() override final; | 361 virtual void mediaPlayerRepaint() override final; |
341 virtual void mediaPlayerSizeChanged() override final; | 362 virtual void mediaPlayerSizeChanged() override final; |
342 virtual void mediaPlayerSetWebLayer(blink::WebLayer*) override final; | 363 virtual void mediaPlayerSetWebLayer(blink::WebLayer*) override final; |
343 virtual void mediaPlayerMediaSourceOpened(blink::WebMediaSource*) override f
inal; | 364 virtual void mediaPlayerMediaSourceOpened(blink::WebMediaSource*) override f
inal;*/ |
344 | 365 |
345 void loadTimerFired(Timer<HTMLMediaElement>*); | 366 void loadTimerFired(Timer<HTMLMediaElement>*); |
346 void progressEventTimerFired(Timer<HTMLMediaElement>*); | 367 void progressEventTimerFired(Timer<HTMLMediaElement>*); |
347 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); | 368 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); |
348 void startPlaybackProgressTimer(); | 369 void startPlaybackProgressTimer(); |
349 void startProgressEventTimer(); | 370 void startProgressEventTimer(); |
350 void stopPeriodicTimers(); | 371 void stopPeriodicTimers(); |
351 | 372 |
352 void seek(double time); | 373 void seek(double time); |
353 void finishSeek(); | 374 void finishSeek(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 // addAudioTrack() and addVideoTrack(). | 466 // addAudioTrack() and addVideoTrack(). |
446 // FIXME: Remove this once all WebMediaPlayer implementations properly repor
t their track info. | 467 // FIXME: Remove this once all WebMediaPlayer implementations properly repor
t their track info. |
447 void createPlaceholderTracksIfNecessary(); | 468 void createPlaceholderTracksIfNecessary(); |
448 | 469 |
449 // Sets the selected/enabled tracks if they aren't set before we initially | 470 // Sets the selected/enabled tracks if they aren't set before we initially |
450 // transition to HAVE_METADATA. | 471 // transition to HAVE_METADATA. |
451 void selectInitialTracksIfNecessary(); | 472 void selectInitialTracksIfNecessary(); |
452 | 473 |
453 void audioTracksTimerFired(Timer<HTMLMediaElement>*); | 474 void audioTracksTimerFired(Timer<HTMLMediaElement>*); |
454 | 475 |
| 476 PassOwnPtr<WebMediaPlayer> createWebMediaPlayer(const WebURL&); |
| 477 void loadMediaPlayer(const WTF::String& url); |
| 478 |
455 Timer<HTMLMediaElement> m_loadTimer; | 479 Timer<HTMLMediaElement> m_loadTimer; |
456 Timer<HTMLMediaElement> m_progressEventTimer; | 480 Timer<HTMLMediaElement> m_progressEventTimer; |
457 Timer<HTMLMediaElement> m_playbackProgressTimer; | 481 Timer<HTMLMediaElement> m_playbackProgressTimer; |
458 Timer<HTMLMediaElement> m_audioTracksTimer; | 482 Timer<HTMLMediaElement> m_audioTracksTimer; |
459 RefPtrWillBeMember<TimeRanges> m_playedTimeRanges; | 483 RefPtrWillBeMember<TimeRanges> m_playedTimeRanges; |
460 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 484 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; |
461 | 485 |
462 double m_playbackRate; | 486 double m_playbackRate; |
463 double m_defaultPlaybackRate; | 487 double m_defaultPlaybackRate; |
464 NetworkState m_networkState; | 488 NetworkState m_networkState; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
500 WaitingForStopDelayingLoadEventTask, | 524 WaitingForStopDelayingLoadEventTask, |
501 // The load is the deferred, and waiting for a triggering event. | 525 // The load is the deferred, and waiting for a triggering event. |
502 WaitingForTrigger, | 526 WaitingForTrigger, |
503 // The load is deferred, and waiting for the task to set the | 527 // The load is deferred, and waiting for the task to set the |
504 // delaying-the-load-event flag, after which the load will be executed. | 528 // delaying-the-load-event flag, after which the load will be executed. |
505 ExecuteOnStopDelayingLoadEventTask | 529 ExecuteOnStopDelayingLoadEventTask |
506 }; | 530 }; |
507 DeferredLoadState m_deferredLoadState; | 531 DeferredLoadState m_deferredLoadState; |
508 Timer<HTMLMediaElement> m_deferredLoadTimer; | 532 Timer<HTMLMediaElement> m_deferredLoadTimer; |
509 | 533 |
510 OwnPtr<MediaPlayer> m_player; | |
511 blink::WebLayer* m_webLayer; | 534 blink::WebLayer* m_webLayer; |
512 | 535 |
513 MediaPlayer::Preload m_preload; | 536 WebMediaPlayer::Preload m_preload; |
514 | 537 |
515 DisplayMode m_displayMode; | 538 DisplayMode m_displayMode; |
516 | 539 |
517 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; | 540 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; |
518 | 541 |
519 // Cached time value. Only valid when ready state is HAVE_METADATA or | 542 // Cached time value. Only valid when ready state is HAVE_METADATA or |
520 // higher, otherwise the current time is assumed to be zero. | 543 // higher, otherwise the current time is assumed to be zero. |
521 mutable double m_cachedTime; | 544 mutable double m_cachedTime; |
522 | 545 |
523 double m_fragmentEndTime; | 546 double m_fragmentEndTime; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 RefPtrWillBeMember<TextTrackList> m_textTracks; | 587 RefPtrWillBeMember<TextTrackList> m_textTracks; |
565 WillBeHeapVector<RefPtrWillBeMember<TextTrack>> m_textTracksWhenResourceSele
ctionBegan; | 588 WillBeHeapVector<RefPtrWillBeMember<TextTrack>> m_textTracksWhenResourceSele
ctionBegan; |
566 | 589 |
567 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; | 590 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; |
568 | 591 |
569 #if ENABLE(WEB_AUDIO) | 592 #if ENABLE(WEB_AUDIO) |
570 // This is a weak reference, since m_audioSourceNode holds a reference to us
. | 593 // This is a weak reference, since m_audioSourceNode holds a reference to us
. |
571 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan
where strong cycles are not a problem. | 594 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan
where strong cycles are not a problem. |
572 GC_PLUGIN_IGNORE("http://crbug.com/404577") | 595 GC_PLUGIN_IGNORE("http://crbug.com/404577") |
573 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; | 596 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; |
| 597 |
| 598 // AudioClientImpl wraps an AudioSourceProviderClient. |
| 599 // When the audio format is known, Chromium calls setFormat(). |
| 600 |
| 601 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm
pl>, public WebAudioSourceProviderClient { |
| 602 public: |
| 603 explicit AudioClientImpl(AudioSourceProviderClient* client) |
| 604 : m_client(client) |
| 605 { |
| 606 } |
| 607 |
| 608 virtual ~AudioClientImpl() { } |
| 609 |
| 610 // WebAudioSourceProviderClient |
| 611 virtual void setFormat(size_t numberOfChannels, float sampleRate) overri
de; |
| 612 |
| 613 DECLARE_TRACE(); |
| 614 |
| 615 private: |
| 616 Member<AudioSourceProviderClient> m_client; |
| 617 }; |
| 618 |
| 619 // AudioSourceProviderImpl wraps a WebAudioSourceProvider. |
| 620 // provideInput() calls into Chromium to get a rendered audio stream. |
| 621 |
| 622 class AudioSourceProviderImpl final : public AudioSourceProvider { |
| 623 public: |
| 624 AudioSourceProviderImpl() |
| 625 : m_webAudioSourceProvider(0) |
| 626 { |
| 627 } |
| 628 |
| 629 virtual ~AudioSourceProviderImpl() { } |
| 630 |
| 631 // Wraps the given WebAudioSourceProvider. |
| 632 void wrap(WebAudioSourceProvider*); |
| 633 |
| 634 // AudioSourceProvider |
| 635 virtual void setClient(AudioSourceProviderClient*) override; |
| 636 virtual void provideInput(AudioBus*, size_t framesToProcess) override; |
| 637 |
| 638 private: |
| 639 WebAudioSourceProvider* m_webAudioSourceProvider; |
| 640 Persistent<AudioClientImpl> m_client; |
| 641 Mutex provideInputLock; |
| 642 }; |
| 643 |
| 644 AudioSourceProviderImpl m_audioSourceProvider; |
574 #endif | 645 #endif |
575 | 646 |
576 friend class MediaController; | 647 friend class MediaController; |
577 RefPtrWillBeMember<MediaController> m_mediaController; | 648 RefPtrWillBeMember<MediaController> m_mediaController; |
| 649 OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
578 | 650 |
579 friend class Internals; | 651 friend class Internals; |
580 friend class TrackDisplayUpdateScope; | 652 friend class TrackDisplayUpdateScope; |
581 | 653 |
582 static URLRegistry* s_mediaStreamRegistry; | 654 static URLRegistry* s_mediaStreamRegistry; |
583 }; | 655 }; |
584 | 656 |
585 inline bool isHTMLMediaElement(const HTMLElement& element) | 657 inline bool isHTMLMediaElement(const HTMLElement& element) |
586 { | 658 { |
587 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 659 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
588 } | 660 } |
589 | 661 |
590 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 662 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
591 | 663 |
592 } // namespace blink | 664 } // namespace blink |
593 | 665 |
594 #endif // HTMLMediaElement_h | 666 #endif // HTMLMediaElement_h |
OLD | NEW |