github.com/cnotch/ipchub@v1.1.0/av/codec/aac/const.go (about) 1 // Copyright (c) 2019,CAOHONGJU All rights reserved. 2 // Use of this source code is governed by a MIT-style 3 // license that can be found in the LICENSE file. 4 5 package aac 6 7 import "sort" 8 9 const ( 10 // SamplesPerFrame 每帧采样数 11 SamplesPerFrame = 1024 12 ) 13 14 // Auido Object Type 15 const ( 16 AOT_NULL = iota ///< Support? Name 17 AOT_AAC_MAIN ///< Y Main 18 AOT_AAC_LC ///< Y Low Complexity 19 AOT_AAC_SSR ///< N (code in SoC repo) Scalable Sample Rate 20 AOT_AAC_LTP ///< Y Long Term Prediction 21 AOT_SBR ///< Y Spectral Band Replication HE-AAC 22 AOT_AAC_SCALABLE ///< N Scalable 23 AOT_TWINVQ ///< N Twin Vector Quantizer 24 AOT_CELP ///< N Code Excited Linear Prediction 25 AOT_HVXC ///< N Harmonic Vector eXcitation Coding 26 AOT_TTSI = 2 + iota ///< N(code = 12) Text-To-Speech Interface 27 AOT_MAINSYNTH ///< N Main Synthesis 28 AOT_WAVESYNTH ///< N Wavetable Synthesis 29 AOT_MIDI ///< N General MIDI 30 AOT_SAFX ///< N Algorithmic Synthesis and Audio Effects 31 AOT_ER_AAC_LC ///< N Error Resilient Low Complexity 32 AOT_ER_AAC_LTP = 3 + iota ///< N(code = 19) Error Resilient Long Term Prediction 33 AOT_ER_AAC_SCALABLE ///< N Error Resilient Scalable 34 AOT_ER_TWINVQ ///< N Error Resilient Twin Vector Quantizer 35 AOT_ER_BSAC ///< N Error Resilient Bit-Sliced Arithmetic Coding 36 AOT_ER_AAC_LD ///< N Error Resilient Low Delay 37 AOT_ER_CELP ///< N Error Resilient Code Excited Linear Prediction 38 AOT_ER_HVXC ///< N Error Resilient Harmonic Vector eXcitation Coding 39 AOT_ER_HILN ///< N Error Resilient Harmonic and Individual Lines plus Noise 40 AOT_ER_PARAM ///< N Error Resilient Parametric 41 AOT_SSC ///< N SinuSoidal Coding 42 AOT_PS ///< N Parametric Stereo 43 AOT_SURROUND ///< N MPEG Surround 44 AOT_ESCAPE ///< Y Escape Value 45 AOT_L1 ///< Y Layer 1 46 AOT_L2 ///< Y Layer 2 47 AOT_L3 ///< Y Layer 3 48 AOT_DST ///< N Direct Stream Transfer 49 AOT_ALS ///< Y Audio LosslesS 50 AOT_SLS ///< N Scalable LosslesS 51 AOT_SLS_NON_CORE ///< N Scalable LosslesS (non core) 52 AOT_ER_AAC_ELD ///< N Error Resilient Enhanced Low Delay 53 AOT_SMR_SIMPLE ///< N Symbolic Music Representation Simple 54 AOT_SMR_MAIN ///< N Symbolic Music Representation Main 55 AOT_USAC_NOSBR ///< N Unified Speech and Audio Coding (no SBR) 56 AOT_SAOC ///< N Spatial Audio Object Coding 57 AOT_LD_SURROUND ///< N Low Delay MPEG Surround 58 AOT_USAC ///< N Unified Speech and Audio Coding 59 ) 60 61 // AAC Profile 表示使用哪个级别的 AAC。 62 // 如 01 Low Complexity(LC) – AAC LC 63 const ( 64 ProfileMain = AOT_AAC_MAIN - 1 65 ProfileLow = AOT_AAC_LC - 1 66 ProfileSSR = AOT_AAC_SSR - 1 67 ProfileLTP = AOT_AAC_LTP - 1 68 ProfileHE = AOT_SBR - 1 69 ProfileLD = AOT_ER_AAC_LD - 1 70 ProfileHE2 = AOT_PS - 1 71 ProfileELD = AOT_ER_AAC_ELD - 1 72 ) 73 74 // AAC 采样频率 75 const ( 76 SampleRate96000 = iota // 0 77 SampleRate88200 // 1 78 SampleRate64000 // 2 79 SampleRate48000 // 3 80 SampleRate44100 // 4 81 SampleRate32000 // 5 82 SampleRate24000 // 6 83 SampleRate22050 // 7 84 SampleRate16000 // 8 85 SampleRate12000 // 9 86 SampleRate11025 // 10 87 SampleRate8000 // 11 88 SampleRate7350 // 12 89 ) 90 91 // SampleRate 获取采用频率具体值 92 func SampleRate(index int) int { 93 return SampleRates[index] 94 } 95 96 // SamplingIndex . 97 func SamplingIndex(rate int) int { 98 i := sort.Search(len(SampleRates), func(i int) bool { return SampleRates[i] <= rate }) 99 if i < len(SampleRates) && SampleRates[i] == rate { 100 return i 101 } 102 return -1 103 } 104 105 // SampleRates 采用频率集合 106 var SampleRates = [16]int{ 107 96000, 88200, 64000, 48000, 108 44100, 32000, 24000, 22050, 109 16000, 12000, 11025, 8000, 110 7350} 111 112 // ACC ChannelConfig 声道配置 113 // 0x00 - defined in audioDecderSpecificConfig 114 // 0x01 单声道(center front speaker) 115 // 0x02 双声道(left, right front speakers) 116 // 0x03 三声道(center, left, right front speakers) 117 // 0x04 四声道(center, left, right front speakers, rear surround speakers) 118 // 0x05 五声道(center, left, right front speakers, left surround, right surround rear speakers) 119 // 0x06 5.1声道(center, left, right front speakers, left surround, right surround rear speakers, front low frequency effects speaker) 120 // 0x07 7.1声道(center, left, right center front speakers, left, right outside front speakers, left surround, right surround rear speakers, front low frequency effects speaker) 121 // 0x08-0x0F - reserved 122 const ( 123 ChannelSpecific = iota // 0 124 ChannelMono // 1 125 ChannelStereo // 2 126 ChannelThree // 3 127 ChannelFour // 4 128 ChannelFive // 5 129 ChannelFivePlusOne // 6 130 ChannelSevenPlusOne // 7 131 ChannelReserved // 8 132 ) 133 134 var aacAudioChannels = [8]uint8{ 135 0, 1, 2, 3, 136 4, 5, 6, 8, 137 } 138 139 // 参数集索引 140 const ( 141 ParameterSetConfig = 0 142 )