/* * 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 Codec * @{ * * @brief Defines APIs of the Codec module. * * The Codec module provides APIs for initializing the custom data and audio and video codecs, * setting codec parameters, and controlling and transferring data. * * @since 3.2 * @version 1.0 */ /** * @file ICodecCallback.idl * * @brief Defines the callbacks used to report codec events and processing results of the input and output buffers. * * * * @since 3.2 * @version 1.0 */ /** * @brief Defines the path for the package of the Codec module APIs. * * @since 3.2 * @version 1.0 */ package ohos.hdi.codec.v1_0; import ohos.hdi.codec.v1_0.CodecTypes; /** * @brief Defines the callbacks of the Codec module. * * The following callbacks are provided: * - Callback used to report component error events, command completion events, and port setting events. * For details, see {@link EventHandler}. * - Callback invoked when the input port has data processed in the buffer. For details, see {@link EmptyBufferDone}. * - Callback invoked when the output port has data filled into the buffer. For details, see {@link FillBufferDone}. * The callbacks are registered by using: * - {@link CreateComponent} when a component is created. * - {@link SetCallbacks} when the component is in the OMX_StateLoaded state. */ [callback] interface ICodecCallback { /** * @brief Reports an event, such as an error, a command completion event, and port setting changes. * * - When event is CODEC_EVENT_CMD_COMPLETE and eventData is null, * data2 indicates a state if data1 is CODEC_COMMAND_STATE_SET and indicates a port if * data1 is any CodecCommandType other than CODEC_COMMAND_STATE_SET. * - When event is CODEC_EVENT_ERROR, data1 indicates an error code and data2 * and eventData are both 0. * - When event is CODEC_EVENT_MARK, data1 and data2 are both 0 and * eventData points to the mark. * - When event is CODEC_EVENT_PORT_SETTINGS_CHANGED, data1 indicates a port and data2 * and eventData are 0. * - When event is CODEC_EVENT_BUFFER_FLAG, data1 indicates a port, data2 indicates a * flag, and eventData is 0. * - When event is CODEC_EVENT_RESOURCES_ACQUIRED or CODEC_EVENT_DYNAMIC_RESOURCES_AVAILABLE, * data1, data2, and eventData are 0. * * @param event Indicates the type of the event to report. For details, see {@link CodecEventType}. * @param info Indicates the pointer to the information to report. For details, see {@link EventInfo}. * * @return Returns HDF_SUCCESS if the operation is successful. * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. * @return Returns HDF_FAILURE if the execution fails. * @return Returns other values if the underlying layer returns a failure. For details about the error codes, * see OMX_ERRORTYPE defined by OpenMAX IL. * * @since 3.2 */ EventHandler([in] enum CodecEventType event, [in] struct EventInfo info); /** * @brief Reports an event indicating that the encoding or decoding in the input buffer is complete. * * * @param appData Indicates the application data. Generally, it is an upper-layer instance * passed in for the callback. * @param buffer Indicates information about the input buffer that was emptied. For details, * see {@link OmxCodecBuffer}. * * @return Returns HDF_SUCCESS if the operation is successful. * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. * @return Returns HDF_FAILURE if the execution fails. * @return Returns other values if the underlying layer returns a failure. For details about the * error codes, see OMX_ERRORTYPE defined by OpenMAX IL. * * @since 3.2 */ EmptyBufferDone([in] long appData, [in] struct OmxCodecBuffer buffer); /** * @brief Reports an event indicating that the output buffer is filled. * * * @param appData Indicates the application data. Generally, it is an upper-layer instance * passed in for the callback. * @param buffer Indicates information about the buffer that was filled. For details, see {@link OmxCodecBuffer}. * * @return Returns HDF_SUCCESS if the operation is successful. * @return Returns HDF_ERR_INVALID_PARAM if the operation fails due to invalid parameters. * @return Returns HDF_FAILURE if the execution fails. * @return Returns other values if the underlying layer returns a failure. For details about the error codes, * see OMX_ERRORTYPE defined by OpenMAX IL. * * @since 3.2 */ FillBufferDone([in] long appData, [in] struct OmxCodecBuffer buffer); }