1/* 2 * Copyright (c) 2022 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/** 17 * @addtogroup LowPowerPlayer 18 * @{ 19 * 20 * @ @brief Provides unified APIs for media services to access low power player drivers. 21 * 22 * The media service can obtain a low power player driver object or proxy, and then invoke the 23 * API provided by the object or proxy, The module provides APIs for initializing the custom data 24 * and audio and video codecs, setting parameters, and controlling and transferring data. 25 * 26 * @since 6.0 27 * @version 1.0 28 */ 29 30package ohos.hdi.low_power_player.v1_0; 31 32import ohos.hdi.low_power_player.v1_0.ILppSyncManagerCallback; 33 34/** 35 * @brief Defines the APIs for the low power player sync manager adapter. 36 * 37 * The APIs can be used to: 38 * - Creating and controlling the sensorhub audio-picture synchronization module. 39 * - Supports the synchronization of upper-layer and lower-layer anchor points. 40 * - Supports the anchor update and computing synchronization on core A. 41 * - Synchronizes binding based on the VDEC and HifiAdapter instance IDs. 42 * For details, see the description of the APIs. 43 */ 44 45interface ILppSyncManagerAdapter { 46 /** 47 * @brief Sets the video channel Id. 48 * 49 * 50 * @param channelId Indicates the channel ID for communication between the vdec and sensorhub. 51 * 52 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 53 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 54 * 55 * @since 6.0 56 * @version 1.0 57 */ 58 SetVideoChannelId([in] unsigned int channelId); 59 60 /** 61 * @brief Sets the audio channel Id. 62 * 63 * The channelId is obtained from the avcodec. 64 * The inner interface needs to be added to the avcodec to obtain the channelId. 65 * 66 * @param channelId Indicates the channel ID for communication between the HIFI and sensorhub. 67 * 68 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 69 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 70 * 71 * @since 6.0 72 * @version 1.0 73 */ 74 SetAudioChannelId([in] unsigned int channelId); 75 76 /** 77 * @brief Starts rendering output and instruct the SenseHub to start outputting the decoded video. 78 * 79 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 80 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 81 * 82 * @since 6.0 83 * @version 1.0 84 */ 85 StartRender(); 86 87 /** 88 * @brief Rendering next frame. 89 * In non-playing states such as seek, the sensor hub must be able to display the first frame. 90 * Called when renderFirstFrame is set to true. 91 * 92 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 93 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 94 * 95 * @since 6.0 96 * @version 1.0 97 */ 98 RenderNextFrame(); 99 100 /** 101 * @brief Pauses. 102 * 103 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 104 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 105 * 106 * @since 6.0 107 * @version 1.0 108 */ 109 Pause(); 110 111 /** 112 * @brief Resumes. 113 * 114 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 115 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 116 * 117 * @since 6.0 118 * @version 1.0 119 */ 120 Resume(); 121 122 /** 123 * @brief Flushs Video Frames. 124 * 125 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 126 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 127 * 128 * @since 6.0 129 * @version 1.0 130 */ 131 Flush(); 132 133 /** 134 * @brief Stops. 135 * 136 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 137 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 138 * 139 * @since 6.0 140 * @version 1.0 141 */ 142 Stop(); 143 144 /** 145 * @brief Resets. 146 * 147 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 148 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 149 * 150 * @since 6.0 151 * @version 1.0 152 */ 153 Reset(); 154 155 /** 156 * @brief Sets the target start frame. 157 * 158 * 159 * 160 * @param framePts Indicates the pts of the target start frame. 161 * @param timeoutMs Indicates the specified Timeout. 162 * 163 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 164 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 165 * 166 * @since 6.0 167 * @version 1.0 168 */ 169 SetTargetStartFrame([in] long framePts, [in] unsigned int timeoutMs); 170 171 /** 172 * @brief Sets the playback speed. 173 * 174 * 175 * 176 * @param speed Indicates the speed of video playback. 177 * 178 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 179 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 180 * 181 * @since 6.0 182 * @version 1.0 183 */ 184 SetPlaybackSpeed([in] float speed); 185 186 /** 187 * @brief Registers the Callback for lpp sync manager apdater. 188 * 189 * 190 * 191 * @param syncCallback Indicates the callback to register. 192 * 193 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 194 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 195 * 196 * @since 6.0 197 * @version 1.0 198 */ 199 RegisterCallback([in] ILppSyncManagerCallback syncCallback); 200 201 /** 202 * @brief Sets parameters for this component, that is, sends an initialization parameter 203 * structure to the component. 204 * 205 * 206 * 207 * @param parameter Indicates the Key-value pair parameter for configuration item extension. 208 * 209 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 210 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 211 * 212 * @since 6.0 213 * @version 1.0 214 */ 215 SetParameter([in] Map<String, String> parameter); 216 217 /** 218 * @brief Obtains the parameter settings of this component. 219 * 220 * 221 * 222 * @param parameter Indicates the Key-value pair parameter for configuration item extension. 223 * 224 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 225 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 226 * 227 * @since 6.0 228 * @version 1.0 229 */ 230 GetParameter([out] Map<String, String> parameter); 231 232 /** 233 * @brief Updates the time anchor. 234 * 235 * 236 * 237 * @param anchorPts Indicates the Updated anchor media pts. 238 * @param anchorClk Indicates the Updated anchor system time. 239 * 240 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 241 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 242 * 243 * @since 6.0 244 * @version 1.0 245 */ 246 UpdateTimeAnchor([in] long anchorPts, [in] unsigned long anchorClk); 247 248 /** 249 * @brief Binds the output buffers of the decoder. 250 * 251 * 252 * 253 * @param outputBuffers Indicates the output buffers of the decoder. 254 * 255 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 256 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 257 * 258 * @since 6.0 259 * @version 1.0 260 */ 261 BindOutputBuffers([in] Map<unsigned int, NativeBuffer> outputBuffers); 262 263 /** 264 * @brief Unbinds the YUV buffer. 265 * 266 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 267 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 268 * 269 * @since 6.0 270 * @version 1.0 271 */ 272 UnbindOutputBuffers(); 273 274 /** 275 * @brief Gets the share buffer. 276 * 277 * 278 * 279 * @param fd Indicates the file descriptor of the current shared buffer. 280 * 281 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 282 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 283 * 284 * @since 6.0 285 * @version 1.0 286 */ 287 GetShareBuffer([out] FileDescriptor fd); 288 289 /** 290 * @brief Sets the tunnel id. 291 * 292 * 293 * 294 * @param tunnelId Indicates the tunnel ID of the layer. 295 * 296 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 297 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 298 * 299 * @since 6.0 300 * @version 1.0 301 */ 302 SetTunnelId([in] unsigned long tunnelId); 303 304 /** 305 * @brief Gets the latest pts. 306 * 307 * 308 * 309 * @param pts Indicates the presentation time stamp. 310 * 311 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 312 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 313 * 314 * @since 6.0 315 * @version 1.0 316 */ 317 GetLatestPts([out] long pts); 318}