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 Plugin {
26 namespace HosLite {
27 bool PluginAuFormat2HdiAttrs(OHOS::Media::Plugin::AudioSampleFormat pFormat, AudioSampleAttributes& attrs);
28 bool HdiAuFormat2PluginFormat(::AudioSampleFormat hdiAudioFormat, OHOS::Media::Plugin::AudioSampleFormat& pluginFormat);
29 bool HdiAttrs2PluginAuFormat(AudioSampleAttributes attrs, OHOS::Media::Plugin::AudioSampleFormat& pFormat);
30 
31 bool PluginSampleRate2HdiRate(uint32_t pRate, AudioSampleRatesMask& mask);
32 std::vector<uint32_t> HdiSampleRatesMask2PluginRates(uint32_t mask);
33 bool HdiRate2PluginSampleRate(AudioSampleRatesMask mask, uint32_t& pRate);
34 
35 bool PluginChannelLayout2HdiMask(OHOS::Media::Plugin::AudioChannelLayout layout, AudioChannelMask& mask);
36 bool HdiMask2PluginChannelLayout(AudioChannelMask mask, OHOS::Media::Plugin::AudioChannelLayout& layout);
37 
38 int32_t GetPcmBytes(::AudioFormat format);
39 } // namespace HosLite
40 } // namespace Plugin
41 } // namespace Media
42 } // namespace OHOS
43 #endif
44