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 23 matching lines...) Expand all Loading... |
34 #include "core/html/track/TextTrackCue.h" | 34 #include "core/html/track/TextTrackCue.h" |
35 #include "core/html/track/vtt/VTTCue.h" | 35 #include "core/html/track/vtt/VTTCue.h" |
36 #include "platform/PODIntervalTree.h" | 36 #include "platform/PODIntervalTree.h" |
37 #include "platform/graphics/media/MediaPlayer.h" | 37 #include "platform/graphics/media/MediaPlayer.h" |
38 #include "public/platform/WebMimeRegistry.h" | 38 #include "public/platform/WebMimeRegistry.h" |
39 | 39 |
40 namespace blink { | 40 namespace blink { |
41 class WebContentDecryptionModule; | 41 class WebContentDecryptionModule; |
42 class WebInbandTextTrack; | 42 class WebInbandTextTrack; |
43 class WebLayer; | 43 class WebLayer; |
| 44 class WebMediaPlayer; |
44 } | 45 } |
45 | 46 |
46 namespace WebCore { | 47 namespace WebCore { |
47 | 48 |
48 #if ENABLE(WEB_AUDIO) | 49 #if ENABLE(WEB_AUDIO) |
49 class AudioSourceProvider; | 50 class AudioSourceProvider; |
50 class MediaElementAudioSourceNode; | 51 class MediaElementAudioSourceNode; |
51 #endif | 52 #endif |
| 53 class AudioTrackList; |
52 class ContentType; | 54 class ContentType; |
53 class Event; | 55 class Event; |
54 class ExceptionState; | 56 class ExceptionState; |
55 class HTMLSourceElement; | 57 class HTMLSourceElement; |
56 class HTMLTrackElement; | 58 class HTMLTrackElement; |
57 class KURL; | 59 class KURL; |
58 class MediaController; | 60 class MediaController; |
59 class MediaControls; | 61 class MediaControls; |
60 class MediaError; | 62 class MediaError; |
61 class MediaKeys; | 63 class MediaKeys; |
62 class HTMLMediaSource; | 64 class HTMLMediaSource; |
63 class TextTrackList; | 65 class TextTrackList; |
64 class TimeRanges; | 66 class TimeRanges; |
65 class URLRegistry; | 67 class URLRegistry; |
| 68 class VideoTrackList; |
66 | 69 |
67 typedef PODIntervalTree<double, TextTrackCue*> CueIntervalTree; | 70 typedef PODIntervalTree<double, TextTrackCue*> CueIntervalTree; |
68 typedef CueIntervalTree::IntervalType CueInterval; | 71 typedef CueIntervalTree::IntervalType CueInterval; |
69 typedef Vector<CueInterval> CueList; | 72 typedef Vector<CueInterval> CueList; |
70 | 73 |
71 // FIXME: The inheritance from MediaPlayerClient here should be private inherita
nce. | 74 // FIXME: The inheritance from MediaPlayerClient here should be private inherita
nce. |
72 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so
it | 75 // But it can't be until the Chromium WebMediaPlayerClientImpl class is fixed so
it |
73 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. | 76 // no longer depends on typecasting a MediaPlayerClient to an HTMLMediaElement. |
74 | 77 |
75 class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, public Ac
tiveDOMObject, public MediaControllerInterface | 78 class HTMLMediaElement : public HTMLElement, public MediaPlayerClient, public Ac
tiveDOMObject, public MediaControllerInterface |
76 , private TextTrackClient | 79 , private TextTrackClient |
77 { | 80 { |
78 public: | 81 public: |
79 static blink::WebMimeRegistry::SupportsType supportsType(const ContentType&,
const String& keySystem = String()); | 82 static blink::WebMimeRegistry::SupportsType supportsType(const ContentType&,
const String& keySystem = String()); |
80 | 83 |
81 static void setMediaStreamRegistry(URLRegistry*); | 84 static void setMediaStreamRegistry(URLRegistry*); |
82 static bool isMediaStreamURL(const String& url); | 85 static bool isMediaStreamURL(const String& url); |
83 | 86 |
84 MediaPlayer* player() const { return m_player.get(); } | 87 MediaPlayer* player() const { return m_player.get(); } |
| 88 blink::WebMediaPlayer* webMediaPlayer() const { return m_player ? m_player->
webMediaPlayer() : 0; } |
85 | 89 |
86 virtual bool isVideo() const = 0; | 90 virtual bool isVideo() const = 0; |
87 virtual bool hasVideo() const OVERRIDE { return false; } | 91 virtual bool hasVideo() const OVERRIDE { return false; } |
88 virtual bool hasAudio() const OVERRIDE FINAL; | 92 virtual bool hasAudio() const OVERRIDE FINAL; |
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 { |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 virtual double volume() const OVERRIDE FINAL; | 176 virtual double volume() const OVERRIDE FINAL; |
173 virtual void setVolume(double, ExceptionState&) OVERRIDE FINAL; | 177 virtual void setVolume(double, ExceptionState&) OVERRIDE FINAL; |
174 virtual bool muted() const OVERRIDE FINAL; | 178 virtual bool muted() const OVERRIDE FINAL; |
175 virtual void setMuted(bool) OVERRIDE FINAL; | 179 virtual void setMuted(bool) OVERRIDE FINAL; |
176 | 180 |
177 virtual void beginScrubbing() OVERRIDE FINAL; | 181 virtual void beginScrubbing() OVERRIDE FINAL; |
178 virtual void endScrubbing() OVERRIDE FINAL; | 182 virtual void endScrubbing() OVERRIDE FINAL; |
179 | 183 |
180 virtual bool canPlay() const OVERRIDE FINAL; | 184 virtual bool canPlay() const OVERRIDE FINAL; |
181 | 185 |
| 186 AudioTrackList* audioTracks(); |
| 187 void didEnabledAudioTrackChange(const AtomicString& audioTrackID, bool enabl
ed); |
| 188 |
| 189 VideoTrackList* videoTracks(); |
| 190 void didSelectedVideoTrackChange(const AtomicString& unselectedTrackID, cons
t AtomicString& selectedTrackID); |
| 191 |
182 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, const AtomicStr
ing& label, const AtomicString& language, ExceptionState&); | 192 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, const AtomicStr
ing& label, const AtomicString& language, ExceptionState&); |
183 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, const AtomicStr
ing& label, ExceptionState& exceptionState) { return addTextTrack(kind, label, e
mptyAtom, exceptionState); } | 193 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, const AtomicStr
ing& label, ExceptionState& exceptionState) { return addTextTrack(kind, label, e
mptyAtom, exceptionState); } |
184 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, ExceptionState&
exceptionState) { return addTextTrack(kind, emptyAtom, emptyAtom, exceptionStat
e); } | 194 PassRefPtr<TextTrack> addTextTrack(const AtomicString& kind, ExceptionState&
exceptionState) { return addTextTrack(kind, emptyAtom, emptyAtom, exceptionStat
e); } |
185 | 195 |
186 TextTrackList* textTracks(); | 196 TextTrackList* textTracks(); |
187 CueList currentlyActiveCues() const { return m_currentlyActiveCues; } | 197 CueList currentlyActiveCues() const { return m_currentlyActiveCues; } |
188 | 198 |
189 void addTrack(TextTrack*); | 199 void addTextTrack(TextTrack*); |
190 void removeTrack(TextTrack*); | 200 void removeTextTrack(TextTrack*, bool fireRemoveTrackEvent); |
191 void removeAllInbandTracks(); | 201 void forgetResourceSpecificTracks(); |
192 void closeCaptionTracksChanged(); | 202 void closeCaptionTracksChanged(); |
193 void notifyMediaPlayerOfTextTrackChanges(); | 203 void notifyMediaPlayerOfTextTrackChanges(); |
194 | 204 |
195 void didAddTrack(HTMLTrackElement*); | 205 void didAddTrack(HTMLTrackElement*); |
196 void didRemoveTrack(HTMLTrackElement*); | 206 void didRemoveTrack(HTMLTrackElement*); |
197 | 207 |
198 virtual void mediaPlayerDidAddTrack(blink::WebInbandTextTrack*) OVERRIDE FIN
AL; | 208 virtual void mediaPlayerDidAddVideoTrack(const AtomicString& id, const Atomi
cString& kind, const AtomicString& label, const AtomicString& language, bool sel
ected) OVERRIDE FINAL; |
199 virtual void mediaPlayerDidRemoveTrack(blink::WebInbandTextTrack*) OVERRIDE
FINAL; | 209 virtual void mediaPlayerDidRemoveVideoTrack(const AtomicString& id) OVERRIDE
FINAL; |
| 210 virtual void mediaPlayerDidAddAudioTrack(const AtomicString& id, const Atomi
cString& kind, const AtomicString& label, const AtomicString& language, bool ena
bled) OVERRIDE FINAL; |
| 211 virtual void mediaPlayerDidRemoveAudioTrack(const AtomicString& id) OVERRIDE
FINAL; |
| 212 virtual void mediaPlayerDidAddTextTrack(blink::WebInbandTextTrack*) OVERRIDE
FINAL; |
| 213 virtual void mediaPlayerDidRemoveTextTrack(blink::WebInbandTextTrack*) OVERR
IDE FINAL; |
200 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d
epend on it. | 214 // FIXME: Remove this when WebMediaPlayerClientImpl::loadInternal does not d
epend on it. |
201 virtual KURL mediaPlayerPosterURL() OVERRIDE { return KURL(); } | 215 virtual KURL mediaPlayerPosterURL() OVERRIDE { return KURL(); } |
202 | 216 |
203 struct TrackGroup { | 217 struct TrackGroup { |
204 enum GroupKind { CaptionsAndSubtitles, Description, Chapter, Metadata, O
ther }; | 218 enum GroupKind { CaptionsAndSubtitles, Description, Chapter, Metadata, O
ther }; |
205 | 219 |
206 TrackGroup(GroupKind kind) | 220 TrackGroup(GroupKind kind) |
207 : visibleTrack(nullptr) | 221 : visibleTrack(nullptr) |
208 , defaultTrack(nullptr) | 222 , defaultTrack(nullptr) |
209 , kind(kind) | 223 , kind(kind) |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/24
9976. | 468 // FIXME: Remove EmeMode once EME v0.1b support is removed. See crbug.com/24
9976. |
455 enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed }; | 469 enum EmeMode { EmeModeNotSelected, EmeModePrefixed, EmeModeUnprefixed }; |
456 | 470 |
457 // check (and set if necessary) the encrypted media extensions (EME) mode | 471 // check (and set if necessary) the encrypted media extensions (EME) mode |
458 // (v0.1b or WD). Returns whether the mode is allowed and successfully set. | 472 // (v0.1b or WD). Returns whether the mode is allowed and successfully set. |
459 bool setEmeMode(EmeMode, ExceptionState&); | 473 bool setEmeMode(EmeMode, ExceptionState&); |
460 | 474 |
461 blink::WebContentDecryptionModule* contentDecryptionModule(); | 475 blink::WebContentDecryptionModule* contentDecryptionModule(); |
462 void setMediaKeysInternal(MediaKeys*); | 476 void setMediaKeysInternal(MediaKeys*); |
463 | 477 |
| 478 // Creates placeholder AudioTrack and/or VideoTrack objects when WebMemediaP
layer objects |
| 479 // advertise they have audio and/or video, but don't explicity signal them v
ia |
| 480 // mediaPlayerDidAddAudioTrack() and mediaPlayerDidAddVideoTrack(). |
| 481 // FIXME: Remove this once all WebMediaPlayer implementations properly repor
t their track info. |
| 482 void createPlaceholderTracksIfNecessary(); |
| 483 |
| 484 // Sets the selected/enabled tracks if they aren't set before we initially |
| 485 // transition to HAVE_METADATA. |
| 486 void selectInitialTracksIfNecessary(); |
| 487 |
464 Timer<HTMLMediaElement> m_loadTimer; | 488 Timer<HTMLMediaElement> m_loadTimer; |
465 Timer<HTMLMediaElement> m_progressEventTimer; | 489 Timer<HTMLMediaElement> m_progressEventTimer; |
466 Timer<HTMLMediaElement> m_playbackProgressTimer; | 490 Timer<HTMLMediaElement> m_playbackProgressTimer; |
467 RefPtr<TimeRanges> m_playedTimeRanges; | 491 RefPtr<TimeRanges> m_playedTimeRanges; |
468 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 492 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
469 | 493 |
470 double m_playbackRate; | 494 double m_playbackRate; |
471 double m_defaultPlaybackRate; | 495 double m_defaultPlaybackRate; |
472 NetworkState m_networkState; | 496 NetworkState m_networkState; |
473 ReadyState m_readyState; | 497 ReadyState m_readyState; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
539 bool m_closedCaptionsVisible : 1; | 563 bool m_closedCaptionsVisible : 1; |
540 | 564 |
541 bool m_completelyLoaded : 1; | 565 bool m_completelyLoaded : 1; |
542 bool m_havePreparedToPlay : 1; | 566 bool m_havePreparedToPlay : 1; |
543 | 567 |
544 bool m_tracksAreReady : 1; | 568 bool m_tracksAreReady : 1; |
545 bool m_haveVisibleTextTrack : 1; | 569 bool m_haveVisibleTextTrack : 1; |
546 bool m_processingPreferenceChange : 1; | 570 bool m_processingPreferenceChange : 1; |
547 double m_lastTextTrackUpdateTime; | 571 double m_lastTextTrackUpdateTime; |
548 | 572 |
| 573 RefPtr<AudioTrackList> m_audioTracks; |
| 574 RefPtr<VideoTrackList> m_videoTracks; |
549 RefPtr<TextTrackList> m_textTracks; | 575 RefPtr<TextTrackList> m_textTracks; |
550 Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan; | 576 Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan; |
551 | 577 |
552 CueIntervalTree m_cueTree; | 578 CueIntervalTree m_cueTree; |
553 | 579 |
554 CueList m_currentlyActiveCues; | 580 CueList m_currentlyActiveCues; |
555 int m_ignoreTrackDisplayUpdate; | 581 int m_ignoreTrackDisplayUpdate; |
556 | 582 |
557 #if ENABLE(WEB_AUDIO) | 583 #if ENABLE(WEB_AUDIO) |
558 // This is a weak reference, since m_audioSourceNode holds a reference to us
. | 584 // 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... |
595 inline bool isHTMLMediaElement(const Node& node) | 621 inline bool isHTMLMediaElement(const Node& node) |
596 { | 622 { |
597 return node.isElementNode() && toElement(node).isMediaElement(); | 623 return node.isElementNode() && toElement(node).isMediaElement(); |
598 } | 624 } |
599 | 625 |
600 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); | 626 DEFINE_NODE_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); |
601 | 627 |
602 } //namespace | 628 } //namespace |
603 | 629 |
604 #endif | 630 #endif |
OLD | NEW |