ohos-media-sys 0.1.0

Raw Bindings to the media framework on OpenHarmony
Documentation
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
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
// automatically generated by rust-bindgen 0.71.1

#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(deprecated)]
#[cfg(feature = "api-11")]
#[allow(unused_imports)]
use crate::avbuffer::OH_AVBuffer;
#[allow(unused_imports)]
use crate::avbuffer_info::OH_AVCodecBufferAttr;
#[cfg(feature = "api-11")]
#[allow(unused_imports)]
use crate::avcodec_base::OH_AVCodecCallback;
#[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;
use ohos_sys_opaque_types::OHNativeWindow;

/// When OH_AVCodec needs new input parameter during the running process, the function pointer will be called and
/// carry an available OH_AVFormat to fill in the new input parameter. This parameter takes effect immediately with the
/// frame.
///
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
/// # Arguments
///
/// * `codec` - OH_AVCodec instance
///
/// * `index` - The index corresponding to the new OH_AVFormat instance
///
/// * `parameter` - Parameter containing the new OH_AVFormat instance
///
/// * `userData` - specified data
///
/// Available since API-level: 12
#[cfg(feature = "api-12")]
#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
pub type OH_VideoEncoder_OnNeedInputParameter = ::core::option::Option<
    unsafe extern "C" fn(
        codec: *mut OH_AVCodec,
        index: u32,
        parameter: *mut OH_AVFormat,
        userData: *mut ::core::ffi::c_void,
    ),
>;
impl OH_VideoEncodeBitrateMode {
    /// constant bit rate mode.
    ///
    /// **Deprecated** since 14
    /// BITRATE_MODE_CBR
    #[deprecated(since = "14")]
    pub const CBR: OH_VideoEncodeBitrateMode = OH_VideoEncodeBitrateMode(0);
    /// variable bit rate mode.
    ///
    /// **Deprecated** since 14
    /// BITRATE_MODE_VBR
    #[deprecated(since = "14")]
    pub const VBR: OH_VideoEncodeBitrateMode = OH_VideoEncodeBitrateMode(1);
    /// constant quality mode.
    ///
    /// **Deprecated** since 14
    /// BITRATE_MODE_CQ
    #[deprecated(since = "14")]
    pub const CQ: OH_VideoEncodeBitrateMode = OH_VideoEncodeBitrateMode(2);
}
#[repr(transparent)]
/// The bitrate mode of video encoder.
///
/// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
///
/// **Deprecated** since 14
/// OH_BitrateMode
///
/// Available since API-level: 9
#[deprecated(since = "14")]
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct OH_VideoEncodeBitrateMode(pub ::core::ffi::c_uint);
extern "C" {
    /// Creates a video encoder instance from the mime type, which is recommended in most cases.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # Arguments
    ///
    /// * `mime` - mime type description string, refer to [`AVCODEC_MIME_TYPE`]
    ///
    /// # Returns
    ///
    /// * Returns a Pointer to an OH_AVCodec instance.
    /// Return nullptr if memory ran out or the mime type is not supported.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_CreateByMime(mime: *const ::core::ffi::c_char) -> *mut OH_AVCodec;
    /// Create a video encoder instance through the video encoder name. The premise of using this interface is to
    /// know the exact name of the encoder.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # Arguments
    ///
    /// * `name` - Video encoder name
    ///
    /// # Returns
    ///
    /// * Returns a Pointer to an OH_AVCodec instance.
    /// Return nullptr if memory ran out or the encoder name is not supported.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_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.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], inner resource has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_Destroy(codec: *mut OH_AVCodec) -> OH_AVErrCode;
    /// Set the asynchronous callback function so that your application can respond to the events generated by the
    /// video encoder. This interface must be called before Prepare is called.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], inner resource has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state, must be called before Prepare.
    ///
    /// **Deprecated** since 11
    /// OH_VideoEncoder_RegisterCallback
    ///
    /// Available since API-level: 9
    #[deprecated(since = "11")]
    pub fn OH_VideoEncoder_SetCallback(
        codec: *mut OH_AVCodec,
        callback: OH_AVCodecAsyncCallback,
        userData: *mut ::core::ffi::c_void,
    ) -> OH_AVErrCode;
    /// Set the asynchronous callback function so that your application can respond to the events generated by the
    /// video encoder. This interface must be called before Prepare is called.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `callback` - A collection of all callback functions, see [`OH_AVCodecCallback`]
    ///
    /// * `userData` - User specific data
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
    /// [`AV_ERR_NO_MEMORY`], inner resource has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state, must be called before Prepare.
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_VideoEncoder_RegisterCallback(
        codec: *mut OH_AVCodec,
        callback: OH_AVCodecCallback,
        userData: *mut ::core::ffi::c_void,
    ) -> OH_AVErrCode;
    /// Set the asynchronous callback function so that your application can respond to the events generated by the
    /// video encoder. This interface is optional only for input surface. If this interface is used, it must be invoked
    /// before [`OH_VideoEncoder_Configure`].
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `onInputParameter` - A callback functions, see [`OH_VideoEncoder_OnNeedInputParameter`]
    ///
    /// * `userData` - User specific data
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
    /// [`AV_ERR_NO_MEMORY`], inner resource has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state, must be called before Prepare.
    ///
    /// Available since API-level: 12
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_VideoEncoder_RegisterParameterCallback(
        codec: *mut OH_AVCodec,
        onInputParameter: OH_VideoEncoder_OnNeedInputParameter,
        userData: *mut ::core::ffi::c_void,
    ) -> OH_AVErrCode;
    /// To configure the video encoder, typically, you need to configure the description information of the
    /// encoded video track. This interface must be called before Prepare is called.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `format` - A pointer to an OH_AVFormat that gives the description of the video track to be encoded
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid. Invalid param in format.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state, must be called before Prepare.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_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.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_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.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_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.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_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.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_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.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_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.VideoEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// # Returns
    ///
    /// * Returns a pointer to an OH_AVFormat instance.
    /// Return nullptr if the codec is nullptr or invaild.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_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.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid. Invalid param in format.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_SetParameter(
        codec: *mut OH_AVCodec,
        format: *mut OH_AVFormat,
    ) -> OH_AVErrCode;
    /// Get the input Surface from the video encoder, this interface must be called before Prepare is called.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `window` - A pointer to a OHNativeWindow instance, see [`OHNativeWindow`], the application is responsible for
    /// managing the life cycle of the window, call OH_NativeWindow_DestroyNativeWindow() when done.
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
    /// [`AV_ERR_NO_MEMORY`], inner resource has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_GetSurface(
        codec: *mut OH_AVCodec,
        window: *mut *mut OHNativeWindow,
    ) -> OH_AVErrCode;
    /// Return the processed output Buffer to the encoder.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// Buffer index should be given by [`OH_AVCodecOnNewOutputData`].
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    /// **Deprecated** since 11
    /// OH_VideoEncoder_FreeOutputBuffer
    ///
    /// Available since API-level: 9
    #[deprecated(since = "11")]
    pub fn OH_VideoEncoder_FreeOutputData(codec: *mut OH_AVCodec, index: u32) -> OH_AVErrCode;
    /// Notifies the video encoder that the input stream has ended. It is recommended to use this interface to notify
    /// the encoder of the end of the stream in surface mode
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    /// Available since API-level: 9
    pub fn OH_VideoEncoder_NotifyEndOfStream(codec: *mut OH_AVCodec) -> OH_AVErrCode;
    /// Submit the input buffer filled with data to the video encoder.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// Buffer index should be given by [`OH_AVCodecOnNeedInputData`].
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    /// **Deprecated** since 11
    /// OH_VideoEncoder_PushInputBuffer
    ///
    /// Available since API-level: 10
    #[deprecated(since = "11")]
    pub fn OH_VideoEncoder_PushInputData(
        codec: *mut OH_AVCodec,
        index: u32,
        attr: OH_AVCodecBufferAttr,
    ) -> OH_AVErrCode;
    /// Submit the input buffer filled with data to the video encoder.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `index` - Enter the index value corresponding to the Buffer
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// Buffer index should be given by [`OH_AVCodecOnNeedInputBuffer`].
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_VideoEncoder_PushInputBuffer(codec: *mut OH_AVCodec, index: u32) -> OH_AVErrCode;
    /// Submit the input parameter filled with data to the video encoder.
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `index` - Enter the index value corresponding to the input parameter
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// Index should be given by [`OH_VideoEncoder_OnNeedInputParameter`].
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    /// Available since API-level: 12
    #[cfg(feature = "api-12")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
    pub fn OH_VideoEncoder_PushInputParameter(codec: *mut OH_AVCodec, index: u32) -> OH_AVErrCode;
    /// Return the processed output Buffer to the encoder.
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// Buffer index should be given by [`OH_AVCodecOnNewOutputBuffer`].
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    ///
    /// Available since API-level: 11
    #[cfg(feature = "api-11")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
    pub fn OH_VideoEncoder_FreeOutputBuffer(codec: *mut OH_AVCodec, index: u32) -> OH_AVErrCode;
    /// Queries the index of the next available input buffer.
    ///
    /// This API must be followed by calling [`OH_VideoEncoder_GetInputBuffer`] to obtain the buffer handle,
    /// which should then be passed to the encoder via [`OH_VideoEncoder_PushInputBuffer`].
    ///
    /// Note: This operation is only supported in synchronous mode.
    ///
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `index` - The index of the input buffer
    ///
    /// * `timeoutUs` - Timeout duration in microseconds, negative value indicates infinite wait.
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
    /// [`AV_ERR_NO_MEMORY`], internal errors in the input encode instance, such as an abnormal NULL.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    /// [`AV_ERR_OPERATE_NOT_PERMIT`], not permitted in asynchronous mode.
    /// [`AV_ERR_TRY_AGAIN_LATER`], query failed, recommended retry after delay..
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_VideoEncoder_QueryInputBuffer(
        codec: *mut OH_AVCodec,
        index: *mut u32,
        timeoutUs: i64,
    ) -> OH_AVErrCode;
    /// Acquires the handle of an available input buffer.
    ///
    /// Note: It's only applicable in synchronous mode.
    ///
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `index` - Buffer index obtained via [`OH_VideoEncoder_QueryInputBuffer`].
    ///
    /// # Returns
    ///
    /// * Returns a Pointer to an OH_AVBuffer instance.
    /// Return nullptr if no buffer available.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_VideoEncoder_GetInputBuffer(codec: *mut OH_AVCodec, index: u32) -> *mut OH_AVBuffer;
    /// Queries the index of the next available output buffer.
    ///
    /// The obtained buffer handle through [`OH_VideoEncoder_GetOutputBuffer`] must be
    /// return to the encoder via [`OH_VideoEncoder_FreeOutputBuffer`].
    ///
    /// Note: This operation is only supported in synchronous mode.
    ///
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `index` - The index value corresponding to the output buffer
    ///
    /// * `timeoutUs` - Timeout duration in microseconds, negative value indicates infinite wait.
    ///
    /// # Returns
    ///
    /// * Returns AV_ERR_OK if the execution is successful,
    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
    /// [`AV_ERR_NO_MEMORY`], internal errors in the input encode instance, such as an abnormal NULL.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
    /// [`AV_ERR_OPERATE_NOT_PERMIT`], not permitted in asynchronous mode.
    /// [`AV_ERR_STREAM_CHANGED`], stream format changed, call [`OH_VideoEncoder_GetOutputDescription`] to
    /// retrieve new steam information.
    /// [`AV_ERR_TRY_AGAIN_LATER`], query failed, recommended retry after delay.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_VideoEncoder_QueryOutputBuffer(
        codec: *mut OH_AVCodec,
        index: *mut u32,
        timeoutUs: i64,
    ) -> OH_AVErrCode;
    /// Acquires the handle of an available output buffer.
    ///
    /// Note: It's only applicable in synchronous mode.
    ///
    ///
    ///
    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// * `index` - Buffer index obtained via [`OH_VideoEncoder_QueryOutputBuffer`].
    ///
    /// # Returns
    ///
    /// * Returns a Pointer to an OH_AVBuffer instance.
    /// Return nullptr if no buffer available.
    ///
    /// Available since API-level: 20
    #[cfg(feature = "api-20")]
    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
    pub fn OH_VideoEncoder_GetOutputBuffer(codec: *mut OH_AVCodec, index: u32) -> *mut OH_AVBuffer;
    /// Get the input data description of the encoder after call [`OH_VideoEncoder_Configure`],
    /// 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.VideoEncoder
    /// # Arguments
    ///
    /// * `codec` - Pointer to an OH_AVCodec instance
    ///
    /// # Returns
    ///
    /// * Returns a pointer to an OH_AVFormat instance.
    /// Return nullptr if the encoder is nullptr or invaild.
    ///
    /// Available since API-level: 10
    pub fn OH_VideoEncoder_GetInputDescription(codec: *mut OH_AVCodec) -> *mut OH_AVFormat;
    /// 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.VideoEncoder
    /// # 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`].
    /// [`AV_ERR_NO_MEMORY`], instance has already released.
    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
    /// [`AV_ERR_UNKNOWN`], unknown error.
    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
    ///
    /// Available since API-level: 10
    pub fn OH_VideoEncoder_IsValid(codec: *mut OH_AVCodec, isValid: *mut bool) -> OH_AVErrCode;
}