| 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 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 487 virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaP
layer*) const OVERRIDE; | 487 virtual GraphicsDeviceAdapter* mediaPlayerGraphicsDeviceAdapter(const MediaP
layer*) const OVERRIDE; |
| 488 #endif | 488 #endif |
| 489 | 489 |
| 490 void loadTimerFired(Timer<HTMLMediaElement>*); | 490 void loadTimerFired(Timer<HTMLMediaElement>*); |
| 491 void progressEventTimerFired(Timer<HTMLMediaElement>*); | 491 void progressEventTimerFired(Timer<HTMLMediaElement>*); |
| 492 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); | 492 void playbackProgressTimerFired(Timer<HTMLMediaElement>*); |
| 493 void startPlaybackProgressTimer(); | 493 void startPlaybackProgressTimer(); |
| 494 void startProgressEventTimer(); | 494 void startProgressEventTimer(); |
| 495 void stopPeriodicTimers(); | 495 void stopPeriodicTimers(); |
| 496 | 496 |
| 497 void seek(float time, ExceptionCode&); | 497 void seek(double time, ExceptionCode&); |
| 498 void finishSeek(); | 498 void finishSeek(); |
| 499 void checkIfSeekNeeded(); | 499 void checkIfSeekNeeded(); |
| 500 void addPlayedRange(float start, float end); | 500 void addPlayedRange(double start, double end); |
| 501 | 501 |
| 502 void scheduleTimeupdateEvent(bool periodicEvent); | 502 void scheduleTimeupdateEvent(bool periodicEvent); |
| 503 void scheduleEvent(const AtomicString& eventName); | 503 void scheduleEvent(const AtomicString& eventName); |
| 504 | 504 |
| 505 // loading | 505 // loading |
| 506 void selectMediaResource(); | 506 void selectMediaResource(); |
| 507 void loadResource(const KURL&, ContentType&, const String& keySystem); | 507 void loadResource(const KURL&, ContentType&, const String& keySystem); |
| 508 void scheduleNextSourceChild(); | 508 void scheduleNextSourceChild(); |
| 509 void loadNextSourceChild(); | 509 void loadNextSourceChild(); |
| 510 void userCancelledLoad(); | 510 void userCancelledLoad(); |
| 511 void clearMediaPlayer(int flags); | 511 void clearMediaPlayer(int flags); |
| 512 bool havePotentialSourceChild(); | 512 bool havePotentialSourceChild(); |
| 513 void noneSupported(); | 513 void noneSupported(); |
| 514 void mediaEngineError(PassRefPtr<MediaError> err); | 514 void mediaEngineError(PassRefPtr<MediaError> err); |
| 515 void cancelPendingEventsAndCallbacks(); | 515 void cancelPendingEventsAndCallbacks(); |
| 516 void waitForSourceChange(); | 516 void waitForSourceChange(); |
| 517 void prepareToPlay(); | 517 void prepareToPlay(); |
| 518 | 518 |
| 519 KURL selectNextSourceChild(ContentType*, String* keySystem, InvalidURLAction
); | 519 KURL selectNextSourceChild(ContentType*, String* keySystem, InvalidURLAction
); |
| 520 | 520 |
| 521 void mediaLoadingFailed(MediaPlayer::NetworkState); | 521 void mediaLoadingFailed(MediaPlayer::NetworkState); |
| 522 | 522 |
| 523 #if ENABLE(VIDEO_TRACK) | 523 #if ENABLE(VIDEO_TRACK) |
| 524 void updateActiveTextTrackCues(float); | 524 void updateActiveTextTrackCues(double); |
| 525 HTMLTrackElement* showingTrackWithSameKind(HTMLTrackElement*) const; | 525 HTMLTrackElement* showingTrackWithSameKind(HTMLTrackElement*) const; |
| 526 | 526 |
| 527 void markCaptionAndSubtitleTracksAsUnconfigured(); | 527 void markCaptionAndSubtitleTracksAsUnconfigured(); |
| 528 virtual void captionPreferencesChanged() OVERRIDE; | 528 virtual void captionPreferencesChanged() OVERRIDE; |
| 529 #endif | 529 #endif |
| 530 | 530 |
| 531 // These "internal" functions do not check user gesture restrictions. | 531 // These "internal" functions do not check user gesture restrictions. |
| 532 void loadInternal(); | 532 void loadInternal(); |
| 533 void playInternal(); | 533 void playInternal(); |
| 534 void pauseInternal(); | 534 void pauseInternal(); |
| 535 | 535 |
| 536 void prepareForLoad(); | 536 void prepareForLoad(); |
| 537 void allowVideoRendering(); | 537 void allowVideoRendering(); |
| 538 | 538 |
| 539 bool processingMediaPlayerCallback() const { return m_processingMediaPlayerC
allback > 0; } | 539 bool processingMediaPlayerCallback() const { return m_processingMediaPlayerC
allback > 0; } |
| 540 void beginProcessingMediaPlayerCallback() { ++m_processingMediaPlayerCallbac
k; } | 540 void beginProcessingMediaPlayerCallback() { ++m_processingMediaPlayerCallbac
k; } |
| 541 void endProcessingMediaPlayerCallback() { ASSERT(m_processingMediaPlayerCall
back); --m_processingMediaPlayerCallback; } | 541 void endProcessingMediaPlayerCallback() { ASSERT(m_processingMediaPlayerCall
back); --m_processingMediaPlayerCallback; } |
| 542 | 542 |
| 543 void updateVolume(); | 543 void updateVolume(); |
| 544 void updatePlayState(); | 544 void updatePlayState(); |
| 545 bool potentiallyPlaying() const; | 545 bool potentiallyPlaying() const; |
| 546 bool endedPlayback() const; | 546 bool endedPlayback() const; |
| 547 bool stoppedDueToErrors() const; | 547 bool stoppedDueToErrors() const; |
| 548 bool pausedForUserInteraction() const; | 548 bool pausedForUserInteraction() const; |
| 549 bool couldPlayIfEnoughData() const; | 549 bool couldPlayIfEnoughData() const; |
| 550 | 550 |
| 551 float minTimeSeekable() const; | 551 double minTimeSeekable() const; |
| 552 float maxTimeSeekable() const; | 552 double maxTimeSeekable() const; |
| 553 | 553 |
| 554 // Pauses playback without changing any states or generating events | 554 // Pauses playback without changing any states or generating events |
| 555 void setPausedInternal(bool); | 555 void setPausedInternal(bool); |
| 556 | 556 |
| 557 void setPlaybackRateInternal(float); | 557 void setPlaybackRateInternal(double); |
| 558 | 558 |
| 559 virtual void mediaCanStart(); | 559 virtual void mediaCanStart(); |
| 560 | 560 |
| 561 void setShouldDelayLoadEvent(bool); | 561 void setShouldDelayLoadEvent(bool); |
| 562 void invalidateCachedTime(); | 562 void invalidateCachedTime(); |
| 563 void refreshCachedTime() const; | 563 void refreshCachedTime() const; |
| 564 | 564 |
| 565 bool hasMediaControls() const; | 565 bool hasMediaControls() const; |
| 566 bool createMediaControls(); | 566 bool createMediaControls(); |
| 567 void configureMediaControls(); | 567 void configureMediaControls(); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 591 void updateDisableSleep(); | 591 void updateDisableSleep(); |
| 592 bool shouldDisableSleep() const; | 592 bool shouldDisableSleep() const; |
| 593 #endif | 593 #endif |
| 594 | 594 |
| 595 Timer<HTMLMediaElement> m_loadTimer; | 595 Timer<HTMLMediaElement> m_loadTimer; |
| 596 Timer<HTMLMediaElement> m_progressEventTimer; | 596 Timer<HTMLMediaElement> m_progressEventTimer; |
| 597 Timer<HTMLMediaElement> m_playbackProgressTimer; | 597 Timer<HTMLMediaElement> m_playbackProgressTimer; |
| 598 RefPtr<TimeRanges> m_playedTimeRanges; | 598 RefPtr<TimeRanges> m_playedTimeRanges; |
| 599 OwnPtr<GenericEventQueue> m_asyncEventQueue; | 599 OwnPtr<GenericEventQueue> m_asyncEventQueue; |
| 600 | 600 |
| 601 float m_playbackRate; | 601 double m_playbackRate; |
| 602 float m_defaultPlaybackRate; | 602 double m_defaultPlaybackRate; |
| 603 bool m_webkitPreservesPitch; | 603 bool m_webkitPreservesPitch; |
| 604 NetworkState m_networkState; | 604 NetworkState m_networkState; |
| 605 ReadyState m_readyState; | 605 ReadyState m_readyState; |
| 606 ReadyState m_readyStateMaximum; | 606 ReadyState m_readyStateMaximum; |
| 607 KURL m_currentSrc; | 607 KURL m_currentSrc; |
| 608 | 608 |
| 609 RefPtr<MediaError> m_error; | 609 RefPtr<MediaError> m_error; |
| 610 | 610 |
| 611 float m_volume; | 611 double m_volume; |
| 612 float m_lastSeekTime; | 612 double m_lastSeekTime; |
| 613 | 613 |
| 614 unsigned m_previousProgress; | 614 unsigned m_previousProgress; |
| 615 double m_previousProgressTime; | 615 double m_previousProgressTime; |
| 616 | 616 |
| 617 // The last time a timeupdate event was sent (wall clock). | 617 // The last time a timeupdate event was sent (wall clock). |
| 618 double m_lastTimeUpdateEventWallTime; | 618 double m_lastTimeUpdateEventWallTime; |
| 619 | 619 |
| 620 // The last time a timeupdate event was sent in movie time. | 620 // The last time a timeupdate event was sent in movie time. |
| 621 float m_lastTimeUpdateEventMovieTime; | 621 double m_lastTimeUpdateEventMovieTime; |
| 622 | 622 |
| 623 // Loading state. | 623 // Loading state. |
| 624 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElem
ent }; | 624 enum LoadState { WaitingForSource, LoadingFromSrcAttr, LoadingFromSourceElem
ent }; |
| 625 LoadState m_loadState; | 625 LoadState m_loadState; |
| 626 RefPtr<HTMLSourceElement> m_currentSourceNode; | 626 RefPtr<HTMLSourceElement> m_currentSourceNode; |
| 627 RefPtr<Node> m_nextChildNodeToConsider; | 627 RefPtr<Node> m_nextChildNodeToConsider; |
| 628 | 628 |
| 629 OwnPtr<MediaPlayer> m_player; | 629 OwnPtr<MediaPlayer> m_player; |
| 630 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) | 630 #if ENABLE(PLUGIN_PROXY_FOR_VIDEO) |
| 631 RefPtr<Widget> m_proxyWidget; | 631 RefPtr<Widget> m_proxyWidget; |
| 632 #endif | 632 #endif |
| 633 | 633 |
| 634 BehaviorRestrictions m_restrictions; | 634 BehaviorRestrictions m_restrictions; |
| 635 | 635 |
| 636 MediaPlayer::Preload m_preload; | 636 MediaPlayer::Preload m_preload; |
| 637 | 637 |
| 638 DisplayMode m_displayMode; | 638 DisplayMode m_displayMode; |
| 639 | 639 |
| 640 // Counter incremented while processing a callback from the media player, so
we can avoid | 640 // Counter incremented while processing a callback from the media player, so
we can avoid |
| 641 // calling the media engine recursively. | 641 // calling the media engine recursively. |
| 642 int m_processingMediaPlayerCallback; | 642 int m_processingMediaPlayerCallback; |
| 643 | 643 |
| 644 RefPtr<MediaSource> m_mediaSource; | 644 RefPtr<MediaSource> m_mediaSource; |
| 645 | 645 |
| 646 mutable float m_cachedTime; | 646 mutable double m_cachedTime; |
| 647 mutable double m_cachedTimeWallClockUpdateTime; | 647 mutable double m_cachedTimeWallClockUpdateTime; |
| 648 mutable double m_minimumWallClockTimeToCacheMediaTime; | 648 mutable double m_minimumWallClockTimeToCacheMediaTime; |
| 649 | 649 |
| 650 double m_fragmentStartTime; | 650 double m_fragmentStartTime; |
| 651 double m_fragmentEndTime; | 651 double m_fragmentEndTime; |
| 652 | 652 |
| 653 typedef unsigned PendingActionFlags; | 653 typedef unsigned PendingActionFlags; |
| 654 PendingActionFlags m_pendingActionFlags; | 654 PendingActionFlags m_pendingActionFlags; |
| 655 | 655 |
| 656 bool m_playing : 1; | 656 bool m_playing : 1; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 685 bool m_dispatchingCanPlayEvent : 1; | 685 bool m_dispatchingCanPlayEvent : 1; |
| 686 bool m_loadInitiatedByUserGesture : 1; | 686 bool m_loadInitiatedByUserGesture : 1; |
| 687 bool m_completelyLoaded : 1; | 687 bool m_completelyLoaded : 1; |
| 688 bool m_havePreparedToPlay : 1; | 688 bool m_havePreparedToPlay : 1; |
| 689 bool m_parsingInProgress : 1; | 689 bool m_parsingInProgress : 1; |
| 690 | 690 |
| 691 #if ENABLE(VIDEO_TRACK) | 691 #if ENABLE(VIDEO_TRACK) |
| 692 bool m_tracksAreReady : 1; | 692 bool m_tracksAreReady : 1; |
| 693 bool m_haveVisibleTextTrack : 1; | 693 bool m_haveVisibleTextTrack : 1; |
| 694 bool m_processingPreferenceChange : 1; | 694 bool m_processingPreferenceChange : 1; |
| 695 float m_lastTextTrackUpdateTime; | 695 double m_lastTextTrackUpdateTime; |
| 696 | 696 |
| 697 RefPtr<TextTrackList> m_textTracks; | 697 RefPtr<TextTrackList> m_textTracks; |
| 698 Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan; | 698 Vector<RefPtr<TextTrack> > m_textTracksWhenResourceSelectionBegan; |
| 699 | 699 |
| 700 CueIntervalTree m_cueTree; | 700 CueIntervalTree m_cueTree; |
| 701 | 701 |
| 702 CueList m_currentlyActiveCues; | 702 CueList m_currentlyActiveCues; |
| 703 int m_ignoreTrackDisplayUpdate; | 703 int m_ignoreTrackDisplayUpdate; |
| 704 #endif | 704 #endif |
| 705 | 705 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 inline HTMLMediaElement* toMediaElement(Node* node) | 758 inline HTMLMediaElement* toMediaElement(Node* node) |
| 759 { | 759 { |
| 760 ASSERT_WITH_SECURITY_IMPLICATION(!node || isMediaElement(node)); | 760 ASSERT_WITH_SECURITY_IMPLICATION(!node || isMediaElement(node)); |
| 761 return static_cast<HTMLMediaElement*>(node); | 761 return static_cast<HTMLMediaElement*>(node); |
| 762 } | 762 } |
| 763 | 763 |
| 764 } //namespace | 764 } //namespace |
| 765 | 765 |
| 766 #endif | 766 #endif |
| 767 #endif | 767 #endif |
| OLD | NEW |