1c5e268c6Sopenharmony_ci/*
2c5e268c6Sopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
3c5e268c6Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
4c5e268c6Sopenharmony_ci * you may not use this file except in compliance with the License.
5c5e268c6Sopenharmony_ci * You may obtain a copy of the License at
6c5e268c6Sopenharmony_ci *
7c5e268c6Sopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
8c5e268c6Sopenharmony_ci *
9c5e268c6Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software
10c5e268c6Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
11c5e268c6Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12c5e268c6Sopenharmony_ci * See the License for the specific language governing permissions and
13c5e268c6Sopenharmony_ci * limitations under the License.
14c5e268c6Sopenharmony_ci */
15c5e268c6Sopenharmony_ci
16c5e268c6Sopenharmony_ci /**
17c5e268c6Sopenharmony_ci * @addtogroup Codec
18c5e268c6Sopenharmony_ci * @{
19c5e268c6Sopenharmony_ci *
20c5e268c6Sopenharmony_ci * @brief Defines APIs of the image Codec module.
21c5e268c6Sopenharmony_ci *
22c5e268c6Sopenharmony_ci * The Codec module provides APIs for image codec, setting codec parameters,
23c5e268c6Sopenharmony_ci * and controlling and transferring image data.
24c5e268c6Sopenharmony_ci *
25c5e268c6Sopenharmony_ci * @since 4.0
26c5e268c6Sopenharmony_ci * @version 1.0
27c5e268c6Sopenharmony_ci */
28c5e268c6Sopenharmony_ci
29c5e268c6Sopenharmony_ci/**
30c5e268c6Sopenharmony_ci * @file ICodecImage.idl
31c5e268c6Sopenharmony_ci *
32c5e268c6Sopenharmony_ci * @brief Declares the APIs for image codec.
33c5e268c6Sopenharmony_ci *
34c5e268c6Sopenharmony_ci *You can use these APIs to allocate input buffer, and decode image
35c5e268c6Sopenharmony_ci *
36c5e268c6Sopenharmony_ci * @since 4.0
37c5e268c6Sopenharmony_ci * @version 1.0
38c5e268c6Sopenharmony_ci */
39c5e268c6Sopenharmony_ci
40c5e268c6Sopenharmony_ci/**
41c5e268c6Sopenharmony_ci * @brief Defines the path for the package of the image Codec module APIs.
42c5e268c6Sopenharmony_ci *
43c5e268c6Sopenharmony_ci * @since 4.0
44c5e268c6Sopenharmony_ci * @version 1.0
45c5e268c6Sopenharmony_ci */
46c5e268c6Sopenharmony_cipackage ohos.hdi.codec.image.v1_0;
47c5e268c6Sopenharmony_ci
48c5e268c6Sopenharmony_ciimport ohos.hdi.codec.image.v1_0.CodecImageType;
49c5e268c6Sopenharmony_ci
50c5e268c6Sopenharmony_ciinterface ICodecImage {
51c5e268c6Sopenharmony_ci
52c5e268c6Sopenharmony_ci    /**
53c5e268c6Sopenharmony_ci     * @brief Obtains image codec capabilities.
54c5e268c6Sopenharmony_ci     *
55c5e268c6Sopenharmony_ci     * You can use this API to obtain the encoding and decoding capabilities provided by the image Codec module.
56c5e268c6Sopenharmony_ci     * For details, see {@link CodecImageCapability}.
57c5e268c6Sopenharmony_ci     *
58c5e268c6Sopenharmony_ci     * @param capList Indicates the image codec capabilities {@link CodecImageCapability} obtained.
59c5e268c6Sopenharmony_ci     *
60c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
61c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
62c5e268c6Sopenharmony_ci     *
63c5e268c6Sopenharmony_ci     * @since 4.0
64c5e268c6Sopenharmony_ci     */
65c5e268c6Sopenharmony_ci    GetImageCapability([out] struct CodecImageCapability[] capList);
66c5e268c6Sopenharmony_ci
67c5e268c6Sopenharmony_ci    /**
68c5e268c6Sopenharmony_ci     * @brief Image codec module init.
69c5e268c6Sopenharmony_ci     *
70c5e268c6Sopenharmony_ci     * You can use this API to init the Image Codec module.
71c5e268c6Sopenharmony_ci     *
72c5e268c6Sopenharmony_ci     * @param role Indicates the image codec role {@link CodecImageRole} obtained.
73c5e268c6Sopenharmony_ci     *
74c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
75c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
76c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
77c5e268c6Sopenharmony_ci     * see <b>HDF_STATUS</b> defined by HDF.
78c5e268c6Sopenharmony_ci     *
79c5e268c6Sopenharmony_ci     * @since 4.0
80c5e268c6Sopenharmony_ci     */
81c5e268c6Sopenharmony_ci    Init([in] enum CodecImageRole role);
82c5e268c6Sopenharmony_ci
83c5e268c6Sopenharmony_ci    /**
84c5e268c6Sopenharmony_ci     * @brief Image codec module deinit.
85c5e268c6Sopenharmony_ci     *
86c5e268c6Sopenharmony_ci     * You can use this API to deinit the Image Codec module.
87c5e268c6Sopenharmony_ci     *
88c5e268c6Sopenharmony_ci     * @param role Indicates the image codec role {@link CodecImageRole} obtained.
89c5e268c6Sopenharmony_ci     *
90c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
91c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
92c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
93c5e268c6Sopenharmony_ci     * see <b>HDF_STATUS</b> defined by HDF.
94c5e268c6Sopenharmony_ci     *
95c5e268c6Sopenharmony_ci     * @since 4.0
96c5e268c6Sopenharmony_ci     */
97c5e268c6Sopenharmony_ci    DeInit([in] enum CodecImageRole role);
98c5e268c6Sopenharmony_ci
99c5e268c6Sopenharmony_ci    /**
100c5e268c6Sopenharmony_ci     * @brief Start jpeg image decode.
101c5e268c6Sopenharmony_ci     *
102c5e268c6Sopenharmony_ci     * You can use this API to start jpeg image decode.
103c5e268c6Sopenharmony_ci     *
104c5e268c6Sopenharmony_ci     * @param inBuffer Indicates input buffer of the jpeg image decode {@link CodecImageBuffer} obtained.
105c5e268c6Sopenharmony_ci     * @param outBuffer Indicates output buffer of the jpeg image decode {@link CodecImageBuffer} obtained.
106c5e268c6Sopenharmony_ci     * @param decInfo Indicates decode information of the image decode {@link JpegDecInfo} obtained.
107c5e268c6Sopenharmony_ci     *
108c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
109c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
110c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
111c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
112c5e268c6Sopenharmony_ci     * see <b>HDF_STATUS</b> defined by HDF.
113c5e268c6Sopenharmony_ci     *
114c5e268c6Sopenharmony_ci     * @since 4.0
115c5e268c6Sopenharmony_ci     */
116c5e268c6Sopenharmony_ci    DoJpegDecode([in] struct CodecImageBuffer inBuffer, [in] struct CodecImageBuffer outBuffer,
117c5e268c6Sopenharmony_ci                 [in] struct CodecJpegDecInfo decInfo);
118c5e268c6Sopenharmony_ci
119c5e268c6Sopenharmony_ci    /**
120c5e268c6Sopenharmony_ci     * @brief Allocate input buffer.
121c5e268c6Sopenharmony_ci     *
122c5e268c6Sopenharmony_ci     * You can use this API to allocate input buffer for image codec.
123c5e268c6Sopenharmony_ci     * After input buffer is duplicated to proxy, stub will automatically free its own reference to input buffer.
124c5e268c6Sopenharmony_ci     *
125c5e268c6Sopenharmony_ci     * @param inBuffer Indicates input buffer of the image codec {@link CodecImageBuffer} obtained.
126c5e268c6Sopenharmony_ci     * @param size Indicates size of input buffer {@link CodecImageBuffer} obtained.
127c5e268c6Sopenharmony_ci     * @param role Indicates image codec role of input buffer {@link CodecImageRole} obtained.
128c5e268c6Sopenharmony_ci     *
129c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
130c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
131c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
132c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
133c5e268c6Sopenharmony_ci     * see <b>HDF_STATUS</b> defined by HDF.
134c5e268c6Sopenharmony_ci     *
135c5e268c6Sopenharmony_ci     * @since 4.0
136c5e268c6Sopenharmony_ci     */
137c5e268c6Sopenharmony_ci    AllocateInBuffer([out] struct CodecImageBuffer inBuffer, [in] unsigned int size, [in] CodecImageRole role);
138c5e268c6Sopenharmony_ci
139c5e268c6Sopenharmony_ci    /**
140c5e268c6Sopenharmony_ci     * @brief Free input buffer.
141c5e268c6Sopenharmony_ci     *
142c5e268c6Sopenharmony_ci     * You can use this API to free input buffer for image decode.
143c5e268c6Sopenharmony_ci     *
144c5e268c6Sopenharmony_ci     * @param buffer Indicates input buffer of the image codec {@link CodecImageBuffer} obtained.
145c5e268c6Sopenharmony_ci     *
146c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
147c5e268c6Sopenharmony_ci     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
148c5e268c6Sopenharmony_ci     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
149c5e268c6Sopenharmony_ci     * see <b>HDF_STATUS</b> defined by HDF.
150c5e268c6Sopenharmony_ci     *
151c5e268c6Sopenharmony_ci     * @since 4.0
152c5e268c6Sopenharmony_ci     * @deprecated
153c5e268c6Sopenharmony_ci     * @stub no longer hold reference to input buffer, no need to free.
154c5e268c6Sopenharmony_ci     */
155c5e268c6Sopenharmony_ci    FreeInBuffer([in] struct CodecImageBuffer inBuffer);
156c5e268c6Sopenharmony_ci
157c5e268c6Sopenharmony_ci}
158