Skip to main content

ohos_media_sys/avcodec_videoencoder/
avcodec_videoencoder_ffi.rs

1// automatically generated by rust-bindgen 0.71.1
2
3#![allow(non_upper_case_globals)]
4#![allow(non_camel_case_types)]
5#![allow(non_snake_case)]
6#![allow(deprecated)]
7#[cfg(feature = "api-11")]
8#[allow(unused_imports)]
9use crate::avbuffer::OH_AVBuffer;
10#[allow(unused_imports)]
11use crate::avbuffer_info::OH_AVCodecBufferAttr;
12#[cfg(feature = "api-11")]
13#[allow(unused_imports)]
14use crate::avcodec_base::OH_AVCodecCallback;
15#[allow(unused_imports)]
16use crate::avcodec_base::{OH_AVCodec, OH_AVCodecAsyncCallback};
17#[allow(unused_imports)]
18use crate::averrors::OH_AVErrCode;
19#[allow(unused_imports)]
20use crate::avformat::OH_AVFormat;
21use ohos_sys_opaque_types::OHNativeWindow;
22
23/// When OH_AVCodec needs new input parameter during the running process, the function pointer will be called and
24/// carry an available OH_AVFormat to fill in the new input parameter. This parameter takes effect immediately with the
25/// frame.
26///
27///
28/// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
29/// # Arguments
30///
31/// * `codec` - OH_AVCodec instance
32///
33/// * `index` - The index corresponding to the new OH_AVFormat instance
34///
35/// * `parameter` - Parameter containing the new OH_AVFormat instance
36///
37/// * `userData` - specified data
38///
39/// Available since API-level: 12
40#[cfg(feature = "api-12")]
41#[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
42pub type OH_VideoEncoder_OnNeedInputParameter = ::core::option::Option<
43    unsafe extern "C" fn(
44        codec: *mut OH_AVCodec,
45        index: u32,
46        parameter: *mut OH_AVFormat,
47        userData: *mut ::core::ffi::c_void,
48    ),
49>;
50impl OH_VideoEncodeBitrateMode {
51    /// constant bit rate mode.
52    ///
53    /// **Deprecated** since 14
54    /// BITRATE_MODE_CBR
55    #[deprecated(since = "14")]
56    pub const CBR: OH_VideoEncodeBitrateMode = OH_VideoEncodeBitrateMode(0);
57    /// variable bit rate mode.
58    ///
59    /// **Deprecated** since 14
60    /// BITRATE_MODE_VBR
61    #[deprecated(since = "14")]
62    pub const VBR: OH_VideoEncodeBitrateMode = OH_VideoEncodeBitrateMode(1);
63    /// constant quality mode.
64    ///
65    /// **Deprecated** since 14
66    /// BITRATE_MODE_CQ
67    #[deprecated(since = "14")]
68    pub const CQ: OH_VideoEncodeBitrateMode = OH_VideoEncodeBitrateMode(2);
69}
70#[repr(transparent)]
71/// The bitrate mode of video encoder.
72///
73/// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
74///
75/// **Deprecated** since 14
76/// OH_BitrateMode
77///
78/// Available since API-level: 9
79#[deprecated(since = "14")]
80#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
81pub struct OH_VideoEncodeBitrateMode(pub ::core::ffi::c_uint);
82extern "C" {
83    /// Creates a video encoder instance from the mime type, which is recommended in most cases.
84    ///
85    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
86    /// # Arguments
87    ///
88    /// * `mime` - mime type description string, refer to [`AVCODEC_MIME_TYPE`]
89    ///
90    /// # Returns
91    ///
92    /// * Returns a Pointer to an OH_AVCodec instance.
93    /// Return nullptr if memory ran out or the mime type is not supported.
94    ///
95    /// Available since API-level: 9
96    pub fn OH_VideoEncoder_CreateByMime(mime: *const ::core::ffi::c_char) -> *mut OH_AVCodec;
97    /// Create a video encoder instance through the video encoder name. The premise of using this interface is to
98    /// know the exact name of the encoder.
99    ///
100    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
101    /// # Arguments
102    ///
103    /// * `name` - Video encoder name
104    ///
105    /// # Returns
106    ///
107    /// * Returns a Pointer to an OH_AVCodec instance.
108    /// Return nullptr if memory ran out or the encoder name is not supported.
109    ///
110    /// Available since API-level: 9
111    pub fn OH_VideoEncoder_CreateByName(name: *const ::core::ffi::c_char) -> *mut OH_AVCodec;
112    /// Clear the internal resources of the encoder and destroy the encoder instance
113    ///
114    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
115    /// # Arguments
116    ///
117    /// * `codec` - Pointer to an OH_AVCodec instance
118    ///
119    /// # Returns
120    ///
121    /// * Returns AV_ERR_OK if the execution is successful,
122    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
123    /// [`AV_ERR_NO_MEMORY`], inner resource has already released.
124    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
125    /// [`AV_ERR_UNKNOWN`], unknown error.
126    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
127    ///
128    /// Available since API-level: 9
129    pub fn OH_VideoEncoder_Destroy(codec: *mut OH_AVCodec) -> OH_AVErrCode;
130    /// Set the asynchronous callback function so that your application can respond to the events generated by the
131    /// video encoder. This interface must be called before Prepare is called.
132    ///
133    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
134    /// # Arguments
135    ///
136    /// * `codec` - Pointer to an OH_AVCodec instance
137    ///
138    /// * `callback` - A collection of all callback functions, see [`OH_AVCodecAsyncCallback`]
139    ///
140    /// * `userData` - User specific data
141    ///
142    /// # Returns
143    ///
144    /// * Returns AV_ERR_OK if the execution is successful,
145    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
146    /// [`AV_ERR_NO_MEMORY`], inner resource has already released.
147    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
148    /// [`AV_ERR_UNKNOWN`], unknown error.
149    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
150    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state, must be called before Prepare.
151    ///
152    /// **Deprecated** since 11
153    /// OH_VideoEncoder_RegisterCallback
154    ///
155    /// Available since API-level: 9
156    #[deprecated(since = "11")]
157    pub fn OH_VideoEncoder_SetCallback(
158        codec: *mut OH_AVCodec,
159        callback: OH_AVCodecAsyncCallback,
160        userData: *mut ::core::ffi::c_void,
161    ) -> OH_AVErrCode;
162    /// Set the asynchronous callback function so that your application can respond to the events generated by the
163    /// video encoder. This interface must be called before Prepare is called.
164    ///
165    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
166    /// # Arguments
167    ///
168    /// * `codec` - Pointer to an OH_AVCodec instance
169    ///
170    /// * `callback` - A collection of all callback functions, see [`OH_AVCodecCallback`]
171    ///
172    /// * `userData` - User specific data
173    ///
174    /// # Returns
175    ///
176    /// * Returns AV_ERR_OK if the execution is successful,
177    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
178    /// [`AV_ERR_NO_MEMORY`], inner resource has already released.
179    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
180    /// [`AV_ERR_UNKNOWN`], unknown error.
181    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
182    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state, must be called before Prepare.
183    ///
184    /// Available since API-level: 11
185    #[cfg(feature = "api-11")]
186    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
187    pub fn OH_VideoEncoder_RegisterCallback(
188        codec: *mut OH_AVCodec,
189        callback: OH_AVCodecCallback,
190        userData: *mut ::core::ffi::c_void,
191    ) -> OH_AVErrCode;
192    /// Set the asynchronous callback function so that your application can respond to the events generated by the
193    /// video encoder. This interface is optional only for input surface. If this interface is used, it must be invoked
194    /// before [`OH_VideoEncoder_Configure`].
195    ///
196    ///
197    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
198    /// # Arguments
199    ///
200    /// * `codec` - Pointer to an OH_AVCodec instance
201    ///
202    /// * `onInputParameter` - A callback functions, see [`OH_VideoEncoder_OnNeedInputParameter`]
203    ///
204    /// * `userData` - User specific data
205    ///
206    /// # Returns
207    ///
208    /// * Returns AV_ERR_OK if the execution is successful,
209    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
210    /// [`AV_ERR_NO_MEMORY`], inner resource has already released.
211    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
212    /// [`AV_ERR_UNKNOWN`], unknown error.
213    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
214    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state, must be called before Prepare.
215    ///
216    /// Available since API-level: 12
217    #[cfg(feature = "api-12")]
218    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
219    pub fn OH_VideoEncoder_RegisterParameterCallback(
220        codec: *mut OH_AVCodec,
221        onInputParameter: OH_VideoEncoder_OnNeedInputParameter,
222        userData: *mut ::core::ffi::c_void,
223    ) -> OH_AVErrCode;
224    /// To configure the video encoder, typically, you need to configure the description information of the
225    /// encoded video track. This interface must be called before Prepare is called.
226    ///
227    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
228    /// # Arguments
229    ///
230    /// * `codec` - Pointer to an OH_AVCodec instance
231    ///
232    /// * `format` - A pointer to an OH_AVFormat that gives the description of the video track to be encoded
233    ///
234    /// # Returns
235    ///
236    /// * Returns AV_ERR_OK if the execution is successful,
237    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
238    /// [`AV_ERR_NO_MEMORY`], instance has already released.
239    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid. Invalid param in format.
240    /// [`AV_ERR_UNKNOWN`], unknown error.
241    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
242    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state, must be called before Prepare.
243    ///
244    /// Available since API-level: 9
245    pub fn OH_VideoEncoder_Configure(
246        codec: *mut OH_AVCodec,
247        format: *mut OH_AVFormat,
248    ) -> OH_AVErrCode;
249    /// To prepare the internal resources of the encoder, the Configure interface must be called before
250    /// calling this interface.
251    ///
252    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
253    /// # Arguments
254    ///
255    /// * `codec` - Pointer to an OH_AVCodec instance
256    ///
257    /// # Returns
258    ///
259    /// * Returns AV_ERR_OK if the execution is successful,
260    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
261    /// [`AV_ERR_NO_MEMORY`], instance has already released.
262    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
263    /// [`AV_ERR_UNKNOWN`], unknown error.
264    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
265    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
266    ///
267    /// Available since API-level: 9
268    pub fn OH_VideoEncoder_Prepare(codec: *mut OH_AVCodec) -> OH_AVErrCode;
269    /// Start the encoder, this interface must be called after the Prepare is successful. After being
270    /// successfully started, the encoder will start reporting NeedInputData events.
271    ///
272    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
273    /// # Arguments
274    ///
275    /// * `codec` - Pointer to an OH_AVCodec instance
276    ///
277    /// # Returns
278    ///
279    /// * Returns AV_ERR_OK if the execution is successful,
280    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
281    /// [`AV_ERR_NO_MEMORY`], instance has already released.
282    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
283    /// [`AV_ERR_UNKNOWN`], unknown error.
284    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
285    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
286    ///
287    /// Available since API-level: 9
288    pub fn OH_VideoEncoder_Start(codec: *mut OH_AVCodec) -> OH_AVErrCode;
289    /// Stop the encoder. After stopping, you can re-enter the Started state through Start.
290    ///
291    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
292    /// # Arguments
293    ///
294    /// * `codec` - Pointer to an OH_AVCodec instance
295    ///
296    /// # Returns
297    ///
298    /// * Returns AV_ERR_OK if the execution is successful,
299    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
300    /// [`AV_ERR_NO_MEMORY`], instance has already released.
301    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
302    /// [`AV_ERR_UNKNOWN`], unknown error.
303    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
304    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
305    ///
306    /// Available since API-level: 9
307    pub fn OH_VideoEncoder_Stop(codec: *mut OH_AVCodec) -> OH_AVErrCode;
308    /// Clear the input and output data buffered in the encoder. After this interface is called, all the Buffer
309    /// indexes previously reported through the asynchronous callback will be invalidated, make sure not to access the
310    /// Buffers corresponding to these indexes.
311    ///
312    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
313    /// # Arguments
314    ///
315    /// * `codec` - Pointer to an OH_AVCodec instance
316    ///
317    /// # Returns
318    ///
319    /// * Returns AV_ERR_OK if the execution is successful,
320    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
321    /// [`AV_ERR_NO_MEMORY`], instance has already released.
322    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
323    /// [`AV_ERR_UNKNOWN`], unknown error.
324    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
325    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
326    ///
327    /// Available since API-level: 9
328    pub fn OH_VideoEncoder_Flush(codec: *mut OH_AVCodec) -> OH_AVErrCode;
329    /// Reset the encoder. To continue coding, you need to call the Configure interface again to
330    /// configure the encoder instance.
331    ///
332    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
333    /// # Arguments
334    ///
335    /// * `codec` - Pointer to an OH_AVCodec instance
336    ///
337    /// # Returns
338    ///
339    /// * Returns AV_ERR_OK if the execution is successful,
340    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
341    /// [`AV_ERR_NO_MEMORY`], instance has already released.
342    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
343    /// [`AV_ERR_UNKNOWN`], unknown error.
344    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
345    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
346    ///
347    /// Available since API-level: 9
348    pub fn OH_VideoEncoder_Reset(codec: *mut OH_AVCodec) -> OH_AVErrCode;
349    /// Get the description information of the output data of the encoder, refer to [`OH_AVFormat`] for details.
350    /// It should be noted that the life cycle of the OH_AVFormat instance pointed to by the return value * needs to
351    /// be manually released by the caller.
352    ///
353    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
354    /// # Arguments
355    ///
356    /// * `codec` - Pointer to an OH_AVCodec instance
357    ///
358    /// # Returns
359    ///
360    /// * Returns a pointer to an OH_AVFormat instance.
361    /// Return nullptr if the codec is nullptr or invaild.
362    ///
363    /// Available since API-level: 9
364    pub fn OH_VideoEncoder_GetOutputDescription(codec: *mut OH_AVCodec) -> *mut OH_AVFormat;
365    /// Set dynamic parameters to the encoder. Note: This interface can only be called after the encoder is started.
366    /// At the same time, incorrect parameter settings may cause the encoding to fail.
367    ///
368    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
369    /// # Arguments
370    ///
371    /// * `codec` - Pointer to an OH_AVCodec instance
372    ///
373    /// * `format` - OH_AVFormat handle pointer
374    ///
375    /// # Returns
376    ///
377    /// * Returns AV_ERR_OK if the execution is successful,
378    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
379    /// [`AV_ERR_NO_MEMORY`], instance has already released.
380    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid. Invalid param in format.
381    /// [`AV_ERR_UNKNOWN`], unknown error.
382    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
383    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
384    ///
385    /// Available since API-level: 9
386    pub fn OH_VideoEncoder_SetParameter(
387        codec: *mut OH_AVCodec,
388        format: *mut OH_AVFormat,
389    ) -> OH_AVErrCode;
390    /// Get the input Surface from the video encoder, this interface must be called before Prepare is called.
391    ///
392    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
393    /// # Arguments
394    ///
395    /// * `codec` - Pointer to an OH_AVCodec instance
396    ///
397    /// * `window` - A pointer to a OHNativeWindow instance, see [`OHNativeWindow`], the application is responsible for
398    /// managing the life cycle of the window, call OH_NativeWindow_DestroyNativeWindow() when done.
399    ///
400    /// # Returns
401    ///
402    /// * Returns AV_ERR_OK if the execution is successful,
403    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
404    /// [`AV_ERR_NO_MEMORY`], inner resource has already released.
405    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
406    /// [`AV_ERR_UNKNOWN`], unknown error.
407    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
408    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
409    ///
410    /// Available since API-level: 9
411    pub fn OH_VideoEncoder_GetSurface(
412        codec: *mut OH_AVCodec,
413        window: *mut *mut OHNativeWindow,
414    ) -> OH_AVErrCode;
415    /// Return the processed output Buffer to the encoder.
416    ///
417    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
418    /// # Arguments
419    ///
420    /// * `codec` - Pointer to an OH_AVCodec instance
421    ///
422    /// * `index` - The index value corresponding to the output Buffer
423    ///
424    /// # Returns
425    ///
426    /// * Returns AV_ERR_OK if the execution is successful,
427    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
428    /// [`AV_ERR_NO_MEMORY`], instance has already released.
429    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
430    /// Buffer index should be given by [`OH_AVCodecOnNewOutputData`].
431    /// [`AV_ERR_UNKNOWN`], unknown error.
432    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
433    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
434    ///
435    /// **Deprecated** since 11
436    /// OH_VideoEncoder_FreeOutputBuffer
437    ///
438    /// Available since API-level: 9
439    #[deprecated(since = "11")]
440    pub fn OH_VideoEncoder_FreeOutputData(codec: *mut OH_AVCodec, index: u32) -> OH_AVErrCode;
441    /// Notifies the video encoder that the input stream has ended. It is recommended to use this interface to notify
442    /// the encoder of the end of the stream in surface mode
443    ///
444    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
445    /// # Arguments
446    ///
447    /// * `codec` - Pointer to an OH_AVCodec instance
448    ///
449    /// # Returns
450    ///
451    /// * Returns AV_ERR_OK if the execution is successful,
452    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
453    /// [`AV_ERR_NO_MEMORY`], instance has already released.
454    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
455    /// [`AV_ERR_UNKNOWN`], unknown error.
456    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
457    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
458    ///
459    /// Available since API-level: 9
460    pub fn OH_VideoEncoder_NotifyEndOfStream(codec: *mut OH_AVCodec) -> OH_AVErrCode;
461    /// Submit the input buffer filled with data to the video encoder.
462    ///
463    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
464    /// # Arguments
465    ///
466    /// * `codec` - Pointer to an OH_AVCodec instance
467    ///
468    /// * `index` - Enter the index value corresponding to the Buffer
469    ///
470    /// * `attr` - Information describing the data contained in the Buffer
471    ///
472    /// # Returns
473    ///
474    /// * Returns AV_ERR_OK if the execution is successful,
475    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
476    /// [`AV_ERR_NO_MEMORY`], instance has already released.
477    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
478    /// Buffer index should be given by [`OH_AVCodecOnNeedInputData`].
479    /// [`AV_ERR_UNKNOWN`], unknown error.
480    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
481    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
482    ///
483    /// **Deprecated** since 11
484    /// OH_VideoEncoder_PushInputBuffer
485    ///
486    /// Available since API-level: 10
487    #[deprecated(since = "11")]
488    pub fn OH_VideoEncoder_PushInputData(
489        codec: *mut OH_AVCodec,
490        index: u32,
491        attr: OH_AVCodecBufferAttr,
492    ) -> OH_AVErrCode;
493    /// Submit the input buffer filled with data to the video encoder.
494    ///
495    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
496    /// # Arguments
497    ///
498    /// * `codec` - Pointer to an OH_AVCodec instance
499    ///
500    /// * `index` - Enter the index value corresponding to the Buffer
501    ///
502    /// # Returns
503    ///
504    /// * Returns AV_ERR_OK if the execution is successful,
505    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
506    /// [`AV_ERR_NO_MEMORY`], instance has already released.
507    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
508    /// Buffer index should be given by [`OH_AVCodecOnNeedInputBuffer`].
509    /// [`AV_ERR_UNKNOWN`], unknown error.
510    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
511    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
512    ///
513    ///
514    /// Available since API-level: 11
515    #[cfg(feature = "api-11")]
516    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
517    pub fn OH_VideoEncoder_PushInputBuffer(codec: *mut OH_AVCodec, index: u32) -> OH_AVErrCode;
518    /// Submit the input parameter filled with data to the video encoder.
519    ///
520    ///
521    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
522    /// # Arguments
523    ///
524    /// * `codec` - Pointer to an OH_AVCodec instance
525    ///
526    /// * `index` - Enter the index value corresponding to the input parameter
527    ///
528    /// # Returns
529    ///
530    /// * Returns AV_ERR_OK if the execution is successful,
531    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
532    /// [`AV_ERR_NO_MEMORY`], instance has already released.
533    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
534    /// Index should be given by [`OH_VideoEncoder_OnNeedInputParameter`].
535    /// [`AV_ERR_UNKNOWN`], unknown error.
536    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
537    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
538    ///
539    /// Available since API-level: 12
540    #[cfg(feature = "api-12")]
541    #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
542    pub fn OH_VideoEncoder_PushInputParameter(codec: *mut OH_AVCodec, index: u32) -> OH_AVErrCode;
543    /// Return the processed output Buffer to the encoder.
544    ///
545    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
546    /// # Arguments
547    ///
548    /// * `codec` - Pointer to an OH_AVCodec instance
549    ///
550    /// * `index` - The index value corresponding to the output Buffer
551    ///
552    /// # Returns
553    ///
554    /// * Returns AV_ERR_OK if the execution is successful,
555    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
556    /// [`AV_ERR_NO_MEMORY`], instance has already released.
557    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
558    /// Buffer index should be given by [`OH_AVCodecOnNewOutputBuffer`].
559    /// [`AV_ERR_UNKNOWN`], unknown error.
560    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
561    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
562    ///
563    /// Available since API-level: 11
564    #[cfg(feature = "api-11")]
565    #[cfg_attr(docsrs, doc(cfg(feature = "api-11")))]
566    pub fn OH_VideoEncoder_FreeOutputBuffer(codec: *mut OH_AVCodec, index: u32) -> OH_AVErrCode;
567    /// Queries the index of the next available input buffer.
568    ///
569    /// This API must be followed by calling [`OH_VideoEncoder_GetInputBuffer`] to obtain the buffer handle,
570    /// which should then be passed to the encoder via [`OH_VideoEncoder_PushInputBuffer`].
571    ///
572    /// Note: This operation is only supported in synchronous mode.
573    ///
574    ///
575    ///
576    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
577    /// # Arguments
578    ///
579    /// * `codec` - Pointer to an OH_AVCodec instance
580    ///
581    /// * `index` - The index of the input buffer
582    ///
583    /// * `timeoutUs` - Timeout duration in microseconds, negative value indicates infinite wait.
584    ///
585    /// # Returns
586    ///
587    /// * Returns AV_ERR_OK if the execution is successful,
588    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
589    /// [`AV_ERR_NO_MEMORY`], internal errors in the input encode instance, such as an abnormal NULL.
590    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
591    /// [`AV_ERR_UNKNOWN`], unknown error.
592    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
593    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
594    /// [`AV_ERR_OPERATE_NOT_PERMIT`], not permitted in asynchronous mode.
595    /// [`AV_ERR_TRY_AGAIN_LATER`], query failed, recommended retry after delay..
596    ///
597    /// Available since API-level: 20
598    #[cfg(feature = "api-20")]
599    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
600    pub fn OH_VideoEncoder_QueryInputBuffer(
601        codec: *mut OH_AVCodec,
602        index: *mut u32,
603        timeoutUs: i64,
604    ) -> OH_AVErrCode;
605    /// Acquires the handle of an available input buffer.
606    ///
607    /// Note: It's only applicable in synchronous mode.
608    ///
609    ///
610    ///
611    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
612    /// # Arguments
613    ///
614    /// * `codec` - Pointer to an OH_AVCodec instance
615    ///
616    /// * `index` - Buffer index obtained via [`OH_VideoEncoder_QueryInputBuffer`].
617    ///
618    /// # Returns
619    ///
620    /// * Returns a Pointer to an OH_AVBuffer instance.
621    /// Return nullptr if no buffer available.
622    ///
623    /// Available since API-level: 20
624    #[cfg(feature = "api-20")]
625    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
626    pub fn OH_VideoEncoder_GetInputBuffer(codec: *mut OH_AVCodec, index: u32) -> *mut OH_AVBuffer;
627    /// Queries the index of the next available output buffer.
628    ///
629    /// The obtained buffer handle through [`OH_VideoEncoder_GetOutputBuffer`] must be
630    /// return to the encoder via [`OH_VideoEncoder_FreeOutputBuffer`].
631    ///
632    /// Note: This operation is only supported in synchronous mode.
633    ///
634    ///
635    ///
636    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
637    /// # Arguments
638    ///
639    /// * `codec` - Pointer to an OH_AVCodec instance
640    ///
641    /// * `index` - The index value corresponding to the output buffer
642    ///
643    /// * `timeoutUs` - Timeout duration in microseconds, negative value indicates infinite wait.
644    ///
645    /// # Returns
646    ///
647    /// * Returns AV_ERR_OK if the execution is successful,
648    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
649    /// [`AV_ERR_NO_MEMORY`], internal errors in the input encode instance, such as an abnormal NULL.
650    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
651    /// [`AV_ERR_UNKNOWN`], unknown error.
652    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
653    /// [`AV_ERR_INVALID_STATE`], this interface was called in invalid state.
654    /// [`AV_ERR_OPERATE_NOT_PERMIT`], not permitted in asynchronous mode.
655    /// [`AV_ERR_STREAM_CHANGED`], stream format changed, call [`OH_VideoEncoder_GetOutputDescription`] to
656    /// retrieve new steam information.
657    /// [`AV_ERR_TRY_AGAIN_LATER`], query failed, recommended retry after delay.
658    ///
659    /// Available since API-level: 20
660    #[cfg(feature = "api-20")]
661    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
662    pub fn OH_VideoEncoder_QueryOutputBuffer(
663        codec: *mut OH_AVCodec,
664        index: *mut u32,
665        timeoutUs: i64,
666    ) -> OH_AVErrCode;
667    /// Acquires the handle of an available output buffer.
668    ///
669    /// Note: It's only applicable in synchronous mode.
670    ///
671    ///
672    ///
673    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
674    /// # Arguments
675    ///
676    /// * `codec` - Pointer to an OH_AVCodec instance
677    ///
678    /// * `index` - Buffer index obtained via [`OH_VideoEncoder_QueryOutputBuffer`].
679    ///
680    /// # Returns
681    ///
682    /// * Returns a Pointer to an OH_AVBuffer instance.
683    /// Return nullptr if no buffer available.
684    ///
685    /// Available since API-level: 20
686    #[cfg(feature = "api-20")]
687    #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
688    pub fn OH_VideoEncoder_GetOutputBuffer(codec: *mut OH_AVCodec, index: u32) -> *mut OH_AVBuffer;
689    /// Get the input data description of the encoder after call [`OH_VideoEncoder_Configure`],
690    /// refer to [`OH_AVFormat`] for details. It should be noted that the life cycle of the OH_AVFormat
691    /// instance pointed to by the return value needs to be manually released by the caller.
692    ///
693    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
694    /// # Arguments
695    ///
696    /// * `codec` - Pointer to an OH_AVCodec instance
697    ///
698    /// # Returns
699    ///
700    /// * Returns a pointer to an OH_AVFormat instance.
701    /// Return nullptr if the encoder is nullptr or invaild.
702    ///
703    /// Available since API-level: 10
704    pub fn OH_VideoEncoder_GetInputDescription(codec: *mut OH_AVCodec) -> *mut OH_AVFormat;
705    /// Check whether the current codec instance is valid. It can be used fault recovery or app
706    /// switchback from the background
707    ///
708    /// Required System Capabilities: SystemCapability.Multimedia.Media.VideoEncoder
709    /// # Arguments
710    ///
711    /// * `codec` - Pointer to an OH_AVCodec instance
712    ///
713    /// * `isValid` - Output Parameter. A pointer to a boolean instance, it is true if the codec instance is valid,
714    /// false if the codec instance is invalid
715    ///
716    /// # Returns
717    ///
718    /// * Returns AV_ERR_OK if the execution is successful,
719    /// otherwise returns a specific error code, refer to [`OH_AVErrCode`].
720    /// [`AV_ERR_NO_MEMORY`], instance has already released.
721    /// [`AV_ERR_INVALID_VAL`], the encoder is nullptr or invalid.
722    /// [`AV_ERR_UNKNOWN`], unknown error.
723    /// [`AV_ERR_SERVICE_DIED`], avcodec service is died.
724    ///
725    /// Available since API-level: 10
726    pub fn OH_VideoEncoder_IsValid(codec: *mut OH_AVCodec, isValid: *mut bool) -> OH_AVErrCode;
727}