OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv
ed. | 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All rights reserv
ed. |
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 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1065 // then the user agent must wait for the steps to complete, and then must | 1065 // then the user agent must wait for the steps to complete, and then must |
1066 // immediately rerun the steps. | 1066 // immediately rerun the steps. |
1067 if (ignoreTrackDisplayUpdateRequests()) | 1067 if (ignoreTrackDisplayUpdateRequests()) |
1068 return; | 1068 return; |
1069 | 1069 |
1070 // 1 - Let current cues be a list of cues, initialized to contain all the | 1070 // 1 - Let current cues be a list of cues, initialized to contain all the |
1071 // cues of all the hidden, showing, or showing by default text tracks of the | 1071 // cues of all the hidden, showing, or showing by default text tracks of the |
1072 // media element (not the disabled ones) whose start times are less than or | 1072 // media element (not the disabled ones) whose start times are less than or |
1073 // equal to the current playback position and whose end times are greater | 1073 // equal to the current playback position and whose end times are greater |
1074 // than the current playback position. | 1074 // than the current playback position. |
1075 Vector<CueIntervalTree::IntervalType> currentCues; | 1075 CueList currentCues; |
1076 | 1076 |
1077 // The user agent must synchronously unset [the text track cue active] flag | 1077 // The user agent must synchronously unset [the text track cue active] flag |
1078 // whenever ... the media element's readyState is changed back to HAVE_NOTHI
NG. | 1078 // whenever ... the media element's readyState is changed back to HAVE_NOTHI
NG. |
1079 if (m_readyState != HAVE_NOTHING && m_player) | 1079 if (m_readyState != HAVE_NOTHING && m_player) |
1080 currentCues = m_cueTree.allOverlaps(m_cueTree.createInterval(movieTime,
movieTime)); | 1080 currentCues = m_cueTree.allOverlaps(m_cueTree.createInterval(movieTime,
movieTime)); |
1081 | 1081 |
1082 Vector<CueIntervalTree::IntervalType> affectedCues; | 1082 CueList previousCues; |
1083 Vector<CueIntervalTree::IntervalType> previousCues; | 1083 CueList missedCues; |
1084 Vector<CueIntervalTree::IntervalType> missedCues; | |
1085 | 1084 |
1086 // 2 - Let other cues be a list of cues, initialized to contain all the cues | 1085 // 2 - Let other cues be a list of cues, initialized to contain all the cues |
1087 // of hidden, showing, and showing by default text tracks of the media | 1086 // of hidden, showing, and showing by default text tracks of the media |
1088 // element that are not present in current cues. | 1087 // element that are not present in current cues. |
1089 previousCues = m_currentlyActiveCues; | 1088 previousCues = m_currentlyActiveCues; |
1090 | 1089 |
1091 // 3 - Let last time be the current playback position at the time this | 1090 // 3 - Let last time be the current playback position at the time this |
1092 // algorithm was last run for this media element, if this is not the first | 1091 // algorithm was last run for this media element, if this is not the first |
1093 // time it has run. | 1092 // time it has run. |
1094 float lastTime = m_lastTextTrackUpdateTime; | 1093 float lastTime = m_lastTextTrackUpdateTime; |
1095 | 1094 |
1096 // 4 - If the current playback position has, since the last time this | 1095 // 4 - If the current playback position has, since the last time this |
1097 // algorithm was run, only changed through its usual monotonic increase | 1096 // algorithm was run, only changed through its usual monotonic increase |
1098 // during normal playback, then let missed cues be the list of cues in other | 1097 // during normal playback, then let missed cues be the list of cues in other |
1099 // cues whose start times are greater than or equal to last time and whose | 1098 // cues whose start times are greater than or equal to last time and whose |
1100 // end times are less than or equal to the current playback position. | 1099 // end times are less than or equal to the current playback position. |
1101 // Otherwise, let missed cues be an empty list. | 1100 // Otherwise, let missed cues be an empty list. |
1102 if (lastTime >= 0 && m_lastSeekTime < movieTime) { | 1101 if (lastTime >= 0 && m_lastSeekTime < movieTime) { |
1103 Vector<CueIntervalTree::IntervalType> potentiallySkippedCues = | 1102 CueList potentiallySkippedCues = |
1104 m_cueTree.allOverlaps(m_cueTree.createInterval(lastTime, movieTime))
; | 1103 m_cueTree.allOverlaps(m_cueTree.createInterval(lastTime, movieTime))
; |
1105 | 1104 |
1106 for (size_t i = 0; i < potentiallySkippedCues.size(); ++i) { | 1105 for (size_t i = 0; i < potentiallySkippedCues.size(); ++i) { |
1107 float cueStartTime = potentiallySkippedCues[i].low(); | 1106 float cueStartTime = potentiallySkippedCues[i].low(); |
1108 float cueEndTime = potentiallySkippedCues[i].high(); | 1107 float cueEndTime = potentiallySkippedCues[i].high(); |
1109 | 1108 |
1110 // Consider cues that may have been missed since the last seek time. | 1109 // Consider cues that may have been missed since the last seek time. |
1111 if (cueStartTime > max(m_lastSeekTime, lastTime) && cueEndTime < mov
ieTime) | 1110 if (cueStartTime > max(m_lastSeekTime, lastTime) && cueEndTime < mov
ieTime) |
1112 missedCues.append(potentiallySkippedCues[i]); | 1111 missedCues.append(potentiallySkippedCues[i]); |
1113 } | 1112 } |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1369 endIgnoringTrackDisplayUpdateRequests(); | 1368 endIgnoringTrackDisplayUpdateRequests(); |
1370 updateActiveTextTrackCues(currentTime()); | 1369 updateActiveTextTrackCues(currentTime()); |
1371 } | 1370 } |
1372 | 1371 |
1373 void HTMLMediaElement::textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue> cue) | 1372 void HTMLMediaElement::textTrackAddCue(TextTrack*, PassRefPtr<TextTrackCue> cue) |
1374 { | 1373 { |
1375 // Negative duration cues need be treated in the interval tree as | 1374 // Negative duration cues need be treated in the interval tree as |
1376 // zero-length cues. | 1375 // zero-length cues. |
1377 double endTime = max(cue->startTime(), cue->endTime()); | 1376 double endTime = max(cue->startTime(), cue->endTime()); |
1378 | 1377 |
1379 CueIntervalTree::IntervalType interval = m_cueTree.createInterval(cue->start
Time(), endTime, cue.get()); | 1378 CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, c
ue.get()); |
1380 if (!m_cueTree.contains(interval)) | 1379 if (!m_cueTree.contains(interval)) |
1381 m_cueTree.add(interval); | 1380 m_cueTree.add(interval); |
1382 updateActiveTextTrackCues(currentTime()); | 1381 updateActiveTextTrackCues(currentTime()); |
1383 } | 1382 } |
1384 | 1383 |
1385 void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue> c
ue) | 1384 void HTMLMediaElement::textTrackRemoveCue(TextTrack*, PassRefPtr<TextTrackCue> c
ue) |
1386 { | 1385 { |
1387 // Negative duration cues need to be treated in the interval tree as | 1386 // Negative duration cues need to be treated in the interval tree as |
1388 // zero-length cues. | 1387 // zero-length cues. |
1389 double endTime = max(cue->startTime(), cue->endTime()); | 1388 double endTime = max(cue->startTime(), cue->endTime()); |
1390 | 1389 |
1391 m_cueTree.remove(m_cueTree.createInterval(cue->startTime(), endTime, cue.get
())); | 1390 CueInterval interval = m_cueTree.createInterval(cue->startTime(), endTime, c
ue.get()); |
| 1391 m_cueTree.remove(interval); |
| 1392 |
| 1393 size_t index = m_currentlyActiveCues.find(interval); |
| 1394 if (index != notFound) |
| 1395 m_currentlyActiveCues.remove(index); |
| 1396 |
1392 updateActiveTextTrackCues(currentTime()); | 1397 updateActiveTextTrackCues(currentTime()); |
1393 } | 1398 } |
1394 | 1399 |
1395 #endif | 1400 #endif |
1396 | 1401 |
1397 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI
fInvalid) | 1402 bool HTMLMediaElement::isSafeToLoadURL(const KURL& url, InvalidURLAction actionI
fInvalid) |
1398 { | 1403 { |
1399 if (!url.isValid()) { | 1404 if (!url.isValid()) { |
1400 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE because url i
s invalid", urlForLoggingMedia(url).utf8().data()); | 1405 LOG(Media, "HTMLMediaElement::isSafeToLoadURL(%s) -> FALSE because url i
s invalid", urlForLoggingMedia(url).utf8().data()); |
1401 return false; | 1406 return false; |
(...skipping 3344 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4746 info.addMember(m_mediaGroup); | 4751 info.addMember(m_mediaGroup); |
4747 info.addMember(m_mediaController); | 4752 info.addMember(m_mediaController); |
4748 | 4753 |
4749 #if PLATFORM(MAC) | 4754 #if PLATFORM(MAC) |
4750 info.addMember(m_sleepDisabler); | 4755 info.addMember(m_sleepDisabler); |
4751 #endif | 4756 #endif |
4752 } | 4757 } |
4753 | 4758 |
4754 } | 4759 } |
4755 #endif | 4760 #endif |
OLD | NEW |