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; | |
342 | 341 |
343 void loadTimerFired(Timer<HTMLMediaElement>*); | 342 void loadTimerFired(Timer<HTMLMediaElement>*); |
344 void progressEventTimerFired(Timer<HTMLMediaElement>*); | 343 void progressEventTimerFired(Timer<HTMLMediaElement>*); |
345 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); | 344 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); |
346 void startPlaybackProgressTimer(); | 345 void startPlaybackProgressTimer(); |
347 void startProgressEventTimer(); | 346 void startProgressEventTimer(); |
348 void stopPeriodicTimers(); | 347 void stopPeriodicTimers(); |
349 | 348 |
350 void seek(double time); | 349 void seek(double time); |
351 void finishSeek(); | 350 void finishSeek(); |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
443 // addAudioTrack() and addVideoTrack(). | 442 // addAudioTrack() and addVideoTrack(). |
444 // FIXME: Remove this once all WebMediaPlayer implementations properly repor
t their track info. | 443 // FIXME: Remove this once all WebMediaPlayer implementations properly repor
t their track info. |
445 void createPlaceholderTracksIfNecessary(); | 444 void createPlaceholderTracksIfNecessary(); |
446 | 445 |
447 // Sets the selected/enabled tracks if they aren't set before we initially | 446 // Sets the selected/enabled tracks if they aren't set before we initially |
448 // transition to HAVE_METADATA. | 447 // transition to HAVE_METADATA. |
449 void selectInitialTracksIfNecessary(); | 448 void selectInitialTracksIfNecessary(); |
450 | 449 |
451 void audioTracksTimerFired(Timer<HTMLMediaElement>*); | 450 void audioTracksTimerFired(Timer<HTMLMediaElement>*); |
452 | 451 |
| 452 void prepareAndLoadMediaPlayer(const WTF::String& url); |
| 453 |
453 Timer<HTMLMediaElement> m_loadTimer; | 454 Timer<HTMLMediaElement> m_loadTimer; |
454 Timer<HTMLMediaElement> m_progressEventTimer; | 455 Timer<HTMLMediaElement> m_progressEventTimer; |
455 Timer<HTMLMediaElement> m_playbackProgressTimer; | 456 Timer<HTMLMediaElement> m_playbackProgressTimer; |
456 Timer<HTMLMediaElement> m_audioTracksTimer; | 457 Timer<HTMLMediaElement> m_audioTracksTimer; |
457 RefPtrWillBeMember<TimeRanges> m_playedTimeRanges; | 458 RefPtrWillBeMember<TimeRanges> m_playedTimeRanges; |
458 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; | 459 OwnPtrWillBeMember<GenericEventQueue> m_asyncEventQueue; |
459 | 460 |
460 double m_playbackRate; | 461 double m_playbackRate; |
461 double m_defaultPlaybackRate; | 462 double m_defaultPlaybackRate; |
462 NetworkState m_networkState; | 463 NetworkState m_networkState; |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 WaitingForStopDelayingLoadEventTask, | 499 WaitingForStopDelayingLoadEventTask, |
499 // The load is the deferred, and waiting for a triggering event. | 500 // The load is the deferred, and waiting for a triggering event. |
500 WaitingForTrigger, | 501 WaitingForTrigger, |
501 // The load is deferred, and waiting for the task to set the | 502 // 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. | 503 // delaying-the-load-event flag, after which the load will be executed. |
503 ExecuteOnStopDelayingLoadEventTask | 504 ExecuteOnStopDelayingLoadEventTask |
504 }; | 505 }; |
505 DeferredLoadState m_deferredLoadState; | 506 DeferredLoadState m_deferredLoadState; |
506 Timer<HTMLMediaElement> m_deferredLoadTimer; | 507 Timer<HTMLMediaElement> m_deferredLoadTimer; |
507 | 508 |
508 OwnPtr<MediaPlayer> m_player; | 509 OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
509 WebLayer* m_webLayer; | 510 WebLayer* m_webLayer; |
510 | 511 |
511 MediaPlayer::Preload m_preload; | 512 WebMediaPlayer::Preload m_preload; |
512 | 513 |
513 DisplayMode m_displayMode; | 514 DisplayMode m_displayMode; |
514 | 515 |
515 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; | 516 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; |
516 | 517 |
517 // Cached time value. Only valid when ready state is HAVE_METADATA or | 518 // Cached time value. Only valid when ready state is HAVE_METADATA or |
518 // higher, otherwise the current time is assumed to be zero. | 519 // higher, otherwise the current time is assumed to be zero. |
519 mutable double m_cachedTime; | 520 mutable double m_cachedTime; |
520 | 521 |
521 double m_fragmentEndTime; | 522 double m_fragmentEndTime; |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 RefPtrWillBeMember<TextTrackList> m_textTracks; | 563 RefPtrWillBeMember<TextTrackList> m_textTracks; |
563 WillBeHeapVector<RefPtrWillBeMember<TextTrack>> m_textTracksWhenResourceSele
ctionBegan; | 564 WillBeHeapVector<RefPtrWillBeMember<TextTrack>> m_textTracksWhenResourceSele
ctionBegan; |
564 | 565 |
565 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; | 566 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; |
566 | 567 |
567 #if ENABLE(WEB_AUDIO) | 568 #if ENABLE(WEB_AUDIO) |
568 // This is a weak reference, since m_audioSourceNode holds a reference to us
. | 569 // 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. | 570 // 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") | 571 GC_PLUGIN_IGNORE("http://crbug.com/404577") |
571 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; | 572 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; |
| 573 |
| 574 // AudioClientImpl wraps an AudioSourceProviderClient. |
| 575 // When the audio format is known, Chromium calls setFormat(). |
| 576 |
| 577 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm
pl>, public WebAudioSourceProviderClient { |
| 578 public: |
| 579 explicit AudioClientImpl(AudioSourceProviderClient* client) |
| 580 : m_client(client) |
| 581 { |
| 582 } |
| 583 |
| 584 virtual ~AudioClientImpl() { } |
| 585 |
| 586 // WebAudioSourceProviderClient |
| 587 virtual void setFormat(size_t numberOfChannels, float sampleRate) overri
de; |
| 588 |
| 589 DECLARE_TRACE(); |
| 590 |
| 591 private: |
| 592 Member<AudioSourceProviderClient> m_client; |
| 593 }; |
| 594 |
| 595 // AudioSourceProviderImpl wraps a WebAudioSourceProvider. |
| 596 // provideInput() calls into Chromium to get a rendered audio stream. |
| 597 |
| 598 class AudioSourceProviderImpl final : public AudioSourceProvider { |
| 599 public: |
| 600 AudioSourceProviderImpl() |
| 601 : m_webAudioSourceProvider(0) |
| 602 { |
| 603 } |
| 604 |
| 605 virtual ~AudioSourceProviderImpl() { } |
| 606 |
| 607 // Wraps the given WebAudioSourceProvider. |
| 608 void wrap(WebAudioSourceProvider*); |
| 609 |
| 610 // AudioSourceProvider |
| 611 virtual void setClient(AudioSourceProviderClient*) override; |
| 612 virtual void provideInput(AudioBus*, size_t framesToProcess) override; |
| 613 |
| 614 private: |
| 615 WebAudioSourceProvider* m_webAudioSourceProvider; |
| 616 Persistent<AudioClientImpl> m_client; |
| 617 Mutex provideInputLock; |
| 618 }; |
| 619 |
| 620 AudioSourceProviderImpl m_audioSourceProvider; |
572 #endif | 621 #endif |
573 | 622 |
574 friend class MediaController; | 623 friend class MediaController; |
575 RefPtrWillBeMember<MediaController> m_mediaController; | 624 RefPtrWillBeMember<MediaController> m_mediaController; |
576 | 625 |
577 friend class Internals; | 626 friend class Internals; |
578 friend class TrackDisplayUpdateScope; | 627 friend class TrackDisplayUpdateScope; |
579 | 628 |
580 static URLRegistry* s_mediaStreamRegistry; | 629 static URLRegistry* s_mediaStreamRegistry; |
581 }; | 630 }; |
582 | 631 |
583 inline bool isHTMLMediaElement(const HTMLElement& element) | 632 inline bool isHTMLMediaElement(const HTMLElement& element) |
584 { | 633 { |
585 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 634 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
586 } | 635 } |
587 | 636 |
588 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 637 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
589 | 638 |
590 } // namespace blink | 639 } // namespace blink |
591 | 640 |
592 #endif // HTMLMediaElement_h | 641 #endif // HTMLMediaElement_h |
OLD | NEW |