summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libpiano/src/crypt.c6
-rw-r--r--src/player.c9
2 files changed, 10 insertions, 5 deletions
diff --git a/libpiano/src/crypt.c b/libpiano/src/crypt.c
index 7e2bb80..475a1ce 100644
--- a/libpiano/src/crypt.c
+++ b/libpiano/src/crypt.c
@@ -23,12 +23,14 @@ THE SOFTWARE.
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
-#include <byteswap.h>
#include "crypt_key_output.h"
#include "crypt_key_input.h"
#include "main.h"
+#define byteswap32(x) (((x >> 24) & 0x000000ff) | ((x >> 8) & 0x0000ff00) | \
+ ((x << 8) & 0x00ff0000) | ((x << 24) & 0xff000000))
+
/* hex string to array of unsigned int values
* @param hex string
* @param return array
@@ -103,7 +105,7 @@ char *PianoIntsToString (const unsigned int *arrInts, size_t arrIntsN) {
/* map string to 4-byte int */
tmp = (unsigned int *) &strDecoded[i*4];
/* FIXME: big endian does not need to byteswap */
- *tmp = bswap_32 (arrInts[i]);
+ *tmp = byteswap32 (arrInts[i]);
}
return strDecoded;
}
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;