diff options
author | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2010-08-09 11:22:27 +0200 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2010-08-09 12:04:18 +0200 |
commit | ecf5ecc70e8d71449a1b8d40496e4906e65457ea (patch) | |
tree | 0b40f781d3d49235eeae7b1f2e970eb454c62464 /src | |
parent | bc3c92cb0e5a219d8f94a8bee6765885dbfc4333 (diff) | |
download | pianobar-ecf5ecc70e8d71449a1b8d40496e4906e65457ea.tar.gz pianobar-ecf5ecc70e8d71449a1b8d40496e4906e65457ea.tar.bz2 pianobar-ecf5ecc70e8d71449a1b8d40496e4906e65457ea.zip |
Support for big endian machines
A few byteswaps replaced by conditional byteswaps. Thanks to Andrew Peng
for providing access to a powerpc machine.
Diffstat (limited to 'src')
-rw-r--r-- | src/player.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/player.c b/src/player.c index 9a83256..18809bd 100644 --- a/src/player.c +++ b/src/player.c @@ -28,13 +28,13 @@ THE SOFTWARE. #include <math.h> #include <stdint.h> #include <limits.h> +#include <arpa/inet.h> #include "player.h" #include "config.h" #include "ui.h" -#define byteswap32(x) (((x >> 24) & 0x000000ff) | ((x >> 8) & 0x0000ff00) | \ - ((x << 8) & 0x00ff0000) | ((x << 24) & 0xff000000)) +#define bigToHostEndian32(x) ntohl(x) /* wait while locked, but don't slow down main thread by keeping * locks too long */ @@ -233,7 +233,7 @@ static WaitressCbReturn_t BarPlayerAACCb (void *ptr, size_t size, void *stream) if (player->sampleSizeN == 0) { /* mp4 uses big endian, convert */ player->sampleSizeN = - byteswap32 (*((int *) (player->buffer + + bigToHostEndian32 (*((int *) (player->buffer + player->bufferRead))); player->sampleSize = calloc (player->sampleSizeN, sizeof (player->sampleSizeN)); @@ -251,7 +251,7 @@ static WaitressCbReturn_t BarPlayerAACCb (void *ptr, size_t size, void *stream) break; } else { player->sampleSize[player->sampleSizeCurr] = - byteswap32 (*((int *) (player->buffer + + bigToHostEndian32 (*((int *) (player->buffer + player->bufferRead))); player->sampleSizeCurr++; player->bufferRead += 4; |