1 /* 2 * Copyright (c) 2020 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 /** 17 * @addtogroup MultiMedia_MediaCommon 18 * @{ 19 * 20 * @brief Provides data types and media formats required for recording and playing audio and videos. 21 * 22 * 23 * @since 1.0 24 * @version 1.0 25 */ 26 27 /** 28 * @file media_info.h 29 * 30 * @brief Declares the <b>media_info</b> class and provides various audio, video, and codec types. 31 * 32 * 33 * @since 1.0 34 * @version 1.0 35 */ 36 37 #ifndef MEDIA_INFO_H 38 #define MEDIA_INFO_H 39 #include <string> 40 41 /** 42 * Indicates the constant quality mode. In this mode, the bit rate is not limited to guarantee the image quality to 43 * the largest extent. 44 */ 45 const int BITRATE_MODE_CQ = 0; 46 47 /** 48 * Indicates the variable bit rate mode. In this mode, the codec dynamically adjusts the output bit rate based on 49 * the image complexity. The codec increases the bit rate if the image is complex and decreases the bit rate if the 50 * image is simple. 51 */ 52 const int BITRATE_MODE_VBR = 1; 53 54 /** Indicates the constant bit rate mode. In this mode, the codec keeps the output bit rate as constant as possible. */ 55 const int BITRATE_MODE_CBR = 2; 56 57 /** Indicates the ARGB8888 color format. */ 58 const int32_t COLOR_FORMAT_ARGB8888_32BIT = 16; 59 60 /** Indicates the YUV420SP color format. */ 61 const int32_t COLOR_FORMAT_YUV420SP = 21; 62 63 64 /** 65 * @brief Enumerates audio source types. 66 * 67 * @since 1.0 68 * @version 1.0 69 */ 70 typedef enum { 71 /** Invalid audio source */ 72 AUDIO_SOURCE_INVALID = -1, 73 /** Default audio source */ 74 AUDIO_SOURCE_DEFAULT = 0, 75 /** Microphone */ 76 AUDIO_MIC = 1, 77 /** Uplink voice */ 78 AUDIO_VOICE_UPLINK = 2, 79 /** Downlink voice */ 80 AUDIO_VOICE_DOWNLINK = 3, 81 /** Voice call */ 82 AUDIO_VOICE_CALL = 4, 83 /** Camcorder */ 84 AUDIO_CAMCORDER = 5, 85 /** Voice recognition */ 86 AUDIO_VOICE_RECOGNITION = 6, 87 /** Voice communication */ 88 AUDIO_VOICE_COMMUNICATION = 7, 89 /** Remote submix */ 90 AUDIO_REMOTE_SUBMIX = 8, 91 /** Unprocessed audio */ 92 AUDIO_UNPROCESSED = 9, 93 /** Voice performance */ 94 AUDIO_VOICE_PERFORMANCE = 10, 95 /** Echo reference */ 96 AUDIO_ECHO_REFERENCE = 1997, 97 /** Radio tuner */ 98 AUDIO_RADIO_TUNER = 1998, 99 /** Hotword */ 100 AUDIO_HOTWORD = 1999, 101 /** Extended remote submix */ 102 AUDIO_REMOTE_SUBMIX_EXTEND = 10007, 103 } AudioSourceType; 104 105 /** 106 * @brief Defines the audio Device Descriptor. 107 * 108 * @since 1.0 109 * @version 1.0 110 */ 111 typedef struct { 112 /** Device name */ 113 std::string deviceName; 114 /** Type of the audio input source */ 115 AudioSourceType inputSourceType; 116 /** Bits 31-24: reserved bits; bits 23-16: mode ID; bits 15-8: device ID; bits 7-0: channel ID */ 117 uint32_t deviceId; 118 } AudioDeviceDesc; 119 120 /** 121 * @brief Enumerates audio stream types. 122 * 123 * @since 1.0 124 * @version 1.0 125 */ 126 typedef enum { 127 /** Default audio stream type */ 128 TYPE_DEFAULT = -1, 129 /** Media */ 130 TYPE_MEDIA = 0, 131 /** Voice call */ 132 TYPE_VOICE_COMMUNICATION = 1, 133 /** System sound */ 134 TYPE_SYSTEM = 2, 135 /** Ringtone */ 136 TYPE_RING = 3, 137 /** Music */ 138 TYPE_MUSIC = 4, 139 /** Alarm */ 140 TYPE_ALARM = 5, 141 /** Notification */ 142 TYPE_NOTIFICATION = 6, 143 /** Bluetooth Synchronous Connection-Oriented (SCO) */ 144 TYPE_BLUETOOTH_SCO = 7, 145 /** Enforced audible */ 146 TYPE_ENFORCED_AUDIBLE = 8, 147 /** Dual-tone multi-frequency (DTMF) */ 148 TYPE_DTMF = 9, 149 /** Text-To-Speech (TTS) */ 150 TYPE_TTS = 10, 151 /** Accessibility */ 152 TYPE_ACCESSIBILITY = 11, 153 } AudioStreamType; 154 155 /** 156 * @brief Enumerates video codec formats. 157 * 158 * @since 1.0 159 * @version 1.0 160 */ 161 typedef enum { 162 /** Default format */ 163 VIDEO_DEFAULT = 0, 164 /** H.264 */ 165 H264 = 2, 166 /** High Efficiency Video Coding (HEVC) */ 167 HEVC = 5, 168 } VideoCodecFormat; 169 170 /** 171 * @brief Enumerates audio codec formats. 172 * 173 * @since 1.0 174 * @version 1.0 175 */ 176 typedef enum { 177 /** Default format */ 178 AUDIO_DEFAULT = 0, 179 /** PCM */ 180 PCM = 1, 181 /** Advanced Audio Coding Low Complexity (AAC-LC) */ 182 AAC_LC = 2, 183 /** High-Efficiency Advanced Audio Coding (AAC-HE), previously known as AAC+ or aacPlus v1 */ 184 AAC_HE_V1 = 3, 185 /** AAC++ or aacPlus v2 */ 186 AAC_HE_V2 = 4, 187 /** Advanced Audio Coding Low Delay (AAC-LD) */ 188 AAC_LD = 5, 189 /** Advanced Audio Coding Enhanced Low Delay (AAC-ELD) */ 190 AAC_ELD = 6, 191 /** G711 a-law*/ 192 G711A = 7, 193 /** G711 u-law */ 194 G711U = 8, 195 /** G726 */ 196 G726 = 9, 197 /** Invalid value */ 198 FORMAT_BUTT, 199 } AudioCodecFormat; 200 201 /** 202 * @brief Enumerates audio bit widths. 203 * 204 * @since 1.0 205 * @version 1.0 206 */ 207 typedef enum { 208 /** 8-bit width */ 209 BIT_WIDTH_8 = 8, 210 /** 16-bit width */ 211 BIT_WIDTH_16 = 16, 212 /** 24-bit width */ 213 BIT_WIDTH_24 = 24, 214 /** 32-bit width */ 215 BIT_WIDTH_32 = 32, 216 /** Invalid value */ 217 BIT_WIDTH_BUTT, 218 } AudioBitWidth; 219 #endif // MEDIA_INFO_H 220