• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 #include "avc_encoder_loader.h"
21 #endif
22 #include "avcodec_errors.h"
23 #include "audio_codeclist_info.h"
24 #include "codeclist_builder.h"
25 
26 namespace {
27 constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN_FRAMEWORK, "CodecList_builder"};
28 }
29 namespace OHOS {
30 namespace MediaAVCodec {
31 #ifndef CLIENT_SUPPORT_CODEC
GetCapabilityList(std::vector<CapabilityData> & caps)32 int32_t VideoCodecList::GetCapabilityList(std::vector<CapabilityData> &caps)
33 {
34     auto ret = FCodecLoader::GetCapabilityList(caps);
35     if (ret == AVCS_ERR_OK) {
36         AVCODEC_LOGI("Get capability from fcodec successful");
37     }
38     return ret;
39 }
40 
GetCapabilityList(std::vector<CapabilityData> & caps)41 int32_t VideoHevcDecoderList::GetCapabilityList(std::vector<CapabilityData> &caps)
42 {
43     auto ret = HevcDecoderLoader::GetCapabilityList(caps);
44     if (ret == AVCS_ERR_OK) {
45         AVCODEC_LOGI("Get capability from hevc decoder successful");
46     }
47     return ret;
48 }
49 
GetCapabilityList(std::vector<CapabilityData> & caps)50 int32_t VideoAvcEncoderList::GetCapabilityList(std::vector<CapabilityData> &caps)
51 {
52     auto ret = AvcEncoderLoader::GetCapabilityList(caps);
53     if (ret == AVCS_ERR_OK) {
54         AVCODEC_LOGI("Get capability from avc encoder successful");
55     }
56     return ret;
57 }
58 #endif
GetCapabilityList(std::vector<CapabilityData> & caps)59 int32_t AudioCodecList::GetCapabilityList(std::vector<CapabilityData> &caps)
60 {
61     auto audioCapabilities = AudioCodeclistInfo::GetInstance().GetAudioCapabilities();
62     for (const auto &v : audioCapabilities) {
63         caps.emplace_back(v);
64     }
65     AVCODEC_LOGI("Get capability from audio codec list successful");
66     return AVCS_ERR_OK;
67 }
68 } // namespace MediaAVCodec
69 } // namespace OHOS