150a07fd2Sopenharmony_ci/* 250a07fd2Sopenharmony_ci * Copyright (c) 2022 Huawei Device Co., Ltd. 350a07fd2Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 450a07fd2Sopenharmony_ci * you may not use this file except in compliance with the License. 550a07fd2Sopenharmony_ci * You may obtain a copy of the License at 650a07fd2Sopenharmony_ci * 750a07fd2Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 850a07fd2Sopenharmony_ci * 950a07fd2Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1050a07fd2Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1150a07fd2Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1250a07fd2Sopenharmony_ci * See the License for the specific language governing permissions and 1350a07fd2Sopenharmony_ci * limitations under the License. 1450a07fd2Sopenharmony_ci */ 1550a07fd2Sopenharmony_ci 1650a07fd2Sopenharmony_ci#ifndef OHOS_AUDIO_DATA_H 1750a07fd2Sopenharmony_ci#define OHOS_AUDIO_DATA_H 1850a07fd2Sopenharmony_ci 1950a07fd2Sopenharmony_ci#include <map> 2050a07fd2Sopenharmony_ci#include <string> 2150a07fd2Sopenharmony_ci 2250a07fd2Sopenharmony_cinamespace OHOS { 2350a07fd2Sopenharmony_cinamespace DistributedHardware { 2450a07fd2Sopenharmony_ciusing std::string; 2550a07fd2Sopenharmony_ciusing std::map; 2650a07fd2Sopenharmony_ci 2750a07fd2Sopenharmony_ciclass AudioData { 2850a07fd2Sopenharmony_cipublic: 2950a07fd2Sopenharmony_ci explicit AudioData(const size_t capacity); 3050a07fd2Sopenharmony_ci ~AudioData(); 3150a07fd2Sopenharmony_ci 3250a07fd2Sopenharmony_ci size_t Size() const; 3350a07fd2Sopenharmony_ci size_t Capacity() const; 3450a07fd2Sopenharmony_ci uint8_t *Data() const; 3550a07fd2Sopenharmony_ci int32_t SetRange(size_t offset, size_t size); 3650a07fd2Sopenharmony_ci 3750a07fd2Sopenharmony_ci void SetInt64(const string name, int64_t value); 3850a07fd2Sopenharmony_ci bool FindInt32(const string &name, int32_t &value); 3950a07fd2Sopenharmony_ci bool FindInt64(const string &name, int64_t &value); 4050a07fd2Sopenharmony_ci bool FindString(const string &name, string &value); 4150a07fd2Sopenharmony_ci 4250a07fd2Sopenharmony_ciprivate: 4350a07fd2Sopenharmony_ci const uint32_t CAPACITY_MAX_SIZE = 2 * 4096; 4450a07fd2Sopenharmony_ci size_t capacity_ = 0; 4550a07fd2Sopenharmony_ci size_t rangeOffset_ = 0; 4650a07fd2Sopenharmony_ci size_t rangeLength_ = 0; 4750a07fd2Sopenharmony_ci uint8_t *data_ = nullptr; 4850a07fd2Sopenharmony_ci 4950a07fd2Sopenharmony_ci map<string, int32_t> int32Map_; 5050a07fd2Sopenharmony_ci map<string, int64_t> int64Map_; 5150a07fd2Sopenharmony_ci map<string, string> stringMap_; 5250a07fd2Sopenharmony_ci 5350a07fd2Sopenharmony_ci AudioData(const AudioData &) = delete; 5450a07fd2Sopenharmony_ci AudioData &operator = (const AudioData &) = delete; 5550a07fd2Sopenharmony_ci}; 5650a07fd2Sopenharmony_ci} // namespace DistributedHardware 5750a07fd2Sopenharmony_ci} // namespace OHOS 5850a07fd2Sopenharmony_ci#endif // OHOS_AUDIO_DATA_H 59