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_HDI_ADAPTER_AU_UTILS_H 17 #define HISTREAMER_HDI_ADAPTER_AU_UTILS_H 18 19 #include <vector> 20 #include "audio_types.h" 21 #include "plugin/common/plugin_audio_tags.h" 22 23 namespace OHOS { 24 namespace Media { 25 namespace HosLitePlugin { 26 bool PluginAuFormat2HdiAttrs(OHOS::Media::Plugin::AudioSampleFormat pFormat, AudioSampleAttributes& attrs); 27 bool HdiAuFormat2PluginFormat(::AudioSampleFormat hdiAudioFormat, OHOS::Media::Plugin::AudioSampleFormat& pluginFormat); 28 bool HdiAttrs2PluginAuFormat(AudioSampleAttributes attrs, OHOS::Media::Plugin::AudioSampleFormat& pFormat); 29 30 bool PluginSampleRate2HdiRate(uint32_t pRate, AudioSampleRatesMask& mask); 31 std::vector<uint32_t> HdiSampleRatesMask2PluginRates(uint32_t mask); 32 bool HdiRate2PluginSampleRate(AudioSampleRatesMask mask, uint32_t& pRate); 33 34 bool PluginChannelLayout2HdiMask(OHOS::Media::Plugin::AudioChannelLayout layout, AudioChannelMask& mask); 35 bool HdiMask2PluginChannelLayout(AudioChannelMask mask, OHOS::Media::Plugin::AudioChannelLayout& layout); 36 37 int32_t GetPcmBytes(AudioFormat format); 38 } // namespace HosLitePlugin 39 } // namespace Media 40 } // namespace OHOS 41 #endif 42