1 /* 2 * Copyright (c) 2023 Shenzhen Kaihong Digital Industry Development 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 OHOS_SHARING_ADTS_H 17 #define OHOS_SHARING_ADTS_H 18 19 #include <cstdint> 20 #include <string> 21 22 namespace OHOS { 23 namespace Sharing { 24 constexpr int32_t ADTS_HEADER_LEN = 7; 25 26 class AdtsHeader { 27 public: 28 static int32_t GetAacFrameLength(const uint8_t *data, size_t bytes); 29 30 static void ParseAacConfig(const std::string &config, AdtsHeader &adts); 31 32 static void DumpAdtsHeader(const AdtsHeader &hed, uint8_t *out); 33 static int32_t DumpAacConfig(const std::string &config, size_t length, uint8_t *out, size_t outSize); 34 35 public: 36 uint32_t id_ = 0; // 1 bslbf 37 uint32_t home_ = 0; // 1 bslbf 38 uint32_t layer_ = 0; // 2 uimsbf Indicates which layer is used. Set to ‘00’ 39 uint32_t profile_ = 0; // 2 uimsbf 40 uint32_t sfIndex_ = 0; // 4 uimsbf 41 uint32_t syncword_ = 0; // 12 bslbf The bit string ‘1111 1111 1111’ 42 uint32_t original_ = 0; // 1 bslbf 43 uint32_t privateBit_ = 0; // 1 bslbf 44 uint32_t aacFrameLength_ = 0; // 13 bslbf 45 uint32_t protectionAbsent_ = 0; // 1 bslbf 46 uint32_t adtsBufferFullness_ = 0; // 11 bslbf 47 uint32_t channelConfiguration_ = 0; // 3 uimsbf 48 uint32_t copyrightIdentificationBit_ = 0; // 1 bslbf 49 uint32_t copyrightIdentificationStart_ = 0; // 1 bslbf 50 uint32_t numberOfRawDataBlocksInFrame_ = 0; // 2 uimsfb 51 }; 52 } // namespace Sharing 53 } // namespace OHOS 54 #endif