mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-10 07:36:41 +02:00
git-svn-id: svn://elaine/murooma/trunk@136 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
130d7c5643
commit
a11a3e4959
3 changed files with 17 additions and 4 deletions
13
chunk.cpp
13
chunk.cpp
|
@ -1,9 +1,11 @@
|
||||||
#include "chunk.h"
|
#include "chunk.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
|
|
||||||
Chunk::Chunk(WireChunk* _wireChunk) : idx(0), wireChunk(_wireChunk)
|
Chunk::Chunk(WireChunk* _wireChunk) : idx(0)
|
||||||
{
|
{
|
||||||
|
wireChunk = new WireChunk(*_wireChunk);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -19,6 +21,15 @@ bool Chunk::isEndOfChunk()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool Chunk::getNext(int16_t& _result)
|
||||||
|
{
|
||||||
|
if (isEndOfChunk())
|
||||||
|
return false;
|
||||||
|
_result = wireChunk->payload[idx++];
|
||||||
|
result = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int Chunk::read(short* _outputBuffer, int _count)
|
int Chunk::read(short* _outputBuffer, int _count)
|
||||||
{
|
{
|
||||||
int result = _count;
|
int result = _count;
|
||||||
|
|
2
chunk.h
2
chunk.h
|
@ -39,6 +39,8 @@ public:
|
||||||
int read(short* _outputBuffer, int _count);
|
int read(short* _outputBuffer, int _count);
|
||||||
bool isEndOfChunk();
|
bool isEndOfChunk();
|
||||||
|
|
||||||
|
bool getNext(int16_t& _result);
|
||||||
|
|
||||||
inline time_point_ms timePoint()
|
inline time_point_ms timePoint()
|
||||||
{
|
{
|
||||||
time_point_ms tp;
|
time_point_ms tp;
|
||||||
|
|
|
@ -22,9 +22,9 @@ void Stream::setBufferLen(size_t bufferLenMs)
|
||||||
|
|
||||||
void Stream::addChunk(Chunk* chunk)
|
void Stream::addChunk(Chunk* chunk)
|
||||||
{
|
{
|
||||||
Chunk* c = new Chunk(*chunk);
|
// Chunk* c = new Chunk(*chunk);
|
||||||
// mutex.lock();
|
// mutex.lock();
|
||||||
chunks.push_back(c);
|
chunks.push_back(chunk);
|
||||||
// mutex.unlock();
|
// mutex.unlock();
|
||||||
cv.notify_all();
|
cv.notify_all();
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ time_point_ms Stream::getNextPlayerChunk(short* outputBuffer, int correction)
|
||||||
{
|
{
|
||||||
Chunk* chunk = getNextChunk();
|
Chunk* chunk = getNextChunk();
|
||||||
time_point_ms tp = chunk->timePoint();
|
time_point_ms tp = chunk->timePoint();
|
||||||
/*
|
|
||||||
if (correction != 0)
|
if (correction != 0)
|
||||||
{
|
{
|
||||||
float idx(chunk->idx);
|
float idx(chunk->idx);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue