• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 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 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_LPP_V1_0_LPPCOMPONENTVDI_H
17 #define OHOS_HDI_LPP_V1_0_LPPCOMPONENTVDI_H
18 
19 #include <map>
20 #include <hdf_log.h>
21 #include <base/native_buffer.h>
22 #include "lpp_component_vdi.h"
23 #include "v1_0/ilpp_sync_manager_callback.h"
24 #include "v1_0/ilpp_types.h"
25 
26 namespace OHOS {
27 namespace HDI {
28 namespace LowPowerPlayer {
29 namespace V1_0 {
30 
31 #define LOW_POWER_PLAYER_VDI_LIBRARY "liblpp_vdi_impl.z.so"
32 
33 class ILowPowerPlayerVdi {
34 public:
35     virtual ~ILowPowerPlayerVdi() = default;
36     virtual int32_t Init() = 0;
37     virtual int32_t SetVideoChannelId(uint32_t channelId) = 0;
38     virtual int32_t StartRender() = 0;
39     virtual int32_t RenderNextFrame() = 0;
40     virtual int32_t Pause() = 0;
41     virtual int32_t Resume() = 0;
42     virtual int32_t Flush() = 0;
43     virtual int32_t Stop() = 0;
44     virtual int32_t Reset() = 0;
45     virtual int32_t Release() = 0;
46     virtual int32_t SetTunnelId(uint64_t& tunnelId) = 0;
47     virtual int32_t SetPlaybackSpeed(float mode) = 0;
48     virtual int32_t GetShareBuffer(int32_t& fd) = 0;
49     virtual int32_t GetParameter(std::map<std::string, std::string>& parameter) = 0;
50     virtual int32_t SetTargetStartFrame(uint64_t framePts, uint32_t timeoutMs) = 0;
51     virtual int32_t RegisterCallback(const sptr<ILppSyncManagerCallback>& syncCallback) = 0;
52     virtual int32_t SetParameter(const std::map<std::string, std::string>& parameter) = 0;
53     virtual int32_t UpdateTimeAnchor(uint64_t anchorPts, uint64_t anchorClk) = 0;
54     virtual int32_t BindOutputBuffers(
55         const std::map<uint32_t, sptr<OHOS::HDI::Base::NativeBuffer>> &outputBuffers) = 0;
56     virtual int32_t UnbindOutputBuffers() = 0;
57     virtual int32_t GetLatestPts(int64_t& pts) = 0;
58 };
59 
60 using GetAVCapabilityFunc = int32_t (*)(LppAVCap&);
61 using CreateLowPowerPlayerVdiFunc = ILowPowerPlayerVdi* (*)();
62 using DestroyLowPowerPlayerVdiFunc = void (*)(ILowPowerPlayerVdi* vdi);
63 extern "C" int32_t GetAVCapabilityVdi(LppAVCap&);
64 extern "C" ILowPowerPlayerVdi* CreateLowPowerPlayerVdi();
65 extern "C" void DestroyLowPowerPlayerVdi(ILowPowerPlayerVdi* vdi);
66 
67 }
68 }
69 }
70 }
71 #endif