mirror of
https://github.com/badaix/snapcast.git
synced 2025-07-19 17:37:45 +02:00
47 lines
879 B
C++
47 lines
879 B
C++
#ifndef STREAM_H
|
|
#define STREAM_H
|
|
|
|
|
|
#include <deque>
|
|
#include <mutex>
|
|
#include <condition_variable>
|
|
#include <vector>
|
|
#include <memory>
|
|
#include "doubleBuffer.h"
|
|
#include "chunk.h"
|
|
#include "timeUtils.h"
|
|
#include "queue.h"
|
|
|
|
|
|
class Stream
|
|
{
|
|
public:
|
|
Stream();
|
|
void addChunk(Chunk* chunk);
|
|
void getPlayerChunk(short* outputBuffer, double outputBufferDacTime, unsigned long framesPerBuffer);
|
|
void setBufferLen(size_t bufferLenMs);
|
|
|
|
private:
|
|
time_point_ms getNextPlayerChunk(short* outputBuffer, int correction = 0);
|
|
void getSilentPlayerChunk(short* outputBuffer);
|
|
void updateBuffers(int age);
|
|
void resetBuffers();
|
|
|
|
int sleep;
|
|
Queue<std::shared_ptr<Chunk>> chunks;
|
|
DoubleBuffer<int>* pMiniBuffer;
|
|
DoubleBuffer<int>* pBuffer;
|
|
DoubleBuffer<int>* pShortBuffer;
|
|
std::shared_ptr<Chunk> chunk;
|
|
|
|
int median;
|
|
int shortMedian;
|
|
time_t lastUpdate;
|
|
int bufferMs;
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|