diff options
author | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2008-10-25 15:28:50 +0200 |
---|---|---|
committer | Lars-Dominik Braun <PromyLOPh@lavabit.com> | 2008-10-25 15:28:50 +0200 |
commit | 5dd5ce54267d6d29704b05e23f05d2e3bcfc9c30 (patch) | |
tree | 0c0b90cb49d0fa60ccb17cff1e0fb814b79d9bdd /src | |
parent | 56b1686b8c27a0b01d0ae3f50615974d03574947 (diff) | |
download | pianobar-windows-5dd5ce54267d6d29704b05e23f05d2e3bcfc9c30.tar.gz pianobar-windows-5dd5ce54267d6d29704b05e23f05d2e3bcfc9c30.tar.bz2 pianobar-windows-5dd5ce54267d6d29704b05e23f05d2e3bcfc9c30.zip |
Use own byteswap implementation
pianobar can be compiled on NetBSD (and maybe others) now.
Diffstat (limited to 'src')
-rw-r--r-- | src/player.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/player.c b/src/player.c index 57fc443..d543547 100644 --- a/src/player.c +++ b/src/player.c @@ -26,11 +26,13 @@ THE SOFTWARE. #include <string.h> #include <math.h> #include <stdint.h> -#include <byteswap.h> #include "player.h" #include "config.h" +#define byteswap32(x) (((x >> 24) & 0x000000ff) | ((x >> 8) & 0x0000ff00) | \ + ((x << 8) & 0x00ff0000) | ((x << 24) & 0xff000000)) + /* FIXME: not the best solution to poll every second, but the easiest * one I know... (pthread's conditions could be another solution) */ #define QUIT_PAUSE_CHECK \ @@ -180,7 +182,8 @@ size_t BarPlayerCurlCb (void *ptr, size_t size, size_t nmemb, void *stream) { /* how many frames do we have? */ if (player->sampleSizeN == 0) { /* mp4 uses big endian, convert */ - player->sampleSizeN = bswap_32 (*((int *) (player->buffer + + player->sampleSizeN = + byteswap32 (*((int *) (player->buffer + player->bufferRead))); player->sampleSize = calloc (player->sampleSizeN, sizeof (player->sampleSizeN)); @@ -189,7 +192,7 @@ size_t BarPlayerCurlCb (void *ptr, size_t size, size_t nmemb, void *stream) { break; } else { player->sampleSize[player->sampleSizeCurr] = - bswap_32 (*((int *) (player->buffer + + byteswap32 (*((int *) (player->buffer + player->bufferRead))); player->sampleSizeCurr++; player->bufferRead += 4; |