mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-17 11:06:16 +02:00
pcmEncoder
git-svn-id: svn://elaine/murooma/trunk@214 d8a302eb-03bc-478d-80e4-98257eca68ef
This commit is contained in:
parent
65d8edf434
commit
9ceb6b3533
4 changed files with 39 additions and 2 deletions
|
@ -3,7 +3,7 @@ CC = /usr/bin/g++
|
|||
CFLAGS = -std=gnu++0x -Wall -Wno-unused-function -D_REENTRANT -DVERSION=\"$(VERSION)\" -I..
|
||||
LDFLAGS = -lrt -lpthread -lportaudio -lboost_system -lboost_program_options
|
||||
|
||||
OBJ = snapServer.o ../common/chunk.o ../common/sampleFormat.o
|
||||
OBJ = snapServer.o pcmEncoder.o ../common/chunk.o ../common/sampleFormat.o
|
||||
BIN = snapserver
|
||||
|
||||
all: server
|
||||
|
|
18
server/pcmEncoder.cpp
Normal file
18
server/pcmEncoder.cpp
Normal file
|
@ -0,0 +1,18 @@
|
|||
#include "pcmEncoder.h"
|
||||
|
||||
PcmEncoder::PcmEncoder()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void PcmEncoder::encode(Chunk* chunk)
|
||||
{
|
||||
WireChunk* wireChunk = chunk->wireChunk;
|
||||
for (size_t n=0; n<wireChunk->length; ++n)
|
||||
wireChunk->payload[n] *= 1.5;
|
||||
// return chunk;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
16
server/pcmEncoder.h
Normal file
16
server/pcmEncoder.h
Normal file
|
@ -0,0 +1,16 @@
|
|||
#ifndef PCM_ENCODER_H
|
||||
#define PCM_ENCODER_H
|
||||
#include "common/chunk.h"
|
||||
|
||||
|
||||
class PcmEncoder
|
||||
{
|
||||
public:
|
||||
PcmEncoder();
|
||||
void encode(Chunk* chunk);
|
||||
};
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -26,6 +26,7 @@
|
|||
#include "common/signalHandler.h"
|
||||
#include "common/utils.h"
|
||||
#include "common/sampleFormat.h"
|
||||
#include "pcmEncoder.h"
|
||||
#include <syslog.h>
|
||||
|
||||
|
||||
|
@ -260,7 +261,8 @@ int main(int argc, char* argv[])
|
|||
|
||||
mkfifo(fifoName.c_str(), 0777);
|
||||
size_t duration = 50;
|
||||
|
||||
|
||||
PcmEncoder pcmEncoder;
|
||||
SampleFormat format(sampleFormat);
|
||||
while (!g_terminated)
|
||||
{
|
||||
|
@ -288,6 +290,7 @@ size_t duration = 50;
|
|||
|
||||
wireChunk->tv_sec = tvChunk.tv_sec;
|
||||
wireChunk->tv_usec = tvChunk.tv_usec;
|
||||
pcmEncoder.encode(chunk.get());
|
||||
server->send(chunk);
|
||||
|
||||
addMs(tvChunk, duration);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue