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
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
// 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::averrors::OH_AVErrCode;
/// Forward declaration of OH_AVFormat.
///
///
/// Available since API-level: 9
#[repr(C)]
pub struct OH_AVFormat {
_unused: [u8; 0],
}
impl OH_AVPixelFormat {
/// yuv 420 planar.
pub const AV_PIXEL_FORMAT_YUVI420: OH_AVPixelFormat = OH_AVPixelFormat(1);
/// NV12. yuv 420 semiplanar.
pub const AV_PIXEL_FORMAT_NV12: OH_AVPixelFormat = OH_AVPixelFormat(2);
/// NV21. yvu 420 semiplanar.
pub const AV_PIXEL_FORMAT_NV21: OH_AVPixelFormat = OH_AVPixelFormat(3);
/// format from surface.
pub const AV_PIXEL_FORMAT_SURFACE_FORMAT: OH_AVPixelFormat = OH_AVPixelFormat(4);
/// RGBA8888
pub const AV_PIXEL_FORMAT_RGBA: OH_AVPixelFormat = OH_AVPixelFormat(5);
/// RGBA1010102
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub const AV_PIXEL_FORMAT_RGBA1010102: OH_AVPixelFormat = OH_AVPixelFormat(6);
}
#[repr(transparent)]
/// Enumerates AVPixel Format.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
///
/// Available since API-level: 9
///
/// Version: 1.0
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OH_AVPixelFormat(pub ::core::ffi::c_uint);
extern "C" {
/// an OH_AVFormat handle pointer to read and write data
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
///
/// # Returns
///
/// * Returns a pointer to an OH_AVFormat instance
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_Create() -> *mut OH_AVFormat;
/// an audio OH_AVFormat handle pointer to read and write data
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `mimeType` - mime type
///
/// * `sampleRate` - sample rate
///
/// * `channelCount` - channel count
///
/// # Returns
///
/// * Returns a pointer to an OH_AVFormat instance if the execution is successful, otherwise nullptr
/// Possible failure causes: 1. mimeType is nullptr. 2. new format is nullptr.
///
/// Available since API-level: 10
///
/// Version: 1.0
pub fn OH_AVFormat_CreateAudioFormat(
mimeType: *const ::core::ffi::c_char,
sampleRate: i32,
channelCount: i32,
) -> *mut OH_AVFormat;
/// an video OH_AVFormat handle pointer to read and write data
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `mimeType` - mime type
///
/// * `width` - width
///
/// * `height` - height
///
/// # Returns
///
/// * Returns a pointer to an OH_AVFormat instance if the execution is successful, otherwise nullptr
/// Possible failure causes: 1. mimeType is nullptr. 2. new format is nullptr.
///
/// Available since API-level: 10
///
/// Version: 1.0
pub fn OH_AVFormat_CreateVideoFormat(
mimeType: *const ::core::ffi::c_char,
width: i32,
height: i32,
) -> *mut OH_AVFormat;
/// Destroy the specified OH_AVFormat handle resource
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// # Returns
///
/// * void
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_Destroy(format: *mut OH_AVFormat);
/// Copy OH_AVFormat handle resource
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `to` - OH_AVFormat handle pointer to receive data
///
/// * `from` - pointer to the OH_AVFormat handle of the copied data
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_Copy(to: *mut OH_AVFormat, from: *mut OH_AVFormat) -> bool;
/// Write Int data to OH_AVFormat
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - key to write data
///
/// * `value` - written data
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error. 3. key is nullptr.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_SetIntValue(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
value: i32,
) -> bool;
/// Write Long data to OH_AVFormat
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - key to write data
///
/// * `value` - written data
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error. 3. key is nullptr.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_SetLongValue(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
value: i64,
) -> bool;
/// Write Float data to OH_AVFormat
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - key to write data
///
/// * `value` - written data
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error. 3. key is nullptr.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_SetFloatValue(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
value: f32,
) -> bool;
/// Write Double data to OH_AVFormat
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - key to write data
///
/// * `value` - written data
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error. 3. key is nullptr.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_SetDoubleValue(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
value: f64,
) -> bool;
/// Write String data to OH_AVFormat
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - key to write data
///
/// * `value` - written data
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error. 3. key is nullptr.
/// 4. value is nullptr.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_SetStringValue(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
value: *const ::core::ffi::c_char,
) -> bool;
/// Write a block of data of a specified length to OH_AVFormat
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - key to write data
///
/// * `addr` - written data addr
///
/// * `size` - written data length
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error. 3. key is nullptr.
/// 4. addr is nullptr. 5. size is zero.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_SetBuffer(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
addr: *const u8,
size: usize,
) -> bool;
/// Read Int data from OH_AVFormat
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - read key value
///
/// * `out` - read data
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error. 3. key is nullptr.
/// 4. out is nullptr.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_GetIntValue(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
out: *mut i32,
) -> bool;
/// Read Long data from OH_AVFormat
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - read key value
///
/// * `out` - read data
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error. 3. key is nullptr.
/// 4. out is nullptr.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_GetLongValue(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
out: *mut i64,
) -> bool;
/// Read Float data from OH_AVFormat
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - read key value
///
/// * `out` - read data
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error. 3. key is nullptr.
/// 4. out is nullptr.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_GetFloatValue(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
out: *mut f32,
) -> bool;
/// Read Double data from OH_AVFormat
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - read key value
///
/// * `out` - read data
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error. 3. key is nullptr.
/// 4. out is nullptr.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_GetDoubleValue(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
out: *mut f64,
) -> bool;
/// Read String data from OH_AVFormat
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - read key value
///
/// * `out` - The read string pointer, the data life cycle pointed to is updated with GetString,
/// and Format is destroyed. If the caller needs to hold it for a long time, it must copy the memory
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error. 3. key is nullptr.
/// 4. out is nullptr. 5. malloc out string nullptr.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_GetStringValue(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
out: *mut *const ::core::ffi::c_char,
) -> bool;
/// Read a block of data of specified length from OH_AVFormat
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - Key value for reading and writing data
///
/// * `addr` - The life cycle is held by the format, with the destruction of the format,
/// if the caller needs to hold it for a long time, it must copy the memory
///
/// * `size` - Length of read and write data
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes: 1. input format is nullptr. 2. input format's magic error. 3. key is nullptr.
/// 4. addr is nullptr. 5. size is nullptr.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_GetBuffer(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
addr: *mut *mut u8,
size: *mut usize,
) -> bool;
/// Output the information contained in OH_AVFormat as a string.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// # Returns
///
/// * Returns a string consisting of key and data for success, nullptr for failure
/// Possible failure causes: 1. input format is nullptr. 2. malloc dump info nullptr.
///
/// Available since API-level: 9
///
/// Version: 1.0
pub fn OH_AVFormat_DumpInfo(format: *mut OH_AVFormat) -> *const ::core::ffi::c_char;
/// Read an array of int32_t values from an OH_AVFormat object.
///
/// Note that the obtained buffer's lifetime bound to the OH_AVFormat object,
/// it's automatically invalidated when the format object is destroyed.
///
/// Applications must explicitly copy the data to newly allocated memory if
/// the data needs to outlive the OH_AVFormat instance.
///
///
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - Data identifier key
///
/// * `addr` - Pointer to receive the data buffer reference
///
/// * `size` - Pointer to receive the element count
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes:
/// 1. input format is nullptr.
/// 2. input format's magic error.
/// 3. key is nullptr.
/// 4. addr is nullptr.
/// 5. size is nullptr.
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub fn OH_AVFormat_GetIntBuffer(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
addr: *mut *mut i32,
size: *mut usize,
) -> bool;
/// Write an array of int32_t values to an OH_AVFormat object.
///
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.Core
/// # Arguments
///
/// * `format` - pointer to an OH_AVFormat instance
///
/// * `key` - Data identifier key
///
/// * `addr` - Pointer to the source data buffer
///
/// * `size` - Number of elements to write (in elements, not bytes)
///
/// # Returns
///
/// * The return value is TRUE for success, FALSE for failure
/// Possible failure causes:
/// 1. input format is nullptr.
/// 2. input format's magic error.
/// 3. key is nullptr.
/// 4. addr is nullptr.
/// 5. size is zero.
///
/// Available since API-level: 20
#[cfg(feature = "api-20")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
pub fn OH_AVFormat_SetIntBuffer(
format: *mut OH_AVFormat,
key: *const ::core::ffi::c_char,
addr: *const i32,
size: usize,
) -> bool;
}