| 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 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 646 if (m_pendingActionFlags & LoadMediaResource) { | 646 if (m_pendingActionFlags & LoadMediaResource) { |
| 647 if (m_loadState == LoadingFromSourceElement) | 647 if (m_loadState == LoadingFromSourceElement) |
| 648 loadNextSourceChild(); | 648 loadNextSourceChild(); |
| 649 else | 649 else |
| 650 loadInternal(); | 650 loadInternal(); |
| 651 } | 651 } |
| 652 | 652 |
| 653 m_pendingActionFlags = 0; | 653 m_pendingActionFlags = 0; |
| 654 } | 654 } |
| 655 | 655 |
| 656 PassRefPtrWillBeRawPtr<MediaError> HTMLMediaElement::error() const | 656 MediaError* HTMLMediaElement::error() const |
| 657 { | 657 { |
| 658 return m_error; | 658 return m_error; |
| 659 } | 659 } |
| 660 | 660 |
| 661 void HTMLMediaElement::setSrc(const AtomicString& url) | 661 void HTMLMediaElement::setSrc(const AtomicString& url) |
| 662 { | 662 { |
| 663 setAttribute(srcAttr, url); | 663 setAttribute(srcAttr, url); |
| 664 } | 664 } |
| 665 | 665 |
| 666 HTMLMediaElement::NetworkState HTMLMediaElement::networkState() const | 666 HTMLMediaElement::NetworkState HTMLMediaElement::networkState() const |
| (...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1279 | 1279 |
| 1280 // 9 - Abort these steps. Until the load() method is invoked or the src attr
ibute is changed, | 1280 // 9 - Abort these steps. Until the load() method is invoked or the src attr
ibute is changed, |
| 1281 // the element won't attempt to load another resource. | 1281 // the element won't attempt to load another resource. |
| 1282 | 1282 |
| 1283 updateDisplayState(); | 1283 updateDisplayState(); |
| 1284 | 1284 |
| 1285 if (layoutObject()) | 1285 if (layoutObject()) |
| 1286 layoutObject()->updateFromElement(); | 1286 layoutObject()->updateFromElement(); |
| 1287 } | 1287 } |
| 1288 | 1288 |
| 1289 void HTMLMediaElement::mediaEngineError(PassRefPtrWillBeRawPtr<MediaError> err) | 1289 void HTMLMediaElement::mediaEngineError(MediaError* err) |
| 1290 { | 1290 { |
| 1291 ASSERT(m_readyState >= HAVE_METADATA); | 1291 ASSERT(m_readyState >= HAVE_METADATA); |
| 1292 WTF_LOG(Media, "HTMLMediaElement::mediaEngineError(%p, %d)", this, static_ca
st<int>(err->code())); | 1292 WTF_LOG(Media, "HTMLMediaElement::mediaEngineError(%p, %d)", this, static_ca
st<int>(err->code())); |
| 1293 | 1293 |
| 1294 // 1 - The user agent should cancel the fetching process. | 1294 // 1 - The user agent should cancel the fetching process. |
| 1295 stopPeriodicTimers(); | 1295 stopPeriodicTimers(); |
| 1296 m_loadState = WaitingForSource; | 1296 m_loadState = WaitingForSource; |
| 1297 | 1297 |
| 1298 // 2 - Set the error attribute to a new MediaError object whose code attribu
te is | 1298 // 2 - Set the error attribute to a new MediaError object whose code attribu
te is |
| 1299 // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE. | 1299 // set to MEDIA_ERR_NETWORK/MEDIA_ERR_DECODE. |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1665 double mediaTime = webMediaPlayer()->mediaTimeForTimeValue(time); | 1665 double mediaTime = webMediaPlayer()->mediaTimeForTimeValue(time); |
| 1666 if (time != mediaTime) { | 1666 if (time != mediaTime) { |
| 1667 WTF_LOG(Media, "HTMLMediaElement::seek(%p, %f) - media timeline equivale
nt is %f", this, time, mediaTime); | 1667 WTF_LOG(Media, "HTMLMediaElement::seek(%p, %f) - media timeline equivale
nt is %f", this, time, mediaTime); |
| 1668 time = mediaTime; | 1668 time = mediaTime; |
| 1669 } | 1669 } |
| 1670 | 1670 |
| 1671 // 8 - If the (possibly now changed) new playback position is not in one of
the ranges given in the | 1671 // 8 - If the (possibly now changed) new playback position is not in one of
the ranges given in the |
| 1672 // seekable attribute, then let it be the position in one of the ranges give
n in the seekable attribute | 1672 // seekable attribute, then let it be the position in one of the ranges give
n in the seekable attribute |
| 1673 // that is the nearest to the new playback position. ... If there are no ran
ges given in the seekable | 1673 // that is the nearest to the new playback position. ... If there are no ran
ges given in the seekable |
| 1674 // attribute then set the seeking IDL attribute to false and abort these ste
ps. | 1674 // attribute then set the seeking IDL attribute to false and abort these ste
ps. |
| 1675 RefPtrWillBeRawPtr<TimeRanges> seekableRanges = seekable(); | 1675 TimeRanges* seekableRanges = seekable(); |
| 1676 | 1676 |
| 1677 if (!seekableRanges->length()) { | 1677 if (!seekableRanges->length()) { |
| 1678 m_seeking = false; | 1678 m_seeking = false; |
| 1679 return; | 1679 return; |
| 1680 } | 1680 } |
| 1681 time = seekableRanges->nearest(time, now); | 1681 time = seekableRanges->nearest(time, now); |
| 1682 | 1682 |
| 1683 if (m_playing && m_lastSeekTime < now) | 1683 if (m_playing && m_lastSeekTime < now) |
| 1684 addPlayedRange(m_lastSeekTime, now); | 1684 addPlayedRange(m_lastSeekTime, now); |
| 1685 | 1685 |
| (...skipping 1172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2858 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerSizeChanged(%p)", this); | 2858 WTF_LOG(Media, "HTMLMediaElement::mediaPlayerSizeChanged(%p)", this); |
| 2859 | 2859 |
| 2860 ASSERT(hasVideo()); // "resize" makes no sense absent video. | 2860 ASSERT(hasVideo()); // "resize" makes no sense absent video. |
| 2861 if (m_readyState > HAVE_NOTHING && isHTMLVideoElement()) | 2861 if (m_readyState > HAVE_NOTHING && isHTMLVideoElement()) |
| 2862 scheduleEvent(EventTypeNames::resize); | 2862 scheduleEvent(EventTypeNames::resize); |
| 2863 | 2863 |
| 2864 if (layoutObject()) | 2864 if (layoutObject()) |
| 2865 layoutObject()->updateFromElement(); | 2865 layoutObject()->updateFromElement(); |
| 2866 } | 2866 } |
| 2867 | 2867 |
| 2868 PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::buffered() const | 2868 TimeRanges* HTMLMediaElement::buffered() const |
| 2869 { | 2869 { |
| 2870 if (m_mediaSource) | 2870 if (m_mediaSource) |
| 2871 return m_mediaSource->buffered(); | 2871 return m_mediaSource->buffered(); |
| 2872 | 2872 |
| 2873 if (!webMediaPlayer()) | 2873 if (!webMediaPlayer()) |
| 2874 return TimeRanges::create(); | 2874 return TimeRanges::create(); |
| 2875 | 2875 |
| 2876 return TimeRanges::create(webMediaPlayer()->buffered()); | 2876 return TimeRanges::create(webMediaPlayer()->buffered()); |
| 2877 } | 2877 } |
| 2878 | 2878 |
| 2879 PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::played() | 2879 TimeRanges* HTMLMediaElement::played() |
| 2880 { | 2880 { |
| 2881 if (m_playing) { | 2881 if (m_playing) { |
| 2882 double time = currentTime(); | 2882 double time = currentTime(); |
| 2883 if (time > m_lastSeekTime) | 2883 if (time > m_lastSeekTime) |
| 2884 addPlayedRange(m_lastSeekTime, time); | 2884 addPlayedRange(m_lastSeekTime, time); |
| 2885 } | 2885 } |
| 2886 | 2886 |
| 2887 if (!m_playedTimeRanges) | 2887 if (!m_playedTimeRanges) |
| 2888 m_playedTimeRanges = TimeRanges::create(); | 2888 m_playedTimeRanges = TimeRanges::create(); |
| 2889 | 2889 |
| 2890 return m_playedTimeRanges->copy(); | 2890 return m_playedTimeRanges->copy(); |
| 2891 } | 2891 } |
| 2892 | 2892 |
| 2893 PassRefPtrWillBeRawPtr<TimeRanges> HTMLMediaElement::seekable() const | 2893 TimeRanges* HTMLMediaElement::seekable() const |
| 2894 { | 2894 { |
| 2895 if (!webMediaPlayer()) | 2895 if (!webMediaPlayer()) |
| 2896 return TimeRanges::create(); | 2896 return TimeRanges::create(); |
| 2897 | 2897 |
| 2898 if (m_mediaSource) | 2898 if (m_mediaSource) |
| 2899 return m_mediaSource->seekable(); | 2899 return m_mediaSource->seekable(); |
| 2900 | 2900 |
| 2901 return TimeRanges::create(webMediaPlayer()->seekable()); | 2901 return TimeRanges::create(webMediaPlayer()->seekable()); |
| 2902 } | 2902 } |
| 2903 | 2903 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2937 | 2937 |
| 2938 // or the current playback position is the earliest possible position and th
e direction | 2938 // or the current playback position is the earliest possible position and th
e direction |
| 2939 // of playback is backwards | 2939 // of playback is backwards |
| 2940 ASSERT(directionOfPlayback() == Backward); | 2940 ASSERT(directionOfPlayback() == Backward); |
| 2941 return now <= 0; | 2941 return now <= 0; |
| 2942 } | 2942 } |
| 2943 | 2943 |
| 2944 bool HTMLMediaElement::stoppedDueToErrors() const | 2944 bool HTMLMediaElement::stoppedDueToErrors() const |
| 2945 { | 2945 { |
| 2946 if (m_readyState >= HAVE_METADATA && m_error) { | 2946 if (m_readyState >= HAVE_METADATA && m_error) { |
| 2947 RefPtrWillBeRawPtr<TimeRanges> seekableRanges = seekable(); | 2947 TimeRanges* seekableRanges = seekable(); |
| 2948 if (!seekableRanges->contain(currentTime())) | 2948 if (!seekableRanges->contain(currentTime())) |
| 2949 return true; | 2949 return true; |
| 2950 } | 2950 } |
| 2951 | 2951 |
| 2952 return false; | 2952 return false; |
| 2953 } | 2953 } |
| 2954 | 2954 |
| 2955 void HTMLMediaElement::updatePlayState() | 2955 void HTMLMediaElement::updatePlayState() |
| 2956 { | 2956 { |
| 2957 bool isPlaying = webMediaPlayer() && !webMediaPlayer()->paused(); | 2957 bool isPlaying = webMediaPlayer() && !webMediaPlayer()->paused(); |
| (...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3772 visitor->trace(m_client); | 3772 visitor->trace(m_client); |
| 3773 } | 3773 } |
| 3774 | 3774 |
| 3775 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) | 3775 DEFINE_TRACE(HTMLMediaElement::AudioSourceProviderImpl) |
| 3776 { | 3776 { |
| 3777 visitor->trace(m_client); | 3777 visitor->trace(m_client); |
| 3778 } | 3778 } |
| 3779 #endif | 3779 #endif |
| 3780 | 3780 |
| 3781 } | 3781 } |
| OLD | NEW |