1/*
2 * Copyright (c) 2024 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 3.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.v3_0;
47
48import ohos.hdi.codec.v3_0.CodecTypes;
49import ohos.hdi.codec.v3_0.ICodecComponent;
50import ohos.hdi.codec.v3_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     * @version 2.0
77     */
78    GetComponentNum([out] int count);
79
80    /**
81     * @brief Obtains codec capabilities.
82     *
83     * You can use this API to obtain the encoding and decoding capabilities provided by the Codec module.
84     * For details, see {@link CodecCompCapability}.
85     *
86     * @param capList Indicates the codec capabilities {@link CodecCompCapability} obtained.
87     * @param count Indicates the number of codec components, which is obtained by {@link GetComponentNum}.
88     *
89     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
90     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
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>OMX_ERRORTYPE</b> defined by OpenMAX IL.
94     *
95     * @since 4.1
96     * @version 2.0
97     */
98    GetComponentCapabilityList([out] struct CodecCompCapability[] capList, [in] int count);
99
100    /**
101     * @brief Creates a codec component instance.
102     *
103     *
104     *
105     * @param component Indicates the pointer to the Codec component created.
106     * @param componentId Indicates the ID of the component created.
107     * @param compName Indicates the component name.
108     * @param appData Indicates the pointer to an application-defined value that will be returned by the callback.
109     * @param callbacks Indicates the pointer to the OMX_CALLBACKTYPE structure. For details,
110     * see {@link ICodecCallback}.
111     *
112     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
113     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
114     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
115     * @return Returns other values if the underlying layer returns a failure. For details about the error codes,
116     * see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
117     *
118     * @since 4.1
119     * @version 2.0
120     */
121    CreateComponent([out] ICodecComponent component, [out] unsigned int componentId, [in] String compName,
122        [in] long appData, [in] ICodecCallback callbacks);
123
124	/**
125     * @brief Destroys a codec component instance.
126     *
127     *
128     *
129     * @param componentId Indicates the ID of the codec component to destroy.
130     *
131     * @return Returns <b>HDF_SUCCESS</b> if the operation is successful.
132     * @return Returns <b>HDF_ERR_INVALID_PARAM</b> if the operation fails due to invalid parameters.
133     * @return Returns <b>HDF_FAILURE</b> if the execution fails.
134     * @return Returns other values if the underlying layer returns a failure. For details about the
135     * error codes, see <b>OMX_ERRORTYPE</b> defined by OpenMAX IL.
136     *
137     * @since 4.1
138     * @version 2.0
139     */
140    DestroyComponent([in] unsigned int componentId);
141}