diff --git a/client/decoder/flacDecoder.cpp b/client/decoder/flacDecoder.cpp index 0b872165..df2ec296 100644 --- a/client/decoder/flacDecoder.cpp +++ b/client/decoder/flacDecoder.cpp @@ -22,6 +22,7 @@ #include #include "flacDecoder.h" #include "common/snapException.h" +#include "common/endian.h" #include "common/log.h" @@ -163,10 +164,13 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder *decoder pcmChunk->payload = (char*)realloc(pcmChunk->payload, pcmChunk->payloadSize + bytes); + int16_t* pcm = (int16_t*)(pcmChunk->payload + pcmChunk->payloadSize); for(size_t i = 0; i < frame->header.blocksize; i++) { - memcpy(pcmChunk->payload + pcmChunk->payloadSize + 4*i, (char*)(buffer[0] + i), 2); - memcpy(pcmChunk->payload + pcmChunk->payloadSize + 4*i+2, (char*)(buffer[1] + i), 2); + pcm[2*i] = SWAP_16((int16_t)(buffer[0][i])); + pcm[2*i + 1] = SWAP_16((int16_t)(buffer[1][i])); +// memcpy(pcmChunk->payload + pcmChunk->payloadSize + 4*i, (char*)(buffer[0] + i), 2); +// memcpy(pcmChunk->payload + pcmChunk->payloadSize + 4*i+2, (char*)(buffer[1] + i), 2); } pcmChunk->payloadSize += bytes; } diff --git a/client/decoder/oggDecoder.cpp b/client/decoder/oggDecoder.cpp index e4f89a56..08dafce1 100644 --- a/client/decoder/oggDecoder.cpp +++ b/client/decoder/oggDecoder.cpp @@ -23,6 +23,7 @@ #include "oggDecoder.h" #include "common/snapException.h" +#include "common/endian.h" #include "common/log.h" @@ -121,7 +122,7 @@ bool OggDecoder::decode(msg::PcmChunk* chunk) val=32767; else if(val<-32768) val=-32768; - *ptr=val; + *ptr=SWAP_16(val); ptr+=vi.channels; } } diff --git a/notes.txt b/notes.txt index 06de7347..b971e9d7 100644 --- a/notes.txt +++ b/notes.txt @@ -65,4 +65,5 @@ http://0pointer.de/public/systemd-man/systemd.exec.html#Environment= http://stackoverflow.com/questions/1024114/location-of-ini-config-files-in-linux-unix - +*OpenWrt: +https://wiki.openwrt.org/doc/howto/buildroot.exigence