mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-10 23:56:43 +02:00
support for vorbis and tremor (-DHAS_TREMOR)
This commit is contained in:
parent
ae557f0d79
commit
73175adedf
4 changed files with 21 additions and 6 deletions
|
@ -24,7 +24,7 @@ OBJ += player/openslPlayer.o
|
|||
else ifeq ($(TARGET), OPENWRT)
|
||||
|
||||
STRIP = echo
|
||||
CXXFLAGS += -DIS_BIG_ENDIAN -DNO_CPP11_STRING -DHAS_OGG -DHAS_ALSA -DHAS_AVAHI -DHAS_DAEMON
|
||||
CXXFLAGS += -DIS_BIG_ENDIAN -DNO_CPP11_STRING -DHAS_TREMOR -DHAS_ALSA -DHAS_AVAHI -DHAS_DAEMON
|
||||
LDFLAGS = -lasound -logg -lvorbisidec -lFLAC -lavahi-client -lavahi-common -latomic
|
||||
OBJ += player/alsaPlayer.o decoder/oggDecoder.o browseAvahi.o
|
||||
|
||||
|
@ -33,7 +33,7 @@ else
|
|||
CXX = /usr/bin/g++
|
||||
STRIP = strip
|
||||
CXXFLAGS += -static-libgcc -static-libstdc++ -DHAS_OGG -DHAS_ALSA -DHAS_AVAHI -DHAS_DAEMON
|
||||
LDFLAGS = -lrt -lasound -logg -lvorbisidec -lFLAC -lavahi-client -lavahi-common
|
||||
LDFLAGS = -lrt -lasound -logg -lvorbis -lFLAC -lavahi-client -lavahi-common
|
||||
OBJ += player/alsaPlayer.o decoder/oggDecoder.o browseAvahi.o
|
||||
|
||||
endif
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
#include <iostream>
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#ifdef HAS_OGG
|
||||
#if defined(HAS_OGG) || defined(HAS_TREMOR)
|
||||
#include "decoder/oggDecoder.h"
|
||||
#endif
|
||||
#include "decoder/pcmDecoder.h"
|
||||
|
@ -97,7 +97,7 @@ void Controller::onMessageReceived(ClientConnection* connection, const msg::Base
|
|||
|
||||
if (headerChunk_->codec == "pcm")
|
||||
decoder_.reset(new PcmDecoder());
|
||||
#ifdef HAS_OGG
|
||||
#if defined(HAS_OGG) || defined(HAS_TREMOR)
|
||||
else if (headerChunk_->codec == "ogg")
|
||||
decoder_.reset(new OggDecoder());
|
||||
#endif
|
||||
|
|
|
@ -19,7 +19,6 @@
|
|||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <cmath>
|
||||
//#include <tremor/ivorbisfile.h>
|
||||
|
||||
#include "oggDecoder.h"
|
||||
#include "common/snapException.h"
|
||||
|
@ -92,7 +91,11 @@ bool OggDecoder::decode(msg::PcmChunk* chunk)
|
|||
continue; /* missing or corrupt data at this page position */
|
||||
/* no reason to complain; already complained above */
|
||||
/* we have a packet. Decode it */
|
||||
#ifdef HAS_TREMOR
|
||||
ogg_int32_t **pcm;
|
||||
#else
|
||||
float **pcm;
|
||||
#endif
|
||||
int samples;
|
||||
|
||||
if (vorbis_synthesis(&vb,&op) == 0) /* test for success! */
|
||||
|
@ -113,10 +116,18 @@ bool OggDecoder::decode(msg::PcmChunk* chunk)
|
|||
for(int i=0; i<vi.channels; i++)
|
||||
{
|
||||
ogg_int16_t *ptr=convbuffer+i;
|
||||
#ifdef HAS_TREMOR
|
||||
ogg_int32_t *mono=pcm[i];
|
||||
#else
|
||||
float *mono=pcm[i];
|
||||
#endif
|
||||
for (int j=0; j<bout; j++)
|
||||
{
|
||||
ogg_int32_t val = mono[j] >> 9;//floor(mono[j]*32767.f+.5f);
|
||||
#ifdef HAS_TREMOR
|
||||
ogg_int32_t val = mono[j] >> 9;
|
||||
#else
|
||||
ogg_int32_t val = floor(mono[j]*32767.f+.5f);
|
||||
#endif
|
||||
/* might as well guard against clipping */
|
||||
if(val>32767)
|
||||
val=32767;
|
||||
|
|
|
@ -19,7 +19,11 @@
|
|||
#ifndef OGG_DECODER_H
|
||||
#define OGG_DECODER_H
|
||||
#include "decoder.h"
|
||||
#ifdef HAS_TREMOR
|
||||
#include <tremor/ivorbiscodec.h>
|
||||
#else
|
||||
#include <vorbis/codec.h>
|
||||
#endif
|
||||
|
||||
|
||||
class OggDecoder : public Decoder
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue