| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 double Player::timeDrift() const | 77 double Player::timeDrift() const |
| 78 { | 78 { |
| 79 return paused() ? pausedTimeDrift() : m_timeDrift; | 79 return paused() ? pausedTimeDrift() : m_timeDrift; |
| 80 } | 80 } |
| 81 | 81 |
| 82 double Player::currentTime() const | 82 double Player::currentTime() const |
| 83 { | 83 { |
| 84 return currentTimeBeforeDrift() - timeDrift(); | 84 return currentTimeBeforeDrift() - timeDrift(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 bool Player::update() | 87 bool Player::update(double* timeToEffectChange) |
| 88 { | 88 { |
| 89 if (!m_content) | 89 if (!m_content) { |
| 90 if (timeToEffectChange) |
| 91 *timeToEffectChange = std::numeric_limits<double>::infinity(); |
| 90 return false; | 92 return false; |
| 93 } |
| 91 | 94 |
| 92 double newTime = isNull(m_timeline->currentTime()) ? nullValue() : currentTi
me(); | 95 double newTime = isNull(m_timeline->currentTime()) ? nullValue() : currentTi
me(); |
| 93 m_content->updateInheritedTime(newTime); | 96 m_content->updateInheritedTime(newTime); |
| 97 if (timeToEffectChange) |
| 98 *timeToEffectChange = m_content->timeToEffectChange(); |
| 94 return m_content->isCurrent() || m_content->isInEffect(); | 99 return m_content->isCurrent() || m_content->isInEffect(); |
| 95 } | 100 } |
| 96 | 101 |
| 97 void Player::cancel() | 102 void Player::cancel() |
| 98 { | 103 { |
| 99 if (!m_content) | 104 if (!m_content) |
| 100 return; | 105 return; |
| 101 | 106 |
| 102 ASSERT(m_content->player() == this); | 107 ASSERT(m_content->player() == this); |
| 103 m_content->detach(); | 108 m_content->detach(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 128 } | 133 } |
| 129 | 134 |
| 130 void Player::setPlaybackRate(double newRate) | 135 void Player::setPlaybackRate(double newRate) |
| 131 { | 136 { |
| 132 double previousTime = currentTime(); | 137 double previousTime = currentTime(); |
| 133 m_playbackRate = newRate; | 138 m_playbackRate = newRate; |
| 134 setCurrentTime(previousTime); | 139 setCurrentTime(previousTime); |
| 135 } | 140 } |
| 136 | 141 |
| 137 } // namespace | 142 } // namespace |
| OLD | NEW |