|
20 | 20 | //! [docs.rs]: https://docs.rs/openh264-sys2/ |
21 | 21 |
|
22 | 22 | #![allow(non_snake_case)] |
| 23 | +#![allow(unpredictable_function_pointer_comparisons)] |
23 | 24 | #![allow(non_camel_case_types)] |
24 | 25 | #![allow(non_upper_case_globals)] |
25 | 26 | #![allow(clippy::missing_safety_doc)] |
@@ -102,25 +103,25 @@ pub mod source { |
102 | 103 | #[allow(clippy::missing_safety_doc)] |
103 | 104 | impl APILoader { |
104 | 105 | pub const fn new() -> Self { Self } |
105 | | - pub unsafe fn WelsCreateSVCEncoder(ppEncoder: *mut *mut ISVCEncoder) -> ::std::os::raw::c_int { crate::generated::fns_source::WelsCreateSVCEncoder(ppEncoder) } |
106 | | - pub unsafe fn WelsDestroySVCEncoder(pEncoder: *mut ISVCEncoder) { crate::generated::fns_source::WelsDestroySVCEncoder(pEncoder) } |
107 | | - pub unsafe fn WelsGetDecoderCapability(pDecCapability: *mut SDecoderCapability) -> ::std::os::raw::c_int { crate::generated::fns_source::WelsGetDecoderCapability(pDecCapability) } |
108 | | - pub unsafe fn WelsCreateDecoder(ppDecoder: *mut *mut ISVCDecoder) -> ::std::os::raw::c_long { crate::generated::fns_source::WelsCreateDecoder(ppDecoder) } |
109 | | - pub unsafe fn WelsDestroyDecoder(pDecoder: *mut ISVCDecoder) { crate::generated::fns_source::WelsDestroyDecoder(pDecoder) } |
110 | | - pub unsafe fn WelsGetCodecVersion() -> OpenH264Version { crate::generated::fns_source::WelsGetCodecVersion() } |
111 | | - pub unsafe fn WelsGetCodecVersionEx(pVersion: *mut OpenH264Version) { crate::generated::fns_source::WelsGetCodecVersionEx(pVersion) } |
| 106 | + pub unsafe fn WelsCreateSVCEncoder(ppEncoder: *mut *mut ISVCEncoder) -> ::std::os::raw::c_int { unsafe { crate::generated::fns_source::WelsCreateSVCEncoder(ppEncoder) }} |
| 107 | + pub unsafe fn WelsDestroySVCEncoder(pEncoder: *mut ISVCEncoder) { unsafe { crate::generated::fns_source::WelsDestroySVCEncoder(pEncoder) }} |
| 108 | + pub unsafe fn WelsGetDecoderCapability(pDecCapability: *mut SDecoderCapability) -> ::std::os::raw::c_int { unsafe { crate::generated::fns_source::WelsGetDecoderCapability(pDecCapability) }} |
| 109 | + pub unsafe fn WelsCreateDecoder(ppDecoder: *mut *mut ISVCDecoder) -> ::std::os::raw::c_long { unsafe { crate::generated::fns_source::WelsCreateDecoder(ppDecoder) }} |
| 110 | + pub unsafe fn WelsDestroyDecoder(pDecoder: *mut ISVCDecoder) { unsafe { crate::generated::fns_source::WelsDestroyDecoder(pDecoder) }} |
| 111 | + pub unsafe fn WelsGetCodecVersion() -> OpenH264Version { unsafe { crate::generated::fns_source::WelsGetCodecVersion() }} |
| 112 | + pub unsafe fn WelsGetCodecVersionEx(pVersion: *mut OpenH264Version) { unsafe { crate::generated::fns_source::WelsGetCodecVersionEx(pVersion) }} |
112 | 113 | } |
113 | 114 |
|
114 | 115 | #[rustfmt::skip] |
115 | 116 | #[allow(clippy::missing_safety_doc)] |
116 | 117 | impl super::API for APILoader { |
117 | | - unsafe fn WelsCreateSVCEncoder(&self, ppEncoder: *mut *mut ISVCEncoder) -> c_int { APILoader::WelsCreateSVCEncoder(ppEncoder) } |
118 | | - unsafe fn WelsDestroySVCEncoder(&self, pEncoder: *mut ISVCEncoder) { APILoader::WelsDestroySVCEncoder(pEncoder) } |
119 | | - unsafe fn WelsGetDecoderCapability(&self, pDecCapability: *mut SDecoderCapability) -> c_int { APILoader::WelsGetDecoderCapability(pDecCapability) } |
120 | | - unsafe fn WelsCreateDecoder(&self, ppDecoder: *mut *mut ISVCDecoder) -> c_long { APILoader::WelsCreateDecoder(ppDecoder) } |
121 | | - unsafe fn WelsDestroyDecoder(&self, pDecoder: *mut ISVCDecoder) { APILoader::WelsDestroyDecoder(pDecoder) } |
122 | | - unsafe fn WelsGetCodecVersion(&self) -> OpenH264Version { APILoader::WelsGetCodecVersion() } |
123 | | - unsafe fn WelsGetCodecVersionEx(&self, pVersion: *mut OpenH264Version) { APILoader::WelsGetCodecVersionEx(pVersion) } |
| 118 | + unsafe fn WelsCreateSVCEncoder(&self, ppEncoder: *mut *mut ISVCEncoder) -> c_int { unsafe { APILoader::WelsCreateSVCEncoder(ppEncoder) }} |
| 119 | + unsafe fn WelsDestroySVCEncoder(&self, pEncoder: *mut ISVCEncoder) { unsafe { APILoader::WelsDestroySVCEncoder(pEncoder) }} |
| 120 | + unsafe fn WelsGetDecoderCapability(&self, pDecCapability: *mut SDecoderCapability) -> c_int { unsafe { APILoader::WelsGetDecoderCapability(pDecCapability) }} |
| 121 | + unsafe fn WelsCreateDecoder(&self, ppDecoder: *mut *mut ISVCDecoder) -> c_long { unsafe { APILoader::WelsCreateDecoder(ppDecoder) }} |
| 122 | + unsafe fn WelsDestroyDecoder(&self, pDecoder: *mut ISVCDecoder) { unsafe { APILoader::WelsDestroyDecoder(pDecoder) }} |
| 123 | + unsafe fn WelsGetCodecVersion(&self) -> OpenH264Version { unsafe { APILoader::WelsGetCodecVersion() }} |
| 124 | + unsafe fn WelsGetCodecVersionEx(&self, pVersion: *mut OpenH264Version) { unsafe { APILoader::WelsGetCodecVersionEx(pVersion) }} |
124 | 125 | } |
125 | 126 | } |
126 | 127 |
|
@@ -207,72 +208,86 @@ impl DynamicAPI { |
207 | 208 | #[allow(unused)] |
208 | 209 | impl API for DynamicAPI { |
209 | 210 | unsafe fn WelsCreateSVCEncoder(&self, ppEncoder: *mut *mut ISVCEncoder) -> c_int { |
210 | | - match self { |
211 | | - #[cfg(feature = "source")] |
212 | | - DynamicAPI::Source(api) => api.WelsCreateSVCEncoder(ppEncoder), |
213 | | - #[cfg(feature = "libloading")] |
214 | | - DynamicAPI::Libloading(api) => api.WelsCreateSVCEncoder(ppEncoder), |
215 | | - _ => panic!("No API enabled"), |
| 211 | + unsafe { |
| 212 | + match self { |
| 213 | + #[cfg(feature = "source")] |
| 214 | + DynamicAPI::Source(api) => api.WelsCreateSVCEncoder(ppEncoder), |
| 215 | + #[cfg(feature = "libloading")] |
| 216 | + DynamicAPI::Libloading(api) => api.WelsCreateSVCEncoder(ppEncoder), |
| 217 | + _ => panic!("No API enabled"), |
| 218 | + } |
216 | 219 | } |
217 | 220 | } |
218 | 221 |
|
219 | 222 | unsafe fn WelsDestroySVCEncoder(&self, pEncoder: *mut ISVCEncoder) { |
220 | | - match self { |
221 | | - #[cfg(feature = "source")] |
222 | | - DynamicAPI::Source(api) => api.WelsDestroySVCEncoder(pEncoder), |
223 | | - #[cfg(feature = "libloading")] |
224 | | - DynamicAPI::Libloading(api) => api.WelsDestroySVCEncoder(pEncoder), |
225 | | - _ => panic!("No API enabled"), |
| 223 | + unsafe { |
| 224 | + match self { |
| 225 | + #[cfg(feature = "source")] |
| 226 | + DynamicAPI::Source(api) => api.WelsDestroySVCEncoder(pEncoder), |
| 227 | + #[cfg(feature = "libloading")] |
| 228 | + DynamicAPI::Libloading(api) => api.WelsDestroySVCEncoder(pEncoder), |
| 229 | + _ => panic!("No API enabled"), |
| 230 | + } |
226 | 231 | } |
227 | 232 | } |
228 | 233 |
|
229 | 234 | unsafe fn WelsGetDecoderCapability(&self, pDecCapability: *mut SDecoderCapability) -> c_int { |
230 | | - match self { |
231 | | - #[cfg(feature = "source")] |
232 | | - DynamicAPI::Source(api) => api.WelsGetDecoderCapability(pDecCapability), |
233 | | - #[cfg(feature = "libloading")] |
234 | | - DynamicAPI::Libloading(api) => api.WelsGetDecoderCapability(pDecCapability), |
235 | | - _ => panic!("No API enabled"), |
| 235 | + unsafe { |
| 236 | + match self { |
| 237 | + #[cfg(feature = "source")] |
| 238 | + DynamicAPI::Source(api) => api.WelsGetDecoderCapability(pDecCapability), |
| 239 | + #[cfg(feature = "libloading")] |
| 240 | + DynamicAPI::Libloading(api) => api.WelsGetDecoderCapability(pDecCapability), |
| 241 | + _ => panic!("No API enabled"), |
| 242 | + } |
236 | 243 | } |
237 | 244 | } |
238 | 245 |
|
239 | 246 | unsafe fn WelsCreateDecoder(&self, ppDecoder: *mut *mut ISVCDecoder) -> c_long { |
240 | | - match self { |
241 | | - #[cfg(feature = "source")] |
242 | | - DynamicAPI::Source(api) => api.WelsCreateDecoder(ppDecoder), |
243 | | - #[cfg(feature = "libloading")] |
244 | | - DynamicAPI::Libloading(api) => api.WelsCreateDecoder(ppDecoder), |
245 | | - _ => panic!("No API enabled"), |
| 247 | + unsafe { |
| 248 | + match self { |
| 249 | + #[cfg(feature = "source")] |
| 250 | + DynamicAPI::Source(api) => api.WelsCreateDecoder(ppDecoder), |
| 251 | + #[cfg(feature = "libloading")] |
| 252 | + DynamicAPI::Libloading(api) => api.WelsCreateDecoder(ppDecoder), |
| 253 | + _ => panic!("No API enabled"), |
| 254 | + } |
246 | 255 | } |
247 | 256 | } |
248 | 257 |
|
249 | 258 | unsafe fn WelsDestroyDecoder(&self, pDecoder: *mut ISVCDecoder) { |
250 | | - match self { |
251 | | - #[cfg(feature = "source")] |
252 | | - DynamicAPI::Source(api) => api.WelsDestroyDecoder(pDecoder), |
253 | | - #[cfg(feature = "libloading")] |
254 | | - DynamicAPI::Libloading(api) => api.WelsDestroyDecoder(pDecoder), |
255 | | - _ => panic!("No API enabled"), |
| 259 | + unsafe { |
| 260 | + match self { |
| 261 | + #[cfg(feature = "source")] |
| 262 | + DynamicAPI::Source(api) => api.WelsDestroyDecoder(pDecoder), |
| 263 | + #[cfg(feature = "libloading")] |
| 264 | + DynamicAPI::Libloading(api) => api.WelsDestroyDecoder(pDecoder), |
| 265 | + _ => panic!("No API enabled"), |
| 266 | + } |
256 | 267 | } |
257 | 268 | } |
258 | 269 |
|
259 | 270 | unsafe fn WelsGetCodecVersion(&self) -> OpenH264Version { |
260 | | - match self { |
261 | | - #[cfg(feature = "source")] |
262 | | - DynamicAPI::Source(api) => api.WelsGetCodecVersion(), |
263 | | - #[cfg(feature = "libloading")] |
264 | | - DynamicAPI::Libloading(api) => api.WelsGetCodecVersion(), |
265 | | - _ => panic!("No API enabled"), |
| 271 | + unsafe { |
| 272 | + match self { |
| 273 | + #[cfg(feature = "source")] |
| 274 | + DynamicAPI::Source(api) => api.WelsGetCodecVersion(), |
| 275 | + #[cfg(feature = "libloading")] |
| 276 | + DynamicAPI::Libloading(api) => api.WelsGetCodecVersion(), |
| 277 | + _ => panic!("No API enabled"), |
| 278 | + } |
266 | 279 | } |
267 | 280 | } |
268 | 281 |
|
269 | 282 | unsafe fn WelsGetCodecVersionEx(&self, pVersion: *mut OpenH264Version) { |
270 | | - match self { |
271 | | - #[cfg(feature = "source")] |
272 | | - DynamicAPI::Source(api) => api.WelsGetCodecVersionEx(pVersion), |
273 | | - #[cfg(feature = "libloading")] |
274 | | - DynamicAPI::Libloading(api) => api.WelsGetCodecVersionEx(pVersion), |
275 | | - _ => panic!("No API enabled"), |
| 283 | + unsafe { |
| 284 | + match self { |
| 285 | + #[cfg(feature = "source")] |
| 286 | + DynamicAPI::Source(api) => api.WelsGetCodecVersionEx(pVersion), |
| 287 | + #[cfg(feature = "libloading")] |
| 288 | + DynamicAPI::Libloading(api) => api.WelsGetCodecVersionEx(pVersion), |
| 289 | + _ => panic!("No API enabled"), |
| 290 | + } |
276 | 291 | } |
277 | 292 | } |
278 | 293 | } |
|
0 commit comments