1 /*
2  * Copyright (c) 2024 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 MEDIA_CODEC_LIST_ADAPTER_IMPL_H
17 #define MEDIA_CODEC_LIST_ADAPTER_IMPL_H
18 
19 #if defined(NWEB_MEDIA_AVCODEC_ENABLE)
20 #include "foundation/multimedia/av_codec/interfaces/inner_api/native/avcodec_list.h"
21 #include "foundation/multimedia/av_codec/interfaces/inner_api/native/media_description.h"
22 #endif
23 
24 #include "media_codec_adapter.h"
25 #include "capability_data_adapter_impl.h"
26 
27 namespace OHOS::NWeb {
28 
29 #if defined(NWEB_MEDIA_AVCODEC_ENABLE)
30 using namespace OHOS::MediaAVCodec;
31 #endif
32 
33 class MediaCodecListAdapterImpl : public MediaCodecListAdapter {
34 public:
35     static MediaCodecListAdapterImpl& GetInstance();
36 
37     MediaCodecListAdapterImpl() = default;
38 
39     ~MediaCodecListAdapterImpl() override = default;
40 
41     std::shared_ptr<CapabilityDataAdapter> GetCodecCapability(const std::string& mime, const bool isEncoder) override;
42 
43 #if defined(NWEB_MEDIA_AVCODEC_ENABLE)
44 private:
45     void TransToAdapterCapability(const CapabilityData* data, std::shared_ptr<CapabilityDataAdapterImpl>& adapterData);
46     std::shared_ptr<AVCodecList> avCodecList_;
47 #endif
48 };
49 
50 } // namespace OHOS::NWeb
51 #endif // MEDIA_CODEC_LIST_ADAPTER_IMPL_H
52