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