From 1860cccafd237f53af724039cdfd477688f6f670 Mon Sep 17 00:00:00 2001 From: huangtianyu Date: Thu, 19 Jun 2025 12:00:30 +0800 Subject: [PATCH] LppCommit Signed-off-by: huangtianyu --- low_power_player/bundle.json | 62 ++++ low_power_player/v1_0/BUILD.gn | 38 +++ .../v1_0/ILowPowerPlayerFactory.idl | 97 ++++++ .../v1_0/ILppAudioSinkAdapter.idl | 216 +++++++++++++ .../v1_0/ILppAudioSinkCallback.idl | 99 ++++++ .../v1_0/ILppSyncManagerAdapter.idl | 303 ++++++++++++++++++ .../v1_0/ILppSyncManagerCallback.idl | 122 +++++++ 7 files changed, 937 insertions(+) create mode 100644 low_power_player/bundle.json create mode 100644 low_power_player/v1_0/BUILD.gn create mode 100644 low_power_player/v1_0/ILowPowerPlayerFactory.idl create mode 100644 low_power_player/v1_0/ILppAudioSinkAdapter.idl create mode 100644 low_power_player/v1_0/ILppAudioSinkCallback.idl create mode 100644 low_power_player/v1_0/ILppSyncManagerAdapter.idl create mode 100644 low_power_player/v1_0/ILppSyncManagerCallback.idl diff --git a/low_power_player/bundle.json b/low_power_player/bundle.json new file mode 100644 index 00000000..dd3a91bf --- /dev/null +++ b/low_power_player/bundle.json @@ -0,0 +1,62 @@ +{ + "name": "@ohos/drivers_interface_lpplayer", + "description": "low power player driver interface", + "version": "3.2", + "license": "Apache License 2.0", + "publishAs": "code-segment", + "segment": { + "destPath": "drivers/interface/low_power_player" + }, + "dirs": {}, + "scripts": {}, + "component": { + "name": "drivers_interface_lpplayer", + "subsystem": "hdf", + "syscap": [], + "adapted_system_type": ["standard", "small"], + "rom": "675KB", + "ram": "7400KB", + "deps": { + "components": [ + "ipc", + "hdf_core", + "hilog", + "c_utils" + ], + "third_party": [] + }, + "build": { + "sub_component": [ + "//drivers/interface/low_power_player/v1_0:low_power_player_idl_target" + ], + "test": [ + ], + "inner_kits": [ + { + "name": "//drivers/interface/low_power_player/v1_0:liblow_power_player_proxy_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/low_power_player" + } + }, + { + "name": "//drivers/interface/low_power_player/v1_0:low_power_player_idl_headers", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/low_power_player" + } + }, + { + "name": "//drivers/interface/low_power_player/v1_0:liblow_power_player_stub_1.0", + "header": { + "header_files": [ + ], + "header_base": "//drivers/interface/low_power_player" + } + } + ] + } + } +} diff --git a/low_power_player/v1_0/BUILD.gn b/low_power_player/v1_0/BUILD.gn new file mode 100644 index 00000000..0cfa262e --- /dev/null +++ b/low_power_player/v1_0/BUILD.gn @@ -0,0 +1,38 @@ + +# Copyright (c) 2024 Huawei Device Co., Ltd. +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +import("//build/config/components/hdi/hdi.gni") +if (defined(ohos_lite)) { + group("liblow_power_player_proxy_1.0") { + deps = [] + public_configs = [] + } +} else { + hdi("low_power_player") { + module_name = "low_power_player_service" + + sources = [ + "ILowPowerPlayerFactory.idl", + "ILppAudioSinkAdapter.idl", + "ILppSyncManagerCallback.idl", + "ILppSyncManagerAdapter.idl", + "ILppAudioSinkCallback.idl", + ] + + branch_protector_ret = "pac_ret" + language = "cpp" + subsystem_name = "hdf" + part_name = "drivers_interface_lpplayer" + } +} \ No newline at end of file diff --git a/low_power_player/v1_0/ILowPowerPlayerFactory.idl b/low_power_player/v1_0/ILowPowerPlayerFactory.idl new file mode 100644 index 00000000..14b78166 --- /dev/null +++ b/low_power_player/v1_0/ILowPowerPlayerFactory.idl @@ -0,0 +1,97 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup LowPowerPlayer + * @{ + * + * @ @brief Provides unified APIs for media services to access low power player drivers. + * + * The media service can obtain a low power player driver object or proxy, and then invoke the + * API provided by the object or proxy, The module provides APIs for initializing the custom data + * and audio and video codecs, setting parameters, and controlling and transferring data. + * + * @since 6.0 + * @version 1.0 + */ + +package ohos.hdi.low_power_player.v1_0; + +import ohos.hdi.low_power_player.v1_0.ILppAudioSinkAdapter; +import ohos.hdi.low_power_player.v1_0.ILppSyncManagerAdapter; + +interface ILowPowerPlayerFactory { + /** + * @brief Creates a low power player audio and video sync manager adapter. + * + * + * + * @param syncMgrAdapter Indicates the pointer to the sync manager adapter created. + * @param syncMgrId Indicates the ID of the adapter created. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + CreateSyncMgr([out] ILppSyncManagerAdapter syncMgrAdapter, [out] unsigned int syncMgrId); + + /** + * @brief Destroys a low power player audio and video sync manager adapter. + * + * + * + * @param syncMgrId Indicates the ID of the sync manager adapter to destroy. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + DestroySyncMgr([in] unsigned int syncMgrId); + + /** + * @brief Creates a low power player audio sink adapter adapter. + * + * + * + * @param audioSinkAdapter Indicates the pointer to the audio sink adapter created. + * @param audioSinkId Indicates the ID of the adapter created. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + CreateAudioSink([out] ILppAudioSinkAdapter audioSinkAdapter, [out] unsigned int audioSinkId); + + /** + * @brief Destroys a low power player audio sink adapter adapter. + * + * + * + * @param audioSinkId Indicates the ID of the audio sink adapter to destroy. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + DestroyAudioSink([in] unsigned int audioSinkId); +} \ No newline at end of file diff --git a/low_power_player/v1_0/ILppAudioSinkAdapter.idl b/low_power_player/v1_0/ILppAudioSinkAdapter.idl new file mode 100644 index 00000000..bb5abc6d --- /dev/null +++ b/low_power_player/v1_0/ILppAudioSinkAdapter.idl @@ -0,0 +1,216 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup LowPowerPlayer + * @{ + * + * @ @brief Provides unified APIs for media services to access low power player drivers. + * + * The media service can obtain a low power player driver object or proxy, and then invoke the + * API provided by the object or proxy, The module provides APIs for initializing the custom data + * and audio and video codecs, setting parameters, and controlling and transferring data. + * + * @since 6.0 + * @version 1.0 + */ + +package ohos.hdi.low_power_player.v1_0; + +import ohos.hdi.low_power_player.v1_0.ILppAudioSinkCallback; + +/** + * @brief Defines the APIs for the low power player audio sink adapter. + * + * The APIs can be used to: + * - Creates and controls the hifiAdpter module. + * - Provides the channels for the bottom layer to callback data and write data to the bottom layer. + * - Supports the anchor update and computing synchronization on core A. + * - Obtains the hifiAdapter instance IDs. + * For details, see the description of the APIs. + */ + +interface ILppAudioSinkAdapter { + /** + * @brief Obtains the audio channel Id. + * + * @param channelId Indicates the hifiAdapter instance IDs. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + GetChannelID([out] unsigned int channelId); + + /** + * @brief Starts. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + Start(); + + /** + * @brief Pauses. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + Pause(); + + /** + * @brief Resumes. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + Resume(); + + /** + * @brief Flushs audio data. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + Flush(); + + /** + * @brief Stops. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + Stop(); + + /** + * @brief Resets. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + Reset(); + + /** + * @brief Registers the Callback for lpp audio sink adapter. + * + * + * + * @param sinkCallback Indicates the callback to register. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + RegisterCallback([in] ILppAudioSinkCallback sinkCallback); + + /** + * @brief Sets the parameter for this component, that is, sends an initialization parameter + * structure to the component. + * + * + * + * @param parameter Indicates the Key-value pair parameter for configuration item extension. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + SetParameter([in] Map parameter); + + /** + * @brief Obtains the parameter settings of this component. + * + * + * + * @param parameter Indicates the Key-value pair parameter for configuration item extension. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + GetParameter([out] Map parameter); + + /** + * @brief writes the audio data. + * + * + * @param ptr Indicates the audio data. + * @param size Indicates the audio data size. + * @param size Indicates size of the audio data that has been written. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + WriteAudioData([in] byte ptr, [in] unsigned int size, [out] unsigned int writtenSize); + + /** + * @brief Obtains the current playback progress. + * + * + * + * @param currentPts Indicates the current pts. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + GetCurrentTime([out] long currentPts); + + /** + * @brief Sets the playback speed. + * + * + * + * @param speed Indicates the speed of audio playback. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + SetPlaybackSpeed([in] float speed); +} diff --git a/low_power_player/v1_0/ILppAudioSinkCallback.idl b/low_power_player/v1_0/ILppAudioSinkCallback.idl new file mode 100644 index 00000000..453279f5 --- /dev/null +++ b/low_power_player/v1_0/ILppAudioSinkCallback.idl @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup LowPowerPlayer + * @{ + * + * @ @brief Provides unified APIs for media services to access low power player drivers. + * + * The media service can obtain a low power player driver object or proxy, and then invoke the + * API provided by the object or proxy, The module provides APIs for initializing the custom data + * and audio and video codecs, setting parameters, and controlling and transferring data. + * + * @since 6.0 + * @version 1.0 + */ + +package ohos.hdi.low_power_player.v1_0; + +/** + * @brief Defines the callbacks of the lpp audio sink adapter. + * + * The following callbacks are provided: + * - Callback used to report events during audio Playback. + * - Callback invoked when obtains the compressed audio data. + * - Callback invoked when the playback is abnormal. + * - Callback invoked when the audio playback is complete. + * The callbacks are registered by using when the adapter is created. + */ + +[callback] interface ILppAudioSinkCallback { + + /** + * @brief Reports for Obtaining compressed audio data. + * + * + * @param size Indicates the data size. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + OnDataNeeded([in] unsigned int size); + + /** + * @brief Reports the error event. + * + * + * @param errorCode Indicates the error code. + * @param errorMsg Indicates the error message. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + OnError([in] int errorCode, [in] String errorMsg); + + /** + * @brief Reports when the audio has been played. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + OnEos(); + + /** + * @brief Reports the process message. + * + * + * @param errorCode Indicates the info code. + * @param errorMsg Indicates the info message. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + OnInfo([in] int infoCode, [in] String infoMsg); +} \ No newline at end of file diff --git a/low_power_player/v1_0/ILppSyncManagerAdapter.idl b/low_power_player/v1_0/ILppSyncManagerAdapter.idl new file mode 100644 index 00000000..4572b0cf --- /dev/null +++ b/low_power_player/v1_0/ILppSyncManagerAdapter.idl @@ -0,0 +1,303 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup LowPowerPlayer + * @{ + * + * @ @brief Provides unified APIs for media services to access low power player drivers. + * + * The media service can obtain a low power player driver object or proxy, and then invoke the + * API provided by the object or proxy, The module provides APIs for initializing the custom data + * and audio and video codecs, setting parameters, and controlling and transferring data. + * + * @since 6.0 + * @version 1.0 + */ + +package ohos.hdi.low_power_player.v1_0; + +import ohos.hdi.low_power_player.v1_0.ILppSyncManagerCallback; + +/** + * @brief Defines the APIs for the low power player sync manager adapter. + * + * The APIs can be used to: + * - Creating and controlling the sensorhub audio-picture synchronization module. + * - Supports the synchronization of upper-layer and lower-layer anchor points. + * - Supports the anchor update and computing synchronization on core A. + * - Synchronizes binding based on the VDEC and HifiAdapter instance IDs. + * For details, see the description of the APIs. + */ + +interface ILppSyncManagerAdapter { + /** + * @brief Sets the video channel Id. + * + * + * @param channelId Indicates the channel ID for communication between the vdec and sensorhub. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + SetVideoChannelId([in] unsigned int channelId); + + /** + * @brief Sets the audio channel Id. + * + * The channelId is obtained from the avcodec. + * The inner interface needs to be added to the avcodec to obtain the channelId. + * + * @param channelId Indicates the channel ID for communication between the HIFI and sensorhub. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + SetAudioChannelId([in] unsigned int channelId); + + /** + * @brief Starts rendering output and instruct the SenseHub to start outputting the decoded video. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + StartRender(); + + /** + * @brief Rendering next frame. + * In non-playing states such as seek, the sensor hub must be able to display the first frame. + * Called when renderFirstFrame is set to true. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + RenderNextFrame(); + + /** + * @brief Pauses. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + Pause(); + + /** + * @brief Resumes. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + Resume(); + + /** + * @brief Flushs Video Frames. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + Flush(); + + /** + * @brief Stops. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + Stop(); + + /** + * @brief Resets. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + Reset(); + + /** + * @brief Sets the target start frame. + * + * + * + * @param framePts Indicates the pts of the target start frame. + * @param timeoutMs Indicates the specified Timeout. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + SetTargetStartFrame([in] unsigned long framePts, [in] unsigned int timeoutMs); + + /** + * @brief Sets the playback speed. + * + * + * + * @param speed Indicates the speed of video playback. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + SetPlaybackSpeed([in] float speed); + + /** + * @brief Registers the Callback for lpp sync manager apdater. + * + * + * + * @param syncCallback Indicates the callback to register. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + RegisterCallback([in] ILppSyncManagerCallback syncCallback); + + /** + * @brief Sets parameters for this component, that is, sends an initialization parameter + * structure to the component. + * + * + * + * @param parameter Indicates the Key-value pair parameter for configuration item extension. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + SetParameter([in] Map parameter); + + /** + * @brief Obtains the parameter settings of this component. + * + * + * + * @param parameter Indicates the Key-value pair parameter for configuration item extension. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + GetParameter([out] Map parameter); + + /** + * @brief Updates the time anchor. + * + * + * + * @param anchorPts Indicates the Updated anchor media pts. + * @param anchorClk Indicates the Updated anchor system time. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + UpdateTimeAnchor([in] unsigned long anchorPts, [in] unsigned long anchorClk); + + /** + * @brief Binds the output buffers of the decoder. + * + * + * + * @param outputBuffers Indicates the output buffers of the decoder. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + BindOutputBuffers([in] Map outputBuffers); + + /** + * @brief Unbinds the YUV buffer. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + UnbindOutputBuffers(); + + /** + * @brief Gets the share buffer. + * + * + * + * @param fd Indicates the file descriptor of the current shared buffer. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + GetShareBuffer([out] FileDescriptor fd); + + /** + * @brief Sets the tunnel id. + * + * + * + * @param tunnelId Indicates the tunnel ID of the layer. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + SetTunnelId([in] unsigned long tunnelId); +} \ No newline at end of file diff --git a/low_power_player/v1_0/ILppSyncManagerCallback.idl b/low_power_player/v1_0/ILppSyncManagerCallback.idl new file mode 100644 index 00000000..28545711 --- /dev/null +++ b/low_power_player/v1_0/ILppSyncManagerCallback.idl @@ -0,0 +1,122 @@ +/* + * Copyright (c) 2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/** + * @addtogroup LowPowerPlayer + * @{ + * + * @ @brief Provides unified APIs for media services to access low power player drivers. + * + * The media service can obtain a low power player driver object or proxy, and then invoke the + * API provided by the object or proxy, The module provides APIs for initializing the custom data + * and audio and video codecs, setting parameters, and controlling and transferring data. + * + * @since 6.0 + * @version 1.0 + */ + +package ohos.hdi.low_power_player.v1_0; + +/** + * @brief Defines the callbacks of the lpp sync manager adapter. + * + * The following callbacks are provided: + * - Callback used to report events during Video Playback. + * - Callback invoked when the video playback is complete. + * - Callback invoked when the first frame of the video is ready. + * - Callback invoked when the playback is abnormal. + * - Callback invoked when the target frame has been decoded after precise seek. + * - Callback invoked when the first frame has been sent and displayed. + * The callbacks are registered by using when the adapter is created. + */ + +[callback] interface ILppSyncManagerCallback { + /** + * @brief Reports error event. + * + * + * @param errorCode Indicates the error code. + * @param errorMsg Indicates the error message. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + OnError([in] int errorCode, [in] String errorMsg); + + /** + * @brief Reports when the target frame has been decoded after precise seek. + * + * + * @param targetPts Indicates pts of the target frame. + * @param isTimeout Indicates whether the timeout occurs. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + OnTargetArrived([in] long targetPts, [in] boolean isTimeout); + + /** + * @brief Reports when the first frame has been sent and displayed. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + OnRenderStarted(); + + /** + * @brief Reports when the video has been played. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + OnEos(); + /** + * @brief Reports when the first frame of the video is ready. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + OnFirstFrameReady(); + + /** + * @brief Reports the process message. + * + * + * @param errorCode Indicates the info code. + * @param errorMsg Indicates the info message. + * + * @return Returns HDF_SUCCESS if the operation is successful. + * @return Returns HDF_FAILURE if the execution fails. + * + * @since 6.0 + * @version 1.0 + */ + OnInfo([in] int infoCode, [in] String infoMsg); +} \ No newline at end of file -- Gitee