From e00800b81712635aade50201cfc3e6eca8b53ae0 Mon Sep 17 00:00:00 2001 From: Luiz Augusto von Dentz Date: Fri, 31 Aug 2007 15:01:12 +0000 Subject: Fix endianess problem. --- audio/pcm_bluetooth.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'audio/pcm_bluetooth.c') 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 */ -- cgit