| 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 // TODO(srirama.m): Make the WebMediaPlayerClient inheritance private by |
| 69 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so
it | 70 // adding a means for getting a WebMediaPlayerEncryptedMediaClient and |
| 70 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. | 71 // WebContentDecryptionModule from an HTMLMediaElement and calling |
| 71 | 72 // WebFrameClient::createMediaPlayer() directly. |
| 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 WILL_BE_USING_PRE_FINALIZER(HTMLMediaElement, dispose); | 76 WILL_BE_USING_PRE_FINALIZER(HTMLMediaElement, dispose); |
| 76 public: | 77 public: |
| 77 static WebMimeRegistry::SupportsType supportsType(const ContentType&, const
String& keySystem = String()); | 78 static WebMimeRegistry::SupportsType supportsType(const ContentType&, const
String& keySystem = String()); |
| 78 | 79 |
| 79 static void setMediaStreamRegistry(URLRegistry*); | 80 static void setMediaStreamRegistry(URLRegistry*); |
| 80 static bool isMediaStreamURL(const String& url); | 81 static bool isMediaStreamURL(const String& url); |
| 81 | 82 |
| 82 DECLARE_VIRTUAL_TRACE(); | 83 DECLARE_VIRTUAL_TRACE(); |
| 83 #if ENABLE(WEB_AUDIO) | 84 #if ENABLE(WEB_AUDIO) |
| 84 void clearWeakMembers(Visitor*); | 85 void clearWeakMembers(Visitor*); |
| 85 #endif | 86 #endif |
| 86 WebMediaPlayer* webMediaPlayer() const { return m_player ? m_player->webMedi
aPlayer() : 0; } | 87 WebMediaPlayer* webMediaPlayer() const |
| 88 { |
| 89 return m_webMediaPlayer.get(); |
| 90 } |
| 87 | 91 |
| 88 virtual bool hasVideo() const { return false; } | 92 virtual bool hasVideo() const { return false; } |
| 89 bool hasAudio() const; | 93 bool hasAudio() const; |
| 90 | 94 |
| 91 bool supportsSave() const; | 95 bool supportsSave() const; |
| 92 | 96 |
| 93 WebLayer* platformLayer() const; | 97 WebLayer* platformLayer() const; |
| 94 | 98 |
| 95 enum DelayedActionType { | 99 enum DelayedActionType { |
| 96 LoadMediaResource = 1 << 0, | 100 LoadMediaResource = 1 << 0, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 107 | 111 |
| 108 // network state | 112 // network state |
| 109 void setSrc(const AtomicString&); | 113 void setSrc(const AtomicString&); |
| 110 const KURL& currentSrc() const { return m_currentSrc; } | 114 const KURL& currentSrc() const { return m_currentSrc; } |
| 111 | 115 |
| 112 enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO
_SOURCE }; | 116 enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO
_SOURCE }; |
| 113 NetworkState networkState() const; | 117 NetworkState networkState() const; |
| 114 | 118 |
| 115 String preload() const; | 119 String preload() const; |
| 116 void setPreload(const AtomicString&); | 120 void setPreload(const AtomicString&); |
| 117 MediaPlayer::Preload preloadType() const; | 121 WebMediaPlayer::Preload preloadType() const; |
| 118 MediaPlayer::Preload effectivePreloadType() const; | 122 WebMediaPlayer::Preload effectivePreloadType() const; |
| 119 | 123 |
| 120 PassRefPtrWillBeRawPtr<TimeRanges> buffered() const; | 124 PassRefPtrWillBeRawPtr<TimeRanges> buffered() const; |
| 121 void load(); | 125 void load(); |
| 122 String canPlayType(const String& mimeType, const String& keySystem = String(
)) const; | 126 String canPlayType(const String& mimeType, const String& keySystem = String(
)) const; |
| 123 | 127 |
| 124 // ready state | 128 // ready state |
| 125 enum ReadyState { HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTUR
E_DATA, HAVE_ENOUGH_DATA }; | 129 enum ReadyState { HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTUR
E_DATA, HAVE_ENOUGH_DATA }; |
| 126 ReadyState readyState() const; | 130 ReadyState readyState() const; |
| 127 bool seeking() const; | 131 bool seeking() const; |
| 128 | 132 |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 void removeTextTrack(TextTrack*); | 186 void removeTextTrack(TextTrack*); |
| 183 void textTracksChanged(); | 187 void textTracksChanged(); |
| 184 void notifyMediaPlayerOfTextTrackChanges(); | 188 void notifyMediaPlayerOfTextTrackChanges(); |
| 185 | 189 |
| 186 // Implements the "forget the media element's media-resource-specific tracks
" algorithm in the HTML5 spec. | 190 // Implements the "forget the media element's media-resource-specific tracks
" algorithm in the HTML5 spec. |
| 187 void forgetResourceSpecificTracks(); | 191 void forgetResourceSpecificTracks(); |
| 188 | 192 |
| 189 void didAddTrackElement(HTMLTrackElement*); | 193 void didAddTrackElement(HTMLTrackElement*); |
| 190 void didRemoveTrackElement(HTMLTrackElement*); | 194 void didRemoveTrackElement(HTMLTrackElement*); |
| 191 | 195 |
| 192 WebMediaPlayer::TrackId addAudioTrack(const String& id, WebMediaPlayerClient
::AudioTrackKind, const AtomicString& label, const AtomicString& language, bool
enabled); | |
| 193 void removeAudioTrack(WebMediaPlayer::TrackId); | |
| 194 WebMediaPlayer::TrackId addVideoTrack(const String& id, WebMediaPlayerClient
::VideoTrackKind, const AtomicString& label, const AtomicString& language, bool
selected); | |
| 195 void removeVideoTrack(WebMediaPlayer::TrackId); | |
| 196 | |
| 197 void mediaPlayerDidAddTextTrack(WebInbandTextTrack*) final; | |
| 198 void mediaPlayerDidRemoveTextTrack(WebInbandTextTrack*) final; | |
| 199 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d
epend on it. | |
| 200 KURL mediaPlayerPosterURL() override { return KURL(); } | |
| 201 | |
| 202 void honorUserPreferencesForAutomaticTextTrackSelection(); | 196 void honorUserPreferencesForAutomaticTextTrackSelection(); |
| 203 | 197 |
| 204 bool textTracksAreReady() const; | 198 bool textTracksAreReady() const; |
| 205 enum VisibilityChangeAssumption { | 199 enum VisibilityChangeAssumption { |
| 206 AssumeNoVisibleChange, | 200 AssumeNoVisibleChange, |
| 207 AssumeVisibleChange | 201 AssumeVisibleChange |
| 208 }; | 202 }; |
| 209 void configureTextTrackDisplay(VisibilityChangeAssumption); | 203 void configureTextTrackDisplay(VisibilityChangeAssumption); |
| 210 void updateTextTrackDisplay(); | 204 void updateTextTrackDisplay(); |
| 211 double lastSeekTime() const { return m_lastSeekTime; } | 205 double lastSeekTime() const { return m_lastSeekTime; } |
| 212 void textTrackReadyStateChanged(TextTrack*); | 206 void textTrackReadyStateChanged(TextTrack*); |
| 213 | 207 |
| 214 void textTrackModeChanged(TextTrack*); | 208 void textTrackModeChanged(TextTrack*); |
| 215 | 209 |
| 216 // EventTarget function. | 210 // EventTarget function. |
| 217 // Both Node (via HTMLElement) and ActiveDOMObject define this method, which | 211 // Both Node (via HTMLElement) and ActiveDOMObject define this method, which |
| 218 // causes an ambiguity error at compile time. This class's constructor | 212 // causes an ambiguity error at compile time. This class's constructor |
| 219 // ensures that both implementations return document, so return the result | 213 // ensures that both implementations return document, so return the result |
| 220 // of one of them here. | 214 // of one of them here. |
| 221 using HTMLElement::executionContext; | 215 using HTMLElement::executionContext; |
| 222 | 216 |
| 223 bool hasSingleSecurityOrigin() const { return !m_player || (webMediaPlayer()
&& webMediaPlayer()->hasSingleSecurityOrigin()); } | 217 bool hasSingleSecurityOrigin() const { return webMediaPlayer() && webMediaPl
ayer()->hasSingleSecurityOrigin(); } |
| 224 | 218 |
| 225 bool isFullscreen() const; | 219 bool isFullscreen() const; |
| 226 void enterFullscreen(); | 220 void enterFullscreen(); |
| 227 void exitFullscreen(); | 221 void exitFullscreen(); |
| 228 | 222 |
| 229 bool hasClosedCaptions() const; | 223 bool hasClosedCaptions() const; |
| 230 bool closedCaptionsVisible() const; | 224 bool closedCaptionsVisible() const; |
| 231 void setClosedCaptionsVisible(bool); | 225 void setClosedCaptionsVisible(bool); |
| 232 | 226 |
| 233 static void setTextTrackKindUserPreferenceForAllMediaElements(Document*); | 227 static void setTextTrackKindUserPreferenceForAllMediaElements(Document*); |
| 234 void automaticTrackSelectionForUpdatedUserPreference(); | 228 void automaticTrackSelectionForUpdatedUserPreference(); |
| 235 | 229 |
| 236 void remoteRouteAvailabilityChanged(bool); | |
| 237 void connectedToRemoteDevice(); | |
| 238 void disconnectedFromRemoteDevice(); | |
| 239 | |
| 240 // Returns the MediaControls, or null if they have not been added yet. | 230 // Returns the MediaControls, or null if they have not been added yet. |
| 241 // Note that this can be non-null even if there is no controls attribute. | 231 // Note that this can be non-null even if there is no controls attribute. |
| 242 MediaControls* mediaControls() const; | 232 MediaControls* mediaControls() const; |
| 243 | 233 |
| 244 // Notifies the media element that the media controls became visible, so | 234 // Notifies the media element that the media controls became visible, so |
| 245 // that text track layout may be updated to avoid overlapping them. | 235 // that text track layout may be updated to avoid overlapping them. |
| 246 void mediaControlsDidBecomeVisible(); | 236 void mediaControlsDidBecomeVisible(); |
| 247 | 237 |
| 248 void sourceWasRemoved(HTMLSourceElement*); | 238 void sourceWasRemoved(HTMLSourceElement*); |
| 249 void sourceWasAdded(HTMLSourceElement*); | 239 void sourceWasAdded(HTMLSourceElement*); |
| 250 | 240 |
| 251 // ActiveDOMObject functions. | 241 // ActiveDOMObject functions. |
| 252 bool hasPendingActivity() const final; | 242 bool hasPendingActivity() const final; |
| 253 void contextDestroyed() final; | 243 void contextDestroyed() final; |
| 254 | 244 |
| 255 #if ENABLE(WEB_AUDIO) | 245 #if ENABLE(WEB_AUDIO) |
| 256 AudioSourceProviderClient* audioSourceNode() { return m_audioSourceNode; } | 246 AudioSourceProviderClient* audioSourceNode() { return m_audioSourceNode; } |
| 257 void setAudioSourceNode(AudioSourceProviderClient*); | 247 void setAudioSourceNode(AudioSourceProviderClient*); |
| 258 | 248 |
| 259 AudioSourceProvider* audioSourceProvider(); | 249 AudioSourceProvider* audioSourceProvider() { return &m_audioSourceProvider;
} |
| 260 #endif | 250 #endif |
| 261 | 251 |
| 262 enum InvalidURLAction { DoNothing, Complain }; | 252 enum InvalidURLAction { DoNothing, Complain }; |
| 263 bool isSafeToLoadURL(const KURL&, InvalidURLAction); | 253 bool isSafeToLoadURL(const KURL&, InvalidURLAction); |
| 264 | 254 |
| 265 // Checks to see if current media data is CORS-same-origin as the | 255 // Checks to see if current media data is CORS-same-origin as the |
| 266 // specified origin. | 256 // specified origin. |
| 267 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; | 257 bool isMediaDataCORSSameOrigin(SecurityOrigin*) const; |
| 268 | 258 |
| 269 MediaController* controller() const; | 259 MediaController* controller() const; |
| (...skipping 15 matching lines...) Expand all Loading... |
| 285 #if ENABLE(OILPAN) | 275 #if ENABLE(OILPAN) |
| 286 void dispose(); | 276 void dispose(); |
| 287 #endif | 277 #endif |
| 288 | 278 |
| 289 void parseAttribute(const QualifiedName&, const AtomicString&) override; | 279 void parseAttribute(const QualifiedName&, const AtomicString&) override; |
| 290 void finishParsingChildren() final; | 280 void finishParsingChildren() final; |
| 291 bool isURLAttribute(const Attribute&) const override; | 281 bool isURLAttribute(const Attribute&) const override; |
| 292 void attach(const AttachContext& = AttachContext()) override; | 282 void attach(const AttachContext& = AttachContext()) override; |
| 293 | 283 |
| 294 void didMoveToNewDocument(Document& oldDocument) override; | 284 void didMoveToNewDocument(Document& oldDocument) override; |
| 285 virtual KURL posterImageURL() const { return KURL(); } |
| 295 | 286 |
| 296 enum DisplayMode { Unknown, Poster, Video }; | 287 enum DisplayMode { Unknown, Poster, Video }; |
| 297 DisplayMode displayMode() const { return m_displayMode; } | 288 DisplayMode displayMode() const { return m_displayMode; } |
| 298 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } | 289 virtual void setDisplayMode(DisplayMode mode) { m_displayMode = mode; } |
| 299 | 290 |
| 300 void setControllerInternal(MediaController*); | 291 void setControllerInternal(MediaController*); |
| 301 | 292 |
| 302 private: | 293 private: |
| 303 void createMediaPlayer(); | 294 void resetMediaPlayerAndMediaSource(); |
| 304 | 295 |
| 305 bool alwaysCreateUserAgentShadowRoot() const final { return true; } | 296 bool alwaysCreateUserAgentShadowRoot() const final { return true; } |
| 306 bool areAuthorShadowsAllowed() const final { return false; } | 297 bool areAuthorShadowsAllowed() const final { return false; } |
| 307 | 298 |
| 308 bool supportsFocus() const final; | 299 bool supportsFocus() const final; |
| 309 bool isMouseFocusable() const final; | 300 bool isMouseFocusable() const final; |
| 310 bool layoutObjectIsNeeded(const ComputedStyle&) override; | 301 bool layoutObjectIsNeeded(const ComputedStyle&) override; |
| 311 LayoutObject* createLayoutObject(const ComputedStyle&) override; | 302 LayoutObject* createLayoutObject(const ComputedStyle&) override; |
| 312 InsertionNotificationRequest insertedInto(ContainerNode*) final; | 303 InsertionNotificationRequest insertedInto(ContainerNode*) final; |
| 313 void didNotifySubtreeInsertionsToDocument() override; | 304 void didNotifySubtreeInsertionsToDocument() override; |
| 314 void removedFrom(ContainerNode*) final; | 305 void removedFrom(ContainerNode*) final; |
| 315 void didRecalcStyle(StyleRecalcChange) final; | 306 void didRecalcStyle(StyleRecalcChange) final; |
| 316 | 307 |
| 317 bool canStartSelection() const override { return false; } | 308 bool canStartSelection() const override { return false; } |
| 318 | 309 |
| 319 void didBecomeFullscreenElement() final; | 310 void didBecomeFullscreenElement() final; |
| 320 void willStopBeingFullscreenElement() final; | 311 void willStopBeingFullscreenElement() final; |
| 321 bool isInteractiveContent() const final; | 312 bool isInteractiveContent() const final; |
| 322 void defaultEventHandler(Event*) final; | 313 void defaultEventHandler(Event*) final; |
| 323 | 314 |
| 324 // ActiveDOMObject functions. | 315 // ActiveDOMObject functions. |
| 325 void stop() final; | 316 void stop() final; |
| 326 | 317 |
| 327 virtual void updateDisplayState() { } | 318 virtual void updateDisplayState() { } |
| 328 | 319 |
| 329 void setReadyState(ReadyState); | 320 void setReadyState(ReadyState); |
| 330 void setNetworkState(WebMediaPlayer::NetworkState); | 321 void setNetworkState(WebMediaPlayer::NetworkState); |
| 331 | 322 |
| 332 void mediaPlayerNetworkStateChanged() final; | 323 // WebMediaPlayerClient implementation. |
| 333 void mediaPlayerReadyStateChanged() final; | 324 void networkStateChanged() final; |
| 334 void mediaPlayerTimeChanged() final; | 325 void readyStateChanged() final; |
| 335 void mediaPlayerDurationChanged() final; | 326 void timeChanged() final; |
| 336 void mediaPlayerPlaybackStateChanged() final; | 327 void repaint() final; |
| 337 void mediaPlayerRequestSeek(double) final; | 328 void durationChanged() final; |
| 338 void mediaPlayerRepaint() final; | 329 void sizeChanged() final; |
| 339 void mediaPlayerSizeChanged() final; | 330 void playbackStateChanged() final; |
| 340 void mediaPlayerSetWebLayer(WebLayer*) final; | 331 |
| 341 void mediaPlayerMediaSourceOpened(WebMediaSource*) final; | 332 void setWebLayer(WebLayer*) final; |
| 333 WebMediaPlayer::TrackId addAudioTrack(const WebString&, WebMediaPlayerClient
::AudioTrackKind, const WebString&, const WebString&, bool) final; |
| 334 void removeAudioTrack(WebMediaPlayer::TrackId) final; |
| 335 WebMediaPlayer::TrackId addVideoTrack(const WebString&, WebMediaPlayerClient
::VideoTrackKind, const WebString&, const WebString&, bool) final; |
| 336 void removeVideoTrack(WebMediaPlayer::TrackId) final; |
| 337 void addTextTrack(WebInbandTextTrack*) final; |
| 338 void removeTextTrack(WebInbandTextTrack*) final; |
| 339 void mediaSourceOpened(WebMediaSource*) final; |
| 340 void requestSeek(double) final; |
| 341 void remoteRouteAvailabilityChanged(bool) final; |
| 342 void connectedToRemoteDevice() final; |
| 343 void disconnectedFromRemoteDevice() final; |
| 342 | 344 |
| 343 void loadTimerFired(Timer<HTMLMediaElement>*); | 345 void loadTimerFired(Timer<HTMLMediaElement>*); |
| 344 void progressEventTimerFired(Timer<HTMLMediaElement>*); | 346 void progressEventTimerFired(Timer<HTMLMediaElement>*); |
| 345 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); | 347 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); |
| 346 void startPlaybackProgressTimer(); | 348 void startPlaybackProgressTimer(); |
| 347 void startProgressEventTimer(); | 349 void startProgressEventTimer(); |
| 348 void stopPeriodicTimers(); | 350 void stopPeriodicTimers(); |
| 349 | 351 |
| 350 void seek(double time); | 352 void seek(double time); |
| 351 void finishSeek(); | 353 void finishSeek(); |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 498 WaitingForStopDelayingLoadEventTask, | 500 WaitingForStopDelayingLoadEventTask, |
| 499 // The load is the deferred, and waiting for a triggering event. | 501 // The load is the deferred, and waiting for a triggering event. |
| 500 WaitingForTrigger, | 502 WaitingForTrigger, |
| 501 // The load is deferred, and waiting for the task to set the | 503 // 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. | 504 // delaying-the-load-event flag, after which the load will be executed. |
| 503 ExecuteOnStopDelayingLoadEventTask | 505 ExecuteOnStopDelayingLoadEventTask |
| 504 }; | 506 }; |
| 505 DeferredLoadState m_deferredLoadState; | 507 DeferredLoadState m_deferredLoadState; |
| 506 Timer<HTMLMediaElement> m_deferredLoadTimer; | 508 Timer<HTMLMediaElement> m_deferredLoadTimer; |
| 507 | 509 |
| 508 OwnPtr<MediaPlayer> m_player; | 510 OwnPtr<WebMediaPlayer> m_webMediaPlayer; |
| 509 WebLayer* m_webLayer; | 511 WebLayer* m_webLayer; |
| 510 | 512 |
| 511 DisplayMode m_displayMode; | 513 DisplayMode m_displayMode; |
| 512 | 514 |
| 513 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; | 515 RefPtrWillBeMember<HTMLMediaSource> m_mediaSource; |
| 514 | 516 |
| 515 // Cached time value. Only valid when ready state is HAVE_METADATA or | 517 // Cached time value. Only valid when ready state is HAVE_METADATA or |
| 516 // higher, otherwise the current time is assumed to be zero. | 518 // higher, otherwise the current time is assumed to be zero. |
| 517 mutable double m_cachedTime; | 519 mutable double m_cachedTime; |
| 518 | 520 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 RefPtrWillBeMember<TextTrackList> m_textTracks; | 559 RefPtrWillBeMember<TextTrackList> m_textTracks; |
| 558 WillBeHeapVector<RefPtrWillBeMember<TextTrack>> m_textTracksWhenResourceSele
ctionBegan; | 560 WillBeHeapVector<RefPtrWillBeMember<TextTrack>> m_textTracksWhenResourceSele
ctionBegan; |
| 559 | 561 |
| 560 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; | 562 OwnPtrWillBeMember<CueTimeline> m_cueTimeline; |
| 561 | 563 |
| 562 #if ENABLE(WEB_AUDIO) | 564 #if ENABLE(WEB_AUDIO) |
| 563 // This is a weak reference, since m_audioSourceNode holds a reference to us
. | 565 // This is a weak reference, since m_audioSourceNode holds a reference to us
. |
| 564 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan
where strong cycles are not a problem. | 566 // FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan
where strong cycles are not a problem. |
| 565 GC_PLUGIN_IGNORE("http://crbug.com/404577") | 567 GC_PLUGIN_IGNORE("http://crbug.com/404577") |
| 566 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; | 568 RawPtrWillBeWeakMember<AudioSourceProviderClient> m_audioSourceNode; |
| 569 |
| 570 // AudioClientImpl wraps an AudioSourceProviderClient. |
| 571 // When the audio format is known, Chromium calls setFormat(). |
| 572 class AudioClientImpl final : public GarbageCollectedFinalized<AudioClientIm
pl>, public WebAudioSourceProviderClient { |
| 573 public: |
| 574 explicit AudioClientImpl(AudioSourceProviderClient* client) |
| 575 : m_client(client) |
| 576 { |
| 577 } |
| 578 |
| 579 ~AudioClientImpl() override { } |
| 580 |
| 581 // WebAudioSourceProviderClient |
| 582 void setFormat(size_t numberOfChannels, float sampleRate) override; |
| 583 |
| 584 DECLARE_TRACE(); |
| 585 |
| 586 private: |
| 587 Member<AudioSourceProviderClient> m_client; |
| 588 }; |
| 589 |
| 590 // AudioSourceProviderImpl wraps a WebAudioSourceProvider. |
| 591 // provideInput() calls into Chromium to get a rendered audio stream. |
| 592 class AudioSourceProviderImpl final : public AudioSourceProvider { |
| 593 public: |
| 594 AudioSourceProviderImpl() |
| 595 : m_webAudioSourceProvider(nullptr) |
| 596 { |
| 597 } |
| 598 |
| 599 ~AudioSourceProviderImpl() override { } |
| 600 |
| 601 // Wraps the given WebAudioSourceProvider. |
| 602 void wrap(WebAudioSourceProvider*); |
| 603 |
| 604 // AudioSourceProvider |
| 605 void setClient(AudioSourceProviderClient*) override; |
| 606 void provideInput(AudioBus*, size_t framesToProcess) override; |
| 607 |
| 608 private: |
| 609 WebAudioSourceProvider* m_webAudioSourceProvider; |
| 610 Persistent<AudioClientImpl> m_client; |
| 611 Mutex provideInputLock; |
| 612 }; |
| 613 |
| 614 AudioSourceProviderImpl m_audioSourceProvider; |
| 567 #endif | 615 #endif |
| 568 | 616 |
| 569 friend class MediaController; | 617 friend class MediaController; |
| 570 PersistentWillBeMember<MediaController> m_mediaController; | 618 PersistentWillBeMember<MediaController> m_mediaController; |
| 571 | 619 |
| 572 friend class Internals; | 620 friend class Internals; |
| 573 friend class TrackDisplayUpdateScope; | 621 friend class TrackDisplayUpdateScope; |
| 574 | 622 |
| 575 static URLRegistry* s_mediaStreamRegistry; | 623 static URLRegistry* s_mediaStreamRegistry; |
| 576 }; | 624 }; |
| 577 | 625 |
| 578 inline bool isHTMLMediaElement(const HTMLElement& element) | 626 inline bool isHTMLMediaElement(const HTMLElement& element) |
| 579 { | 627 { |
| 580 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 628 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 581 } | 629 } |
| 582 | 630 |
| 583 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 631 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 584 | 632 |
| 585 } // namespace blink | 633 } // namespace blink |
| 586 | 634 |
| 587 #endif // HTMLMediaElement_h | 635 #endif // HTMLMediaElement_h |
| OLD | NEW |