Skip to main content

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