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 ICodecImageJpeg.idl 31 * 32 * @brief Declares the APIs for jpeg image codec. 33 * 34 *You can use these APIs to allocate input buffer, and decode jpeg 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; 49import ohos.hdi.codec.image.v1_0.ICodecImageCallback; 50 51interface ICodecImageJpeg { 52 53 /** 54 * @brief Obtains image codec capabilities. 55 * 56 * You can use this API to obtain the encoding and decoding capabilities provided by the image Codec module. 57 * For details, see {@link CodecImageCapability}. 58 * 59 * @param capList Indicates the image codec capabilities {@link CodecImageCapability} obtained. 60 * 61 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 62 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 63 * 64 * @since 4.0 65 */ 66 GetImageCapability([out] struct CodecImageCapability[] capList); 67 68 /** 69 * @brief Jpeg image codec module init. 70 * 71 * You can use this API to init the jpeg image Codec module. 72 * 73 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 74 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 75 * @return Returns other values if the underlying layer returns a failure. For details about the error codes, 76 * see <b>HDF_STATUS</b> defined by HDF. 77 * 78 * @since 4.0 79 */ 80 JpegInit(); 81 82 /** 83 * @brief Jpeg image codec module deinit. 84 * 85 * You can use this API to deinit the jpeg image Codec module. 86 * 87 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 88 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 89 * @return Returns other values if the underlying layer returns a failure. For details about the error codes, 90 * see <b>HDF_STATUS</b> defined by HDF. 91 * 92 * @since 4.0 93 */ 94 JpegDeInit(); 95 96 /** 97 * @brief Start jpeg image decode. 98 * 99 * You can use this API to start jpeg image decode, if return Returns <b>HDF_SUCCESS</b>, 100 * the image is decoding, you should receive the decode result by <b>callbacks</b>. 101 * 102 * @param inBuffer Indicates input buffer of the jpeg image decode {@link CodecImageBuffer} obtained. 103 * @param outBuffer Indicates output buffer of the jpeg image decode {@link CodecImageBuffer} obtained. 104 * @param callbacks Indicates callback of the image decode {@link ICodecImageCallback} obtained. 105 * @param decInfo Indicates decode information of the image decode {@link JpegDecInfo} obtained. 106 * 107 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 108 * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters. 109 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 110 * @return Returns other values if the underlying layer returns a failure. For details about the error codes, 111 * see <b>HDF_STATUS</b> defined by HDF. 112 * 113 * @since 4.0 114 */ 115 DoJpegDecode([in] struct CodecImageBuffer inBuffer, [in] struct CodecImageBuffer outBuffer, 116 [in] ICodecImageCallback callbacks, [in] struct CodecJpegDecInfo decInfo); 117 118 /** 119 * @brief Allocate input buffer. 120 * 121 * You can use this API to allocate input buffer for jpeg image decode. 122 * 123 * @param inBuffer Indicates input buffer of the jpeg image decode {@link CodecImageBuffer} obtained. 124 * @param size Indicates size of input buffer {@link CodecImageBuffer} obtained. 125 * 126 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 127 * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters. 128 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 129 * @return Returns other values if the underlying layer returns a failure. For details about the error codes, 130 * see <b>HDF_STATUS</b> defined by HDF. 131 * 132 * @since 4.0 133 */ 134 AllocateInBuffer([out] struct CodecImageBuffer inBuffer, [in] unsigned int size); 135 136 /** 137 * @brief Free input buffer. 138 * 139 * You can use this API to free input buffer for jpeg image decode. 140 * 141 * @param buffer Indicates input buffer of the jpeg image decode {@link CodecImageBuffer} obtained. 142 * 143 * @return Returns <b>HDF_SUCCESS</b> if the operation is successful. 144 * @return Returns <b>HDF_FAILURE</b> if the execution fails. 145 * @return Returns other values if the underlying layer returns a failure. For details about the error codes, 146 * see <b>HDF_STATUS</b> defined by HDF. 147 * 148 * @since 4.0 149 */ 150 FreeInBuffer([in] struct CodecImageBuffer inBuffer); 151 152} 153