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 image Codec module. 21 * 22 * The Codec module provides APIs for image codec, setting codec parameters, 23 * and controlling and transferring image data. 24 * 25 * @since 4.0 26 * @version 1.0 27 */ 28 29/** 30 * @file ICodecImage.idl 31 * 32 * @brief Declares the APIs for image codec. 33 * 34 *You can use these APIs to allocate input buffer, and decode image 35 * 36 * @since 4.0 37 * @version 1.0 38 */ 39 40/** 41 * @brief Defines the path for the package of the image Codec module APIs. 42 * 43 * @since 4.0 44 * @version 1.0 45 */ 46package ohos.hdi.codec.image.v1_0; 47 48import ohos.hdi.codec.image.v1_0.CodecImageType; 49 50interface ICodecImage { 51 52 /** 53 * @brief Obtains image codec capabilities. 54 * 55 * You can use this API to obtain the encoding and decoding capabilities provided by the image Codec module. 56 * For details, see {@link CodecImageCapability}. 57 * 58 * @param capList Indicates the image codec capabilities {@link CodecImageCapability} obtained. 59 * 60 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 61 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 62 * 63 * @since 4.0 64 */ 65 GetImageCapability([out] struct CodecImageCapability[] capList); 66 67 /** 68 * @brief Image codec module init. 69 * 70 * You can use this API to init the Image Codec module. 71 * 72 * @param role Indicates the image codec role {@link CodecImageRole} obtained. 73 * 74 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 75 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 76 * @return Returns other values if the underlying layer returns a failure. For details about the error codes, 77 * see <b>HDF_STATUS</b> defined by HDF. 78 * 79 * @since 4.0 80 */ 81 Init([in] enum CodecImageRole role); 82 83 /** 84 * @brief Image codec module deinit. 85 * 86 * You can use this API to deinit the Image Codec module. 87 * 88 * @param role Indicates the image codec role {@link CodecImageRole} obtained. 89 * 90 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 91 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 92 * @return Returns other values if the underlying layer returns a failure. For details about the error codes, 93 * see <b>HDF_STATUS</b> defined by HDF. 94 * 95 * @since 4.0 96 */ 97 DeInit([in] enum CodecImageRole role); 98 99 /** 100 * @brief Start jpeg image decode. 101 * 102 * You can use this API to start jpeg image decode. 103 * 104 * @param inBuffer Indicates input buffer of the jpeg image decode {@link CodecImageBuffer} obtained. 105 * @param outBuffer Indicates output buffer of the jpeg image decode {@link CodecImageBuffer} obtained. 106 * @param decInfo Indicates decode information of the image decode {@link JpegDecInfo} obtained. 107 * 108 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 109 * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters. 110 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 111 * @return Returns other values if the underlying layer returns a failure. For details about the error codes, 112 * see <b>HDF_STATUS</b> defined by HDF. 113 * 114 * @since 4.0 115 */ 116 DoJpegDecode([in] struct CodecImageBuffer inBuffer, [in] struct CodecImageBuffer outBuffer, 117 [in] struct CodecJpegDecInfo decInfo); 118 119 /** 120 * @brief Allocate input buffer. 121 * 122 * You can use this API to allocate input buffer for image codec. 123 * After input buffer is duplicated to proxy, stub will automatically free its own reference to input buffer. 124 * 125 * @param inBuffer Indicates input buffer of the image codec {@link CodecImageBuffer} obtained. 126 * @param size Indicates size of input buffer {@link CodecImageBuffer} obtained. 127 * @param role Indicates image codec role of input buffer {@link CodecImageRole} obtained. 128 * 129 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 130 * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters. 131 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 132 * @return Returns other values if the underlying layer returns a failure. For details about the error codes, 133 * see <b>HDF_STATUS</b> defined by HDF. 134 * 135 * @since 4.0 136 */ 137 AllocateInBuffer([out] struct CodecImageBuffer inBuffer, [in] unsigned int size, [in] CodecImageRole role); 138 139 /** 140 * @brief Free input buffer. 141 * 142 * You can use this API to free input buffer for image decode. 143 * 144 * @param buffer Indicates input buffer of the image codec {@link CodecImageBuffer} obtained. 145 * 146 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 147 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 148 * @return Returns other values if the underlying layer returns a failure. For details about the error codes, 149 * see <b>HDF_STATUS</b> defined by HDF. 150 * 151 * @since 4.0 152 * @deprecated 153 * @stub no longer hold reference to input buffer, no need to free. 154 */ 155 FreeInBuffer([in] struct CodecImageBuffer inBuffer); 156 157} 158