1 /*
2  * Copyright (C) 2023 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 #include "avcodec_log.h"
17 #ifndef CLIENT_SUPPORT_CODEC
18 #include "fcodec_loader.h"
19 #include "hevc_decoder_loader.h"
20 #endif
21 #include "avcodec_errors.h"
22 #include "audio_codeclist_info.h"
23 #include "codeclist_builder.h"
24 
25 namespace {
26 constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_FRAMEWORK, "CodecList_builder"};
27 }
28 namespace OHOS {
29 namespace MediaAVCodec {
30 #ifndef CLIENT_SUPPORT_CODEC
GetCapabilityList(std::vector<CapabilityData> & caps)31 int32_t VideoCodecList::GetCapabilityList(std::vector<CapabilityData> &caps)
32 {
33     auto ret = FCodecLoader::GetCapabilityList(caps);
34     if (ret == AVCS_ERR_OK) {
35         AVCODEC_LOGI("Get capability from fcodec successful");
36     }
37     return ret;
38 }
39 
GetCapabilityList(std::vector<CapabilityData> & caps)40 int32_t VideoHevcDecoderList::GetCapabilityList(std::vector<CapabilityData> &caps)
41 {
42     auto ret = HevcDecoderLoader::GetCapabilityList(caps);
43     if (ret == AVCS_ERR_OK) {
44         AVCODEC_LOGI("Get capability from hevc decoder successful");
45     }
46     return ret;
47 }
48 #endif
GetCapabilityList(std::vector<CapabilityData> & caps)49 int32_t AudioCodecList::GetCapabilityList(std::vector<CapabilityData> &caps)
50 {
51     auto audioCapabilities = AudioCodeclistInfo::GetInstance().GetAudioCapabilities();
52     for (const auto &v : audioCapabilities) {
53         caps.emplace_back(v);
54     }
55     AVCODEC_LOGI("Get capability from audio codec list successful");
56     return AVCS_ERR_OK;
57 }
58 } // namespace MediaAVCodec
59 } // namespace OHOS