• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2022 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_V1_0_CODECCOMPONENTSERVICE_H
17 #define OHOS_HDI_CODEC_V1_0_CODECCOMPONENTSERVICE_H
18 
19 #include "component_node.h"
20 #include "v1_0/icodec_component.h"
21 namespace OHOS {
22 namespace HDI {
23 namespace Codec {
24 namespace V1_0 {
25 class CodecComponentService : public ICodecComponent {
26 public:
CodecComponentService(const std::shared_ptr<OHOS::Codec::Omx::ComponentNode> & node)27     CodecComponentService(const std::shared_ptr<OHOS::Codec::Omx::ComponentNode> &node) : node_(node)
28     {}
29     virtual ~CodecComponentService() = default;
30     int32_t GetComponentVersion(CompVerInfo &verInfo) override;
31     int32_t SendCommand(OMX_COMMANDTYPE 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(OMX_STATETYPE &state) override;
40     int32_t ComponentTunnelRequest(uint32_t port, int32_t tunneledComp, uint32_t tunneledPort,
41                                    const OMX_TUNNELSETUPTYPE &inTunnelSetup,
42                                    OMX_TUNNELSETUPTYPE &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 private:
55     std::shared_ptr<OHOS::Codec::Omx::ComponentNode> node_;
56 };
57 }  // namespace V1_0
58 }  // namespace Codec
59 }  // namespace HDI
60 }  // namespace OHOS
61 
62 #endif  // OHOS_HDI_CODEC_V1_0_CODECCOMPONENTSERVICE_H