1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
// automatically generated by rust-bindgen 0.71.1
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(deprecated)]
#[allow(unused_imports)]
use crate::avbuffer_info::OH_AVCodecBufferAttr;
#[allow(unused_imports)]
use crate::avcodec_base::{OH_AVCodec, OH_AVCodecAsyncCallback};
#[allow(unused_imports)]
use crate::averrors::OH_AVErrCode;
#[allow(unused_imports)]
use crate::avformat::OH_AVFormat;
extern "C" {
/// Creates an audio encoder instance from the mime type, this interface is recommended in most cases.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `mime` - mime type description string, refer to [`AVCODEC_MIME_TYPE`]
///
/// # Returns
///
/// * Returns a Pointer to an OH_AVCodec instance
///
/// **Deprecated** since 11
/// OH_AudioCodec_CreateByMime
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_CreateByMime(mime: *const ::core::ffi::c_char) -> *mut OH_AVCodec;
/// Create an audio encoder instance through the audio encoder name.
/// The premise of using this interface is to know the exact name of the encoder.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `name` - Audio encoder name
///
/// # Returns
///
/// * Returns a Pointer to an OH_AVCodec instance
///
/// **Deprecated** since 11
/// OH_AudioCodec_CreateByName
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_CreateByName(name: *const ::core::ffi::c_char) -> *mut OH_AVCodec;
/// Clear the internal resources of the encoder and destroy the encoder instance
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// # Returns
///
/// * Returns AV_ERR_OK if the execution is successful,
/// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
///
/// **Deprecated** since 11
/// OH_AudioCodec_Destroy
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_Destroy(codec: *mut OH_AVCodec) -> OH_AVErrCode;
/// Set the asynchronous callback function so that your application can respond to
/// the events generated by the audio encoder. This interface must be called before Prepare is called.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// * `callback` - A collection of all callback functions, see [`OH_AVCodecAsyncCallback`]
///
/// * `userData` - User specific data
///
/// # Returns
///
/// * Returns AV_ERR_OK if the execution is successful,
/// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
///
/// **Deprecated** since 11
/// OH_AudioCodec_RegisterCallback
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_SetCallback(
codec: *mut OH_AVCodec,
callback: OH_AVCodecAsyncCallback,
userData: *mut ::core::ffi::c_void,
) -> OH_AVErrCode;
/// To configure the audio encoder, typically, you need to configure the description information of
/// the encoded audio track. This interface must be called before Prepare is called.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// * `format` - OH_AVFormat handle pointer
///
/// # Returns
///
/// * Returns AV_ERR_OK if the execution is successful,
/// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
///
/// **Deprecated** since 11
/// OH_AudioCodec_Configure
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_Configure(
codec: *mut OH_AVCodec,
format: *mut OH_AVFormat,
) -> OH_AVErrCode;
/// To prepare the internal resources of the encoder,
/// the Configure interface must be called before calling this interface.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// # Returns
///
/// * Returns AV_ERR_OK if the execution is successful,
/// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
///
/// **Deprecated** since 11
/// OH_AudioCodec_Prepare
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_Prepare(codec: *mut OH_AVCodec) -> OH_AVErrCode;
/// Start the encoder, this interface must be called after the Prepare is successful.
/// After being successfully started, the encoder will start reporting NeedInputData events.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// # Returns
///
/// * Returns AV_ERR_OK if the execution is successful,
/// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
///
/// **Deprecated** since 11
/// OH_AudioCodec_Start
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_Start(codec: *mut OH_AVCodec) -> OH_AVErrCode;
/// Stop the encoder. After stopping, you can re-enter the Started state through Start.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// # Returns
///
/// * Returns AV_ERR_OK if the execution is successful,
/// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
///
/// **Deprecated** since 11
/// OH_AudioCodec_Stop
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_Stop(codec: *mut OH_AVCodec) -> OH_AVErrCode;
/// Clear the input and output data buffered in the encoder. After this interface is called,
/// all the Buffer indexes previously reported through the asynchronous callback will be invalidated,
/// make sure not to access the Buffers corresponding to these indexes.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// # Returns
///
/// * Returns AV_ERR_OK if the execution is successful,
/// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
///
/// **Deprecated** since 11
/// OH_AudioCodec_Flush
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_Flush(codec: *mut OH_AVCodec) -> OH_AVErrCode;
/// Reset the encoder. To continue coding, you need to call the Configure interface
/// again to configure the encoder instance.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// # Returns
///
/// * Returns AV_ERR_OK if the execution is successful,
/// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
///
/// **Deprecated** since 11
/// OH_AudioCodec_Reset
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_Reset(codec: *mut OH_AVCodec) -> OH_AVErrCode;
/// Get the description information of the output data of the encoder, refer to [`OH_AVFormat`] for details.
/// It should be noted that the life cycle of the OH_AVFormat instance pointed to by the return value * needs to
/// be manually released by the caller.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// # Returns
///
/// * Returns the OH_AVFormat handle pointer, the life cycle is refreshed with the next GetOutputMediaDescription,
/// or destroyed with OH_AVCodec;
///
/// **Deprecated** since 11
/// OH_AudioCodec_GetOutputDescription
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_GetOutputDescription(codec: *mut OH_AVCodec) -> *mut OH_AVFormat;
/// Set dynamic parameters to the encoder. Note: This interface can only be called after the encoder is started.
/// At the same time, incorrect parameter settings may cause the encoding to fail.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// * `format` - OH_AVFormat handle pointer
///
/// # Returns
///
/// * Returns AV_ERR_OK if the execution is successful,
/// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
///
/// **Deprecated** since 11
/// OH_AudioCodec_SetParameter
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_SetParameter(
codec: *mut OH_AVCodec,
format: *mut OH_AVFormat,
) -> OH_AVErrCode;
/// Submit the input buffer filled with data to the audio encoder. The [`OH_AVCodecOnNeedInputData`]
/// callback will report the available input buffer and the corresponding index value. Once the buffer with the
/// specified index is submitted to the audio encoder, the buffer cannot be accessed again until the
/// callback is received again reporting that the buffer with the same index is available
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// * `index` - Enter the index value corresponding to the Buffer
///
/// * `attr` - Information describing the data contained in the Buffer
///
/// # Returns
///
/// * Returns AV_ERR_OK if the execution is successful,
/// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
///
/// **Deprecated** since 11
/// OH_AudioCodec_PushInputBuffer
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_PushInputData(
codec: *mut OH_AVCodec,
index: u32,
attr: OH_AVCodecBufferAttr,
) -> OH_AVErrCode;
/// Return the processed output Buffer to the encoder.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// * `index` - The index value corresponding to the output Buffer
///
/// # Returns
///
/// * Returns AV_ERR_OK if the execution is successful,
/// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
///
/// **Deprecated** since 11
/// OH_AudioCodec_FreeOutputBuffer
///
/// Available since API-level: 9
///
/// Version: 1.0
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_FreeOutputData(codec: *mut OH_AVCodec, index: u32) -> OH_AVErrCode;
/// Check whether the current codec instance is valid. It can be used fault recovery or app
/// switchback from the background
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.AudioEncoder
/// # Arguments
///
/// * `codec` - Pointer to an OH_AVCodec instance
///
/// * `isValid` - Output Parameter. A pointer to a boolean instance, it is true if the codec instance is valid,
/// false if the codec instance is invalid
///
/// # Returns
///
/// * Returns AV_ERR_OK if the execution is successful,
/// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
///
/// **Deprecated** since 11
/// OH_AudioCodec_IsValid
///
/// Available since API-level: 10
#[deprecated(since = "11")]
pub fn OH_AudioEncoder_IsValid(codec: *mut OH_AVCodec, isValid: *mut bool) -> OH_AVErrCode;
}