| 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 28 matching lines...) Expand all Loading... |
| 39 class DocumentTimeline; | 39 class DocumentTimeline; |
| 40 | 40 |
| 41 class Player FINAL : public RefCounted<Player> { | 41 class Player FINAL : public RefCounted<Player> { |
| 42 | 42 |
| 43 public: | 43 public: |
| 44 ~Player(); | 44 ~Player(); |
| 45 static PassRefPtr<Player> create(DocumentTimeline*, TimedItem*); | 45 static PassRefPtr<Player> create(DocumentTimeline*, TimedItem*); |
| 46 | 46 |
| 47 // Returns whether this player is still current or in effect. | 47 // Returns whether this player is still current or in effect. |
| 48 bool update(); | 48 bool update(); |
| 49 void cancel(); |
| 49 double currentTime() const; | 50 double currentTime() const; |
| 50 void setCurrentTime(double); | 51 void setCurrentTime(double); |
| 51 bool paused() const { return !isNull(m_pauseStartTime); } | 52 bool paused() const { return !isNull(m_pauseStartTime); } |
| 52 void setPaused(bool); | 53 void setPaused(bool); |
| 53 double playbackRate() const { return m_playbackRate; } | 54 double playbackRate() const { return m_playbackRate; } |
| 54 void setPlaybackRate(double); | 55 void setPlaybackRate(double); |
| 55 double startTime() const { return m_startTime; } | 56 double startTime() const { return m_startTime; } |
| 56 double timeDrift() const; | 57 double timeDrift() const; |
| 57 DocumentTimeline* timeline() { return m_timeline; } | 58 DocumentTimeline* timeline() { return m_timeline; } |
| 58 | 59 |
| 59 private: | 60 private: |
| 60 Player(DocumentTimeline*, TimedItem*); | 61 Player(DocumentTimeline*, TimedItem*); |
| 61 static double effectiveTime(double time) { return isNull(time) ? 0 : time; } | 62 static double effectiveTime(double time) { return isNull(time) ? 0 : time; } |
| 62 inline double pausedTimeDrift() const; | 63 inline double pausedTimeDrift() const; |
| 63 inline double currentTimeBeforeDrift() const; | 64 inline double currentTimeBeforeDrift() const; |
| 64 | 65 |
| 65 double m_pauseStartTime; | 66 double m_pauseStartTime; |
| 66 double m_playbackRate; | 67 double m_playbackRate; |
| 67 double m_timeDrift; | 68 double m_timeDrift; |
| 68 const double m_startTime; | 69 const double m_startTime; |
| 69 | 70 |
| 70 RefPtr<TimedItem> m_content; | 71 RefPtr<TimedItem> m_content; |
| 71 DocumentTimeline* const m_timeline; | 72 DocumentTimeline* const m_timeline; |
| 72 }; | 73 }; |
| 73 | 74 |
| 74 } // namespace | 75 } // namespace |
| 75 | 76 |
| 76 #endif | 77 #endif |
| OLD | NEW |