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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 bool Player::update() | 87 bool Player::update() |
88 { | 88 { |
89 if (!m_content) | 89 if (!m_content) |
90 return false; | 90 return false; |
91 | 91 |
92 double newTime = isNull(m_timeline->currentTime()) ? nullValue() : currentTi
me(); | 92 double newTime = isNull(m_timeline->currentTime()) ? nullValue() : currentTi
me(); |
93 m_content->updateInheritedTime(newTime); | 93 m_content->updateInheritedTime(newTime); |
94 return m_content->isCurrent() || m_content->isInEffect(); | 94 return m_content->isCurrent() || m_content->isInEffect(); |
95 } | 95 } |
96 | 96 |
| 97 void Player::cancel() |
| 98 { |
| 99 if (!m_content) |
| 100 return; |
| 101 |
| 102 m_content->detach(); |
| 103 m_content = 0; |
| 104 } |
| 105 |
97 void Player::setCurrentTime(double seekTime) | 106 void Player::setCurrentTime(double seekTime) |
98 { | 107 { |
99 if (paused()) | 108 if (paused()) |
100 m_pauseStartTime = seekTime; | 109 m_pauseStartTime = seekTime; |
101 else | 110 else |
102 m_timeDrift = currentTimeBeforeDrift() - seekTime; | 111 m_timeDrift = currentTimeBeforeDrift() - seekTime; |
103 | 112 |
104 update(); | 113 update(); |
105 } | 114 } |
106 | 115 |
(...skipping 11 matching lines...) Expand all Loading... |
118 } | 127 } |
119 | 128 |
120 void Player::setPlaybackRate(double newRate) | 129 void Player::setPlaybackRate(double newRate) |
121 { | 130 { |
122 double previousTime = currentTime(); | 131 double previousTime = currentTime(); |
123 m_playbackRate = newRate; | 132 m_playbackRate = newRate; |
124 setCurrentTime(previousTime); | 133 setCurrentTime(previousTime); |
125 } | 134 } |
126 | 135 |
127 } // namespace | 136 } // namespace |
OLD | NEW |