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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 , public PlatformTextTrackMenuClient | 89 , public PlatformTextTrackMenuClient |
90 #endif | 90 #endif |
91 { | 91 { |
92 public: | 92 public: |
93 MediaPlayer* player() const { return m_player.get(); } | 93 MediaPlayer* player() const { return m_player.get(); } |
94 | 94 |
95 virtual bool isVideo() const = 0; | 95 virtual bool isVideo() const = 0; |
96 virtual bool hasVideo() const { return false; } | 96 virtual bool hasVideo() const { return false; } |
97 virtual bool hasAudio() const; | 97 virtual bool hasAudio() const; |
98 | 98 |
99 void rewind(float timeDelta); | 99 void rewind(double timeDelta); |
100 void returnToRealtime(); | 100 void returnToRealtime(); |
101 | 101 |
102 // Eventually overloaded in HTMLVideoElement | 102 // Eventually overloaded in HTMLVideoElement |
103 virtual bool supportsFullscreen() const { return false; }; | 103 virtual bool supportsFullscreen() const { return false; }; |
104 | 104 |
105 virtual bool supportsSave() const; | 105 virtual bool supportsSave() const; |
106 virtual bool supportsScanning() const; | 106 virtual bool supportsScanning() const; |
107 | 107 |
108 PlatformMedia platformMedia() const; | 108 PlatformMedia platformMedia() const; |
109 #if USE(ACCELERATED_COMPOSITING) | 109 #if USE(ACCELERATED_COMPOSITING) |
(...skipping 27 matching lines...) Expand all Loading... |
137 | 137 |
138 PassRefPtr<TimeRanges> buffered() const; | 138 PassRefPtr<TimeRanges> buffered() const; |
139 void load(); | 139 void load(); |
140 String canPlayType(const String& mimeType, const String& keySystem = String(
), const KURL& = KURL()) const; | 140 String canPlayType(const String& mimeType, const String& keySystem = String(
), const KURL& = KURL()) const; |
141 | 141 |
142 // ready state | 142 // ready state |
143 ReadyState readyState() const; | 143 ReadyState readyState() const; |
144 bool seeking() const; | 144 bool seeking() const; |
145 | 145 |
146 // playback state | 146 // playback state |
147 float currentTime() const; | 147 double currentTime() const; |
148 void setCurrentTime(float, ExceptionCode&); | 148 void setCurrentTime(double, ExceptionCode&); |
149 double initialTime() const; | 149 double initialTime() const; |
150 float startTime() const; | 150 double startTime() const; |
151 float duration() const; | 151 double duration() const; |
152 bool paused() const; | 152 bool paused() const; |
153 float defaultPlaybackRate() const; | 153 double defaultPlaybackRate() const; |
154 void setDefaultPlaybackRate(float); | 154 void setDefaultPlaybackRate(double); |
155 float playbackRate() const; | 155 double playbackRate() const; |
156 void setPlaybackRate(float); | 156 void setPlaybackRate(double); |
157 void updatePlaybackRate(); | 157 void updatePlaybackRate(); |
158 bool webkitPreservesPitch() const; | 158 bool webkitPreservesPitch() const; |
159 void setWebkitPreservesPitch(bool); | 159 void setWebkitPreservesPitch(bool); |
160 PassRefPtr<TimeRanges> played(); | 160 PassRefPtr<TimeRanges> played(); |
161 PassRefPtr<TimeRanges> seekable() const; | 161 PassRefPtr<TimeRanges> seekable() const; |
162 bool ended() const; | 162 bool ended() const; |
163 bool autoplay() const; | 163 bool autoplay() const; |
164 void setAutoplay(bool b); | 164 void setAutoplay(bool b); |
165 bool loop() const; | 165 bool loop() const; |
166 void setLoop(bool b); | 166 void setLoop(bool b); |
(...skipping 30 matching lines...) Expand all Loading... |
197 #endif | 197 #endif |
198 | 198 |
199 #if ENABLE(ENCRYPTED_MEDIA_V2) | 199 #if ENABLE(ENCRYPTED_MEDIA_V2) |
200 MediaKeys* mediaKeys() const { return m_mediaKeys.get(); } | 200 MediaKeys* mediaKeys() const { return m_mediaKeys.get(); } |
201 void setMediaKeys(MediaKeys*); | 201 void setMediaKeys(MediaKeys*); |
202 #endif | 202 #endif |
203 | 203 |
204 // controls | 204 // controls |
205 bool controls() const; | 205 bool controls() const; |
206 void setControls(bool); | 206 void setControls(bool); |
207 float volume() const; | 207 double volume() const; |
208 void setVolume(float, ExceptionCode&); | 208 void setVolume(double, ExceptionCode&); |
209 bool muted() const; | 209 bool muted() const; |
210 void setMuted(bool); | 210 void setMuted(bool); |
211 | 211 |
212 void togglePlayState(); | 212 void togglePlayState(); |
213 void beginScrubbing(); | 213 void beginScrubbing(); |
214 void endScrubbing(); | 214 void endScrubbing(); |
215 | 215 |
216 bool canPlay() const; | 216 bool canPlay() const; |
217 | 217 |
218 float percentLoaded() const; | 218 double percentLoaded() const; |
219 | 219 |
220 #if ENABLE(VIDEO_TRACK) | 220 #if ENABLE(VIDEO_TRACK) |
221 PassRefPtr<TextTrack> addTextTrack(const String& kind, const String& label,
const String& language, ExceptionCode&); | 221 PassRefPtr<TextTrack> addTextTrack(const String& kind, const String& label,
const String& language, ExceptionCode&); |
222 PassRefPtr<TextTrack> addTextTrack(const String& kind, const String& label,
ExceptionCode& ec) { return addTextTrack(kind, label, emptyString(), ec); } | 222 PassRefPtr<TextTrack> addTextTrack(const String& kind, const String& label,
ExceptionCode& ec) { return addTextTrack(kind, label, emptyString(), ec); } |
223 PassRefPtr<TextTrack> addTextTrack(const String& kind, ExceptionCode& ec) {
return addTextTrack(kind, emptyString(), emptyString(), ec); } | 223 PassRefPtr<TextTrack> addTextTrack(const String& kind, ExceptionCode& ec) {
return addTextTrack(kind, emptyString(), emptyString(), ec); } |
224 | 224 |
225 TextTrackList* textTracks(); | 225 TextTrackList* textTracks(); |
226 CueList currentlyActiveCues() const { return m_currentlyActiveCues; } | 226 CueList currentlyActiveCues() const { return m_currentlyActiveCues; } |
227 | 227 |
228 void addTrack(TextTrack*); | 228 void addTrack(TextTrack*); |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 virtual IntRect mediaPlayerWindowClipRect() OVERRIDE; | 483 virtual IntRect mediaPlayerWindowClipRect() OVERRIDE; |
484 virtual CachedResourceLoader* mediaPlayerCachedResourceLoader() OVERRIDE; | 484 virtual CachedResourceLoader* mediaPlayerCachedResourceLoader() OVERRIDE; |
485 | 485 |
486 void loadTimerFired(Timer<HTMLMediaElement>*); | 486 void loadTimerFired(Timer<HTMLMediaElement>*); |
487 void progressEventTimerFired(Timer<HTMLMediaElement>*); | 487 void progressEventTimerFired(Timer<HTMLMediaElement>*); |
488 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); | 488 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); |
489 void startPlaybackProgressTimer(); | 489 void startPlaybackProgressTimer(); |
490 void startProgressEventTimer(); | 490 void startProgressEventTimer(); |
491 void stopPeriodicTimers(); | 491 void stopPeriodicTimers(); |
492 | 492 |
493 void seek(float time, ExceptionCode&); | 493 void seek(double time, ExceptionCode&); |
494 void finishSeek(); | 494 void finishSeek(); |
495 void checkIfSeekNeeded(); | 495 void checkIfSeekNeeded(); |
496 void addPlayedRange(float start, float end); | 496 void addPlayedRange(double start, double end); |
497 | 497 |
498 void scheduleTimeupdateEvent(bool periodicEvent); | 498 void scheduleTimeupdateEvent(bool periodicEvent); |
499 void scheduleEvent(const AtomicString& eventName); | 499 void scheduleEvent(const AtomicString& eventName); |
500 | 500 |
501 // loading | 501 // loading |
502 void selectMediaResource(); | 502 void selectMediaResource(); |
503 void loadResource(const KURL&, ContentType&, const String& keySystem); | 503 void loadResource(const KURL&, ContentType&, const String& keySystem); |
504 void scheduleNextSourceChild(); | 504 void scheduleNextSourceChild(); |
505 void loadNextSourceChild(); | 505 void loadNextSourceChild(); |
506 void userCancelledLoad(); | 506 void userCancelledLoad(); |
507 void clearMediaPlayer(int flags); | 507 void clearMediaPlayer(int flags); |
508 bool havePotentialSourceChild(); | 508 bool havePotentialSourceChild(); |
509 void noneSupported(); | 509 void noneSupported(); |
510 void mediaEngineError(PassRefPtr<MediaError> err); | 510 void mediaEngineError(PassRefPtr<MediaError> err); |
511 void cancelPendingEventsAndCallbacks(); | 511 void cancelPendingEventsAndCallbacks(); |
512 void waitForSourceChange(); | 512 void waitForSourceChange(); |
513 void prepareToPlay(); | 513 void prepareToPlay(); |
514 | 514 |
515 KURL selectNextSourceChild(ContentType*, String* keySystem, InvalidURLAction
); | 515 KURL selectNextSourceChild(ContentType*, String* keySystem, InvalidURLAction
); |
516 | 516 |
517 void mediaLoadingFailed(MediaPlayer::NetworkState); | 517 void mediaLoadingFailed(MediaPlayer::NetworkState); |
518 | 518 |
519 #if ENABLE(VIDEO_TRACK) | 519 #if ENABLE(VIDEO_TRACK) |
520 void updateActiveTextTrackCues(float); | 520 void updateActiveTextTrackCues(double); |
521 HTMLTrackElement* showingTrackWithSameKind(HTMLTrackElement*) const; | 521 HTMLTrackElement* showingTrackWithSameKind(HTMLTrackElement*) const; |
522 | 522 |
523 void markCaptionAndSubtitleTracksAsUnconfigured(); | 523 void markCaptionAndSubtitleTracksAsUnconfigured(); |
524 virtual void captionPreferencesChanged() OVERRIDE; | 524 virtual void captionPreferencesChanged() OVERRIDE; |
525 #endif | 525 #endif |
526 | 526 |
527 // These "internal" functions do not check user gesture restrictions. | 527 // These "internal" functions do not check user gesture restrictions. |
528 void loadInternal(); | 528 void loadInternal(); |
529 void playInternal(); | 529 void playInternal(); |
530 void pauseInternal(); | 530 void pauseInternal(); |
531 | 531 |
532 void prepareForLoad(); | 532 void prepareForLoad(); |
533 void allowVideoRendering(); | 533 void allowVideoRendering(); |
534 | 534 |
535 bool processingMediaPlayerCallback() const { return m_processingMediaPlayerC
allback > 0; } | 535 bool processingMediaPlayerCallback() const { return m_processingMediaPlayerC
allback > 0; } |
536 void beginProcessingMediaPlayerCallback() { ++m_processingMediaPlayerCallbac
k; } | 536 void beginProcessingMediaPlayerCallback() { ++m_processingMediaPlayerCallbac
k; } |
537 void endProcessingMediaPlayerCallback() { ASSERT(m_processingMediaPlayerCall
back); --m_processingMediaPlayerCallback; } | 537 void endProcessingMediaPlayerCallback() { ASSERT(m_processingMediaPlayerCall
back); --m_processingMediaPlayerCallback; } |
538 | 538 |
539 void updateVolume(); | 539 void updateVolume(); |
540 void updatePlayState(); | 540 void updatePlayState(); |
541 bool potentiallyPlaying() const; | 541 bool potentiallyPlaying() const; |
542 bool endedPlayback() const; | 542 bool endedPlayback() const; |
543 bool stoppedDueToErrors() const; | 543 bool stoppedDueToErrors() const; |
544 bool pausedForUserInteraction() const; | 544 bool pausedForUserInteraction() const; |
545 bool couldPlayIfEnoughData() const; | 545 bool couldPlayIfEnoughData() const; |
546 | 546 |
547 float minTimeSeekable() const; | 547 double minTimeSeekable() const; |
548 float maxTimeSeekable() const; | 548 double maxTimeSeekable() const; |
549 | 549 |
550 // Pauses playback without changing any states or generating events | 550 // Pauses playback without changing any states or generating events |
551 void setPausedInternal(bool); | 551 void setPausedInternal(bool); |
552 | 552 |
553 void setPlaybackRateInternal(float); | 553 void setPlaybackRateInternal(double); |
554 | 554 |
555 virtual void mediaCanStart(); | 555 virtual void mediaCanStart(); |
556 | 556 |
557 void setShouldDelayLoadEvent(bool); | 557 void setShouldDelayLoadEvent(bool); |
558 void invalidateCachedTime(); | 558 void invalidateCachedTime(); |
559 void refreshCachedTime() const; | 559 void refreshCachedTime() const; |
560 | 560 |
561 bool hasMediaControls() const; | 561 bool hasMediaControls() const; |
562 bool createMediaControls(); | 562 bool createMediaControls(); |
563 void configureMediaControls(); | 563 void configureMediaControls(); |
(...skipping 23 matching lines...) Expand all Loading... |
587 void updateDisableSleep(); | 587 void updateDisableSleep(); |
588 bool shouldDisableSleep() const; | 588 bool shouldDisableSleep() const; |
589 #endif | 589 #endif |
590 | 590 |
591 Timer<HTMLMediaElement> m_loadTimer; | 591 Timer<HTMLMediaElement> m_loadTimer; |
592 Timer<HTMLMediaElement> m_progressEventTimer; | 592 Timer<HTMLMediaElement> m_progressEventTimer; |
593 Timer<HTMLMediaElement> m_playbackProgressTimer; | 593 Timer<HTMLMediaElement> m_playbackProgressTimer; |
594 RefPtr<TimeRanges> m_playedTimeRanges; | 594 RefPtr<TimeRanges> m_playedTimeRanges; |
595 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 595 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
596 | 596 |
597 float m_playbackRate; | 597 double m_playbackRate; |
598 float m_defaultPlaybackRate; | 598 double m_defaultPlaybackRate; |
599 bool m_webkitPreservesPitch; | 599 bool m_webkitPreservesPitch; |
600 NetworkState m_networkState; | 600 NetworkState m_networkState; |
601 ReadyState m_readyState; | 601 ReadyState m_readyState; |
602 ReadyState m_readyStateMaximum; | 602 ReadyState m_readyStateMaximum; |
603 KURL m_currentSrc; | 603 KURL m_currentSrc; |
604 | 604 |
605 RefPtr<MediaError> m_error; | 605 RefPtr<MediaError> m_error; |
606 | 606 |
607 float m_volume; | 607 double m_volume; |
608 float m_lastSeekTime; | 608 double m_lastSeekTime; |
609 | 609 |
610 unsigned m_previousProgress; | 610 unsigned m_previousProgress; |
611 double m_previousProgressTime; | 611 double m_previousProgressTime; |
612 | 612 |
613 // The last time a timeupdate event was sent (wall clock). | 613 // The last time a timeupdate event was sent (wall clock). |
614 double m_lastTimeUpdateEventWallTime; | 614 double m_lastTimeUpdateEventWallTime; |
615 | 615 |
616 // The last time a timeupdate event was sent in movie time. | 616 // The last time a timeupdate event was sent in movie time. |
617 float m_lastTimeUpdateEventMovieTime; | 617 double m_lastTimeUpdateEventMovieTime; |
618 | 618 |
619 // Loading state. | 619 // Loading state. |
620 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElem
ent }; | 620 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElem
ent }; |
621 LoadState m_loadState; | 621 LoadState m_loadState; |
622 RefPtr<HTMLSourceElement> m_currentSourceNode; | 622 RefPtr<HTMLSourceElement> m_currentSourceNode; |
623 RefPtr<Node> m_nextChildNodeToConsider; | 623 RefPtr<Node> m_nextChildNodeToConsider; |
624 | 624 |
625 OwnPtr<MediaPlayer> m_player; | 625 OwnPtr<MediaPlayer> m_player; |
626 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) | 626 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) |
627 RefPtr<Widget> m_proxyWidget; | 627 RefPtr<Widget> m_proxyWidget; |
628 #endif | 628 #endif |
629 | 629 |
630 BehaviorRestrictions m_restrictions; | 630 BehaviorRestrictions m_restrictions; |
631 | 631 |
632 MediaPlayer::Preload m_preload; | 632 MediaPlayer::Preload m_preload; |
633 | 633 |
634 DisplayMode m_displayMode; | 634 DisplayMode m_displayMode; |
635 | 635 |
636 // Counter incremented while processing a callback from the media player, so
we can avoid | 636 // Counter incremented while processing a callback from the media player, so
we can avoid |
637 // calling the media engine recursively. | 637 // calling the media engine recursively. |
638 int m_processingMediaPlayerCallback; | 638 int m_processingMediaPlayerCallback; |
639 | 639 |
640 RefPtr<MediaSource> m_mediaSource; | 640 RefPtr<MediaSource> m_mediaSource; |
641 | 641 |
642 mutable float m_cachedTime; | 642 mutable double m_cachedTime; |
643 mutable double m_cachedTimeWallClockUpdateTime; | 643 mutable double m_cachedTimeWallClockUpdateTime; |
644 mutable double m_minimumWallClockTimeToCacheMediaTime; | 644 mutable double m_minimumWallClockTimeToCacheMediaTime; |
645 | 645 |
646 double m_fragmentStartTime; | 646 double m_fragmentStartTime; |
647 double m_fragmentEndTime; | 647 double m_fragmentEndTime; |
648 | 648 |
649 typedef unsigned PendingActionFlags; | 649 typedef unsigned PendingActionFlags; |
650 PendingActionFlags m_pendingActionFlags; | 650 PendingActionFlags m_pendingActionFlags; |
651 | 651 |
652 bool m_playing : 1; | 652 bool m_playing : 1; |
(...skipping 28 matching lines...) Expand all Loading... |
681 bool m_dispatchingCanPlayEvent : 1; | 681 bool m_dispatchingCanPlayEvent : 1; |
682 bool m_loadInitiatedByUserGesture : 1; | 682 bool m_loadInitiatedByUserGesture : 1; |
683 bool m_completelyLoaded : 1; | 683 bool m_completelyLoaded : 1; |
684 bool m_havePreparedToPlay : 1; | 684 bool m_havePreparedToPlay : 1; |
685 bool m_parsingInProgress : 1; | 685 bool m_parsingInProgress : 1; |
686 | 686 |
687 #if ENABLE(VIDEO_TRACK) | 687 #if ENABLE(VIDEO_TRACK) |
688 bool m_tracksAreReady : 1; | 688 bool m_tracksAreReady : 1; |
689 bool m_haveVisibleTextTrack : 1; | 689 bool m_haveVisibleTextTrack : 1; |
690 bool m_processingPreferenceChange : 1; | 690 bool m_processingPreferenceChange : 1; |
691 float m_lastTextTrackUpdateTime; | 691 double m_lastTextTrackUpdateTime; |
692 | 692 |
693 RefPtr<TextTrackList> m_textTracks; | 693 RefPtr<TextTrackList> m_textTracks; |
694 Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan; | 694 Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan; |
695 | 695 |
696 CueIntervalTree m_cueTree; | 696 CueIntervalTree m_cueTree; |
697 | 697 |
698 CueList m_currentlyActiveCues; | 698 CueList m_currentlyActiveCues; |
699 int m_ignoreTrackDisplayUpdate; | 699 int m_ignoreTrackDisplayUpdate; |
700 #endif | 700 #endif |
701 | 701 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
754 inline HTMLMediaElement* toMediaElement(Node* node) | 754 inline HTMLMediaElement* toMediaElement(Node* node) |
755 { | 755 { |
756 ASSERT_WITH_SECURITY_IMPLICATION(!node || isMediaElement(node)); | 756 ASSERT_WITH_SECURITY_IMPLICATION(!node || isMediaElement(node)); |
757 return static_cast<HTMLMediaElement*>(node); | 757 return static_cast<HTMLMediaElement*>(node); |
758 } | 758 } |
759 | 759 |
760 } //namespace | 760 } //namespace |
761 | 761 |
762 #endif | 762 #endif |
763 #endif | 763 #endif |
OLD | NEW |