1/* 2 * Copyright (c) 2023 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 Codec 18 * @{ 19 * 20 * @brief Defines APIs of the Codec module. 21 * 22 * The Codec module provides APIs for initializing the custom data and audio and video codecs, 23 * setting codec parameters, and controlling and transferring data. 24 * 25 * @since 4.1 26 * @version 2.0 27 */ 28 29/** 30 * @file ICodecComponentManager.idl 31 * 32 * @brief Declares the APIs for managing Codec components. 33 * 34 * You can use the APIs to obtain the component encoding and decoding capabilities, and create or destroy components. 35 * 36 * @since 4.1 37 * @version 2.0 38 */ 39 40/** 41 * @brief Defines the path for the package of the Codec module APIs. 42 * 43 * @since 4.1 44 * @version 2.0 45 */ 46package ohos.hdi.codec.v2_0; 47 48import ohos.hdi.codec.v2_0.CodecTypes; 49import ohos.hdi.codec.v2_0.ICodecComponent; 50import ohos.hdi.codec.v2_0.ICodecCallback; 51 52/** 53 * @brief Defines the APIs for managing the codec components. 54 * 55 * The APIs can be used to: 56 * - Obtain the number of codec components and codec capabilities. 57 * - Create or destroy a codec component. 58 */ 59 60interface ICodecComponentManager { 61 62 /** 63 * @brief Obtains the number of codec components. 64 * 65 * Codec capabilities can be further obtained based on the number of codec components. 66 * 67 * @param count Indicates the number of codec components obtained. 68 * 69 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 70 * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters. 71 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 72 * @return Returns other values if the underlying layer returns a failure. For details about the 73 * error codes, see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL. 74 * 75 * @since 4.1 76 */ 77 GetComponentNum([out] int count); 78 79 /** 80 * @brief Obtains codec capabilities. 81 * 82 * You can use this API to obtain the encoding and decoding capabilities provided by the Codec module. 83 * For details, see {@link CodecCompCapability}. 84 * 85 * @param capList Indicates the codec capabilities {@link CodecCompCapability} obtained. 86 * @param count Indicates the number of codec components, which is obtained by {@link GetComponentNum}. 87 * 88 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 89 * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters. 90 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 91 * @return Returns other values if the underlying layer returns a failure. For details about the error codes, 92 * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL. 93 * 94 * @since 4.1 95 */ 96 GetComponentCapabilityList([out] struct CodecCompCapability[] capList, [in] int count); 97 98 /** 99 * @brief Creates a codec component instance. 100 * 101 * 102 * 103 * @param component Indicates the pointer to the Codec component created. 104 * @param componentId Indicates the ID of the component created. 105 * @param compName Indicates the component name. 106 * @param appData Indicates the pointer to an application-defined value that will be returned by the callback. 107 * @param callbacks Indicates the pointer to the OMX_CALLBACKTYPE structure. For details, 108 * see {@link ICodecCallback}. 109 * 110 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 111 * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters. 112 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 113 * @return Returns other values if the underlying layer returns a failure. For details about the error codes, 114 * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL. 115 * 116 * @since 4.1 117 */ 118 CreateComponent([out] ICodecComponent component, [out] unsigned int componentId, [in] String compName, 119 [in] long appData, [in] ICodecCallback callbacks); 120 121 /** 122 * @brief Destroys a codec component instance. 123 * 124 * 125 * 126 * @param componentId Indicates the ID of the codec component to destroy. 127 * 128 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 129 * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters. 130 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 131 * @return Returns other values if the underlying layer returns a failure. For details about the 132 * error codes, see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL. 133 * 134 * @since 4.1 135 */ 136 DestroyComponent([in] unsigned int componentId); 137}