mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-18 19:46:14 +02:00
xxx
git-svn-id: svn://elaine/murooma/trunk@135 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
b8cc8e8a67
commit
130d7c5643
1 changed files with 35 additions and 0 deletions
35
chunk.cpp
Normal file
35
chunk.cpp
Normal file
|
@ -0,0 +1,35 @@
|
|||
#include "chunk.h"
|
||||
#include <string.h>
|
||||
|
||||
|
||||
Chunk::Chunk(WireChunk* _wireChunk) : idx(0), wireChunk(_wireChunk)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
Chunk::~Chunk()
|
||||
{
|
||||
delete wireChunk;
|
||||
}
|
||||
|
||||
|
||||
bool Chunk::isEndOfChunk()
|
||||
{
|
||||
return idx >= WIRE_CHUNK_SIZE;
|
||||
}
|
||||
|
||||
|
||||
int Chunk::read(short* _outputBuffer, int _count)
|
||||
{
|
||||
int result = _count;
|
||||
if (idx + _count > WIRE_CHUNK_SIZE)
|
||||
result = WIRE_CHUNK_SIZE - idx;
|
||||
|
||||
if (_outputBuffer != NULL)
|
||||
memcpy(_outputBuffer, &wireChunk->payload[idx], sizeof(int16_t)*result);
|
||||
|
||||
idx += result;
|
||||
return result;
|
||||
}
|
||||
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue