ohos_media_sys/avsource/avsource_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-12")]
8use crate::avcodec_base::OH_AVDataSource;
9#[cfg(feature = "api-20")]
10use crate::avcodec_base::OH_AVDataSourceExt;
11#[allow(unused_imports)]
12use crate::averrors::OH_AVErrCode;
13use crate::avformat::OH_AVFormat;
14
15/// Forward declaration of OH_AVSource.
16///
17///
18/// Available since API-level: 10
19#[repr(C)]
20pub struct OH_AVSource {
21 _unused: [u8; 0],
22}
23extern "C" {
24 /// Creates an OH_AVSource instance that models the media with dataSource.
25 ///
26 /// Required System Capabilities: SystemCapability.Multimedia.Media.Spliter
27 /// # Arguments
28 ///
29 /// * `dataSource` - An Struct for a remote media resource.
30 ///
31 /// # Returns
32 ///
33 /// * Returns a pointer to an OH_AVSource instance if the execution is successful, otherwise returns nullptr.
34 /// Possible failure causes:
35 /// 1. dataSource is nullptr.
36 /// 2. dataSource->size == 0.
37 /// 3. set data source failed.
38 /// 4. out of memory.
39 /// 5. demuxer engine is nullptr.
40 ///
41 /// Available since API-level: 12
42 #[cfg(feature = "api-12")]
43 #[cfg_attr(docsrs, doc(cfg(feature = "api-12")))]
44 pub fn OH_AVSource_CreateWithDataSource(dataSource: *mut OH_AVDataSource) -> *mut OH_AVSource;
45 /// Creates an OH_AVSource instance with dataSource and userData.
46 ///
47 /// Required System Capabilities: SystemCapability.Multimedia.Media.Spliter
48 /// # Arguments
49 ///
50 /// * `dataSource` - A pointer to the data source structure, which can obtain the input data.
51 ///
52 /// * `userData` - A pointer to user-defined data.
53 ///
54 /// # Returns
55 ///
56 /// * Returns a pointer to an OH_AVSource instance if the execution is successful, otherwise returns nullptr.
57 /// Possible failure causes:
58 /// 1. dataSource is nullptr.
59 /// 2. dataSource->size == 0.
60 /// 3. set data source failed.
61 /// 4. out of memory.
62 /// 5. demuxer engine is nullptr.
63 ///
64 /// Available since API-level: 20
65 #[cfg(feature = "api-20")]
66 #[cfg_attr(docsrs, doc(cfg(feature = "api-20")))]
67 pub fn OH_AVSource_CreateWithDataSourceExt(
68 dataSource: *mut OH_AVDataSourceExt,
69 userData: *mut ::core::ffi::c_void,
70 ) -> *mut OH_AVSource;
71 /// Creates an OH_AVSource instance that models the media at the URI.
72 ///
73 /// Required System Capabilities: SystemCapability.Multimedia.Media.Spliter
74 /// # Arguments
75 ///
76 /// * `uri` - An URI for a remote media resource.
77 ///
78 /// # Returns
79 ///
80 /// * Returns a pointer to an OH_AVSource instance if the execution is successful, otherwise returns nullptr.
81 /// Possible failure causes:
82 /// 1. network anomaly.
83 /// 2. resource is invalid.
84 /// 3. file format is not supported.
85 ///
86 /// Available since API-level: 10
87 pub fn OH_AVSource_CreateWithURI(uri: *mut ::core::ffi::c_char) -> *mut OH_AVSource;
88 /// Creates an OH_AVSource instance that models the media at the FileDescriptor.
89 ///
90 /// Required System Capabilities: SystemCapability.Multimedia.Media.Spliter
91 /// # Arguments
92 ///
93 /// * `fd` - The fileDescriptor of data source.
94 ///
95 /// * `offset` - The offset into the file to start reading.
96 ///
97 /// * `size` - The file size in bytes.
98 ///
99 /// # Returns
100 ///
101 /// * Returns a pointer to an OH_AVSource instance if the execution is successful, otherwise returns nullptr.
102 /// Possible failure causes:
103 /// 1. fd is invalid.
104 /// 2. offset is not start pos of resource.
105 /// 3. size error.
106 /// 4. resource is invalid.
107 /// 5. file format is not supported.
108 ///
109 /// Available since API-level: 10
110 pub fn OH_AVSource_CreateWithFD(fd: i32, offset: i64, size: i64) -> *mut OH_AVSource;
111 /// Destroy the OH_AVSource instance and free the internal resources.
112 ///
113 /// Required System Capabilities: SystemCapability.Multimedia.Media.Spliter
114 /// # Arguments
115 ///
116 /// * `source` - Pointer to an OH_AVSource instance.
117 ///
118 /// # Returns
119 ///
120 /// * Returns AV_ERR_OK if the execution is successful,
121 /// otherwise returns a specific error code, refer to [`OH_AVErrCode`]
122 /// [`AV_ERR_INVALID_VAL`] source is invalid.
123 ///
124 /// Available since API-level: 10
125 pub fn OH_AVSource_Destroy(source: *mut OH_AVSource) -> OH_AVErrCode;
126 /// Get the format info of source.
127 /// It should be noted that the life cycle of the OH_AVFormat instance pointed to by the return value * needs
128 /// to be manually released by the caller.
129 ///
130 /// Required System Capabilities: SystemCapability.Multimedia.Media.Spliter
131 /// # Arguments
132 ///
133 /// * `source` - Pointer to an OH_AVSource instance.
134 ///
135 /// # Returns
136 ///
137 /// * Returns the source's format info if the execution is successful, otherwise returns nullptr.
138 /// Possible failure causes:
139 /// 1. source is invalid.
140 ///
141 /// Available since API-level: 10
142 pub fn OH_AVSource_GetSourceFormat(source: *mut OH_AVSource) -> *mut OH_AVFormat;
143 /// Get the format info of track.
144 /// It should be noted that the life cycle of the OH_AVFormat instance pointed to by the return value * needs
145 /// to be manually released by the caller.
146 ///
147 /// Required System Capabilities: SystemCapability.Multimedia.Media.Spliter
148 /// # Arguments
149 ///
150 /// * `source` - Pointer to an OH_AVSource instance.
151 ///
152 /// * `trackIndex` - The track index to get format.
153 ///
154 /// # Returns
155 ///
156 /// * Returns the track's format info if the execution is successful, otherwise returns nullptr.
157 /// Possible failure causes:
158 /// 1. source is invalid.
159 /// 2. trackIndex is out of range.
160 ///
161 /// Available since API-level: 10
162 pub fn OH_AVSource_GetTrackFormat(
163 source: *mut OH_AVSource,
164 trackIndex: u32,
165 ) -> *mut OH_AVFormat;
166 /// Get the format info of custom metadata.
167 ///
168 /// It should be noted that the life cycle of the OH_AVFormat instance pointed to by the return value * needs
169 /// to be manually released by the caller.
170 ///
171 ///
172 /// Required System Capabilities: SystemCapability.Multimedia.Media.Spliter
173 /// # Arguments
174 ///
175 /// * `source` - Pointer to an OH_AVSource instance.
176 ///
177 /// # Returns
178 ///
179 /// * Returns the metadata's format info if the execution is successful, otherwise returns nullptr.
180 /// Possible failure causes:
181 /// 1. source is invalid.
182 ///
183 /// Available since API-level: 18
184 #[cfg(feature = "api-18")]
185 #[cfg_attr(docsrs, doc(cfg(feature = "api-18")))]
186 pub fn OH_AVSource_GetCustomMetadataFormat(source: *mut OH_AVSource) -> *mut OH_AVFormat;
187}