Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(463)

Side by Side Diff: Source/core/html/HTMLMediaElement.h

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

Powered by Google App Engine
This is Rietveld 408576698