1#[repr(C)]
4#[derive(Debug, Copy, Clone)]
5pub struct vsl_host {
6 _unused: [u8; 0],
7}
8#[doc = " The VSLHost object manages a connection point at the user-defined path and\n allows frames to be registered for client use."]
9pub type VSLHost = vsl_host;
10#[repr(C)]
11#[derive(Debug, Copy, Clone)]
12pub struct vsl_client {
13 _unused: [u8; 0],
14}
15#[doc = " The VSLClient object manages a single connection to a VSLHost."]
16pub type VSLClient = vsl_client;
17#[repr(C)]
18#[derive(Debug, Copy, Clone)]
19pub struct vsl_frame {
20 _unused: [u8; 0],
21}
22#[doc = " The VSLFrame object represents a single video frame from either the host\n or client perspective. Certain API are only available to the host or client."]
23pub type VSLFrame = vsl_frame;
24#[repr(C)]
25#[derive(Debug, Copy, Clone)]
26pub struct vsl_encoder {
27 _unused: [u8; 0],
28}
29#[doc = " The VSLEncoder object represents encoder instance.\n"]
30pub type VSLEncoder = vsl_encoder;
31#[repr(C)]
32#[derive(Debug, Copy, Clone)]
33pub struct vsl_decoder {
34 _unused: [u8; 0],
35}
36#[doc = " The VSLEncoder object represents encoder instance.\n"]
37pub type VSLDecoder = vsl_decoder;
38#[doc = " The VSLRect structure represents a rectangle region of a frame and is used to\n define cropping regions for sub-frames."]
39#[repr(C)]
40#[derive(Debug, Copy, Clone)]
41pub struct vsl_rect {
42 #[doc = " The left-most pixel offset for the rectangle."]
43 pub x: ::std::os::raw::c_int,
44 #[doc = " The top-most pixel offset for the rectangle."]
45 pub y: ::std::os::raw::c_int,
46 #[doc = " The width in pixels of the rectangle. The end position is x+width."]
47 pub width: ::std::os::raw::c_int,
48 #[doc = " The height in pixels of the rectangle. The end position is y+height."]
49 pub height: ::std::os::raw::c_int,
50}
51#[allow(clippy::unnecessary_operation, clippy::identity_op)]
52const _: () = {
53 ["Size of vsl_rect"][::std::mem::size_of::<vsl_rect>() - 16usize];
54 ["Alignment of vsl_rect"][::std::mem::align_of::<vsl_rect>() - 4usize];
55 ["Offset of field: vsl_rect::x"][::std::mem::offset_of!(vsl_rect, x) - 0usize];
56 ["Offset of field: vsl_rect::y"][::std::mem::offset_of!(vsl_rect, y) - 4usize];
57 ["Offset of field: vsl_rect::width"][::std::mem::offset_of!(vsl_rect, width) - 8usize];
58 ["Offset of field: vsl_rect::height"][::std::mem::offset_of!(vsl_rect, height) - 12usize];
59};
60#[doc = " The VSLRect structure represents a rectangle region of a frame and is used to\n define cropping regions for sub-frames."]
61pub type VSLRect = vsl_rect;
62pub const vsl_encode_profile_VSL_ENCODE_PROFILE_AUTO: vsl_encode_profile = 0;
63pub const vsl_encode_profile_VSL_ENCODE_PROFILE_5000_KBPS: vsl_encode_profile = 1;
64pub const vsl_encode_profile_VSL_ENCODE_PROFILE_25000_KBPS: vsl_encode_profile = 2;
65pub const vsl_encode_profile_VSL_ENCODE_PROFILE_50000_KBPS: vsl_encode_profile = 3;
66pub const vsl_encode_profile_VSL_ENCODE_PROFILE_100000_KBPS: vsl_encode_profile = 4;
67pub type vsl_encode_profile = ::std::os::raw::c_uint;
68pub use self::vsl_encode_profile as VSLEncoderProfile;
69#[doc = " Function pointer definition which will be called as part of\n @ref vsl_frame_unregister. This is typically used to free resources\n associated with the frame on either client or host side."]
70pub type vsl_frame_cleanup = ::std::option::Option<unsafe extern "C" fn(frame: *mut VSLFrame)>;
71#[repr(C)]
72#[derive(Debug, Copy, Clone)]
73pub struct vsl_camera_buffer {
74 _unused: [u8; 0],
75}
76#[repr(C)]
77#[derive(Debug, Copy, Clone)]
78pub struct vsl_camera {
79 _unused: [u8; 0],
80}
81pub const VSLDecoderRetCode_VSL_DEC_SUCCESS: VSLDecoderRetCode = 0;
82pub const VSLDecoderRetCode_VSL_DEC_ERR: VSLDecoderRetCode = 1;
83pub const VSLDecoderRetCode_VSL_DEC_INIT_INFO: VSLDecoderRetCode = 2;
84pub const VSLDecoderRetCode_VSL_DEC_FRAME_DEC: VSLDecoderRetCode = 4;
85pub type VSLDecoderRetCode = ::std::os::raw::c_uint;
86pub struct VideoStreamLibrary {
87 __library: ::libloading::Library,
88 pub vsl_version:
89 Result<unsafe extern "C" fn() -> *const ::std::os::raw::c_char, ::libloading::Error>,
90 pub vsl_timestamp: Result<unsafe extern "C" fn() -> i64, ::libloading::Error>,
91 pub vsl_host_init: Result<
92 unsafe extern "C" fn(path: *const ::std::os::raw::c_char) -> *mut VSLHost,
93 ::libloading::Error,
94 >,
95 pub vsl_host_release: Result<unsafe extern "C" fn(host: *mut VSLHost), ::libloading::Error>,
96 pub vsl_host_path: Result<
97 unsafe extern "C" fn(host: *const VSLHost) -> *const ::std::os::raw::c_char,
98 ::libloading::Error,
99 >,
100 pub vsl_host_poll: Result<
101 unsafe extern "C" fn(host: *mut VSLHost, wait: i64) -> ::std::os::raw::c_int,
102 ::libloading::Error,
103 >,
104 pub vsl_host_service: Result<
105 unsafe extern "C" fn(
106 host: *mut VSLHost,
107 sock: ::std::os::raw::c_int,
108 ) -> ::std::os::raw::c_int,
109 ::libloading::Error,
110 >,
111 pub vsl_host_process: Result<
112 unsafe extern "C" fn(host: *mut VSLHost) -> ::std::os::raw::c_int,
113 ::libloading::Error,
114 >,
115 pub vsl_host_sockets: Result<
116 unsafe extern "C" fn(
117 host: *mut VSLHost,
118 n_sockets: usize,
119 sockets: *mut ::std::os::raw::c_int,
120 max_sockets: *mut usize,
121 ) -> ::std::os::raw::c_int,
122 ::libloading::Error,
123 >,
124 pub vsl_host_post: Result<
125 unsafe extern "C" fn(
126 host: *mut VSLHost,
127 frame: *mut VSLFrame,
128 expires: i64,
129 duration: i64,
130 pts: i64,
131 dts: i64,
132 ) -> ::std::os::raw::c_int,
133 ::libloading::Error,
134 >,
135 pub vsl_host_drop: Result<
136 unsafe extern "C" fn(host: *mut VSLHost, frame: *mut VSLFrame) -> ::std::os::raw::c_int,
137 ::libloading::Error,
138 >,
139 pub vsl_client_init: Result<
140 unsafe extern "C" fn(
141 path: *const ::std::os::raw::c_char,
142 userptr: *mut ::std::os::raw::c_void,
143 reconnect: bool,
144 ) -> *mut VSLClient,
145 ::libloading::Error,
146 >,
147 pub vsl_client_release:
148 Result<unsafe extern "C" fn(client: *mut VSLClient), ::libloading::Error>,
149 pub vsl_client_disconnect:
150 Result<unsafe extern "C" fn(client: *mut VSLClient), ::libloading::Error>,
151 pub vsl_client_userptr: Result<
152 unsafe extern "C" fn(client: *mut VSLClient) -> *mut ::std::os::raw::c_void,
153 ::libloading::Error,
154 >,
155 pub vsl_client_path: Result<
156 unsafe extern "C" fn(client: *const VSLClient) -> *const ::std::os::raw::c_char,
157 ::libloading::Error,
158 >,
159 pub vsl_client_set_timeout:
160 Result<unsafe extern "C" fn(client: *mut VSLClient, timeout: f32), ::libloading::Error>,
161 pub vsl_frame_register: Result<
162 unsafe extern "C" fn(
163 host: *mut VSLHost,
164 serial: i64,
165 handle: ::std::os::raw::c_int,
166 width: ::std::os::raw::c_int,
167 height: ::std::os::raw::c_int,
168 fourcc: u32,
169 size: usize,
170 offset: usize,
171 expires: i64,
172 duration: i64,
173 pts: i64,
174 dts: i64,
175 cleanup: vsl_frame_cleanup,
176 userptr: *mut ::std::os::raw::c_void,
177 ) -> *mut VSLFrame,
178 ::libloading::Error,
179 >,
180 pub vsl_frame_init: Result<
181 unsafe extern "C" fn(
182 width: u32,
183 height: u32,
184 stride: u32,
185 fourcc: u32,
186 userptr: *mut ::std::os::raw::c_void,
187 cleanup: vsl_frame_cleanup,
188 ) -> *mut VSLFrame,
189 ::libloading::Error,
190 >,
191 pub vsl_frame_alloc: Result<
192 unsafe extern "C" fn(
193 frame: *mut VSLFrame,
194 path: *const ::std::os::raw::c_char,
195 ) -> ::std::os::raw::c_int,
196 ::libloading::Error,
197 >,
198 pub vsl_frame_unalloc: Result<unsafe extern "C" fn(frame: *mut VSLFrame), ::libloading::Error>,
199 pub vsl_frame_attach: Result<
200 unsafe extern "C" fn(
201 frame: *mut VSLFrame,
202 fd: ::std::os::raw::c_int,
203 size: usize,
204 offset: usize,
205 ) -> ::std::os::raw::c_int,
206 ::libloading::Error,
207 >,
208 pub vsl_frame_path: Result<
209 unsafe extern "C" fn(frame: *const VSLFrame) -> *const ::std::os::raw::c_char,
210 ::libloading::Error,
211 >,
212 pub vsl_frame_unregister:
213 Result<unsafe extern "C" fn(frame: *mut VSLFrame), ::libloading::Error>,
214 pub vsl_frame_copy: Result<
215 unsafe extern "C" fn(
216 target: *mut VSLFrame,
217 source: *mut VSLFrame,
218 crop: *const VSLRect,
219 ) -> ::std::os::raw::c_int,
220 ::libloading::Error,
221 >,
222 pub vsl_frame_userptr: Result<
223 unsafe extern "C" fn(frame: *mut VSLFrame) -> *mut ::std::os::raw::c_void,
224 ::libloading::Error,
225 >,
226 pub vsl_frame_set_userptr: Result<
227 unsafe extern "C" fn(frame: *mut VSLFrame, userptr: *mut ::std::os::raw::c_void),
228 ::libloading::Error,
229 >,
230 pub vsl_frame_wait: Result<
231 unsafe extern "C" fn(client: *mut VSLClient, until: i64) -> *mut VSLFrame,
232 ::libloading::Error,
233 >,
234 pub vsl_frame_release: Result<unsafe extern "C" fn(frame: *mut VSLFrame), ::libloading::Error>,
235 pub vsl_frame_trylock: Result<
236 unsafe extern "C" fn(frame: *mut VSLFrame) -> ::std::os::raw::c_int,
237 ::libloading::Error,
238 >,
239 pub vsl_frame_unlock: Result<
240 unsafe extern "C" fn(frame: *mut VSLFrame) -> ::std::os::raw::c_int,
241 ::libloading::Error,
242 >,
243 pub vsl_frame_serial:
244 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, ::libloading::Error>,
245 pub vsl_frame_timestamp:
246 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, ::libloading::Error>,
247 pub vsl_frame_duration:
248 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, ::libloading::Error>,
249 pub vsl_frame_pts:
250 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, ::libloading::Error>,
251 pub vsl_frame_dts:
252 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, ::libloading::Error>,
253 pub vsl_frame_expires:
254 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, ::libloading::Error>,
255 pub vsl_frame_fourcc:
256 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> u32, ::libloading::Error>,
257 pub vsl_frame_width: Result<
258 unsafe extern "C" fn(frame: *const VSLFrame) -> ::std::os::raw::c_int,
259 ::libloading::Error,
260 >,
261 pub vsl_frame_height: Result<
262 unsafe extern "C" fn(frame: *const VSLFrame) -> ::std::os::raw::c_int,
263 ::libloading::Error,
264 >,
265 pub vsl_frame_stride: Result<
266 unsafe extern "C" fn(frame: *const VSLFrame) -> ::std::os::raw::c_int,
267 ::libloading::Error,
268 >,
269 pub vsl_frame_size: Result<
270 unsafe extern "C" fn(frame: *const VSLFrame) -> ::std::os::raw::c_int,
271 ::libloading::Error,
272 >,
273 pub vsl_frame_handle: Result<
274 unsafe extern "C" fn(frame: *const VSLFrame) -> ::std::os::raw::c_int,
275 ::libloading::Error,
276 >,
277 pub vsl_frame_paddr:
278 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> isize, ::libloading::Error>,
279 pub vsl_frame_mmap: Result<
280 unsafe extern "C" fn(frame: *mut VSLFrame, size: *mut usize) -> *mut ::std::os::raw::c_void,
281 ::libloading::Error,
282 >,
283 pub vsl_frame_munmap: Result<unsafe extern "C" fn(frame: *mut VSLFrame), ::libloading::Error>,
284 pub vsl_frame_sync: Result<
285 unsafe extern "C" fn(
286 frame: *const VSLFrame,
287 enable: ::std::os::raw::c_int,
288 mode: ::std::os::raw::c_int,
289 ) -> ::std::os::raw::c_int,
290 ::libloading::Error,
291 >,
292 pub vsl_fourcc_from_string: Result<
293 unsafe extern "C" fn(fourcc: *const ::std::os::raw::c_char) -> u32,
294 ::libloading::Error,
295 >,
296 pub vsl_encoder_create: Result<
297 unsafe extern "C" fn(
298 profile: VSLEncoderProfile,
299 outputFourcc: u32,
300 fps: ::std::os::raw::c_int,
301 ) -> *mut VSLEncoder,
302 ::libloading::Error,
303 >,
304 pub vsl_encoder_release:
305 Result<unsafe extern "C" fn(encoder: *mut VSLEncoder), ::libloading::Error>,
306 pub vsl_encode_frame: Result<
307 unsafe extern "C" fn(
308 encoder: *mut VSLEncoder,
309 source: *mut VSLFrame,
310 destination: *mut VSLFrame,
311 cropRegion: *const VSLRect,
312 keyframe: *mut ::std::os::raw::c_int,
313 ) -> ::std::os::raw::c_int,
314 ::libloading::Error,
315 >,
316 pub vsl_encoder_new_output_frame: Result<
317 unsafe extern "C" fn(
318 encoder: *const VSLEncoder,
319 width: ::std::os::raw::c_int,
320 height: ::std::os::raw::c_int,
321 duration: i64,
322 pts: i64,
323 dts: i64,
324 ) -> *mut VSLFrame,
325 ::libloading::Error,
326 >,
327 pub vsl_camera_open_device: Result<
328 unsafe extern "C" fn(filename: *const ::std::os::raw::c_char) -> *mut vsl_camera,
329 ::libloading::Error,
330 >,
331 pub vsl_camera_init_device: Result<
332 unsafe extern "C" fn(
333 ctx: *mut vsl_camera,
334 width: *mut ::std::os::raw::c_int,
335 height: *mut ::std::os::raw::c_int,
336 buf_count: *mut ::std::os::raw::c_int,
337 fourcc: *mut u32,
338 ) -> ::std::os::raw::c_int,
339 ::libloading::Error,
340 >,
341 pub vsl_camera_mirror: Result<
342 unsafe extern "C" fn(ctx: *const vsl_camera, mirror: bool) -> ::std::os::raw::c_int,
343 ::libloading::Error,
344 >,
345 pub vsl_camera_mirror_v: Result<
346 unsafe extern "C" fn(ctx: *const vsl_camera, mirror: bool) -> ::std::os::raw::c_int,
347 ::libloading::Error,
348 >,
349 pub vsl_camera_start_capturing: Result<
350 unsafe extern "C" fn(ctx: *mut vsl_camera) -> ::std::os::raw::c_int,
351 ::libloading::Error,
352 >,
353 pub vsl_camera_get_data: Result<
354 unsafe extern "C" fn(ctx: *mut vsl_camera) -> *mut vsl_camera_buffer,
355 ::libloading::Error,
356 >,
357 pub vsl_camera_release_buffer: Result<
358 unsafe extern "C" fn(
359 ctx: *mut vsl_camera,
360 buffer: *const vsl_camera_buffer,
361 ) -> ::std::os::raw::c_int,
362 ::libloading::Error,
363 >,
364 pub vsl_camera_stop_capturing: Result<
365 unsafe extern "C" fn(ctx: *const vsl_camera) -> ::std::os::raw::c_int,
366 ::libloading::Error,
367 >,
368 pub vsl_camera_uninit_device:
369 Result<unsafe extern "C" fn(ctx: *mut vsl_camera), ::libloading::Error>,
370 pub vsl_camera_close_device:
371 Result<unsafe extern "C" fn(ctx: *mut vsl_camera), ::libloading::Error>,
372 pub vsl_camera_is_dmabuf_supported: Result<
373 unsafe extern "C" fn(ctx: *const vsl_camera) -> ::std::os::raw::c_int,
374 ::libloading::Error,
375 >,
376 pub vsl_camera_get_queued_buf_count: Result<
377 unsafe extern "C" fn(ctx: *const vsl_camera) -> ::std::os::raw::c_int,
378 ::libloading::Error,
379 >,
380 pub vsl_camera_buffer_mmap: Result<
381 unsafe extern "C" fn(buffer: *mut vsl_camera_buffer) -> *mut ::std::os::raw::c_void,
382 ::libloading::Error,
383 >,
384 pub vsl_camera_buffer_dma_fd: Result<
385 unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> ::std::os::raw::c_int,
386 ::libloading::Error,
387 >,
388 pub vsl_camera_buffer_phys_addr:
389 Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u64, ::libloading::Error>,
390 pub vsl_camera_buffer_length:
391 Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, ::libloading::Error>,
392 pub vsl_camera_buffer_fourcc:
393 Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, ::libloading::Error>,
394 pub vsl_camera_buffer_timestamp: Result<
395 unsafe extern "C" fn(
396 buffer: *const vsl_camera_buffer,
397 seconds: *mut i64,
398 nanoseconds: *mut i64,
399 ),
400 ::libloading::Error,
401 >,
402 pub vsl_camera_enum_fmts: Result<
403 unsafe extern "C" fn(
404 ctx: *const vsl_camera,
405 codes: *mut u32,
406 size: ::std::os::raw::c_int,
407 ) -> ::std::os::raw::c_int,
408 ::libloading::Error,
409 >,
410 pub vsl_camera_enum_mplane_fmts: Result<
411 unsafe extern "C" fn(
412 ctx: *const vsl_camera,
413 codes: *mut u32,
414 size: ::std::os::raw::c_int,
415 ) -> ::std::os::raw::c_int,
416 ::libloading::Error,
417 >,
418 pub vsl_decoder_create: Result<
419 unsafe extern "C" fn(outputFourcc: u32, fps: ::std::os::raw::c_int) -> *mut VSLDecoder,
420 ::libloading::Error,
421 >,
422 pub vsl_decode_frame: Result<
423 unsafe extern "C" fn(
424 decoder: *mut VSLDecoder,
425 data: *const ::std::os::raw::c_void,
426 data_length: ::std::os::raw::c_uint,
427 bytes_used: *mut usize,
428 output_frame: *mut *mut VSLFrame,
429 ) -> VSLDecoderRetCode,
430 ::libloading::Error,
431 >,
432 pub vsl_decoder_width: Result<
433 unsafe extern "C" fn(decoder: *const VSLDecoder) -> ::std::os::raw::c_int,
434 ::libloading::Error,
435 >,
436 pub vsl_decoder_height: Result<
437 unsafe extern "C" fn(decoder: *const VSLDecoder) -> ::std::os::raw::c_int,
438 ::libloading::Error,
439 >,
440 pub vsl_decoder_crop:
441 Result<unsafe extern "C" fn(decoder: *const VSLDecoder) -> VSLRect, ::libloading::Error>,
442 pub vsl_decoder_release: Result<
443 unsafe extern "C" fn(decoder: *mut VSLDecoder) -> ::std::os::raw::c_int,
444 ::libloading::Error,
445 >,
446}
447impl VideoStreamLibrary {
448 pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
449 where
450 P: ::libloading::AsFilename,
451 {
452 let library = ::libloading::Library::new(path)?;
453 Self::from_library(library)
454 }
455 pub unsafe fn from_library<L>(library: L) -> Result<Self, ::libloading::Error>
456 where
457 L: Into<::libloading::Library>,
458 {
459 let __library = library.into();
460 let vsl_version = __library.get(b"vsl_version\0").map(|sym| *sym);
461 let vsl_timestamp = __library.get(b"vsl_timestamp\0").map(|sym| *sym);
462 let vsl_host_init = __library.get(b"vsl_host_init\0").map(|sym| *sym);
463 let vsl_host_release = __library.get(b"vsl_host_release\0").map(|sym| *sym);
464 let vsl_host_path = __library.get(b"vsl_host_path\0").map(|sym| *sym);
465 let vsl_host_poll = __library.get(b"vsl_host_poll\0").map(|sym| *sym);
466 let vsl_host_service = __library.get(b"vsl_host_service\0").map(|sym| *sym);
467 let vsl_host_process = __library.get(b"vsl_host_process\0").map(|sym| *sym);
468 let vsl_host_sockets = __library.get(b"vsl_host_sockets\0").map(|sym| *sym);
469 let vsl_host_post = __library.get(b"vsl_host_post\0").map(|sym| *sym);
470 let vsl_host_drop = __library.get(b"vsl_host_drop\0").map(|sym| *sym);
471 let vsl_client_init = __library.get(b"vsl_client_init\0").map(|sym| *sym);
472 let vsl_client_release = __library.get(b"vsl_client_release\0").map(|sym| *sym);
473 let vsl_client_disconnect = __library.get(b"vsl_client_disconnect\0").map(|sym| *sym);
474 let vsl_client_userptr = __library.get(b"vsl_client_userptr\0").map(|sym| *sym);
475 let vsl_client_path = __library.get(b"vsl_client_path\0").map(|sym| *sym);
476 let vsl_client_set_timeout = __library.get(b"vsl_client_set_timeout\0").map(|sym| *sym);
477 let vsl_frame_register = __library.get(b"vsl_frame_register\0").map(|sym| *sym);
478 let vsl_frame_init = __library.get(b"vsl_frame_init\0").map(|sym| *sym);
479 let vsl_frame_alloc = __library.get(b"vsl_frame_alloc\0").map(|sym| *sym);
480 let vsl_frame_unalloc = __library.get(b"vsl_frame_unalloc\0").map(|sym| *sym);
481 let vsl_frame_attach = __library.get(b"vsl_frame_attach\0").map(|sym| *sym);
482 let vsl_frame_path = __library.get(b"vsl_frame_path\0").map(|sym| *sym);
483 let vsl_frame_unregister = __library.get(b"vsl_frame_unregister\0").map(|sym| *sym);
484 let vsl_frame_copy = __library.get(b"vsl_frame_copy\0").map(|sym| *sym);
485 let vsl_frame_userptr = __library.get(b"vsl_frame_userptr\0").map(|sym| *sym);
486 let vsl_frame_set_userptr = __library.get(b"vsl_frame_set_userptr\0").map(|sym| *sym);
487 let vsl_frame_wait = __library.get(b"vsl_frame_wait\0").map(|sym| *sym);
488 let vsl_frame_release = __library.get(b"vsl_frame_release\0").map(|sym| *sym);
489 let vsl_frame_trylock = __library.get(b"vsl_frame_trylock\0").map(|sym| *sym);
490 let vsl_frame_unlock = __library.get(b"vsl_frame_unlock\0").map(|sym| *sym);
491 let vsl_frame_serial = __library.get(b"vsl_frame_serial\0").map(|sym| *sym);
492 let vsl_frame_timestamp = __library.get(b"vsl_frame_timestamp\0").map(|sym| *sym);
493 let vsl_frame_duration = __library.get(b"vsl_frame_duration\0").map(|sym| *sym);
494 let vsl_frame_pts = __library.get(b"vsl_frame_pts\0").map(|sym| *sym);
495 let vsl_frame_dts = __library.get(b"vsl_frame_dts\0").map(|sym| *sym);
496 let vsl_frame_expires = __library.get(b"vsl_frame_expires\0").map(|sym| *sym);
497 let vsl_frame_fourcc = __library.get(b"vsl_frame_fourcc\0").map(|sym| *sym);
498 let vsl_frame_width = __library.get(b"vsl_frame_width\0").map(|sym| *sym);
499 let vsl_frame_height = __library.get(b"vsl_frame_height\0").map(|sym| *sym);
500 let vsl_frame_stride = __library.get(b"vsl_frame_stride\0").map(|sym| *sym);
501 let vsl_frame_size = __library.get(b"vsl_frame_size\0").map(|sym| *sym);
502 let vsl_frame_handle = __library.get(b"vsl_frame_handle\0").map(|sym| *sym);
503 let vsl_frame_paddr = __library.get(b"vsl_frame_paddr\0").map(|sym| *sym);
504 let vsl_frame_mmap = __library.get(b"vsl_frame_mmap\0").map(|sym| *sym);
505 let vsl_frame_munmap = __library.get(b"vsl_frame_munmap\0").map(|sym| *sym);
506 let vsl_frame_sync = __library.get(b"vsl_frame_sync\0").map(|sym| *sym);
507 let vsl_fourcc_from_string = __library.get(b"vsl_fourcc_from_string\0").map(|sym| *sym);
508 let vsl_encoder_create = __library.get(b"vsl_encoder_create\0").map(|sym| *sym);
509 let vsl_encoder_release = __library.get(b"vsl_encoder_release\0").map(|sym| *sym);
510 let vsl_encode_frame = __library.get(b"vsl_encode_frame\0").map(|sym| *sym);
511 let vsl_encoder_new_output_frame = __library
512 .get(b"vsl_encoder_new_output_frame\0")
513 .map(|sym| *sym);
514 let vsl_camera_open_device = __library.get(b"vsl_camera_open_device\0").map(|sym| *sym);
515 let vsl_camera_init_device = __library.get(b"vsl_camera_init_device\0").map(|sym| *sym);
516 let vsl_camera_mirror = __library.get(b"vsl_camera_mirror\0").map(|sym| *sym);
517 let vsl_camera_mirror_v = __library.get(b"vsl_camera_mirror_v\0").map(|sym| *sym);
518 let vsl_camera_start_capturing = __library
519 .get(b"vsl_camera_start_capturing\0")
520 .map(|sym| *sym);
521 let vsl_camera_get_data = __library.get(b"vsl_camera_get_data\0").map(|sym| *sym);
522 let vsl_camera_release_buffer = __library
523 .get(b"vsl_camera_release_buffer\0")
524 .map(|sym| *sym);
525 let vsl_camera_stop_capturing = __library
526 .get(b"vsl_camera_stop_capturing\0")
527 .map(|sym| *sym);
528 let vsl_camera_uninit_device = __library.get(b"vsl_camera_uninit_device\0").map(|sym| *sym);
529 let vsl_camera_close_device = __library.get(b"vsl_camera_close_device\0").map(|sym| *sym);
530 let vsl_camera_is_dmabuf_supported = __library
531 .get(b"vsl_camera_is_dmabuf_supported\0")
532 .map(|sym| *sym);
533 let vsl_camera_get_queued_buf_count = __library
534 .get(b"vsl_camera_get_queued_buf_count\0")
535 .map(|sym| *sym);
536 let vsl_camera_buffer_mmap = __library.get(b"vsl_camera_buffer_mmap\0").map(|sym| *sym);
537 let vsl_camera_buffer_dma_fd = __library.get(b"vsl_camera_buffer_dma_fd\0").map(|sym| *sym);
538 let vsl_camera_buffer_phys_addr = __library
539 .get(b"vsl_camera_buffer_phys_addr\0")
540 .map(|sym| *sym);
541 let vsl_camera_buffer_length = __library.get(b"vsl_camera_buffer_length\0").map(|sym| *sym);
542 let vsl_camera_buffer_fourcc = __library.get(b"vsl_camera_buffer_fourcc\0").map(|sym| *sym);
543 let vsl_camera_buffer_timestamp = __library
544 .get(b"vsl_camera_buffer_timestamp\0")
545 .map(|sym| *sym);
546 let vsl_camera_enum_fmts = __library.get(b"vsl_camera_enum_fmts\0").map(|sym| *sym);
547 let vsl_camera_enum_mplane_fmts = __library
548 .get(b"vsl_camera_enum_mplane_fmts\0")
549 .map(|sym| *sym);
550 let vsl_decoder_create = __library.get(b"vsl_decoder_create\0").map(|sym| *sym);
551 let vsl_decode_frame = __library.get(b"vsl_decode_frame\0").map(|sym| *sym);
552 let vsl_decoder_width = __library.get(b"vsl_decoder_width\0").map(|sym| *sym);
553 let vsl_decoder_height = __library.get(b"vsl_decoder_height\0").map(|sym| *sym);
554 let vsl_decoder_crop = __library.get(b"vsl_decoder_crop\0").map(|sym| *sym);
555 let vsl_decoder_release = __library.get(b"vsl_decoder_release\0").map(|sym| *sym);
556 Ok(VideoStreamLibrary {
557 __library,
558 vsl_version,
559 vsl_timestamp,
560 vsl_host_init,
561 vsl_host_release,
562 vsl_host_path,
563 vsl_host_poll,
564 vsl_host_service,
565 vsl_host_process,
566 vsl_host_sockets,
567 vsl_host_post,
568 vsl_host_drop,
569 vsl_client_init,
570 vsl_client_release,
571 vsl_client_disconnect,
572 vsl_client_userptr,
573 vsl_client_path,
574 vsl_client_set_timeout,
575 vsl_frame_register,
576 vsl_frame_init,
577 vsl_frame_alloc,
578 vsl_frame_unalloc,
579 vsl_frame_attach,
580 vsl_frame_path,
581 vsl_frame_unregister,
582 vsl_frame_copy,
583 vsl_frame_userptr,
584 vsl_frame_set_userptr,
585 vsl_frame_wait,
586 vsl_frame_release,
587 vsl_frame_trylock,
588 vsl_frame_unlock,
589 vsl_frame_serial,
590 vsl_frame_timestamp,
591 vsl_frame_duration,
592 vsl_frame_pts,
593 vsl_frame_dts,
594 vsl_frame_expires,
595 vsl_frame_fourcc,
596 vsl_frame_width,
597 vsl_frame_height,
598 vsl_frame_stride,
599 vsl_frame_size,
600 vsl_frame_handle,
601 vsl_frame_paddr,
602 vsl_frame_mmap,
603 vsl_frame_munmap,
604 vsl_frame_sync,
605 vsl_fourcc_from_string,
606 vsl_encoder_create,
607 vsl_encoder_release,
608 vsl_encode_frame,
609 vsl_encoder_new_output_frame,
610 vsl_camera_open_device,
611 vsl_camera_init_device,
612 vsl_camera_mirror,
613 vsl_camera_mirror_v,
614 vsl_camera_start_capturing,
615 vsl_camera_get_data,
616 vsl_camera_release_buffer,
617 vsl_camera_stop_capturing,
618 vsl_camera_uninit_device,
619 vsl_camera_close_device,
620 vsl_camera_is_dmabuf_supported,
621 vsl_camera_get_queued_buf_count,
622 vsl_camera_buffer_mmap,
623 vsl_camera_buffer_dma_fd,
624 vsl_camera_buffer_phys_addr,
625 vsl_camera_buffer_length,
626 vsl_camera_buffer_fourcc,
627 vsl_camera_buffer_timestamp,
628 vsl_camera_enum_fmts,
629 vsl_camera_enum_mplane_fmts,
630 vsl_decoder_create,
631 vsl_decode_frame,
632 vsl_decoder_width,
633 vsl_decoder_height,
634 vsl_decoder_crop,
635 vsl_decoder_release,
636 })
637 }
638 #[doc = " Returns the VideoStream Library version."]
639 pub unsafe fn vsl_version(&self) -> *const ::std::os::raw::c_char {
640 (self
641 .vsl_version
642 .as_ref()
643 .expect("Expected function, got error."))()
644 }
645 pub unsafe fn vsl_timestamp(&self) -> i64 {
646 (self
647 .vsl_timestamp
648 .as_ref()
649 .expect("Expected function, got error."))()
650 }
651 #[doc = " Creates a host on the requested path. If the path is unavailable because\n of permissions or already exists then NULL is returned and errno is set.\n\n @memberof VSLHost"]
652 pub unsafe fn vsl_host_init(&self, path: *const ::std::os::raw::c_char) -> *mut VSLHost {
653 (self
654 .vsl_host_init
655 .as_ref()
656 .expect("Expected function, got error."))(path)
657 }
658 #[doc = " Releases the host, disconnecting all clients and releasing any allocated\n memory.\n\n @memberof VSLHost"]
659 pub unsafe fn vsl_host_release(&self, host: *mut VSLHost) {
660 (self
661 .vsl_host_release
662 .as_ref()
663 .expect("Expected function, got error."))(host)
664 }
665 #[doc = " Returns the bound path of the host.\n\n @memberof VSLHost"]
666 pub unsafe fn vsl_host_path(&self, host: *const VSLHost) -> *const ::std::os::raw::c_char {
667 (self
668 .vsl_host_path
669 .as_ref()
670 .expect("Expected function, got error."))(host)
671 }
672 #[doc = " Polls the list of available connections in our pool. If @param wait is >0\n then poll will timeout after @param wait milliseconds. Note frames are only\n expired by the @ref vsl_host_process function so the @param wait parameter\n should be some value no greater than the desired expiration time.\n\n @memberof VSLHost"]
673 pub unsafe fn vsl_host_poll(&self, host: *mut VSLHost, wait: i64) -> ::std::os::raw::c_int {
674 (self
675 .vsl_host_poll
676 .as_ref()
677 .expect("Expected function, got error."))(host, wait)
678 }
679 #[doc = " Services a single client socket. Note this does not accept new sockets for\n that you must call @ref vsl_host_process(). The main advantage over calling\n this function is to see if individual client servicing resulted in an error.\n\n @since 1.0\n @memberof VSLHost"]
680 pub unsafe fn vsl_host_service(
681 &self,
682 host: *mut VSLHost,
683 sock: ::std::os::raw::c_int,
684 ) -> ::std::os::raw::c_int {
685 (self
686 .vsl_host_service
687 .as_ref()
688 .expect("Expected function, got error."))(host, sock)
689 }
690 #[doc = " Process the host tasks by first expiring old frames and then servicing the\n first available connection in our pool. This function should be called in a\n loop, generally blocked by @ref vsl_host_poll.\n\n @memberof VSLHost"]
691 pub unsafe fn vsl_host_process(&self, host: *mut VSLHost) -> ::std::os::raw::c_int {
692 (self
693 .vsl_host_process
694 .as_ref()
695 .expect("Expected function, got error."))(host)
696 }
697 #[doc = " Request a copy of the sockets managed by the host. There will always be at\n least one socket which is the connection socket which accepts new\n connections. Up to n_sockets socket descriptors will be copied into the\n sockets buffer, if n_sockets is fewer than the number of available sockets\n errno will be set to ENOBUFS. The n_socket parameter, if provided, will be\n populated with a value of n_clients+1 which can be used to query required\n space for the sockets buffer. It is suggested to provide a buffer which is\n larger than max_sockets to avoid race conditions where the number of sockets\n changes between calls to this function.\n\n Note that the array of sockets should be refreshed often as once the function\n returns they may be stale. The API is implemented in such as way as to allow\n thread-safe operations where one thread may-be using the vsl sockets to send\n messages while another is polling for a read.\n\n @memberof VSLHost"]
698 pub unsafe fn vsl_host_sockets(
699 &self,
700 host: *mut VSLHost,
701 n_sockets: usize,
702 sockets: *mut ::std::os::raw::c_int,
703 max_sockets: *mut usize,
704 ) -> ::std::os::raw::c_int {
705 (self
706 .vsl_host_sockets
707 .as_ref()
708 .expect("Expected function, got error."))(host, n_sockets, sockets, max_sockets)
709 }
710 #[doc = " Registers the frame with the host and publishes it to subscribers.\n\n @note A frame posted to this function transfers ownership to the host and\n should not have @ref vsl_frame_release called on it. This will be managed\n by the host on frame expiry."]
711 pub unsafe fn vsl_host_post(
712 &self,
713 host: *mut VSLHost,
714 frame: *mut VSLFrame,
715 expires: i64,
716 duration: i64,
717 pts: i64,
718 dts: i64,
719 ) -> ::std::os::raw::c_int {
720 (self
721 .vsl_host_post
722 .as_ref()
723 .expect("Expected function, got error."))(
724 host, frame, expires, duration, pts, dts
725 )
726 }
727 #[doc = " Drops the frame from the host. This is meant to be called from the frame\n but can also be used to remove the host association of the frame and return\n ownership to the caller.\n\n @since 1.3\n @memberof VSLHost"]
728 pub unsafe fn vsl_host_drop(
729 &self,
730 host: *mut VSLHost,
731 frame: *mut VSLFrame,
732 ) -> ::std::os::raw::c_int {
733 (self
734 .vsl_host_drop
735 .as_ref()
736 .expect("Expected function, got error."))(host, frame)
737 }
738 #[doc = " Creates a client and connects to the host at the provided path. If the\n connection cannot be made NULL is returned and errno is set.\n\n @memberof VSLClient"]
739 pub unsafe fn vsl_client_init(
740 &self,
741 path: *const ::std::os::raw::c_char,
742 userptr: *mut ::std::os::raw::c_void,
743 reconnect: bool,
744 ) -> *mut VSLClient {
745 (self
746 .vsl_client_init
747 .as_ref()
748 .expect("Expected function, got error."))(path, userptr, reconnect)
749 }
750 #[doc = " Releases the client, disconnecting from the host and releasing allocated\n memory.\n\n @memberof VSLClient"]
751 pub unsafe fn vsl_client_release(&self, client: *mut VSLClient) {
752 (self
753 .vsl_client_release
754 .as_ref()
755 .expect("Expected function, got error."))(client)
756 }
757 #[doc = " Disconnects from the VSLHost and stops all reconnection attempts. This\n should be called as part of closing down a VSL client session. It is\n thread-safe unlike vsl_client_release which disposes of the client object.\n\n @memberof VSLClient\n @since 1.1"]
758 pub unsafe fn vsl_client_disconnect(&self, client: *mut VSLClient) {
759 (self
760 .vsl_client_disconnect
761 .as_ref()
762 .expect("Expected function, got error."))(client)
763 }
764 #[doc = " Returns the optional userptr associated with this client connection.\n\n @memberof VSLClient"]
765 pub unsafe fn vsl_client_userptr(&self, client: *mut VSLClient) -> *mut ::std::os::raw::c_void {
766 (self
767 .vsl_client_userptr
768 .as_ref()
769 .expect("Expected function, got error."))(client)
770 }
771 #[doc = " Returns the path on which the client has connected to the host.\n\n @memberof VSLClient"]
772 pub unsafe fn vsl_client_path(
773 &self,
774 client: *const VSLClient,
775 ) -> *const ::std::os::raw::c_char {
776 (self
777 .vsl_client_path
778 .as_ref()
779 .expect("Expected function, got error."))(client)
780 }
781 #[doc = " Sets the socket timeout for this client.\n\n @memberof VSLClient"]
782 pub unsafe fn vsl_client_set_timeout(&self, client: *mut VSLClient, timeout: f32) {
783 (self
784 .vsl_client_set_timeout
785 .as_ref()
786 .expect("Expected function, got error."))(client, timeout)
787 }
788 #[doc = " Creates and posts the video frame along with optional user pointer to any\n arbitrary data. Typically it would be used for holding a reference to\n the host's view of the frame handle.\n\n @deprecated The vsl_frame_register function is deprecated in favour of using\n the @ref vsl_frame_init(), @ref vsl_frame_alloc() or @ref vsl_frame_attach(),\n and @ref vsl_host_post() functions which separate frame creation from posting\n to the host for publishing to subscribers.\n\n @note A frame created through this function is owned by the host and should\n not have @ref vsl_frame_release called on it. This will be managed by the\n host on frame expiry.\n\n @memberof VSLFrame"]
789 pub unsafe fn vsl_frame_register(
790 &self,
791 host: *mut VSLHost,
792 serial: i64,
793 handle: ::std::os::raw::c_int,
794 width: ::std::os::raw::c_int,
795 height: ::std::os::raw::c_int,
796 fourcc: u32,
797 size: usize,
798 offset: usize,
799 expires: i64,
800 duration: i64,
801 pts: i64,
802 dts: i64,
803 cleanup: vsl_frame_cleanup,
804 userptr: *mut ::std::os::raw::c_void,
805 ) -> *mut VSLFrame {
806 (self
807 .vsl_frame_register
808 .as_ref()
809 .expect("Expected function, got error."))(
810 host, serial, handle, width, height, fourcc, size, offset, expires, duration, pts, dts,
811 cleanup, userptr,
812 )
813 }
814 #[doc = " Initializes a VSLFrame without underlying frame buffer. To create the\n backing memory either call @ref vsl_frame_alloc() or to attach to an existing\n bufer use @ref vsl_frame_attach().\n\n @since 1.3\n @memberof VSLFrame"]
815 pub unsafe fn vsl_frame_init(
816 &self,
817 width: u32,
818 height: u32,
819 stride: u32,
820 fourcc: u32,
821 userptr: *mut ::std::os::raw::c_void,
822 cleanup: vsl_frame_cleanup,
823 ) -> *mut VSLFrame {
824 (self
825 .vsl_frame_init
826 .as_ref()
827 .expect("Expected function, got error."))(
828 width, height, stride, fourcc, userptr, cleanup,
829 )
830 }
831 #[doc = " Allocates the underlying memory for the frame. This function will prefer to\n allocate using dmabuf and fallback to shared memory if dmabuf is not\n available, unless the frame has a path defined in which case shared memory is\n assumed. If the path begins with /dev then it assumed to point to a\n dmabuf-heap device. If path is NULL then the allocator will first attempt to\n create a dmabuf then fallback to shared memory.\n\n Allocations will be based on a buffer large enough to hold height*stride\n bytes. If using a compressed fourcc such as JPEG the actual data will be\n smaller, this size can be captured when calling @ref vsl_frame_copy() as the\n function returns the number of bytes copied into the target frame. There is\n currently no method to capture the actual compressed size when receiving an\n already compressed frame. This limitation is because the size varies from\n frame to frame while the underlying buffer is of a fixed size. When the\n actual encoded size is important, the @ref vsl_frame_copy() should be called\n directly or the reported size communicated to the client through a separate\n channel.\n\n @since 1.3\n @memberof VSLFrame"]
832 pub unsafe fn vsl_frame_alloc(
833 &self,
834 frame: *mut VSLFrame,
835 path: *const ::std::os::raw::c_char,
836 ) -> ::std::os::raw::c_int {
837 (self
838 .vsl_frame_alloc
839 .as_ref()
840 .expect("Expected function, got error."))(frame, path)
841 }
842 #[doc = " Frees the allocated buffer for this frame. Does not release the frame itself\n for that use @ref vsl_frame_release().\n\n @param frame\n @since 1.3\n @memberof VSLFrame"]
843 pub unsafe fn vsl_frame_unalloc(&self, frame: *mut VSLFrame) {
844 (self
845 .vsl_frame_unalloc
846 .as_ref()
847 .expect("Expected function, got error."))(frame)
848 }
849 #[doc = " Attach the provided file descriptor to the VSLFrame. If size is not provided\n it is assumed to be stride*height bytes. If offset is provided then size\n *MUST* be provided, the offset is in bytes to the start of the frame.\n\n @since 1.3\n @memberof VSLFrame"]
850 pub unsafe fn vsl_frame_attach(
851 &self,
852 frame: *mut VSLFrame,
853 fd: ::std::os::raw::c_int,
854 size: usize,
855 offset: usize,
856 ) -> ::std::os::raw::c_int {
857 (self
858 .vsl_frame_attach
859 .as_ref()
860 .expect("Expected function, got error."))(frame, fd, size, offset)
861 }
862 #[doc = " Returns the path to the underlying VSLFrame buffer. Note it will not always\n be available, such as when the frame was externally created. When no path is\n available NULL is returned.\n\n @note This function is not thread-safe and you must use the string\n immediately.\n\n @since 1.3\n @memberof VSLFrame"]
863 pub unsafe fn vsl_frame_path(&self, frame: *const VSLFrame) -> *const ::std::os::raw::c_char {
864 (self
865 .vsl_frame_path
866 .as_ref()
867 .expect("Expected function, got error."))(frame)
868 }
869 #[doc = " Unregisters the frame, removing it from the host pool.\n\n @deprecated This function is deprecated in favour of calling\n @ref vsl_frame_release() which will handle the required cleanup.\n\n @memberof VSLFrame"]
870 pub unsafe fn vsl_frame_unregister(&self, frame: *mut VSLFrame) {
871 (self
872 .vsl_frame_unregister
873 .as_ref()
874 .expect("Expected function, got error."))(frame)
875 }
876 #[doc = " Copy the source frame into the target frame, with optional source crop. The\n copy handles format conversion, rescaling to fit the target frame. Resize\n happens after the crop, if required.\n\n Copy can happen between any frames, regardless of whether they are parented\n or not or have differing parents. The copy happens through the underlying\n buffers and will attempt to use available hardware accelerators.\n\n The function will attempt to lock target and source. Since lock is a no-op\n when not a client frame it is safe even for free-standing frames. Copying to\n or from a posted frame is safe but is likely to cause visual corruption such\n as tearing.\n\n @since 1.3\n @memberof VSLFrame"]
877 pub unsafe fn vsl_frame_copy(
878 &self,
879 target: *mut VSLFrame,
880 source: *mut VSLFrame,
881 crop: *const VSLRect,
882 ) -> ::std::os::raw::c_int {
883 (self
884 .vsl_frame_copy
885 .as_ref()
886 .expect("Expected function, got error."))(target, source, crop)
887 }
888 #[doc = " Returns the user pointer associated with this frame.\n\n @memberof VSLFrame"]
889 pub unsafe fn vsl_frame_userptr(&self, frame: *mut VSLFrame) -> *mut ::std::os::raw::c_void {
890 (self
891 .vsl_frame_userptr
892 .as_ref()
893 .expect("Expected function, got error."))(frame)
894 }
895 #[doc = " Associate userptr with this frame.\n\n @memberof VSLFrame"]
896 pub unsafe fn vsl_frame_set_userptr(
897 &self,
898 frame: *mut VSLFrame,
899 userptr: *mut ::std::os::raw::c_void,
900 ) {
901 (self
902 .vsl_frame_set_userptr
903 .as_ref()
904 .expect("Expected function, got error."))(frame, userptr)
905 }
906 #[doc = " Waits for a frame to arrive and returns a new frame object. Frames who's\n timestamp is less than @param until will be ignored.\n\n @memberof VSLFrame"]
907 pub unsafe fn vsl_frame_wait(&self, client: *mut VSLClient, until: i64) -> *mut VSLFrame {
908 (self
909 .vsl_frame_wait
910 .as_ref()
911 .expect("Expected function, got error."))(client, until)
912 }
913 #[doc = " Releases the frame, performing required cleanup. If the frame was mapped it\n will be unmapped. If the frame was posted to a host it will be removed, if\n this is a client frame it will be unlocked.\n\n @memberof VSLFrame"]
914 pub unsafe fn vsl_frame_release(&self, frame: *mut VSLFrame) {
915 (self
916 .vsl_frame_release
917 .as_ref()
918 .expect("Expected function, got error."))(frame)
919 }
920 #[doc = " Attempts to lock the video frame.\n\n @memberof VSLFrame"]
921 pub unsafe fn vsl_frame_trylock(&self, frame: *mut VSLFrame) -> ::std::os::raw::c_int {
922 (self
923 .vsl_frame_trylock
924 .as_ref()
925 .expect("Expected function, got error."))(frame)
926 }
927 #[doc = " Attempts to unlock the video frame.\n\n @memberof VSLFrame"]
928 pub unsafe fn vsl_frame_unlock(&self, frame: *mut VSLFrame) -> ::std::os::raw::c_int {
929 (self
930 .vsl_frame_unlock
931 .as_ref()
932 .expect("Expected function, got error."))(frame)
933 }
934 #[doc = " Returns the serial frame count of the video frame.\n\n Note this frame serial tracks the count of frames registered on the host and\n does not necessarily equal the actual frame number from the camera.\n\n @memberof VSLFrame"]
935 pub unsafe fn vsl_frame_serial(&self, frame: *const VSLFrame) -> i64 {
936 (self
937 .vsl_frame_serial
938 .as_ref()
939 .expect("Expected function, got error."))(frame)
940 }
941 #[doc = " Returns the timestamp for this frame in nanoseconds.\n\n @memberof VSLFrame"]
942 pub unsafe fn vsl_frame_timestamp(&self, frame: *const VSLFrame) -> i64 {
943 (self
944 .vsl_frame_timestamp
945 .as_ref()
946 .expect("Expected function, got error."))(frame)
947 }
948 #[doc = " Returns the duration for this frame in nanoseconds.\n\n @memberof VSLFrame"]
949 pub unsafe fn vsl_frame_duration(&self, frame: *const VSLFrame) -> i64 {
950 (self
951 .vsl_frame_duration
952 .as_ref()
953 .expect("Expected function, got error."))(frame)
954 }
955 #[doc = " Returns the presentation timestamp for this frame in nanoseconds.\n\n @memberof VSLFrame"]
956 pub unsafe fn vsl_frame_pts(&self, frame: *const VSLFrame) -> i64 {
957 (self
958 .vsl_frame_pts
959 .as_ref()
960 .expect("Expected function, got error."))(frame)
961 }
962 #[doc = " Returns the decode timestamp for this frame in nanoseconds.\n\n @memberof VSLFrame"]
963 pub unsafe fn vsl_frame_dts(&self, frame: *const VSLFrame) -> i64 {
964 (self
965 .vsl_frame_dts
966 .as_ref()
967 .expect("Expected function, got error."))(frame)
968 }
969 #[doc = " Returns the epiration time for this frame in milliseconds.\n\n @memberof VSLFrame"]
970 pub unsafe fn vsl_frame_expires(&self, frame: *const VSLFrame) -> i64 {
971 (self
972 .vsl_frame_expires
973 .as_ref()
974 .expect("Expected function, got error."))(frame)
975 }
976 #[doc = " Returns the FOURCC code for the video frame.\n\n @memberof VSLFrame"]
977 pub unsafe fn vsl_frame_fourcc(&self, frame: *const VSLFrame) -> u32 {
978 (self
979 .vsl_frame_fourcc
980 .as_ref()
981 .expect("Expected function, got error."))(frame)
982 }
983 #[doc = " Returns the width in pixels of the video frame.\n\n @memberof VSLFrame"]
984 pub unsafe fn vsl_frame_width(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
985 (self
986 .vsl_frame_width
987 .as_ref()
988 .expect("Expected function, got error."))(frame)
989 }
990 #[doc = " Returns the height in pixels of the video frame.\n\n @memberof VSLFrame"]
991 pub unsafe fn vsl_frame_height(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
992 (self
993 .vsl_frame_height
994 .as_ref()
995 .expect("Expected function, got error."))(frame)
996 }
997 #[doc = " Returns the stride in bytes of the video frame, to go from one row to the\n next.\n\n @since 1.3\n @memberof VSLFrame"]
998 pub unsafe fn vsl_frame_stride(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
999 (self
1000 .vsl_frame_stride
1001 .as_ref()
1002 .expect("Expected function, got error."))(frame)
1003 }
1004 #[doc = " Returns the size in bytes of the video frame.\n\n @memberof VSLFrame"]
1005 pub unsafe fn vsl_frame_size(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
1006 (self
1007 .vsl_frame_size
1008 .as_ref()
1009 .expect("Expected function, got error."))(frame)
1010 }
1011 #[doc = " Returns the file descriptor for this frame or -1 if none is associated.\n\n @memberof VSLFrame"]
1012 pub unsafe fn vsl_frame_handle(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
1013 (self
1014 .vsl_frame_handle
1015 .as_ref()
1016 .expect("Expected function, got error."))(frame)
1017 }
1018 #[doc = " Returns the physical address of the frame. If the frame does not support\n DMA then MMAP_FAILED is returned.\n\n @memberof VSLFrame"]
1019 pub unsafe fn vsl_frame_paddr(&self, frame: *const VSLFrame) -> isize {
1020 (self
1021 .vsl_frame_paddr
1022 .as_ref()
1023 .expect("Expected function, got error."))(frame)
1024 }
1025 #[doc = " Maps the frame into the process' memory space, optionally also sets the\n size of the frame if @param size is non-NULL. Ensure the frame is\n unmapped when no longer needed using @ref nn_frame_munmap().\n\n Note that a frame must be locked for the duration of the mapping.\n\n @memberof VSLFrame"]
1026 pub unsafe fn vsl_frame_mmap(
1027 &self,
1028 frame: *mut VSLFrame,
1029 size: *mut usize,
1030 ) -> *mut ::std::os::raw::c_void {
1031 (self
1032 .vsl_frame_mmap
1033 .as_ref()
1034 .expect("Expected function, got error."))(frame, size)
1035 }
1036 #[doc = " Maps the frame into the process' memory space, optionally also sets the\n size of the frame if @param size is non-NULL.\n\n @memberof VSLFrame"]
1037 pub unsafe fn vsl_frame_munmap(&self, frame: *mut VSLFrame) {
1038 (self
1039 .vsl_frame_munmap
1040 .as_ref()
1041 .expect("Expected function, got error."))(frame)
1042 }
1043 #[doc = " Cache synchronization session control for when using DMA-backed buffers.\n This happens automatically on mmap/munmap but the API is also available for\n cases where the frame is updated in-place during a mapping.\n\n @param frame the frame object to synchronize\n @param enable whether the sync session is being enabled or disabled\n @param mode the synchronization mode controls READ, WRITE, or both.\n @since 1.3\n @memberof VSLFrame"]
1044 pub unsafe fn vsl_frame_sync(
1045 &self,
1046 frame: *const VSLFrame,
1047 enable: ::std::os::raw::c_int,
1048 mode: ::std::os::raw::c_int,
1049 ) -> ::std::os::raw::c_int {
1050 (self
1051 .vsl_frame_sync
1052 .as_ref()
1053 .expect("Expected function, got error."))(frame, enable, mode)
1054 }
1055 #[doc = " Returns a fourcc integer code from the string. If the fourcc code is invalid\n or unsupported then 0 is returned."]
1056 pub unsafe fn vsl_fourcc_from_string(&self, fourcc: *const ::std::os::raw::c_char) -> u32 {
1057 (self
1058 .vsl_fourcc_from_string
1059 .as_ref()
1060 .expect("Expected function, got error."))(fourcc)
1061 }
1062 #[doc = " @brief Creates VSLEncoder instance\n\n @param profile VSLEncoderProfile determining encode quality\n @param outputFourcc fourcc code defining the codec\n @param fps output stream fps\n @return VSLEncoder* new encoder instance\n\n Every encoder instance must be released using vsl_encoder_release\n\n For Hantro VC8000e encoder initialization is performed when vsl_encode_frame\n is called for a first time"]
1063 pub unsafe fn vsl_encoder_create(
1064 &self,
1065 profile: VSLEncoderProfile,
1066 outputFourcc: u32,
1067 fps: ::std::os::raw::c_int,
1068 ) -> *mut VSLEncoder {
1069 (self
1070 .vsl_encoder_create
1071 .as_ref()
1072 .expect("Expected function, got error."))(profile, outputFourcc, fps)
1073 }
1074 #[doc = " @brief Destroys VSLEncoder instance\n\n @param encoder VSLEncoder* instance to destroy"]
1075 pub unsafe fn vsl_encoder_release(&self, encoder: *mut VSLEncoder) {
1076 (self
1077 .vsl_encoder_release
1078 .as_ref()
1079 .expect("Expected function, got error."))(encoder)
1080 }
1081 #[doc = " @brief Encode frame\n @param encoder VSLEncoder instance\n @param source VSLFrame source\n @param destination VSLFrame destination\n @param cropRegion (optional) VSLRect that defines the crop region, NULL when\n destination and source sizes match\n @param keyframe (optional) VSL sets this to 1 if the encoded frame is a\n keyframe, otherwise 0. User can set to NULL to ignore param.\n @retval 0 on success\n @retval -1 on falure (check errno for details)\n\n For Hantro VC8000e encoder initialization is performed when this function is\n called for a first time For Hantro VC8000e encoder source width, height and\n fourcc; destination width, height and fourcc; cropRegion parameters must\n match for all function calls throughout the lifetime of the encoder instance"]
1082 pub unsafe fn vsl_encode_frame(
1083 &self,
1084 encoder: *mut VSLEncoder,
1085 source: *mut VSLFrame,
1086 destination: *mut VSLFrame,
1087 cropRegion: *const VSLRect,
1088 keyframe: *mut ::std::os::raw::c_int,
1089 ) -> ::std::os::raw::c_int {
1090 (self
1091 .vsl_encode_frame
1092 .as_ref()
1093 .expect("Expected function, got error."))(
1094 encoder,
1095 source,
1096 destination,
1097 cropRegion,
1098 keyframe,
1099 )
1100 }
1101 pub unsafe fn vsl_encoder_new_output_frame(
1102 &self,
1103 encoder: *const VSLEncoder,
1104 width: ::std::os::raw::c_int,
1105 height: ::std::os::raw::c_int,
1106 duration: i64,
1107 pts: i64,
1108 dts: i64,
1109 ) -> *mut VSLFrame {
1110 (self
1111 .vsl_encoder_new_output_frame
1112 .as_ref()
1113 .expect("Expected function, got error."))(
1114 encoder, width, height, duration, pts, dts
1115 )
1116 }
1117 #[doc = " Opens the camera device specified by the @param filename and allocates\n device memory. If the device was not found or could not be recognized\n\n Return NULL if the device was not found or could not be recognized.\n Otherwise returns a vsl_camera context which can be used in other vsl_camera\n functions.\n\n @memberof VSLCamera"]
1118 pub unsafe fn vsl_camera_open_device(
1119 &self,
1120 filename: *const ::std::os::raw::c_char,
1121 ) -> *mut vsl_camera {
1122 (self
1123 .vsl_camera_open_device
1124 .as_ref()
1125 .expect("Expected function, got error."))(filename)
1126 }
1127 #[doc = " Initialized the camera device in @param ctx for streaming\n and allocate camera buffers.\n\n Then requests the camera to stream at the requested @param width\n and @param height using the requested @param fourcc code.\n\n If @param width, @param height, or @param fourcc are 0, the respective value\n use the default provided by the driver\n\n The @param width, @param height, @param fourcc parameters\n will be set to the actual width and height and fourcc that\n the camera driver sets the device to.\n\n Returns -1 if an error is encountered when initializing the camera to stream,\n otherwise returns 0\n\n @memberof VSLCamera"]
1128 pub unsafe fn vsl_camera_init_device(
1129 &self,
1130 ctx: *mut vsl_camera,
1131 width: *mut ::std::os::raw::c_int,
1132 height: *mut ::std::os::raw::c_int,
1133 buf_count: *mut ::std::os::raw::c_int,
1134 fourcc: *mut u32,
1135 ) -> ::std::os::raw::c_int {
1136 (self
1137 .vsl_camera_init_device
1138 .as_ref()
1139 .expect("Expected function, got error."))(ctx, width, height, buf_count, fourcc)
1140 }
1141 #[doc = " Requests the camera in @param ctx to mirror the image leftside right\n\n Returns -1 if a mirror was requested but the camera driver refused\n the request, otherwise 0.\n\n @memberof VSLCamera"]
1142 pub unsafe fn vsl_camera_mirror(
1143 &self,
1144 ctx: *const vsl_camera,
1145 mirror: bool,
1146 ) -> ::std::os::raw::c_int {
1147 (self
1148 .vsl_camera_mirror
1149 .as_ref()
1150 .expect("Expected function, got error."))(ctx, mirror)
1151 }
1152 #[doc = " Requests the camera in @param ctx to mirror the image upside down\n\n Returns -1 if a mirror was requested but the camera driver refused\n the request, otherwise 0.\n\n @memberof VSLCamera"]
1153 pub unsafe fn vsl_camera_mirror_v(
1154 &self,
1155 ctx: *const vsl_camera,
1156 mirror: bool,
1157 ) -> ::std::os::raw::c_int {
1158 (self
1159 .vsl_camera_mirror_v
1160 .as_ref()
1161 .expect("Expected function, got error."))(ctx, mirror)
1162 }
1163 #[doc = " Starts the camera stream.\n\n Must be called after @ref vsl_camera_init_device\n\n @memberof VSLCamera"]
1164 pub unsafe fn vsl_camera_start_capturing(&self, ctx: *mut vsl_camera) -> ::std::os::raw::c_int {
1165 (self
1166 .vsl_camera_start_capturing
1167 .as_ref()
1168 .expect("Expected function, got error."))(ctx)
1169 }
1170 #[doc = " Attempts to read a frame from the camera.\n\n Must be called after @ref vsl_camera_start_capturing.\n\n Ensure to call @ref vsl_camera_release_buffer after the buffer is done being\n used and allow the buffer to be reused for frame capture.\n\n @memberof VSLCamera"]
1171 pub unsafe fn vsl_camera_get_data(&self, ctx: *mut vsl_camera) -> *mut vsl_camera_buffer {
1172 (self
1173 .vsl_camera_get_data
1174 .as_ref()
1175 .expect("Expected function, got error."))(ctx)
1176 }
1177 #[doc = " Enqueues a buffer to be reused for frame capture.\n\n @memberof VSLCamera"]
1178 pub unsafe fn vsl_camera_release_buffer(
1179 &self,
1180 ctx: *mut vsl_camera,
1181 buffer: *const vsl_camera_buffer,
1182 ) -> ::std::os::raw::c_int {
1183 (self
1184 .vsl_camera_release_buffer
1185 .as_ref()
1186 .expect("Expected function, got error."))(ctx, buffer)
1187 }
1188 #[doc = " Stops the camera stream.\n\n @memberof VSLCamera"]
1189 pub unsafe fn vsl_camera_stop_capturing(
1190 &self,
1191 ctx: *const vsl_camera,
1192 ) -> ::std::os::raw::c_int {
1193 (self
1194 .vsl_camera_stop_capturing
1195 .as_ref()
1196 .expect("Expected function, got error."))(ctx)
1197 }
1198 #[doc = " Uninitializes the camera buffers and frees the buffer memory\n\n Ensure that the device is not streaming. If\n @ref vsl_camera_start_capturing was called, ensure that\n @ref vsl_camera_stop_capturing is called before this function\n\n @memberof VSLCamera"]
1199 pub unsafe fn vsl_camera_uninit_device(&self, ctx: *mut vsl_camera) {
1200 (self
1201 .vsl_camera_uninit_device
1202 .as_ref()
1203 .expect("Expected function, got error."))(ctx)
1204 }
1205 #[doc = " Closes the camera device and frees the device memory\n\n Ensure that the device is not streaming. If\n @ref vsl_camera_start_capturing was called, ensure that\n @ref vsl_camera_stop_capturing is called before this function\n\n @memberof VSLCamera"]
1206 pub unsafe fn vsl_camera_close_device(&self, ctx: *mut vsl_camera) {
1207 (self
1208 .vsl_camera_close_device
1209 .as_ref()
1210 .expect("Expected function, got error."))(ctx)
1211 }
1212 #[doc = " Checks if dma buffers are supported on the camera\n\n Ensure that this is called after\n @ref vsl_camera_init_device\n\n @memberof VSLCamera"]
1213 pub unsafe fn vsl_camera_is_dmabuf_supported(
1214 &self,
1215 ctx: *const vsl_camera,
1216 ) -> ::std::os::raw::c_int {
1217 (self
1218 .vsl_camera_is_dmabuf_supported
1219 .as_ref()
1220 .expect("Expected function, got error."))(ctx)
1221 }
1222 #[doc = " Returns the number of queued buffers for the camera.\n @ref vsl_camera_get_data will timeout if there are 0 queued buffers.\n\n The user can send buffers back to the buffer queue using\n @ref vsl_camera_release_buffer\n\n @memberof VSLCamera"]
1223 pub unsafe fn vsl_camera_get_queued_buf_count(
1224 &self,
1225 ctx: *const vsl_camera,
1226 ) -> ::std::os::raw::c_int {
1227 (self
1228 .vsl_camera_get_queued_buf_count
1229 .as_ref()
1230 .expect("Expected function, got error."))(ctx)
1231 }
1232 #[doc = " Returns the mmap memory of the camera buffer\n\n @memberof VSLCamera"]
1233 pub unsafe fn vsl_camera_buffer_mmap(
1234 &self,
1235 buffer: *mut vsl_camera_buffer,
1236 ) -> *mut ::std::os::raw::c_void {
1237 (self
1238 .vsl_camera_buffer_mmap
1239 .as_ref()
1240 .expect("Expected function, got error."))(buffer)
1241 }
1242 #[doc = " Returns the dmabuf file descriptor of the camera buffer\n\n If the device does not support dmabuf, returns -1\n\n @memberof VSLCamera"]
1243 pub unsafe fn vsl_camera_buffer_dma_fd(
1244 &self,
1245 buffer: *const vsl_camera_buffer,
1246 ) -> ::std::os::raw::c_int {
1247 (self
1248 .vsl_camera_buffer_dma_fd
1249 .as_ref()
1250 .expect("Expected function, got error."))(buffer)
1251 }
1252 #[doc = " Returns the phys addr of the camera buffer\n\n If the device does not support physical address, returns 0\n\n @memberof VSLCamera"]
1253 pub unsafe fn vsl_camera_buffer_phys_addr(&self, buffer: *const vsl_camera_buffer) -> u64 {
1254 (self
1255 .vsl_camera_buffer_phys_addr
1256 .as_ref()
1257 .expect("Expected function, got error."))(buffer)
1258 }
1259 #[doc = " Returns the length of the camera buffer in bytes\n\n @memberof VSLCamera"]
1260 pub unsafe fn vsl_camera_buffer_length(&self, buffer: *const vsl_camera_buffer) -> u32 {
1261 (self
1262 .vsl_camera_buffer_length
1263 .as_ref()
1264 .expect("Expected function, got error."))(buffer)
1265 }
1266 #[doc = " Returns the fourcc code of the camera buffer\n\n @memberof VSLCamera"]
1267 pub unsafe fn vsl_camera_buffer_fourcc(&self, buffer: *const vsl_camera_buffer) -> u32 {
1268 (self
1269 .vsl_camera_buffer_fourcc
1270 .as_ref()
1271 .expect("Expected function, got error."))(buffer)
1272 }
1273 #[doc = " Reads the timestamp of the camera buffer into @param seconds and @param\n nanoseconds. The seconds are relative to the monotonic time when the frame\n was captured, nanoseconds are the sub-seconds in nanoseconds."]
1274 pub unsafe fn vsl_camera_buffer_timestamp(
1275 &self,
1276 buffer: *const vsl_camera_buffer,
1277 seconds: *mut i64,
1278 nanoseconds: *mut i64,
1279 ) {
1280 (self
1281 .vsl_camera_buffer_timestamp
1282 .as_ref()
1283 .expect("Expected function, got error."))(buffer, seconds, nanoseconds)
1284 }
1285 #[doc = " Lists the supported single planar formats of\n the camera into @param codes as fourcc codes"]
1286 pub unsafe fn vsl_camera_enum_fmts(
1287 &self,
1288 ctx: *const vsl_camera,
1289 codes: *mut u32,
1290 size: ::std::os::raw::c_int,
1291 ) -> ::std::os::raw::c_int {
1292 (self
1293 .vsl_camera_enum_fmts
1294 .as_ref()
1295 .expect("Expected function, got error."))(ctx, codes, size)
1296 }
1297 #[doc = " Lists the supported multi planar formats of\n the camera into @param codes as fourcc codes"]
1298 pub unsafe fn vsl_camera_enum_mplane_fmts(
1299 &self,
1300 ctx: *const vsl_camera,
1301 codes: *mut u32,
1302 size: ::std::os::raw::c_int,
1303 ) -> ::std::os::raw::c_int {
1304 (self
1305 .vsl_camera_enum_mplane_fmts
1306 .as_ref()
1307 .expect("Expected function, got error."))(ctx, codes, size)
1308 }
1309 pub unsafe fn vsl_decoder_create(
1310 &self,
1311 outputFourcc: u32,
1312 fps: ::std::os::raw::c_int,
1313 ) -> *mut VSLDecoder {
1314 (self
1315 .vsl_decoder_create
1316 .as_ref()
1317 .expect("Expected function, got error."))(outputFourcc, fps)
1318 }
1319 pub unsafe fn vsl_decode_frame(
1320 &self,
1321 decoder: *mut VSLDecoder,
1322 data: *const ::std::os::raw::c_void,
1323 data_length: ::std::os::raw::c_uint,
1324 bytes_used: *mut usize,
1325 output_frame: *mut *mut VSLFrame,
1326 ) -> VSLDecoderRetCode {
1327 (self
1328 .vsl_decode_frame
1329 .as_ref()
1330 .expect("Expected function, got error."))(
1331 decoder,
1332 data,
1333 data_length,
1334 bytes_used,
1335 output_frame,
1336 )
1337 }
1338 pub unsafe fn vsl_decoder_width(&self, decoder: *const VSLDecoder) -> ::std::os::raw::c_int {
1339 (self
1340 .vsl_decoder_width
1341 .as_ref()
1342 .expect("Expected function, got error."))(decoder)
1343 }
1344 pub unsafe fn vsl_decoder_height(&self, decoder: *const VSLDecoder) -> ::std::os::raw::c_int {
1345 (self
1346 .vsl_decoder_height
1347 .as_ref()
1348 .expect("Expected function, got error."))(decoder)
1349 }
1350 pub unsafe fn vsl_decoder_crop(&self, decoder: *const VSLDecoder) -> VSLRect {
1351 (self
1352 .vsl_decoder_crop
1353 .as_ref()
1354 .expect("Expected function, got error."))(decoder)
1355 }
1356 pub unsafe fn vsl_decoder_release(&self, decoder: *mut VSLDecoder) -> ::std::os::raw::c_int {
1357 (self
1358 .vsl_decoder_release
1359 .as_ref()
1360 .expect("Expected function, got error."))(decoder)
1361 }
1362}