1 /* 2 * 3 * BlueZ - Bluetooth protocol stack for Linux 4 * 5 * Copyright (C) 2006-2010 Nokia Corporation 6 * Copyright (C) 2004-2010 Marcel Holtmann <marcel (at) holtmann.org> 7 * 8 * 9 * This program is free software; you can redistribute it and/or modify 10 * it under the terms of the GNU General Public License as published by 11 * the Free Software Foundation; either version 2 of the License, or 12 * (at your option) any later version. 13 * 14 * This program 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 17 * GNU General Public License for more details. 18 * 19 * You should have received a copy of the GNU General Public License 20 * along with this program; if not, write to the Free Software 21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 22 * 23 */ 24 25 #define A2DP_CODEC_SBC 0x00 26 #define A2DP_CODEC_MPEG12 0x01 27 #define A2DP_CODEC_MPEG24 0x02 28 #define A2DP_CODEC_ATRAC 0x03 29 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 34 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 39 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 44 45 #define SBC_SUBBANDS_4 (1 << 1) 46 #define SBC_SUBBANDS_8 1 47 48 #define SBC_ALLOCATION_SNR (1 << 1) 49 #define SBC_ALLOCATION_LOUDNESS 1 50 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 55 56 #define MPEG_LAYER_MP1 (1 << 2) 57 #define MPEG_LAYER_MP2 (1 << 1) 58 #define MPEG_LAYER_MP3 1 59 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 66 67 #define MAX_BITPOOL 64 68 #define MIN_BITPOOL 2 69 70 #if __BYTE_ORDER == __LITTLE_ENDIAN 71 72 typedef struct { 73 uint8_t channel_mode:4; 74 uint8_t frequency:4; 75 uint8_t allocation_method:2; 76 uint8_t subbands:2; 77 uint8_t block_length:4; 78 uint8_t min_bitpool; 79 uint8_t max_bitpool; 80 } __attribute__ ((packed)) a2dp_sbc_t; 81 82 typedef struct { 83 uint8_t channel_mode:4; 84 uint8_t crc:1; 85 uint8_t layer:3; 86 uint8_t frequency:6; 87 uint8_t mpf:1; 88 uint8_t rfa:1; 89 uint16_t bitrate; 90 } __attribute__ ((packed)) a2dp_mpeg_t; 91 92 #elif __BYTE_ORDER == __BIG_ENDIAN 93 94 typedef struct { 95 uint8_t frequency:4; 96 uint8_t channel_mode:4; 97 uint8_t block_length:4; 98 uint8_t subbands:2; 99 uint8_t allocation_method:2; 100 uint8_t min_bitpool; 101 uint8_t max_bitpool; 102 } __attribute__ ((packed)) a2dp_sbc_t; 103 104 typedef struct { 105 uint8_t layer:3; 106 uint8_t crc:1; 107 uint8_t channel_mode:4; 108 uint8_t rfa:1; 109 uint8_t mpf:1; 110 uint8_t frequency:6; 111 uint16_t bitrate; 112 } __attribute__ ((packed)) a2dp_mpeg_t; 113 114 #else 115 #error "Unknown byte order" 116 #endif 117