1 /*
2  * Copyright 2016 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 //
18 // A2DP constants for AAC codec
19 //
20 
21 #ifndef A2DP_AAC_CONSTANTS_H
22 #define A2DP_AAC_CONSTANTS_H
23 
24 // AAC codec specific settings
25 #define A2DP_AAC_CODEC_LEN 8
26 
27 // [Octet 0] Object Type
28 #define A2DP_AAC_OBJECT_TYPE_MPEG2_LC 0x80  /* MPEG-2 Low Complexity */
29 #define A2DP_AAC_OBJECT_TYPE_MPEG4_LC 0x40  /* MPEG-4 Low Complexity */
30 #define A2DP_AAC_OBJECT_TYPE_MPEG4_LTP 0x20 /* MPEG-4 Long Term Prediction */
31 #define A2DP_AAC_OBJECT_TYPE_MPEG4_SCALABLE 0x10
32 // [Octet 1] Sampling Frequency - 8000 to 44100
33 #define A2DP_AAC_SAMPLING_FREQ_MASK0 0xFF
34 #define A2DP_AAC_SAMPLING_FREQ_8000 0x80
35 #define A2DP_AAC_SAMPLING_FREQ_11025 0x40
36 #define A2DP_AAC_SAMPLING_FREQ_12000 0x20
37 #define A2DP_AAC_SAMPLING_FREQ_16000 0x10
38 #define A2DP_AAC_SAMPLING_FREQ_22050 0x08
39 #define A2DP_AAC_SAMPLING_FREQ_24000 0x04
40 #define A2DP_AAC_SAMPLING_FREQ_32000 0x02
41 #define A2DP_AAC_SAMPLING_FREQ_44100 0x01
42 // [Octet 2], [Bits 4-7] Sampling Frequency - 48000 to 96000
43 // NOTE: Bits offset for the higher-order octet 16-bit integer
44 #define A2DP_AAC_SAMPLING_FREQ_MASK1 (0xF0 << 8)
45 #define A2DP_AAC_SAMPLING_FREQ_48000 (0x80 << 8)
46 #define A2DP_AAC_SAMPLING_FREQ_64000 (0x40 << 8)
47 #define A2DP_AAC_SAMPLING_FREQ_88200 (0x20 << 8)
48 #define A2DP_AAC_SAMPLING_FREQ_96000 (0x10 << 8)
49 // [Octet 2], [Bits 2-3] Channel Mode
50 #define A2DP_AAC_CHANNEL_MODE_MASK 0x0C
51 #define A2DP_AAC_CHANNEL_MODE_MONO 0x08
52 #define A2DP_AAC_CHANNEL_MODE_STEREO 0x04
53 // [Octet 2], [Bits 0-1] RFA
54 // [Octet 3], [Bit 7] Variable Bit Rate Supported
55 #define A2DP_AAC_VARIABLE_BIT_RATE_MASK 0x80
56 #define A2DP_AAC_VARIABLE_BIT_RATE_ENABLED 0x80
57 #define A2DP_AAC_VARIABLE_BIT_RATE_DISABLED 0x00
58 // [Octet 3], [Bits 0-6] Bit Rate - Bits 16-22 in the 23-bit UiMsbf
59 #define A2DP_AAC_BIT_RATE_MASK0 (0x7F << 16)
60 #define A2DP_AAC_BIT_RATE_MASK1 (0xFF << 8)
61 #define A2DP_AAC_BIT_RATE_MASK2 0xFF
62 // [Octet 4], [Bits 0-7] Bit Rate - Bits 8-15 in the 23-bit UiMsfb
63 // [Octet 5], [Bits 0-7] Bit Rate - Bits 0-7 in the 23-bit UiMsfb
64 
65 #endif  // A2DP_AAC_CONSTANTS_H
66