aboutsummaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/timestamp.cpp34
-rw-r--r--sound/timestamp.h12
2 files changed, 11 insertions, 35 deletions
diff --git a/sound/timestamp.cpp b/sound/timestamp.cpp
index 1eb5483fc2..1e49e1b476 100644
--- a/sound/timestamp.cpp
+++ b/sound/timestamp.cpp
@@ -148,21 +148,9 @@ Timestamp Timestamp::addMsecs(int ms) const {
}
void Timestamp::addIntern(const Timestamp &ts) {
+ assert(_framerate == ts._framerate);
_secs += ts._secs;
-
- if (_framerate == ts._framerate) {
- _numFrames += ts._numFrames;
- } else {
- // We need to multiply by the quotient of the two framerates.
- // We cancel the GCD in this fraction to reduce the risk of
- // overflows.
- const uint g = Common::gcd(_framerate, ts._framerate);
- const uint p = _framerate / g;
- const uint q = ts._framerate / g;
-
- _framerate *= q;
- _numFrames = _numFrames * q + ts._numFrames * p;
- }
+ _numFrames += ts._numFrames;
normalize();
}
@@ -187,24 +175,6 @@ Timestamp Timestamp::operator-(const Timestamp &ts) const {
return result;
}
-/*
-Timestamp &Timestamp::operator+=(const Timestamp &ts) {
- addIntern(ts);
- return *this;
-}
-
-Timestamp &Timestamp::operator-=(const Timestamp &ts) {
- addIntern(-ts);
- return *this;
-}
-*/
-
-/*
-int Timestamp::frameDiff(const Timestamp &ts) const {
- return (*this - ts).totalNumberOfFrames();
-}
-*/
-
int Timestamp::frameDiff(const Timestamp &ts) const {
int delta = 0;
diff --git a/sound/timestamp.h b/sound/timestamp.h
index 410445eccd..fef4107535 100644
--- a/sound/timestamp.h
+++ b/sound/timestamp.h
@@ -126,11 +126,17 @@ public:
// unary minus
Timestamp operator-() const;
+ /**
+ * Compute the sum of two timestamps. This is only
+ * allowed if they use the same framerate.
+ */
Timestamp operator+(const Timestamp &ts) const;
- Timestamp operator-(const Timestamp &ts) const;
-// Timestamp &operator+=(const Timestamp &ts);
-// Timestamp &operator-=(const Timestamp &ts);
+ /**
+ * Compute the difference between two timestamps. This is only
+ * allowed if they use the same framerate.
+ */
+ Timestamp operator-(const Timestamp &ts) const;
/**
* Computes the number of frames between this timestamp and ts.