1 /* 2 * Copyright (c) 2021-2021 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 #ifndef HISTREAMER_PLUGIN_COMMON_AUDIO_TAGS_H 17 #define HISTREAMER_PLUGIN_COMMON_AUDIO_TAGS_H 18 19 #include <cstdint> // NOLINT: used it 20 21 namespace OHOS { 22 namespace Media { 23 namespace Plugin { 24 /** 25 * @enum Audio Channel Masks 26 * 27 * A 64-bit integer with bits set for each channel. 28 * 29 * @since 1.0 30 * @version 1.0 31 */ 32 enum AudioChannelMasks : uint64_t { 33 FRONT_LEFT = 1ULL << 0U, 34 FRONT_RIGHT = 1ULL << 1U, 35 FRONT_CENTER = 1ULL << 2U, 36 LOW_FREQUENCY = 1ULL << 3U, 37 BACK_LEFT = 1ULL << 4U, 38 BACK_RIGHT = 1ULL << 5U, 39 FRONT_LEFT_OF_CENTER = 1ULL << 6U, 40 FRONT_RIGHT_OF_CENTER = 1ULL << 7U, 41 BACK_CENTER = 1ULL << 8U, 42 SIDE_LEFT = 1ULL << 9U, 43 SIDE_RIGHT = 1ULL << 10U, 44 TOP_CENTER = 1ULL << 11U, 45 TOP_FRONT_LEFT = 1ULL << 12U, 46 TOP_FRONT_CENTER = 1ULL << 13U, 47 TOP_FRONT_RIGHT = 1ULL << 14U, 48 TOP_BACK_LEFT = 1ULL << 15U, 49 TOP_BACK_CENTER = 1ULL << 16U, 50 TOP_BACK_RIGHT = 1ULL << 17U, 51 STEREO_LEFT = 1ULL << 29U, 52 STEREO_RIGHT = 1ULL << 30U, 53 WIDE_LEFT = 1ULL << 31U, 54 WIDE_RIGHT = 1ULL << 32U, 55 }; 56 57 58 /** 59 * @enum Audio Channel Layout 60 * 61 * Indicates that the channel order in which the user requests decoder output 62 * is the native codec channel order. 63 * 64 * @since 1.0 65 * @version 1.0 66 */ 67 enum struct AudioChannelLayout : uint64_t { 68 MONO = (AudioChannelMasks::FRONT_CENTER), 69 STEREO = (AudioChannelMasks::FRONT_LEFT | AudioChannelMasks::FRONT_RIGHT), 70 CH_2POINT1 = (STEREO | AudioChannelMasks::LOW_FREQUENCY), 71 CH_2_1 = (STEREO | AudioChannelMasks::BACK_CENTER), 72 SURROUND = (STEREO | AudioChannelMasks::FRONT_CENTER), 73 CH_3POINT1 = (SURROUND | AudioChannelMasks::LOW_FREQUENCY), 74 CH_4POINT0 = (SURROUND | AudioChannelMasks::BACK_CENTER), 75 CH_4POINT1 = (CH_4POINT0 | AudioChannelMasks::LOW_FREQUENCY), 76 CH_2_2 = (STEREO | AudioChannelMasks::SIDE_LEFT | AudioChannelMasks::SIDE_RIGHT), 77 QUAD = (STEREO | AudioChannelMasks::BACK_LEFT | AudioChannelMasks::BACK_RIGHT), 78 CH_5POINT0 = (SURROUND | AudioChannelMasks::SIDE_LEFT | AudioChannelMasks::SIDE_RIGHT), 79 CH_5POINT1 = (CH_5POINT0 | AudioChannelMasks::LOW_FREQUENCY), 80 CH_5POINT0_BACK = (SURROUND | AudioChannelMasks::BACK_LEFT | AudioChannelMasks::BACK_RIGHT), 81 CH_5POINT1_BACK = (CH_5POINT0_BACK | AudioChannelMasks::LOW_FREQUENCY), 82 CH_6POINT0 = (CH_5POINT0 | AudioChannelMasks::BACK_CENTER), 83 CH_6POINT0_FRONT = (CH_2_2 | AudioChannelMasks::FRONT_LEFT_OF_CENTER | 84 AudioChannelMasks::FRONT_RIGHT_OF_CENTER), 85 HEXAGONAL = (CH_5POINT0_BACK | AudioChannelMasks::BACK_CENTER), 86 CH_6POINT1 = (CH_5POINT1 | AudioChannelMasks::BACK_CENTER), 87 CH_6POINT1_BACK = (CH_5POINT1_BACK | AudioChannelMasks::BACK_CENTER), 88 CH_6POINT1_FRONT = (CH_6POINT0_FRONT | AudioChannelMasks::LOW_FREQUENCY), 89 CH_7POINT0 = (CH_5POINT0 | AudioChannelMasks::BACK_LEFT | AudioChannelMasks::BACK_RIGHT), 90 CH_7POINT0_FRONT = (CH_5POINT0 | AudioChannelMasks::FRONT_LEFT_OF_CENTER | 91 AudioChannelMasks::FRONT_RIGHT_OF_CENTER), 92 CH_7POINT1 = (CH_5POINT1 | AudioChannelMasks::BACK_LEFT | AudioChannelMasks::BACK_RIGHT), 93 CH_7POINT1_WIDE = (CH_5POINT1 | AudioChannelMasks::FRONT_LEFT_OF_CENTER | 94 AudioChannelMasks::FRONT_RIGHT_OF_CENTER), 95 CH_7POINT1_WIDE_BACK = (CH_5POINT1_BACK | AudioChannelMasks::FRONT_LEFT_OF_CENTER | 96 AudioChannelMasks::FRONT_RIGHT_OF_CENTER), 97 OCTAGONAL = (CH_5POINT0 | AudioChannelMasks::BACK_LEFT | AudioChannelMasks::BACK_CENTER | 98 AudioChannelMasks::BACK_RIGHT), 99 HEXADECAGONAL = (OCTAGONAL | AudioChannelMasks::WIDE_LEFT | AudioChannelMasks::WIDE_RIGHT | 100 AudioChannelMasks::TOP_BACK_LEFT | AudioChannelMasks::TOP_BACK_RIGHT | 101 AudioChannelMasks::TOP_BACK_CENTER | AudioChannelMasks::TOP_FRONT_CENTER | 102 AudioChannelMasks::TOP_FRONT_LEFT | AudioChannelMasks::TOP_FRONT_RIGHT), 103 STEREO_DOWNMIX = (AudioChannelMasks::STEREO_LEFT | AudioChannelMasks::STEREO_RIGHT), 104 }; 105 106 /** 107 * @enum Audio sample formats 108 * 109 * 'S' is signed, 'U' is unsigned, and 'F' is a floating-point number. 110 * 'P' is planes, default is interleaved. 111 * 112 * @since 1.0 113 * @version 1.0 114 */ 115 enum struct AudioSampleFormat : uint8_t { 116 /* 8 bit */ 117 S8, U8, S8P, U8P, 118 /* 16 bit */ 119 S16, U16, S16P, U16P, 120 /* 24 bit */ 121 S24, U24, S24P, U24P, 122 /* 32 bit */ 123 S32, U32, S32P, U32P, 124 /* 64 bit */ 125 S64, U64, S64P, U64P, 126 /* float double */ 127 F32, F32P, F64, F64P, 128 }; 129 130 /** 131 * @enum Audio AAC Profile。 132 * 133 * AAC mode type. Note that the term profile is used with the MPEG-2 134 * standard and the term object type and profile is used with MPEG-4 135 * 136 * @since 1.0 137 * @version 1.0 138 */ 139 enum struct AudioAacProfile : uint8_t { 140 NONE = 0, ///< Null, not used 141 MAIN = 1, ///< AAC Main object 142 LC, ///< AAC Low Complexity object (AAC profile) 143 SSR, ///< AAC Scalable Sample Rate object 144 LTP, ///< AAC Long Term Prediction object 145 HE, ///< AAC High Efficiency (object type SBR, HE-AAC profile) 146 SCALABLE, ///< AAC Scalable object 147 ERLC = 17, ///< ER AAC Low Complexity object (Error Resilient AAC-LC) 148 ER_SCALABLE = 20, ///< ER AAC scalable object 149 LD = 23, ///< AAC Low Delay object (Error Resilient) 150 HE_PS = 29, ///< AAC High Efficiency with Parametric Stereo coding (HE-AAC v2, object type PS) 151 ELD = 39, ///< AAC Enhanced Low Delay. NOTE: Pending Khronos standardization 152 XHE = 42, ///< extended High Efficiency AAC. NOTE: Pending Khronos standardization 153 }; 154 155 /** 156 * @enum Audio AAC Stream Format 157 * 158 * @since 1.0 159 * @version 1.0 160 */ 161 enum struct AudioAacStreamFormat : uint8_t { 162 MP2ADTS = 0, ///< AAC Audio Data Transport Stream 2 format 163 MP4ADTS, ///< AAC Audio Data Transport Stream 4 format 164 MP4LOAS, ///< AAC Low Overhead Audio Stream format 165 MP4LATM, ///< AAC Low overhead Audio Transport Multiplex 166 ADIF, ///< AAC Audio Data Interchange Format 167 MP4FF, ///< AAC inside MPEG-4/ISO File Format 168 RAW, ///< AAC Raw Format 169 }; 170 } // namespace Plugin 171 } // namespace Media 172 } // namespace OHOS 173 #endif // HISTREAMER_PLUGIN_COMMON_AUDIO_TAGS_H 174