1/* 2 * Copyright (C) 2021 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 17syntax = "proto2"; 18 19package android.media.audio; 20 21// The Java AudioDeviceInfo device type. 22// 23// From 24// frameworks/base/media/java/android/media/AudioDeviceInfo.java 25enum AudioDeviceInfoType { 26 /** 27 * A device type associated with an unknown or uninitialized device. 28 */ 29 AUDIO_DEVICE_INFO_TYPE_UNKNOWN = 0; 30 /** 31 * A device type describing the attached earphone speaker. 32 */ 33 AUDIO_DEVICE_INFO_TYPE_BUILTIN_EARPIECE = 1; 34 /** 35 * A device type describing the speaker system (i.e. a mono speaker 36 * or stereo speakers) built in a device. 37 */ 38 AUDIO_DEVICE_INFO_TYPE_BUILTIN_SPEAKER = 2; 39 /** 40 * A device type describing a headset, which is the combination of 41 * a headphones and microphone. 42 */ 43 AUDIO_DEVICE_INFO_TYPE_WIRED_HEADSET = 3; 44 /** 45 * A device type describing a pair of wired headphones. 46 */ 47 AUDIO_DEVICE_INFO_TYPE_WIRED_HEADPHONES = 4; 48 /** 49 * A device type describing an analog line-level connection. 50 */ 51 AUDIO_DEVICE_INFO_TYPE_LINE_ANALOG = 5; 52 /** 53 * A device type describing a digital line connection (e.g. SPDIF). 54 */ 55 AUDIO_DEVICE_INFO_TYPE_LINE_DIGITAL = 6; 56 /** 57 * A device type describing a Bluetooth device typically used 58 * for telephony. 59 */ 60 AUDIO_DEVICE_INFO_TYPE_BLUETOOTH_SCO = 7; 61 /** 62 * A device type describing a Bluetooth device supporting the A2DP profile. 63 */ 64 AUDIO_DEVICE_INFO_TYPE_BLUETOOTH_A2DP = 8; 65 /** 66 * A device type describing an HDMI connection . 67 */ 68 AUDIO_DEVICE_INFO_TYPE_HDMI = 9; 69 /** 70 * A device type describing the Audio Return Channel of an HDMI connection. 71 */ 72 AUDIO_DEVICE_INFO_TYPE_HDMI_ARC = 10; 73 /** 74 * A device type describing a USB audio device. 75 */ 76 AUDIO_DEVICE_INFO_TYPE_USB_DEVICE = 11; 77 /** 78 * A device type describing a USB audio device in accessory mode. 79 */ 80 AUDIO_DEVICE_INFO_TYPE_USB_ACCESSORY = 12; 81 /** 82 * A device type describing the audio device associated with a dock. 83 */ 84 AUDIO_DEVICE_INFO_TYPE_DOCK = 13; 85 /** 86 * A device type associated with the transmission of audio signals over FM. 87 */ 88 AUDIO_DEVICE_INFO_TYPE_FM = 14; 89 /** 90 * A device type describing the microphone(s) built in a device. 91 */ 92 AUDIO_DEVICE_INFO_TYPE_BUILTIN_MIC = 15; 93 /** 94 * A device type for accessing the audio content transmitted over FM. 95 */ 96 AUDIO_DEVICE_INFO_TYPE_FM_TUNER = 16; 97 /** 98 * A device type for accessing the audio content transmitted 99 * over the TV tuner system. 100 */ 101 AUDIO_DEVICE_INFO_TYPE_TV_TUNER = 17; 102 /** 103 * A device type describing the transmission of audio signals 104 * over the telephony network. 105 */ 106 AUDIO_DEVICE_INFO_TYPE_TELEPHONY = 18; 107 /** 108 * A device type describing the auxiliary line-level connectors. 109 */ 110 AUDIO_DEVICE_INFO_TYPE_AUX_LINE = 19; 111 /** 112 * A device type connected over IP. 113 */ 114 AUDIO_DEVICE_INFO_TYPE_IP = 20; 115 /** 116 * A type-agnostic device used for communication with 117 * external audio systems 118 */ 119 AUDIO_DEVICE_INFO_TYPE_BUS = 21; 120 /** 121 * A device type describing a USB audio headset. 122 */ 123 AUDIO_DEVICE_INFO_TYPE_USB_HEADSET = 22; 124 /** 125 * A device type describing a Hearing Aid. 126 */ 127 AUDIO_DEVICE_INFO_TYPE_HEARING_AID = 23; 128 /** 129 * A device type describing the speaker system (i.e. a mono speaker 130 * or stereo speakers) built in a device, that is specifically tuned 131 * for outputting sounds like notifications and alarms 132 * (i.e. sounds the user couldn't necessarily anticipate). 133 * <p>Note that this physical audio device may be the same as 134 * {@link #TYPE_BUILTIN_SPEAKER} but is driven differently to safely 135 * accommodate the different use case.</p> 136 */ 137 AUDIO_DEVICE_INFO_TYPE_BUILTIN_SPEAKER_SAFE = 24; 138 /** 139 * A device type for rerouting audio within the Android framework between 140 * mixes and system applications. 141 * This type is for instance encountered when querying the output device 142 * of a track (with {@link AudioTrack#getRoutedDevice()} playing from 143 * a device in screen mirroring mode, where the audio is not heard on the 144 * device, but on the remote device. 145 */ 146 AUDIO_DEVICE_INFO_TYPE_REMOTE_SUBMIX = 25; 147 148 /** 149 * A device type describing a Bluetooth Low Energy (BLE) audio headset 150 * or headphones. Headphones are grouped with headsets when the device 151 * is a sink: the features of headsets and headphones with regard to 152 * playback are the same. 153 */ 154 AUDIO_DEVICE_INFO_TYPE_BLE_HEADSET = 26; 155 156 /** 157 * A device type describing a Bluetooth Low Energy (BLE) audio speaker. 158 */ 159 AUDIO_DEVICE_INFO_TYPE_BLE_SPEAKER = 27; 160 161 /** 162 * A device type describing an Echo Canceller loopback Reference. 163 * This device is only used when capturing with 164 * MediaRecorder.AudioSource.ECHO_REFERENCE, 165 * which requires privileged permission. 166 * @hide */ 167 168 AUDIO_DEVICE_INFO_TYPE_ECHO_REFERENCE = 28; 169 170 /** 171 * A device type describing the Enhanced Audio Return Channel 172 * of an HDMI connection. 173 */ 174 AUDIO_DEVICE_INFO_TYPE_HDMI_EARC = 29; 175 176 /** 177 * A device type describing a Bluetooth Low Energy (BLE) broadcast group. 178 */ 179 AUDIO_DEVICE_INFO_TYPE_BLE_BROADCAST = 30; 180} 181 182// The event (method) associated with the AudioRecord (e.g. create, start, 183// stop, etc.) 184enum AudioRecordEvent { 185 AUDIO_RECORD_EVENT_UNKNOWN = 0; 186 AUDIO_RECORD_EVENT_CREATE = 1; 187} 188 189// The event (method) associated with the AudioTrack (e.g. create, start, 190// pause, etc.) 191enum AudioTrackEvent { 192 AUDIO_TRACK_EVENT_UNKNOWN = 0; 193 AUDIO_TRACK_EVENT_CREATE = 1; 194} 195 196// An enumeration from system/media/audio/include/system/audio-hal-enums.h 197// audio_content_type_t, representing the content type of the AudioTrack. 198enum ContentType { 199 // Note: The first value in an enum must map to zero. 200 // Mapping the first value to zero ensures the default behavior 201 // is consistent between proto2 and proto3. 202 CONTENT_TYPE_UNKNOWN = 0; 203 CONTENT_TYPE_INVALID = -1; 204 CONTENT_TYPE_SPEECH = 1; 205 CONTENT_TYPE_MUSIC = 2; 206 CONTENT_TYPE_MOVIE = 3; 207 CONTENT_TYPE_SONIFICATION = 4; 208} 209 210// An enumeration from system/media/audio/include/system/audio-hal-enums.h 211// audio_format_t, representing the encoding of the AudioTrack data. 212enum Encoding { 213 // AUDIO_FORMAT_DEFAULT may alias as UNKNOWN if enum value not listed below. 214 AUDIO_FORMAT_DEFAULT = 0; 215 AUDIO_FORMAT_PCM_16_BIT = 0x1; 216 AUDIO_FORMAT_PCM_8_BIT = 0x2; 217 AUDIO_FORMAT_PCM_32_BIT = 0x3; 218 AUDIO_FORMAT_PCM_8_24_BIT = 0x4; 219 AUDIO_FORMAT_PCM_FLOAT = 0x5; 220 AUDIO_FORMAT_PCM_24_BIT_PACKED = 0x6; 221 AUDIO_FORMAT_MP3 = 0x1000000; 222 AUDIO_FORMAT_AMR_NB = 0x2000000; 223 AUDIO_FORMAT_AMR_WB = 0x3000000; 224 AUDIO_FORMAT_AAC = 0x4000000; 225 AUDIO_FORMAT_AAC_MAIN = 0x4000001; 226 AUDIO_FORMAT_AAC_LC = 0x4000002; 227 AUDIO_FORMAT_AAC_SSR = 0x4000004; 228 AUDIO_FORMAT_AAC_LTP = 0x4000008; 229 AUDIO_FORMAT_AAC_HE_V1 = 0x4000010; 230 AUDIO_FORMAT_AAC_SCALABLE = 0x4000020; 231 AUDIO_FORMAT_AAC_ERLC = 0x4000040; 232 AUDIO_FORMAT_AAC_LD = 0x4000080; 233 AUDIO_FORMAT_AAC_HE_V2 = 0x4000100; 234 AUDIO_FORMAT_AAC_ELD = 0x4000200; 235 AUDIO_FORMAT_AAC_XHE = 0x4000300; 236 AUDIO_FORMAT_HE_AAC_V1 = 0x5000000; 237 AUDIO_FORMAT_HE_AAC_V2 = 0x6000000; 238 AUDIO_FORMAT_VORBIS = 0x7000000; 239 AUDIO_FORMAT_OPUS = 0x8000000; 240 AUDIO_FORMAT_AC3 = 0x9000000; 241 AUDIO_FORMAT_E_AC3 = 0xa000000; 242 AUDIO_FORMAT_E_AC3_JOC = 0xa000001; 243 AUDIO_FORMAT_DTS = 0xb000000; 244 AUDIO_FORMAT_DTS_HD = 0xc000000; 245 AUDIO_FORMAT_IEC61937 = 0xd000000; 246 AUDIO_FORMAT_DOLBY_TRUEHD = 0xe000000; 247 AUDIO_FORMAT_EVRC = 0x10000000; 248 AUDIO_FORMAT_EVRCB = 0x11000000; 249 AUDIO_FORMAT_EVRCWB = 0x12000000; 250 AUDIO_FORMAT_EVRCNW = 0x13000000; 251 AUDIO_FORMAT_AAC_ADIF = 0x14000000; 252 AUDIO_FORMAT_WMA = 0x15000000; 253 AUDIO_FORMAT_WMA_PRO = 0x16000000; 254 AUDIO_FORMAT_AMR_WB_PLUS = 0x17000000; 255 AUDIO_FORMAT_MP2 = 0x18000000; 256 AUDIO_FORMAT_QCELP = 0x19000000; 257 AUDIO_FORMAT_DSD = 0x1a000000; 258 AUDIO_FORMAT_FLAC = 0x1b000000; 259 AUDIO_FORMAT_ALAC = 0x1c000000; 260 AUDIO_FORMAT_APE = 0x1d000000; 261 AUDIO_FORMAT_AAC_ADTS = 0x1e000000; 262 AUDIO_FORMAT_AAC_ADTS_MAIN = 0x1e000001; 263 AUDIO_FORMAT_AAC_ADTS_LC = 0x1e000002; 264 AUDIO_FORMAT_AAC_ADTS_SSR = 0x1e000004; 265 AUDIO_FORMAT_AAC_ADTS_LTP = 0x1e000008; 266 AUDIO_FORMAT_AAC_ADTS_HE_V1 = 0x1e000010; 267 AUDIO_FORMAT_AAC_ADTS_SCALABLE = 0x1e000020; 268 AUDIO_FORMAT_AAC_ADTS_ERLC = 0x1e000040; 269 AUDIO_FORMAT_AAC_ADTS_LD = 0x1e000080; 270 AUDIO_FORMAT_AAC_ADTS_HE_V2 = 0x1e000100; 271 AUDIO_FORMAT_AAC_ADTS_ELD = 0x1e000200; 272 AUDIO_FORMAT_AAC_ADTS_XHE = 0x1e000300; 273 AUDIO_FORMAT_SBC = 0x1f000000; 274 AUDIO_FORMAT_APTX = 0x20000000; 275 AUDIO_FORMAT_APTX_HD = 0x21000000; 276 AUDIO_FORMAT_AC4 = 0x22000000; 277 AUDIO_FORMAT_LDAC = 0x23000000; 278 AUDIO_FORMAT_MAT = 0x24000000; 279 AUDIO_FORMAT_MAT_1_0 = 0x24000001; 280 AUDIO_FORMAT_MAT_2_0 = 0x24000002; 281 AUDIO_FORMAT_MAT_2_1 = 0x24000003; 282 AUDIO_FORMAT_AAC_LATM = 0x25000000; 283 AUDIO_FORMAT_AAC_LATM_LC = 0x25000002; 284 AUDIO_FORMAT_AAC_LATM_HE_V1 = 0x25000010; 285 AUDIO_FORMAT_AAC_LATM_HE_V2 = 0x25000100; 286 AUDIO_FORMAT_CELT = 0x26000000; 287 AUDIO_FORMAT_APTX_ADAPTIVE = 0x27000000; 288 AUDIO_FORMAT_LHDC = 0x28000000; 289 AUDIO_FORMAT_LHDC_LL = 0x29000000; 290 AUDIO_FORMAT_APTX_TWSP = 0x2a000000; 291 AUDIO_FORMAT_LC3 = 0x2b000000; 292 AUDIO_FORMAT_MPEGH = 0x2c000000; 293 AUDIO_FORMAT_MPEGH_BL_L3 = 0x2c000013; 294 AUDIO_FORMAT_MPEGH_BL_L4 = 0x2c000014; 295 AUDIO_FORMAT_MPEGH_LC_L3 = 0x2c000023; 296 AUDIO_FORMAT_MPEGH_LC_L4 = 0x2c000024; 297 AUDIO_FORMAT_IEC60958 = 0x2d000000; 298 AUDIO_FORMAT_DTS_UHD = 0x2e000000; 299 AUDIO_FORMAT_DRA = 0x2f000000; 300} 301 302// Spatializer HeadTracking modes 303// See: 304// frameworks/base/media/java/android/media/Spatializer.java 305// frameworks/av/media/libaudioclient/aidl/android/media/SpatializerHeadTrackingMode.aidl 306enum HeadTrackingMode { 307 HEAD_TRACKING_MODE_OTHER = 0; 308 HEAD_TRACKING_MODE_DISABLED = -1; 309 HEAD_TRACKING_MODE_RELATIVE_WORLD = 1; 310 HEAD_TRACKING_MODE_RELATIVE_SCREEN = 2; 311} 312 313// An enumeration from system/media/audio/include/system/audio-hal-enums.h 314// audio_source_t, representing the input source for the AudioRecord. 315// Keep in sync with audio-hal-enums.h. 316enum Source { 317 // Note: The first value in an enum must map to zero. 318 // Mapping the first value to zero ensures the default behavior 319 // is consistent between proto2 and proto3. 320 AUDIO_SOURCE_DEFAULT = 0; // may alias as UNKNOWN 321 AUDIO_SOURCE_INVALID = -1; 322 AUDIO_SOURCE_MIC = 1; 323 AUDIO_SOURCE_VOICE_UPLINK = 2; 324 AUDIO_SOURCE_VOICE_DOWNLINK = 3; 325 AUDIO_SOURCE_VOICE_CALL = 4; 326 AUDIO_SOURCE_CAMCORDER = 5; 327 AUDIO_SOURCE_VOICE_RECOGNITION = 6; 328 AUDIO_SOURCE_VOICE_COMMUNICATION = 7; 329 AUDIO_SOURCE_REMOTE_SUBMIX = 8; 330 AUDIO_SOURCE_UNPROCESSED = 9; 331 AUDIO_SOURCE_VOICE_PERFORMANCE = 10; 332 AUDIO_SOURCE_ECHO_REFERENCE = 1997; 333 AUDIO_SOURCE_FM_TUNER = 1998; 334 AUDIO_SOURCE_HOTWORD = 1999; 335} 336 337// Spatializer capability levels 338// See: 339// frameworks/base/media/java/android/media/Spatializer.java 340// frameworks/av/media/libaudioclient/aidl/android/media/SpatializationLevel.aidl 341enum SpatializerLevel { 342 SPATIALIZER_LEVEL_NONE = 0; 343 SPATIALIZER_LEVEL_MULTICHANNEL = 1; 344 SPATIALIZER_LEVEL_MCHAN_BED_PLUS_OBJECTS = 2; 345} 346 347// Spatializer modes 348// See: 349// frameworks/av/media/libaudioclient/aidl/android/media/SpatializationMode.aidl 350enum SpatializerMode { 351 SPATIALIZER_MODE_BINAURAL = 0; 352 SPATIALIZER_MODE_TRANSAURAL = 1; 353} 354 355// Spatialization settings change may be due to special events. 356enum SpatializerSettingEvent { 357 SPATIALIZER_SETTING_EVENT_NORMAL = 0; // Change during normal operation: 358 // e.g. System UI or sensor device change 359 // see the atom for more details. 360 SPATIALIZER_SETTING_EVENT_BOOT = 1; // On boot-up. 361 SPATIALIZER_SETTING_EVENT_FIRST = 2; // First time for a removable device. 362} 363 364// An enumeration from system/media/audio/include/system/audio-hal-enums.h 365// audio_usage_t, representing the use case for the AudioTrack. 366enum Usage { 367 AUDIO_USAGE_UNKNOWN = 0; 368 AUDIO_USAGE_MEDIA = 1; 369 AUDIO_USAGE_VOICE_COMMUNICATION = 2; 370 AUDIO_USAGE_VOICE_COMMUNICATION_SIGNALLING = 3; 371 AUDIO_USAGE_ALARM = 4; 372 AUDIO_USAGE_NOTIFICATION = 5; 373 AUDIO_USAGE_NOTIFICATION_TELEPHONY_RINGTONE = 6; 374 AUDIO_USAGE_NOTIFICATION_EVENT = 10; 375 AUDIO_USAGE_ASSISTANCE_ACCESSIBILITY = 11; 376 AUDIO_USAGE_ASSISTANCE_NAVIGATION_GUIDANCE = 12; 377 AUDIO_USAGE_ASSISTANCE_SONIFICATION = 13; 378 AUDIO_USAGE_GAME = 14; 379 AUDIO_USAGE_VIRTUAL_SOURCE = 15; 380 AUDIO_USAGE_ASSISTANT = 16; 381 AUDIO_USAGE_CALL_ASSISTANT = 17; 382 AUDIO_USAGE_EMERGENCY = 1000; 383 AUDIO_USAGE_SAFETY = 1001; 384 AUDIO_USAGE_VEHICLE_STATUS = 1002; 385 AUDIO_USAGE_ANNOUNCEMENT = 1003; 386} 387