mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-18 03:26:15 +02:00
seeking
git-svn-id: svn://elaine/murooma/trunk@209 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
10323c0485
commit
559baf31e3
6 changed files with 79 additions and 28 deletions
|
@ -27,18 +27,33 @@ Chunk::~Chunk()
|
|||
|
||||
bool Chunk::isEndOfChunk() const
|
||||
{
|
||||
return idx >= (wireChunk->length / format.frameSize);
|
||||
return idx >= getFrameCount();
|
||||
}
|
||||
|
||||
|
||||
double Chunk::getFrameCount() const
|
||||
{
|
||||
return (wireChunk->length / format.frameSize);
|
||||
}
|
||||
|
||||
|
||||
|
||||
double Chunk::getDuration() const
|
||||
{
|
||||
// std::cout << wireChunk->length << "\t" << format.frameSize << "\t" << (wireChunk->length / format.frameSize) << "\t" << ((double)format.rate / 1000.) << "\n";
|
||||
return (wireChunk->length / format.frameSize) / ((double)format.rate / 1000.);
|
||||
return getFrameCount() / format.msRate();
|
||||
}
|
||||
|
||||
|
||||
int Chunk::seek(int frames)
|
||||
{
|
||||
idx += frames;
|
||||
if (idx > getFrameCount())
|
||||
idx = getFrameCount();
|
||||
if (idx < 0)
|
||||
idx = 0;
|
||||
return idx;
|
||||
}
|
||||
|
||||
|
||||
int Chunk::read(void* outputBuffer, size_t frameCount)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue