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 31 matching lines...) Loading... |
42 class WebInbandTextTrack; | 42 class WebInbandTextTrack; |
43 class WebLayer; | 43 class WebLayer; |
44 } | 44 } |
45 | 45 |
46 namespace WebCore { | 46 namespace WebCore { |
47 | 47 |
48 #if ENABLE(WEB_AUDIO) | 48 #if ENABLE(WEB_AUDIO) |
49 class AudioSourceProvider; | 49 class AudioSourceProvider; |
50 class MediaElementAudioSourceNode; | 50 class MediaElementAudioSourceNode; |
51 #endif | 51 #endif |
| 52 class AudioTrackList; |
52 class ContentType; | 53 class ContentType; |
53 class Event; | 54 class Event; |
54 class ExceptionState; | 55 class ExceptionState; |
55 class HTMLSourceElement; | 56 class HTMLSourceElement; |
56 class HTMLTrackElement; | 57 class HTMLTrackElement; |
57 class KURL; | 58 class KURL; |
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 TextTrackList; | 63 class TextTrackList; |
63 class TimeRanges; | 64 class TimeRanges; |
64 class URLRegistry; | 65 class URLRegistry; |
| 66 class VideoTrackList; |
65 | 67 |
66 typedef PODIntervalTree<double, TextTrackCue*> CueIntervalTree; | 68 typedef PODIntervalTree<double, TextTrackCue*> CueIntervalTree; |
67 typedef CueIntervalTree::IntervalType CueInterval; | 69 typedef CueIntervalTree::IntervalType CueInterval; |
68 typedef Vector<CueInterval> CueList; | 70 typedef Vector<CueInterval> CueList; |
69 | 71 |
70 // FIXME: The inheritance from MediaPlayerClient here should be private inherita
nce. | 72 // FIXME: The inheritance from MediaPlayerClient here should be private inherita
nce. |
71 // 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 |
72 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. | 74 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. |
73 | 75 |
74 class HTMLMediaElement : public Supplementable<HTMLMediaElement>, public HTMLEle
ment, public MediaPlayerClient, public ActiveDOMObject, public MediaControllerIn
terface | 76 class HTMLMediaElement : public Supplementable<HTMLMediaElement>, public HTMLEle
ment, public MediaPlayerClient, public ActiveDOMObject, public MediaControllerIn
terface |
(...skipping 77 matching lines...) Loading... |
152 // controls | 154 // controls |
153 bool controls() const; | 155 bool controls() const; |
154 void setControls(bool); | 156 void setControls(bool); |
155 virtual double volume() const OVERRIDE FINAL; | 157 virtual double volume() const OVERRIDE FINAL; |
156 virtual void setVolume(double, ExceptionState&) OVERRIDE FINAL; | 158 virtual void setVolume(double, ExceptionState&) OVERRIDE FINAL; |
157 virtual bool muted() const OVERRIDE FINAL; | 159 virtual bool muted() const OVERRIDE FINAL; |
158 virtual void setMuted(bool) OVERRIDE FINAL; | 160 virtual void setMuted(bool) OVERRIDE FINAL; |
159 | 161 |
160 virtual bool canPlay() const OVERRIDE FINAL; | 162 virtual bool canPlay() const OVERRIDE FINAL; |
161 | 163 |
| 164 |
162 void togglePlayState(); | 165 void togglePlayState(); |
163 | 166 |
| 167 AudioTrackList& audioTracks(); |
| 168 void audioTrackChanged(const String& audioTrackID); |
| 169 |
| 170 VideoTrackList& videoTracks(); |
| 171 void selectedVideoTrackChanged(const String& selectedTrackID); |
| 172 |
164 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, const AtomicStr
ing& label, const AtomicString& language, ExceptionState&); | 173 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, const AtomicStr
ing& label, const AtomicString& language, ExceptionState&); |
165 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, const AtomicStr
ing& label, ExceptionState& exceptionState) { return addTextTrack(kind, label, e
mptyAtom, exceptionState); } | 174 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, const AtomicStr
ing& label, ExceptionState& exceptionState) { return addTextTrack(kind, label, e
mptyAtom, exceptionState); } |
166 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, ExceptionState&
exceptionState) { return addTextTrack(kind, emptyAtom, emptyAtom, exceptionStat
e); } | 175 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, ExceptionState&
exceptionState) { return addTextTrack(kind, emptyAtom, emptyAtom, exceptionStat
e); } |
167 | 176 |
168 TextTrackList* textTracks(); | 177 TextTrackList* textTracks(); |
169 CueList currentlyActiveCues() const { return m_currentlyActiveCues; } | 178 CueList currentlyActiveCues() const { return m_currentlyActiveCues; } |
170 | 179 |
171 void addTextTrack(TextTrack*); | 180 void addTextTrack(TextTrack*); |
172 void removeTextTrack(TextTrack*); | 181 void removeTextTrack(TextTrack*); |
173 void closeCaptionTracksChanged(); | 182 void closeCaptionTracksChanged(); |
174 void notifyMediaPlayerOfTextTrackChanges(); | 183 void notifyMediaPlayerOfTextTrackChanges(); |
175 | 184 |
176 // Implements the "forget the media element's media-resource-specific tracks
" algorithm in the HTML5 spec. | 185 // Implements the "forget the media element's media-resource-specific tracks
" algorithm in the HTML5 spec. |
177 void forgetResourceSpecificTracks(); | 186 void forgetResourceSpecificTracks(); |
178 | 187 |
179 void didAddTrackElement(HTMLTrackElement*); | 188 void didAddTrackElement(HTMLTrackElement*); |
180 void didRemoveTrackElement(HTMLTrackElement*); | 189 void didRemoveTrackElement(HTMLTrackElement*); |
181 | 190 |
| 191 void addVideoTrack(const String& id, blink::WebMediaPlayerClient::VideoTrack
Kind, const AtomicString& label, const AtomicString& language, bool selected); |
| 192 void removeVideoTrack(const String& id); |
| 193 void addAudioTrack(const String& id, blink::WebMediaPlayerClient::AudioTrack
Kind, const AtomicString& label, const AtomicString& language, bool enabled); |
| 194 void removeAudioTrack(const String& id); |
| 195 |
182 virtual void mediaPlayerDidAddTextTrack(blink::WebInbandTextTrack*) OVERRIDE
FINAL; | 196 virtual void mediaPlayerDidAddTextTrack(blink::WebInbandTextTrack*) OVERRIDE
FINAL; |
183 virtual void mediaPlayerDidRemoveTextTrack(blink::WebInbandTextTrack*) OVERR
IDE FINAL; | 197 virtual void mediaPlayerDidRemoveTextTrack(blink::WebInbandTextTrack*) OVERR
IDE FINAL; |
184 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d
epend on it. | 198 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d
epend on it. |
185 virtual KURL mediaPlayerPosterURL() OVERRIDE { return KURL(); } | 199 virtual KURL mediaPlayerPosterURL() OVERRIDE { return KURL(); } |
186 | 200 |
187 struct TrackGroup { | 201 struct TrackGroup { |
188 enum GroupKind { CaptionsAndSubtitles, Description, Chapter, Metadata, O
ther }; | 202 enum GroupKind { CaptionsAndSubtitles, Description, Chapter, Metadata, O
ther }; |
189 | 203 |
190 TrackGroup(GroupKind kind) | 204 TrackGroup(GroupKind kind) |
191 : visibleTrack(nullptr) | 205 : visibleTrack(nullptr) |
(...skipping 218 matching lines...) Loading... |
410 | 424 |
411 const AtomicString& mediaGroup() const; | 425 const AtomicString& mediaGroup() const; |
412 void setMediaGroup(const AtomicString&); | 426 void setMediaGroup(const AtomicString&); |
413 void updateMediaController(); | 427 void updateMediaController(); |
414 bool isBlocked() const; | 428 bool isBlocked() const; |
415 bool isBlockedOnMediaController() const; | 429 bool isBlockedOnMediaController() const; |
416 bool isAutoplaying() const { return m_autoplaying; } | 430 bool isAutoplaying() const { return m_autoplaying; } |
417 | 431 |
418 blink::WebMediaPlayer::CORSMode corsMode() const; | 432 blink::WebMediaPlayer::CORSMode corsMode() const; |
419 | 433 |
| 434 // Creates placeholder AudioTrack and/or VideoTrack objects when WebMemediaP
layer objects |
| 435 // advertise they have audio and/or video, but don't explicity signal them v
ia |
| 436 // mediaPlayerDidAddAudioTrack() and mediaPlayerDidAddVideoTrack(). |
| 437 // FIXME: Remove this once all WebMediaPlayer implementations properly repor
t their track info. |
| 438 void createPlaceholderTracksIfNecessary(); |
| 439 |
| 440 // Sets the selected/enabled tracks if they aren't set before we initially |
| 441 // transition to HAVE_METADATA. |
| 442 void selectInitialTracksIfNecessary(); |
| 443 |
| 444 void audioTracksTimerFired(Timer<HTMLMediaElement>*); |
| 445 |
420 Timer<HTMLMediaElement> m_loadTimer; | 446 Timer<HTMLMediaElement> m_loadTimer; |
421 Timer<HTMLMediaElement> m_progressEventTimer; | 447 Timer<HTMLMediaElement> m_progressEventTimer; |
422 Timer<HTMLMediaElement> m_playbackProgressTimer; | 448 Timer<HTMLMediaElement> m_playbackProgressTimer; |
| 449 Timer<HTMLMediaElement> m_audioTracksTimer; |
423 RefPtr<TimeRanges> m_playedTimeRanges; | 450 RefPtr<TimeRanges> m_playedTimeRanges; |
424 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 451 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
425 | 452 |
426 double m_playbackRate; | 453 double m_playbackRate; |
427 double m_defaultPlaybackRate; | 454 double m_defaultPlaybackRate; |
428 NetworkState m_networkState; | 455 NetworkState m_networkState; |
429 ReadyState m_readyState; | 456 ReadyState m_readyState; |
430 ReadyState m_readyStateMaximum; | 457 ReadyState m_readyStateMaximum; |
431 KURL m_currentSrc; | 458 KURL m_currentSrc; |
432 | 459 |
(...skipping 62 matching lines...) Loading... |
495 | 522 |
496 bool m_completelyLoaded : 1; | 523 bool m_completelyLoaded : 1; |
497 bool m_havePreparedToPlay : 1; | 524 bool m_havePreparedToPlay : 1; |
498 bool m_delayingLoadForPreloadNone : 1; | 525 bool m_delayingLoadForPreloadNone : 1; |
499 | 526 |
500 bool m_tracksAreReady : 1; | 527 bool m_tracksAreReady : 1; |
501 bool m_haveVisibleTextTrack : 1; | 528 bool m_haveVisibleTextTrack : 1; |
502 bool m_processingPreferenceChange : 1; | 529 bool m_processingPreferenceChange : 1; |
503 double m_lastTextTrackUpdateTime; | 530 double m_lastTextTrackUpdateTime; |
504 | 531 |
| 532 RefPtr<AudioTrackList> m_audioTracks; |
| 533 RefPtr<VideoTrackList> m_videoTracks; |
505 RefPtr<TextTrackList> m_textTracks; | 534 RefPtr<TextTrackList> m_textTracks; |
506 Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan; | 535 Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan; |
507 | 536 |
508 CueIntervalTree m_cueTree; | 537 CueIntervalTree m_cueTree; |
509 | 538 |
510 CueList m_currentlyActiveCues; | 539 CueList m_currentlyActiveCues; |
511 int m_ignoreTrackDisplayUpdate; | 540 int m_ignoreTrackDisplayUpdate; |
512 | 541 |
513 #if ENABLE(WEB_AUDIO) | 542 #if ENABLE(WEB_AUDIO) |
514 // This is a weak reference, since m_audioSourceNode holds a reference to us
. | 543 // This is a weak reference, since m_audioSourceNode holds a reference to us
. |
(...skipping 38 matching lines...) 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 |