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::WebTrackId*); | |
acolwell GONE FROM CHROMIUM
2014/05/16 19:47:56
nit: Docs please. I initially thought you had a po
| |
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::WebTrackId addAudioTrack(const String& id, blink::WebMediaPlayerClien t::AudioTrackKind, const AtomicString& label, const AtomicString& language, bool enabled); | |
195 void removeAudioTrack(blink::WebTrackId); | |
196 blink::WebTrackId addVideoTrack(const String& id, blink::WebMediaPlayerClien t::VideoTrackKind, const AtomicString& label, const AtomicString& language, bool selected); | |
197 void removeVideoTrack(blink::WebTrackId); | |
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 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
412 | 426 |
413 const AtomicString& mediaGroup() const; | 427 const AtomicString& mediaGroup() const; |
414 void setMediaGroup(const AtomicString&); | 428 void setMediaGroup(const AtomicString&); |
415 void updateMediaController(); | 429 void updateMediaController(); |
416 bool isBlocked() const; | 430 bool isBlocked() const; |
417 bool isBlockedOnMediaController() const; | 431 bool isBlockedOnMediaController() const; |
418 bool isAutoplaying() const { return m_autoplaying; } | 432 bool isAutoplaying() const { return m_autoplaying; } |
419 | 433 |
420 blink::WebMediaPlayer::CORSMode corsMode() const; | 434 blink::WebMediaPlayer::CORSMode corsMode() const; |
421 | 435 |
436 // Creates placeholder AudioTrack and/or VideoTrack objects when WebMemediaP layer objects | |
437 // advertise they have audio and/or video, but don't explicity signal them v ia | |
438 // mediaPlayerDidAddAudioTrack() and mediaPlayerDidAddVideoTrack(). | |
439 // FIXME: Remove this once all WebMediaPlayer implementations properly repor t their track info. | |
440 void createPlaceholderTracksIfNecessary(); | |
441 | |
442 // Sets the selected/enabled tracks if they aren't set before we initially | |
443 // transition to HAVE_METADATA. | |
444 void selectInitialTracksIfNecessary(); | |
445 | |
446 void audioTracksTimerFired(Timer<HTMLMediaElement>*); | |
447 | |
422 Timer<HTMLMediaElement> m_loadTimer; | 448 Timer<HTMLMediaElement> m_loadTimer; |
423 Timer<HTMLMediaElement> m_progressEventTimer; | 449 Timer<HTMLMediaElement> m_progressEventTimer; |
424 Timer<HTMLMediaElement> m_playbackProgressTimer; | 450 Timer<HTMLMediaElement> m_playbackProgressTimer; |
451 Timer<HTMLMediaElement> m_audioTracksTimer; | |
425 RefPtr<TimeRanges> m_playedTimeRanges; | 452 RefPtr<TimeRanges> m_playedTimeRanges; |
426 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 453 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
427 | 454 |
428 double m_playbackRate; | 455 double m_playbackRate; |
429 double m_defaultPlaybackRate; | 456 double m_defaultPlaybackRate; |
430 NetworkState m_networkState; | 457 NetworkState m_networkState; |
431 ReadyState m_readyState; | 458 ReadyState m_readyState; |
432 ReadyState m_readyStateMaximum; | 459 ReadyState m_readyStateMaximum; |
433 KURL m_currentSrc; | 460 KURL m_currentSrc; |
434 | 461 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
496 | 523 |
497 bool m_completelyLoaded : 1; | 524 bool m_completelyLoaded : 1; |
498 bool m_havePreparedToPlay : 1; | 525 bool m_havePreparedToPlay : 1; |
499 bool m_delayingLoadForPreloadNone : 1; | 526 bool m_delayingLoadForPreloadNone : 1; |
500 | 527 |
501 bool m_tracksAreReady : 1; | 528 bool m_tracksAreReady : 1; |
502 bool m_haveVisibleTextTrack : 1; | 529 bool m_haveVisibleTextTrack : 1; |
503 bool m_processingPreferenceChange : 1; | 530 bool m_processingPreferenceChange : 1; |
504 double m_lastTextTrackUpdateTime; | 531 double m_lastTextTrackUpdateTime; |
505 | 532 |
533 RefPtr<AudioTrackList> m_audioTracks; | |
534 RefPtr<VideoTrackList> m_videoTracks; | |
506 RefPtrWillBeMember<TextTrackList> m_textTracks; | 535 RefPtrWillBeMember<TextTrackList> m_textTracks; |
507 WillBeHeapVector<RefPtrWillBeMember<TextTrack> > m_textTracksWhenResourceSel ectionBegan; | 536 WillBeHeapVector<RefPtrWillBeMember<TextTrack> > m_textTracksWhenResourceSel ectionBegan; |
508 | 537 |
509 CueIntervalTree m_cueTree; | 538 CueIntervalTree m_cueTree; |
510 | 539 |
511 CueList m_currentlyActiveCues; | 540 CueList m_currentlyActiveCues; |
512 int m_ignoreTrackDisplayUpdate; | 541 int m_ignoreTrackDisplayUpdate; |
513 | 542 |
514 #if ENABLE(WEB_AUDIO) | 543 #if ENABLE(WEB_AUDIO) |
515 // This is a weak reference, since m_audioSourceNode holds a reference to us . | 544 // 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... | |
552 inline bool isHTMLMediaElement(const HTMLElement& element) | 581 inline bool isHTMLMediaElement(const HTMLElement& element) |
553 { | 582 { |
554 return isHTMLAudioElement(element) || isHTMLVideoElement(element); | 583 return isHTMLAudioElement(element) || isHTMLVideoElement(element); |
555 } | 584 } |
556 | 585 |
557 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 586 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
558 | 587 |
559 } //namespace | 588 } //namespace |
560 | 589 |
561 #endif | 590 #endif |
OLD | NEW |