summaryrefslogtreecommitdiffstats
path: root/audio
diff options
context:
space:
mode:
authorLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-08-31 15:01:12 +0000
committerLuiz Augusto von Dentz <luiz.dentz@openbossa.org>2007-08-31 15:01:12 +0000
commite00800b81712635aade50201cfc3e6eca8b53ae0 (patch)
tree29a74e0a72b568a90b4fe51e36c905ba5dec60ff /audio
parent1778b4d041e6251d7411467a1db978730f8fdce0 (diff)
Fix endianess problem.
Diffstat (limited to 'audio')
-rw-r--r--audio/a2dp.h19
-rw-r--r--audio/avdtp.c4
-rw-r--r--audio/avdtp.h15
-rw-r--r--audio/pcm_bluetooth.c31
4 files changed, 67 insertions, 2 deletions
diff --git a/audio/a2dp.h b/audio/a2dp.h
index 6a966302..e0d1c2f6 100644
--- a/audio/a2dp.h
+++ b/audio/a2dp.h
@@ -47,6 +47,8 @@
#define A2DP_ALLOCATION_SNR (1 << 1)
#define A2DP_ALLOCATION_LOUDNESS 1
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
struct sbc_codec_cap {
struct avdtp_media_codec_capability cap;
uint8_t channel_mode:4;
@@ -58,6 +60,23 @@ struct sbc_codec_cap {
uint8_t max_bitpool;
} __attribute__ ((packed));
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+struct sbc_codec_cap {
+ struct avdtp_media_codec_capability cap;
+ uint8_t frequency:4;
+ uint8_t channel_mode:4;
+ uint8_t block_length:4;
+ uint8_t subbands:2;
+ uint8_t allocation_method:2;
+ uint8_t min_bitpool;
+ uint8_t max_bitpool;
+} __attribute__ ((packed));
+
+#else
+#error "Unknown byte order"
+#endif
+
struct a2dp_sep;
typedef void (*a2dp_stream_cb_t) (struct avdtp *session, struct a2dp_sep *sep,
diff --git a/audio/avdtp.c b/audio/avdtp.c
index a50b82b3..2d873bd4 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -238,10 +238,10 @@ struct seid_req {
struct setconf_req {
struct avdtp_header header;
- uint8_t int_seid:6;
- uint8_t rfa1:2;
uint8_t acp_seid:6;
uint8_t rfa0:2;
+ uint8_t int_seid:6;
+ uint8_t rfa1:2;
uint8_t caps[0];
} __attribute__ ((packed));
diff --git a/audio/avdtp.h b/audio/avdtp.h
index d8408ac0..e81bf496 100644
--- a/audio/avdtp.h
+++ b/audio/avdtp.h
@@ -79,6 +79,8 @@ struct avdtp_service_capability {
uint8_t data[0];
} __attribute__ ((packed));
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
struct avdtp_media_codec_capability {
uint8_t rfa0:4;
uint8_t media_type:4;
@@ -86,6 +88,19 @@ struct avdtp_media_codec_capability {
uint8_t data[0];
} __attribute__ ((packed));
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+struct avdtp_media_codec_capability {
+ uint8_t media_type:4;
+ uint8_t rfa0:4;
+ uint8_t media_codec_type;
+ uint8_t data[0];
+} __attribute__ ((packed));
+
+#else
+#error "Unknown byte order"
+#endif
+
typedef void (*avdtp_stream_state_cb) (struct avdtp_stream *stream,
avdtp_state_t old_state,
avdtp_state_t new_state,
diff --git a/audio/pcm_bluetooth.c b/audio/pcm_bluetooth.c
index 5a3b2317..bc962012 100644
--- a/audio/pcm_bluetooth.c
+++ b/audio/pcm_bluetooth.c
@@ -65,6 +65,8 @@
#define SCO_RXBUFS 0x04
#endif
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+
struct rtp_header {
uint8_t cc:4;
uint8_t x:1;
@@ -88,6 +90,35 @@ struct rtp_payload {
uint8_t is_fragmented:1;
} __attribute__ ((packed));
+#elif __BYTE_ORDER == __BIG_ENDIAN
+
+struct rtp_header {
+ uint8_t v:2;
+ uint8_t p:1;
+ uint8_t x:1;
+ uint8_t cc:4;
+
+ uint8_t m:1;
+ uint8_t pt:7;
+
+ uint16_t sequence_number;
+ uint32_t timestamp;
+ uint32_t ssrc;
+ uint32_t csrc[0];
+} __attribute__ ((packed));
+
+struct rtp_payload {
+ uint8_t is_fragmented:1;
+ uint8_t is_first_fragment:1;
+ uint8_t is_last_fragment:1;
+ uint8_t rfa0:1;
+ uint8_t frame_count:4;
+} __attribute__ ((packed));
+
+#else
+#error "Unknown byte order"
+#endif
+
struct bluetooth_a2dp {
sbc_t sbc; /* Codec data */
int codesize; /* SBC codesize */