mirror of
https://github.com/badaix/snapcast.git
synced 2025-05-25 15:06:21 +02:00
flac and ogg decoding on big endian
This commit is contained in:
parent
eb328564ad
commit
b29fadc465
3 changed files with 10 additions and 4 deletions
|
@ -22,6 +22,7 @@
|
||||||
#include <FLAC/stream_decoder.h>
|
#include <FLAC/stream_decoder.h>
|
||||||
#include "flacDecoder.h"
|
#include "flacDecoder.h"
|
||||||
#include "common/snapException.h"
|
#include "common/snapException.h"
|
||||||
|
#include "common/endian.h"
|
||||||
#include "common/log.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);
|
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++)
|
for(size_t i = 0; i < frame->header.blocksize; i++)
|
||||||
{
|
{
|
||||||
memcpy(pcmChunk->payload + pcmChunk->payloadSize + 4*i, (char*)(buffer[0] + i), 2);
|
pcm[2*i] = SWAP_16((int16_t)(buffer[0][i]));
|
||||||
memcpy(pcmChunk->payload + pcmChunk->payloadSize + 4*i+2, (char*)(buffer[1] + i), 2);
|
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;
|
pcmChunk->payloadSize += bytes;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
|
|
||||||
#include "oggDecoder.h"
|
#include "oggDecoder.h"
|
||||||
#include "common/snapException.h"
|
#include "common/snapException.h"
|
||||||
|
#include "common/endian.h"
|
||||||
#include "common/log.h"
|
#include "common/log.h"
|
||||||
|
|
||||||
|
|
||||||
|
@ -121,7 +122,7 @@ bool OggDecoder::decode(msg::PcmChunk* chunk)
|
||||||
val=32767;
|
val=32767;
|
||||||
else if(val<-32768)
|
else if(val<-32768)
|
||||||
val=-32768;
|
val=-32768;
|
||||||
*ptr=val;
|
*ptr=SWAP_16(val);
|
||||||
ptr+=vi.channels;
|
ptr+=vi.channels;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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
|
http://stackoverflow.com/questions/1024114/location-of-ini-config-files-in-linux-unix
|
||||||
|
|
||||||
|
|
||||||
|
*OpenWrt:
|
||||||
|
https://wiki.openwrt.org/doc/howto/buildroot.exigence
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue