Add a "getLength" function to SeekableAudioStream.
svn-id: r47036
This commit is contained in:
parent
1712e223e2
commit
e9a94ecb9b
6 changed files with 24 additions and 0 deletions
|
@ -122,6 +122,7 @@ public:
|
|||
// GROSS HACK, if anyone sees this, be aware that you should
|
||||
// never copy this! This is just a temporary hack...
|
||||
bool seek(const Audio::Timestamp &) { return false; }
|
||||
Audio::Timestamp getLength() const { return Audio::Timestamp(0, getRate()); }
|
||||
private:
|
||||
Common::SeekableReadStream *_stream;
|
||||
bool _loop;
|
||||
|
|
|
@ -175,6 +175,8 @@ public:
|
|||
}
|
||||
|
||||
bool seek(const Timestamp &where);
|
||||
// TODO: We can definitly increase the precision here, since we know the exact sample count
|
||||
Timestamp getLength() const { return Timestamp(_playtime, getRate()); }
|
||||
|
||||
void setNumLoops(uint numLoops) {
|
||||
_numLoops = numLoops;
|
||||
|
@ -334,6 +336,8 @@ public:
|
|||
return kUnknownPlayTime;
|
||||
return _playtime * _numLoops;
|
||||
}
|
||||
// TODO: We can definitly increase the precision here, since we know the exact sample count
|
||||
Timestamp getLength() const { return Timestamp(_playtime, getRate()); }
|
||||
|
||||
bool seek(const Timestamp &where);
|
||||
};
|
||||
|
|
|
@ -157,6 +157,13 @@ public:
|
|||
* @return true on success, false on failure.
|
||||
*/
|
||||
virtual bool seek(const Timestamp &where) = 0;
|
||||
|
||||
/**
|
||||
* Returns the length of the stream.
|
||||
*
|
||||
* @return length as Timestamp.
|
||||
*/
|
||||
virtual Timestamp getLength() const = 0;
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -150,6 +150,8 @@ public:
|
|||
}
|
||||
|
||||
bool seek(const Timestamp &where);
|
||||
// TODO: We can definitly increase the precision here, since FLAC allows us to catch the sample count
|
||||
Timestamp getLength() const { return Timestamp(_totalPlayTime, getRate()); }
|
||||
|
||||
bool isStreamDecoderReady() const { return getStreamDecoderState() == FLAC__STREAM_DECODER_SEARCH_FOR_FRAME_SYNC ; }
|
||||
|
||||
|
|
|
@ -100,6 +100,8 @@ public:
|
|||
}
|
||||
|
||||
bool seek(const Timestamp &where);
|
||||
// TODO: Maybe we can have a more precise implementation of this
|
||||
Timestamp getLength() const { return Timestamp(_totalPlayTime, getRate()); }
|
||||
|
||||
void setNumLoops(uint numLoops) {
|
||||
_numLoops = numLoops;
|
||||
|
|
|
@ -139,6 +139,14 @@ public:
|
|||
}
|
||||
|
||||
bool seek(const Timestamp &where);
|
||||
// TODO: Maybe we can have a more precise implementation of this
|
||||
Timestamp getLength() const {
|
||||
#ifdef USE_TREMOR
|
||||
return Timestamp(_endTime, getRate());
|
||||
#else
|
||||
return Timestamp((uint32)(_endTime * 1000.0), getRate());
|
||||
#endif
|
||||
}
|
||||
|
||||
protected:
|
||||
bool refill();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue