3 * BlueZ - Bluetooth protocol stack for Linux
5 * Copyright (C) 2006-2010 Nokia Corporation
6 * Copyright (C) 2004-2010 Marcel Holtmann <marcel@holtmann.org>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Lesser General Public
11 * License as published by the Free Software Foundation; either
12 * version 2.1 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Lesser General Public License for more details.
19 * You should have received a copy of the GNU Lesser General Public
20 * License along with this library; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 #define A2DP_CODEC_SBC 0x00
26 #define A2DP_CODEC_MPEG12 0x01
27 #define A2DP_CODEC_MPEG24 0x02
28 #define A2DP_CODEC_ATRAC 0x03
30 #define SBC_SAMPLING_FREQ_16000 (1 << 3)
31 #define SBC_SAMPLING_FREQ_32000 (1 << 2)
32 #define SBC_SAMPLING_FREQ_44100 (1 << 1)
33 #define SBC_SAMPLING_FREQ_48000 1
35 #define SBC_CHANNEL_MODE_MONO (1 << 3)
36 #define SBC_CHANNEL_MODE_DUAL_CHANNEL (1 << 2)
37 #define SBC_CHANNEL_MODE_STEREO (1 << 1)
38 #define SBC_CHANNEL_MODE_JOINT_STEREO 1
40 #define SBC_BLOCK_LENGTH_4 (1 << 3)
41 #define SBC_BLOCK_LENGTH_8 (1 << 2)
42 #define SBC_BLOCK_LENGTH_12 (1 << 1)
43 #define SBC_BLOCK_LENGTH_16 1
45 #define SBC_SUBBANDS_4 (1 << 1)
46 #define SBC_SUBBANDS_8 1
48 #define SBC_ALLOCATION_SNR (1 << 1)
49 #define SBC_ALLOCATION_LOUDNESS 1
51 #define MPEG_CHANNEL_MODE_MONO (1 << 3)
52 #define MPEG_CHANNEL_MODE_DUAL_CHANNEL (1 << 2)
53 #define MPEG_CHANNEL_MODE_STEREO (1 << 1)
54 #define MPEG_CHANNEL_MODE_JOINT_STEREO 1
56 #define MPEG_LAYER_MP1 (1 << 2)
57 #define MPEG_LAYER_MP2 (1 << 1)
58 #define MPEG_LAYER_MP3 1
60 #define MPEG_SAMPLING_FREQ_16000 (1 << 5)
61 #define MPEG_SAMPLING_FREQ_22050 (1 << 4)
62 #define MPEG_SAMPLING_FREQ_24000 (1 << 3)
63 #define MPEG_SAMPLING_FREQ_32000 (1 << 2)
64 #define MPEG_SAMPLING_FREQ_44100 (1 << 1)
65 #define MPEG_SAMPLING_FREQ_48000 1
67 #define MAX_BITPOOL 64
70 #if __BYTE_ORDER == __LITTLE_ENDIAN
73 uint8_t channel_mode:4;
75 uint8_t allocation_method:2;
77 uint8_t block_length:4;
80 } __attribute__ ((packed)) a2dp_sbc_t;
83 uint8_t channel_mode:4;
90 } __attribute__ ((packed)) a2dp_mpeg_t;
92 #elif __BYTE_ORDER == __BIG_ENDIAN
96 uint8_t channel_mode:4;
97 uint8_t block_length:4;
99 uint8_t allocation_method:2;
102 } __attribute__ ((packed)) a2dp_sbc_t;
107 uint8_t channel_mode:4;
112 } __attribute__ ((packed)) a2dp_mpeg_t;
115 #error "Unknown byte order"