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 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 416 | 430 |
| 417 const AtomicString& mediaGroup() const; | 431 const AtomicString& mediaGroup() const; |
| 418 void setMediaGroup(const AtomicString&); | 432 void setMediaGroup(const AtomicString&); |
| 419 void updateMediaController(); | 433 void updateMediaController(); |
| 420 bool isBlocked() const; | 434 bool isBlocked() const; |
| 421 bool isBlockedOnMediaController() const; | 435 bool isBlockedOnMediaController() const; |
| 422 bool isAutoplaying() const { return m_autoplaying; } | 436 bool isAutoplaying() const { return m_autoplaying; } |
| 423 | 437 |
| 424 blink::WebMediaPlayer::CORSMode corsMode() const; | 438 blink::WebMediaPlayer::CORSMode corsMode() const; |
| 425 | 439 |
| 440 // Creates placeholder AudioTrack and/or VideoTrack objects when WebMemediaP layer objects | |
| 441 // advertise they have audio and/or video, but don't explicitly signal them via | |
| 442 // mediaPlayerDidAddAudioTrack() and mediaPlayerDidAddVideoTrack(). | |
|
acolwell GONE FROM CHROMIUM
2014/06/11 19:01:04
nit: s/mediaPlayerDidA/a/
philipj_slow
2014/06/12 12:08:24
Done.
| |
| 443 // FIXME: Remove this once all WebMediaPlayer implementations properly repor t their track info. | |
| 444 void createPlaceholderTracksIfNecessary(); | |
| 445 | |
| 446 // Sets the selected/enabled tracks if they aren't set before we initially | |
| 447 // transition to HAVE_METADATA. | |
| 448 void selectInitialTracksIfNecessary(); | |
| 449 | |
| 450 void audioTracksTimerFired(Timer<HTMLMediaElement>*); | |
| 451 | |
| 426 Timer<HTMLMediaElement> m_loadTimer; | 452 Timer<HTMLMediaElement> m_loadTimer; |
| 427 Timer<HTMLMediaElement> m_progressEventTimer; | 453 Timer<HTMLMediaElement> m_progressEventTimer; |
| 428 Timer<HTMLMediaElement> m_playbackProgressTimer; | 454 Timer<HTMLMediaElement> m_playbackProgressTimer; |
| 455 Timer<HTMLMediaElement> m_audioTracksTimer; | |
| 429 RefPtr<TimeRanges> m_playedTimeRanges; | 456 RefPtr<TimeRanges> m_playedTimeRanges; |
| 430 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 457 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
| 431 | 458 |
| 432 double m_playbackRate; | 459 double m_playbackRate; |
| 433 double m_defaultPlaybackRate; | 460 double m_defaultPlaybackRate; |
| 434 NetworkState m_networkState; | 461 NetworkState m_networkState; |
| 435 ReadyState m_readyState; | 462 ReadyState m_readyState; |
| 436 ReadyState m_readyStateMaximum; | 463 ReadyState m_readyStateMaximum; |
| 437 KURL m_currentSrc; | 464 KURL m_currentSrc; |
| 438 | 465 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 503 bool m_delayingLoadForPreloadNone : 1; | 530 bool m_delayingLoadForPreloadNone : 1; |
| 504 | 531 |
| 505 bool m_tracksAreReady : 1; | 532 bool m_tracksAreReady : 1; |
| 506 bool m_haveVisibleTextTrack : 1; | 533 bool m_haveVisibleTextTrack : 1; |
| 507 bool m_processingPreferenceChange : 1; | 534 bool m_processingPreferenceChange : 1; |
| 508 #if ENABLE(OILPAN) | 535 #if ENABLE(OILPAN) |
| 509 bool m_isFinalizing : 1; | 536 bool m_isFinalizing : 1; |
| 510 #endif | 537 #endif |
| 511 double m_lastTextTrackUpdateTime; | 538 double m_lastTextTrackUpdateTime; |
| 512 | 539 |
| 540 RefPtrWillBeMember<AudioTrackList> m_audioTracks; | |
| 541 RefPtrWillBeMember<VideoTrackList> m_videoTracks; | |
| 513 RefPtrWillBeMember<TextTrackList> m_textTracks; | 542 RefPtrWillBeMember<TextTrackList> m_textTracks; |
| 514 WillBeHeapVector<RefPtrWillBeMember<TextTrack> > m_textTracksWhenResourceSel ectionBegan; | 543 WillBeHeapVector<RefPtrWillBeMember<TextTrack> > m_textTracksWhenResourceSel ectionBegan; |
| 515 | 544 |
| 516 CueIntervalTree m_cueTree; | 545 CueIntervalTree m_cueTree; |
| 517 | 546 |
| 518 CueList m_currentlyActiveCues; | 547 CueList m_currentlyActiveCues; |
| 519 int m_ignoreTrackDisplayUpdate; | 548 int m_ignoreTrackDisplayUpdate; |
| 520 | 549 |
| 521 #if ENABLE(WEB_AUDIO) | 550 #if ENABLE(WEB_AUDIO) |
| 522 // This is a weak reference, since m_audioSourceNode holds a reference to us . | 551 // 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... | |
| 559 inline bool isHTMLMediaElement(const HTMLElement& element) | 588 inline bool isHTMLMediaElement(const HTMLElement& element) |
| 560 { | 589 { |
| 561 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 590 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
| 562 } | 591 } |
| 563 | 592 |
| 564 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 593 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
| 565 | 594 |
| 566 } //namespace | 595 } //namespace |
| 567 | 596 |
| 568 #endif | 597 #endif |
| OLD | NEW |