1 /* 2 * Copyright (c) 2025 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 ARK_AUDIO_DECODER_FORMAT_ADAPTER_IMPL_H 17 #define ARK_AUDIO_DECODER_FORMAT_ADAPTER_IMPL_H 18 #pragma once 19 20 #include "audio_codec_decoder_adapter.h" 21 #include "ohos_adapter/include/ark_audio_codec_decoder_adapter.h" 22 23 namespace OHOS::ArkWeb { 24 25 class ArkAudioDecoderFormatAdapterImpl : public ArkAudioDecoderFormatAdapter { 26 public: 27 explicit ArkAudioDecoderFormatAdapterImpl(std::shared_ptr<OHOS::NWeb::AudioDecoderFormatAdapter>); 28 29 int32_t GetSampleRate() override; 30 31 int32_t GetChannelCount() override; 32 33 int64_t GetBitRate() override; 34 35 int32_t GetMaxInputSize() override; 36 37 bool GetAACIsAdts() override; 38 39 int32_t GetAudioSampleFormat() override; 40 41 int32_t GetIdentificationHeader() override; 42 43 int32_t GetSetupHeader() override; 44 45 uint8_t* GetCodecConfig() override; 46 47 uint32_t GetCodecConfigSize() override; 48 49 void SetSampleRate(int32_t sampleRate) override; 50 51 void SetChannelCount(int32_t channelCount) override; 52 53 void SetBitRate(int64_t bitRate) override; 54 55 void SetMaxInputSize(int32_t maxInputSize) override; 56 57 void SetAACIsAdts(bool isAdts) override; 58 59 void SetAudioSampleFormat(int32_t audioSampleFormat) override; 60 61 void SetIdentificationHeader(int32_t idHeader) override; 62 63 void SetSetupHeader(int32_t setupHeader) override; 64 65 void SetCodecConfig(uint8_t* codecConfig) override; 66 67 void SetCodecConfigSize(uint32_t size) override; 68 69 private: 70 std::shared_ptr<OHOS::NWeb::AudioDecoderFormatAdapter> real_; 71 72 IMPLEMENT_REFCOUNTING(ArkAudioDecoderFormatAdapterImpl); 73 }; 74 75 } // namespace OHOS::ArkWeb 76 77 #endif // ARK_DECODER_FORMAT_ADAPTER_IMPL_H 78