• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2022-2023 Shenzhen Kaihong DID 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 OHOS_HDI_CODEC_V2_0_CODECCOMPONENTSERVICE_H
17 #define OHOS_HDI_CODEC_V2_0_CODECCOMPONENTSERVICE_H
18 
19 #include "component_node.h"
20 #include "v2_0/icodec_component.h"
21 namespace OHOS {
22 namespace HDI {
23 namespace Codec {
24 namespace V2_0 {
25 class CodecComponentService : public ICodecComponent {
26 public:
27     CodecComponentService(const std::shared_ptr<OHOS::Codec::Omx::ComponentNode> &node,
28                           const std::shared_ptr<OHOS::Codec::Omx::ComponentMgr> mgr, const std::string name);
29     virtual ~CodecComponentService();
30     int32_t GetComponentVersion(CompVerInfo &verInfo) override;
31     int32_t SendCommand(CodecCommandType cmd, uint32_t param, const std::vector<int8_t> &cmdData) override;
32     int32_t GetParameter(uint32_t index, const std::vector<int8_t> &inParamStruct,
33                          std::vector<int8_t> &outParamStruct) override;
34     int32_t SetParameter(uint32_t index, const std::vector<int8_t> &paramStruct) override;
35     int32_t GetConfig(uint32_t index, const std::vector<int8_t> &inCfgStruct,
36                       std::vector<int8_t> &outCfgStruct) override;
37     int32_t SetConfig(uint32_t index, const std::vector<int8_t> &cfgStruct) override;
38     int32_t GetExtensionIndex(const std::string &paramName, uint32_t &indexType) override;
39     int32_t GetState(CodecStateType &state) override;
40     int32_t ComponentTunnelRequest(uint32_t port, int32_t tunneledComp, uint32_t tunneledPort,
41                                    const CodecTunnelSetupType &inTunnelSetup,
42                                    CodecTunnelSetupType &outTunnelSetup) override;
43     int32_t UseBuffer(uint32_t portIndex, const OmxCodecBuffer &inBuffer, OmxCodecBuffer &outBuffer) override;
44     int32_t AllocateBuffer(uint32_t portIndex, const OmxCodecBuffer &inBuffer, OmxCodecBuffer &outBuffer) override;
45     int32_t FreeBuffer(uint32_t portIndex, const OmxCodecBuffer &buffer) override;
46     int32_t EmptyThisBuffer(const OmxCodecBuffer &buffer) override;
47     int32_t FillThisBuffer(const OmxCodecBuffer &buffer) override;
48     int32_t SetCallbacks(const sptr<ICodecCallback> &callbacks, int64_t appData) override;
49     int32_t ComponentDeInit() override;
50     int32_t UseEglImage(uint32_t portIndex, const OmxCodecBuffer &inBuffer, OmxCodecBuffer &outBuffer,
51                         const std::vector<int8_t> &eglImage) override;
52     int32_t ComponentRoleEnum(std::vector<uint8_t> &role, uint32_t index) override;
53 
54     const std::string &GetComponentCompName() const;
55     void GetComponentNode(std::shared_ptr<OHOS::Codec::Omx::ComponentNode> &dumpNode_);
56 private:
57     void SetComponentRole();
58     void ReleaseCache();
59     bool isIPCMode_;
60     std::string name_;
61     std::shared_ptr<OHOS::Codec::Omx::ComponentNode> node_;
62     std::shared_ptr<OHOS::Codec::Omx::ComponentMgr> mgr_;
63 };
64 }  // namespace V2_0
65 }  // namespace Codec
66 }  // namespace HDI
67 }  // namespace OHOS
68 
69 #endif  // OHOS_HDI_CODEC_V2_0_CODECCOMPONENTSERVICE_H