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_errors.h"
17 #include "avcodec_log.h"
18 #include "codeclist_builder.h"
19 #ifndef CLIENT_SUPPORT_CODEC
20 #include "hcodec_loader.h"
21 #endif
22 #include "codec_ability_singleton.h"
23
24 namespace OHOS {
25 namespace MediaAVCodec {
GetInstance()26 CodecAbilitySingleton &CodecAbilitySingleton::GetInstance()
27 {
28 static std::shared_ptr<CodecAbilitySingleton> instance = nullptr;
29 instance = std::make_shared<CodecAbilitySingleton>();
30 return *instance;
31 }
32
RegisterCapabilityArray(std::vector<CapabilityData> & capaArray,CodecType codecType)33 void CodecAbilitySingleton::RegisterCapabilityArray(std::vector<CapabilityData> &capaArray, CodecType codecType)
34 {
35 CodecAbilitySingletonImpl::RegisterCapabilityArray(capaArray, codecType);
36 }
37
GetCapabilityArray()38 std::vector<CapabilityData> CodecAbilitySingleton::GetCapabilityArray()
39 {
40 return CodecAbilitySingletonImpl::GetCapabilityArray();
41 }
42
GetCapabilityByName(const std::string & name)43 std::optional<CapabilityData> CodecAbilitySingleton::GetCapabilityByName(const std::string &name)
44 {
45 return CodecAbilitySingletonImpl::GetCapabilityByName(name);
46 }
47
GetMimeByCodecName(const std::string & name)48 std::string CodecAbilitySingleton::GetMimeByCodecName(const std::string &name)
49 {
50 return std::string();
51 }
52
GetNameCodecTypeMap()53 std::unordered_map<std::string, CodecType> CodecAbilitySingleton::GetNameCodecTypeMap()
54 {
55 return CodecAbilitySingletonImpl::GetNameCodecTypeMap();
56 }
57
GetMimeCapIdxMap()58 std::unordered_map<std::string, std::vector<size_t>> CodecAbilitySingleton::GetMimeCapIdxMap()
59 {
60 return CodecAbilitySingletonImpl::GetMimeCapIdxMap();
61 }
62 } // namespace MediaAVCodec
63 } // namespace OHOS
64