Chromium Code Reviews| 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 16 matching lines...) Expand all Loading... | |
| 27 #define HTMLMediaElement_h | 27 #define HTMLMediaElement_h |
| 28 | 28 |
| 29 #include "core/dom/ActiveDOMObject.h" | 29 #include "core/dom/ActiveDOMObject.h" |
| 30 #include "core/events/GenericEventQueue.h" | 30 #include "core/events/GenericEventQueue.h" |
| 31 #include "core/html/HTMLElement.h" | 31 #include "core/html/HTMLElement.h" |
| 32 #include "core/html/track/TextTrack.h" | 32 #include "core/html/track/TextTrack.h" |
| 33 #include "core/html/track/TextTrackCue.h" | 33 #include "core/html/track/TextTrackCue.h" |
| 34 #include "core/html/track/vtt/VTTCue.h" | 34 #include "core/html/track/vtt/VTTCue.h" |
| 35 #include "platform/PODIntervalTree.h" | 35 #include "platform/PODIntervalTree.h" |
| 36 #include "platform/graphics/media/MediaPlayer.h" | 36 #include "platform/graphics/media/MediaPlayer.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 WebContentDecryptionModule; | 41 class WebContentDecryptionModule; |
| 41 class WebInbandTextTrack; | 42 class WebInbandTextTrack; |
| 42 class WebLayer; | 43 class WebLayer; |
| 43 } | 44 } |
| 44 | 45 |
| 45 namespace WebCore { | 46 namespace WebCore { |
| 46 | 47 |
| 47 #if ENABLE(WEB_AUDIO) | 48 #if ENABLE(WEB_AUDIO) |
| 48 class AudioSourceProvider; | 49 class AudioSourceProvider; |
| 49 class AudioSourceProviderClient; | 50 class AudioSourceProviderClient; |
| 50 #endif | 51 #endif |
| 52 class AudioTrackList; | |
| 51 class ContentType; | 53 class ContentType; |
| 52 class Event; | 54 class Event; |
| 53 class ExceptionState; | 55 class ExceptionState; |
| 54 class HTMLSourceElement; | 56 class HTMLSourceElement; |
| 55 class HTMLTrackElement; | 57 class HTMLTrackElement; |
| 56 class KURL; | 58 class KURL; |
| 57 class MediaController; | 59 class MediaController; |
| 58 class MediaControls; | 60 class MediaControls; |
| 59 class MediaError; | 61 class MediaError; |
| 60 class HTMLMediaSource; | 62 class HTMLMediaSource; |
| 61 class TextTrackList; | 63 class TextTrackList; |
| 62 class TimeRanges; | 64 class TimeRanges; |
| 63 class URLRegistry; | 65 class URLRegistry; |
| 66 class VideoTrackList; | |
| 64 | 67 |
| 65 typedef PODIntervalTree<double, TextTrackCue*> CueIntervalTree; | 68 typedef PODIntervalTree<double, TextTrackCue*> CueIntervalTree; |
| 66 typedef CueIntervalTree::IntervalType CueInterval; | 69 typedef CueIntervalTree::IntervalType CueInterval; |
| 67 typedef Vector<CueInterval> CueList; | 70 typedef Vector<CueInterval> CueList; |
| 68 | 71 |
| 69 // FIXME: The inheritance from MediaPlayerClient here should be private inherita nce. | 72 // FIXME: The inheritance from MediaPlayerClient here should be private inherita nce. |
| 70 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so it | 73 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so it |
| 71 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. | 74 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. |
| 72 | 75 |
| 73 class HTMLMediaElement : public HTMLElement, public WillBeHeapSupplementable<HTM LMediaElement>, public MediaPlayerClient, public ActiveDOMObject | 76 class HTMLMediaElement : public HTMLElement, public WillBeHeapSupplementable<HTM LMediaElement>, public MediaPlayerClient, public ActiveDOMObject |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 double volume() const; | 160 double volume() const; |
| 158 void setVolume(double, ExceptionState&); | 161 void setVolume(double, ExceptionState&); |
| 159 bool muted() const; | 162 bool muted() const; |
| 160 void setMuted(bool); | 163 void setMuted(bool); |
| 161 | 164 |
| 162 // play/pause toggling that uses the media controller if present. togglePlay StateWillPlay() is | 165 // play/pause toggling that uses the media controller if present. togglePlay StateWillPlay() is |
| 163 // true if togglePlayState() will call play() or unpause() on the media elem ent or controller. | 166 // true if togglePlayState() will call play() or unpause() on the media elem ent or controller. |
| 164 bool togglePlayStateWillPlay() const; | 167 bool togglePlayStateWillPlay() const; |
| 165 void togglePlayState(); | 168 void togglePlayState(); |
| 166 | 169 |
| 170 AudioTrackList& audioTracks(); | |
| 171 void audioTrackChanged(); | |
| 172 | |
| 173 VideoTrackList& videoTracks(); | |
| 174 void selectedVideoTrackChanged(blink::WebMediaPlayer::TrackId*); | |
| 175 | |
| 167 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, con st AtomicString& label, const AtomicString& language, ExceptionState&); | 176 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, con st AtomicString& label, const AtomicString& language, ExceptionState&); |
| 168 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, con st AtomicString& label, ExceptionState& exceptionState) { return addTextTrack(ki nd, label, emptyAtom, exceptionState); } | 177 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, con st AtomicString& label, ExceptionState& exceptionState) { return addTextTrack(ki nd, label, emptyAtom, exceptionState); } |
| 169 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, Exc eptionState& exceptionState) { return addTextTrack(kind, emptyAtom, emptyAtom, e xceptionState); } | 178 PassRefPtrWillBeRawPtr<TextTrack> addTextTrack(const AtomicString& kind, Exc eptionState& exceptionState) { return addTextTrack(kind, emptyAtom, emptyAtom, e xceptionState); } |
| 170 | 179 |
| 171 TextTrackList* textTracks(); | 180 TextTrackList* textTracks(); |
| 172 CueList currentlyActiveCues() const { return m_currentlyActiveCues; } | 181 CueList currentlyActiveCues() const { return m_currentlyActiveCues; } |
| 173 | 182 |
| 174 void addTextTrack(TextTrack*); | 183 void addTextTrack(TextTrack*); |
| 175 void removeTextTrack(TextTrack*); | 184 void removeTextTrack(TextTrack*); |
| 176 void closeCaptionTracksChanged(); | 185 void closeCaptionTracksChanged(); |
| 177 void notifyMediaPlayerOfTextTrackChanges(); | 186 void notifyMediaPlayerOfTextTrackChanges(); |
| 178 | 187 |
| 179 // 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. |
| 180 void forgetResourceSpecificTracks(); | 189 void forgetResourceSpecificTracks(); |
| 181 | 190 |
| 182 void didAddTrackElement(HTMLTrackElement*); | 191 void didAddTrackElement(HTMLTrackElement*); |
| 183 void didRemoveTrackElement(HTMLTrackElement*); | 192 void didRemoveTrackElement(HTMLTrackElement*); |
| 184 | 193 |
| 194 blink::WebMediaPlayer::TrackId addAudioTrack(const String& id, blink::WebMed iaPlayerClient::AudioTrackKind, const AtomicString& label, const AtomicString& l anguage, bool enabled); | |
| 195 void removeAudioTrack(blink::WebMediaPlayer::TrackId); | |
| 196 blink::WebMediaPlayer::TrackId addVideoTrack(const String& id, blink::WebMed iaPlayerClient::VideoTrackKind, const AtomicString& label, const AtomicString& l anguage, bool selected); | |
| 197 void removeVideoTrack(blink::WebMediaPlayer::TrackId); | |
| 198 | |
| 185 virtual void mediaPlayerDidAddTextTrack(blink::WebInbandTextTrack*) OVERRIDE FINAL; | 199 virtual void mediaPlayerDidAddTextTrack(blink::WebInbandTextTrack*) OVERRIDE FINAL; |
| 186 virtual void mediaPlayerDidRemoveTextTrack(blink::WebInbandTextTrack*) OVERR IDE FINAL; | 200 virtual void mediaPlayerDidRemoveTextTrack(blink::WebInbandTextTrack*) OVERR IDE FINAL; |
| 187 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d epend on it. | 201 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d epend on it. |
| 188 virtual KURL mediaPlayerPosterURL() OVERRIDE { return KURL(); } | 202 virtual KURL mediaPlayerPosterURL() OVERRIDE { return KURL(); } |
| 189 | 203 |
| 190 class TrackGroup { | 204 class TrackGroup { |
| 191 STACK_ALLOCATED(); | 205 STACK_ALLOCATED(); |
| 192 public: | 206 public: |
| 193 enum GroupKind { CaptionsAndSubtitles, Description, Chapter, Metadata, O ther }; | 207 enum GroupKind { CaptionsAndSubtitles, Description, Chapter, Metadata, O ther }; |
| 194 | 208 |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 413 | 427 |
| 414 const AtomicString& mediaGroup() const; | 428 const AtomicString& mediaGroup() const; |
| 415 void setMediaGroup(const AtomicString&); | 429 void setMediaGroup(const AtomicString&); |
| 416 void updateMediaController(); | 430 void updateMediaController(); |
| 417 bool isBlocked() const; | 431 bool isBlocked() const; |
| 418 bool isBlockedOnMediaController() const; | 432 bool isBlockedOnMediaController() const; |
| 419 bool isAutoplaying() const { return m_autoplaying; } | 433 bool isAutoplaying() const { return m_autoplaying; } |
| 420 | 434 |
| 421 blink::WebMediaPlayer::CORSMode corsMode() const; | 435 blink::WebMediaPlayer::CORSMode corsMode() const; |
| 422 | 436 |
| 437 // Creates placeholder AudioTrack and/or VideoTrack objects when WebMemediaP layer objects | |
| 438 // advertise they have audio and/or video, but don't explicity signal them v ia | |
|
acolwell GONE FROM CHROMIUM
2014/06/02 20:28:14
nit: s/explicity/explicitly/
philipj_slow
2014/06/11 10:03:48
Done.
| |
| 439 // mediaPlayerDidAddAudioTrack() and mediaPlayerDidAddVideoTrack(). | |
| 440 // FIXME: Remove this once all WebMediaPlayer implementations properly repor t their track info. | |
| 441 void createPlaceholderTracksIfNecessary(); | |
| 442 | |
| 443 // Sets the selected/enabled tracks if they aren't set before we initially | |
| 444 // transition to HAVE_METADATA. | |
| 445 void selectInitialTracksIfNecessary(); | |
| 446 | |
| 447 void audioTracksTimerFired(Timer<HTMLMediaElement>*); | |
| 448 | |
| 423 Timer<HTMLMediaElement> m_loadTimer; | 449 Timer<HTMLMediaElement> m_loadTimer; |
| 424 Timer<HTMLMediaElement> m_progressEventTimer; | 450 Timer<HTMLMediaElement> m_progressEventTimer; |
| 425 Timer<HTMLMediaElement> m_playbackProgressTimer; | 451 Timer<HTMLMediaElement> m_playbackProgressTimer; |
| 452 Timer<HTMLMediaElement> m_audioTracksTimer; | |
| 426 RefPtr<TimeRanges> m_playedTimeRanges; | 453 RefPtr<TimeRanges> m_playedTimeRanges; |
| 427 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 454 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
| 428 | 455 |
| 429 double m_playbackRate; | 456 double m_playbackRate; |
| 430 double m_defaultPlaybackRate; | 457 double m_defaultPlaybackRate; |
| 431 NetworkState m_networkState; | 458 NetworkState m_networkState; |
| 432 ReadyState m_readyState; | 459 ReadyState m_readyState; |
| 433 ReadyState m_readyStateMaximum; | 460 ReadyState m_readyStateMaximum; |
| 434 KURL m_currentSrc; | 461 KURL m_currentSrc; |
| 435 | 462 |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 497 | 524 |
| 498 bool m_completelyLoaded : 1; | 525 bool m_completelyLoaded : 1; |
| 499 bool m_havePreparedToPlay : 1; | 526 bool m_havePreparedToPlay : 1; |
| 500 bool m_delayingLoadForPreloadNone : 1; | 527 bool m_delayingLoadForPreloadNone : 1; |
| 501 | 528 |
| 502 bool m_tracksAreReady : 1; | 529 bool m_tracksAreReady : 1; |
| 503 bool m_haveVisibleTextTrack : 1; | 530 bool m_haveVisibleTextTrack : 1; |
| 504 bool m_processingPreferenceChange : 1; | 531 bool m_processingPreferenceChange : 1; |
| 505 double m_lastTextTrackUpdateTime; | 532 double m_lastTextTrackUpdateTime; |
| 506 | 533 |
| 534 RefPtrWillBeMember<AudioTrackList> m_audioTracks; | |
| 535 RefPtrWillBeMember<VideoTrackList> m_videoTracks; | |
| 507 RefPtrWillBeMember<TextTrackList> m_textTracks; | 536 RefPtrWillBeMember<TextTrackList> m_textTracks; |
| 508 WillBeHeapVector<RefPtrWillBeMember<TextTrack> > m_textTracksWhenResourceSel ectionBegan; | 537 WillBeHeapVector<RefPtrWillBeMember<TextTrack> > m_textTracksWhenResourceSel ectionBegan; |
| 509 | 538 |
| 510 CueIntervalTree m_cueTree; | 539 CueIntervalTree m_cueTree; |
| 511 | 540 |
| 512 CueList m_currentlyActiveCues; | 541 CueList m_currentlyActiveCues; |
| 513 int m_ignoreTrackDisplayUpdate; | 542 int m_ignoreTrackDisplayUpdate; |
| 514 | 543 |
| 515 #if ENABLE(WEB_AUDIO) | 544 #if ENABLE(WEB_AUDIO) |
| 516 // This is a weak reference, since m_audioSourceNode holds a reference to us . | 545 // This is a weak reference, since m_audioSourceNode holds a reference to us . |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 553 inline bool isHTMLMediaElement(const HTMLElement& element) | 582 inline bool isHTMLMediaElement(const HTMLElement& element) |
| 554 { | 583 { |
| 555 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 584 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 556 } | 585 } |
| 557 | 586 |
| 558 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 587 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 559 | 588 |
| 560 } //namespace | 589 } //namespace |
| 561 | 590 |
| 562 #endif | 591 #endif |
| OLD | NEW |