• 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 "codeclist_server.h"
17 #include "avcodec_log.h"
18 
19 namespace {
20 constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, LOG_DOMAIN, "CodecListServer"};
21 }
22 
23 namespace OHOS {
24 namespace MediaAVCodec {
25 using namespace Media;
Create()26 std::shared_ptr<ICodecListService> CodecListServer::Create()
27 {
28     std::shared_ptr<CodecListServer> server = std::make_shared<CodecListServer>();
29     if (!server->Init()) {
30         AVCODEC_LOGE("failed to init CodecListServer");
31         return nullptr;
32     }
33     return server;
34 }
35 
CodecListServer()36 CodecListServer::CodecListServer()
37 {
38     AVCODEC_LOGD("0x%{public}06" PRIXPTR " Instances create", FAKE_POINTER(this));
39 }
40 
~CodecListServer()41 CodecListServer::~CodecListServer()
42 {
43     AVCODEC_LOGD("0x%{public}06" PRIXPTR " Instances destroy", FAKE_POINTER(this));
44 }
45 
Init()46 bool CodecListServer::Init()
47 {
48     codecListCore_ = std::make_shared<CodecListCore>();
49     return true;
50 }
51 
FindDecoder(const Format & format)52 std::string CodecListServer::FindDecoder(const Format &format)
53 {
54     return codecListCore_->FindDecoder(format);
55 }
56 
FindEncoder(const Format & format)57 std::string CodecListServer::FindEncoder(const Format &format)
58 {
59     return codecListCore_->FindEncoder(format);
60 }
61 
GetCapability(CapabilityData & capabilityData,const std::string & mime,const bool isEncoder,const AVCodecCategory & category)62 int32_t CodecListServer::GetCapability(CapabilityData &capabilityData, const std::string &mime, const bool isEncoder,
63                                        const AVCodecCategory &category)
64 {
65     return codecListCore_->GetCapability(capabilityData, mime, isEncoder, category);
66 }
67 } // namespace MediaAVCodec
68 } // namespace OHOS
69