1pub const VSL_VERSION: &[u8; 6] = b"2.5.2\0";
7pub const VSL_V4L2_MAX_FORMATS: u32 = 64;
8pub const VSL_V4L2_MAX_RESOLUTIONS: u32 = 32;
9pub const VSL_V4L2_MAX_FRAMERATES: u32 = 16;
10#[repr(C)]
11#[derive(Debug, Copy, Clone)]
12pub struct vsl_host {
13 _unused: [u8; 0],
14}
15#[doc = " @struct VSLHost\n @brief The VSLHost object manages a connection point at the user-defined path\n and allows frames to be registered for client use."]
16pub type VSLHost = vsl_host;
17#[repr(C)]
18#[derive(Debug, Copy, Clone)]
19pub struct vsl_client {
20 _unused: [u8; 0],
21}
22#[doc = " @struct VSLClient\n @brief The VSLClient object manages a single connection to a VSLHost."]
23pub type VSLClient = vsl_client;
24#[repr(C)]
25#[derive(Debug, Copy, Clone)]
26pub struct vsl_frame {
27 _unused: [u8; 0],
28}
29#[doc = " @struct VSLFrame\n @brief The VSLFrame object represents a single video frame from either the\n host or client perspective. Certain API are only available to the host or\n client."]
30pub type VSLFrame = vsl_frame;
31#[repr(C)]
32#[derive(Debug, Copy, Clone)]
33pub struct vsl_encoder {
34 _unused: [u8; 0],
35}
36#[doc = " @struct VSLEncoder\n @brief The VSLEncoder object represents encoder instance.\n"]
37pub type VSLEncoder = vsl_encoder;
38#[repr(C)]
39#[derive(Debug, Copy, Clone)]
40pub struct vsl_decoder {
41 _unused: [u8; 0],
42}
43#[doc = " @struct VSLDecoder\n @brief The VSLDecoder object represents decoder instance.\n"]
44pub type VSLDecoder = vsl_decoder;
45#[doc = " The VSLRect structure represents a rectangle region of a frame and is used to\n define cropping regions for sub-frames."]
46#[repr(C)]
47#[derive(Debug, Copy, Clone)]
48pub struct vsl_rect {
49 #[doc = " The left-most pixel offset for the rectangle."]
50 pub x: ::std::os::raw::c_int,
51 #[doc = " The top-most pixel offset for the rectangle."]
52 pub y: ::std::os::raw::c_int,
53 #[doc = " The width in pixels of the rectangle. The end position is x+width."]
54 pub width: ::std::os::raw::c_int,
55 #[doc = " The height in pixels of the rectangle. The end position is y+height."]
56 pub height: ::std::os::raw::c_int,
57}
58#[allow(clippy::unnecessary_operation, clippy::identity_op)]
59const _: () = {
60 ["Size of vsl_rect"][::std::mem::size_of::<vsl_rect>() - 16usize];
61 ["Alignment of vsl_rect"][::std::mem::align_of::<vsl_rect>() - 4usize];
62 ["Offset of field: vsl_rect::x"][::std::mem::offset_of!(vsl_rect, x) - 0usize];
63 ["Offset of field: vsl_rect::y"][::std::mem::offset_of!(vsl_rect, y) - 4usize];
64 ["Offset of field: vsl_rect::width"][::std::mem::offset_of!(vsl_rect, width) - 8usize];
65 ["Offset of field: vsl_rect::height"][::std::mem::offset_of!(vsl_rect, height) - 12usize];
66};
67#[doc = " The VSLRect structure represents a rectangle region of a frame and is used to\n define cropping regions for sub-frames."]
68pub type VSLRect = vsl_rect;
69#[doc = " Automatic bitrate selection (encoder default).\n\n Platform and version dependent. Testing shows approximately 10000 kbps\n on i.MX8M Plus. Use this for general-purpose encoding when specific\n bitrate control is not required."]
70pub const vsl_encode_profile_VSL_ENCODE_PROFILE_AUTO: vsl_encode_profile = 0;
71#[doc = " 5 Mbps target bitrate.\n\n Suitable for moderate quality 1080p video or high quality 720p."]
72pub const vsl_encode_profile_VSL_ENCODE_PROFILE_5000_KBPS: vsl_encode_profile = 1;
73#[doc = " 25 Mbps target bitrate.\n\n Suitable for high quality 1080p video or moderate quality 4K."]
74pub const vsl_encode_profile_VSL_ENCODE_PROFILE_25000_KBPS: vsl_encode_profile = 2;
75#[doc = " 50 Mbps target bitrate.\n\n Suitable for very high quality 1080p or high quality 4K video."]
76pub const vsl_encode_profile_VSL_ENCODE_PROFILE_50000_KBPS: vsl_encode_profile = 3;
77#[doc = " 100 Mbps target bitrate.\n\n Suitable for maximum quality 4K video or when preserving fine details\n is critical. May stress storage and network bandwidth."]
78pub const vsl_encode_profile_VSL_ENCODE_PROFILE_100000_KBPS: vsl_encode_profile = 4;
79#[doc = " Encoder profile defining target bitrate for video encoding.\n\n These profiles provide a convenient way to specify encoding quality/bitrate\n tradeoffs. Higher bitrates produce better quality at the cost of larger file\n sizes and potentially higher CPU/power consumption.\n\n @note The actual quality-to-bitrate ratio depends on the codec (H.264 vs\n H.265), encoder implementation, and content complexity."]
80pub type vsl_encode_profile = ::std::os::raw::c_uint;
81#[doc = " Encoder profile defining target bitrate for video encoding.\n\n These profiles provide a convenient way to specify encoding quality/bitrate\n tradeoffs. Higher bitrates produce better quality at the cost of larger file\n sizes and potentially higher CPU/power consumption.\n\n @note The actual quality-to-bitrate ratio depends on the codec (H.264 vs\n H.265), encoder implementation, and content complexity."]
82pub use self::vsl_encode_profile as VSLEncoderProfile;
83#[doc = " H.264/AVC (Advanced Video Coding) codec.\n\n Widely supported standard (ISO/IEC 14496-10, ITU-T H.264) with good\n compression and compatibility. Recommended for maximum device\n compatibility."]
84pub const VSLDecoderCodec_VSL_DEC_H264: VSLDecoderCodec = 0;
85#[doc = " H.265/HEVC (High Efficiency Video Coding) codec.\n\n Next-generation standard (ISO/IEC 23008-2, ITU-T H.265) providing\n approximately 50% better compression than H.264 at equivalent quality.\n Recommended when bandwidth/storage are constrained and decoder support\n is confirmed."]
86pub const VSLDecoderCodec_VSL_DEC_HEVC: VSLDecoderCodec = 1;
87#[doc = " Video codec type for hardware decoder.\n\n Specifies which video compression standard to use for decoding.\n Both codecs are supported via Hantro VPU hardware acceleration on i.MX8."]
88pub type VSLDecoderCodec = ::std::os::raw::c_uint;
89#[doc = " Auto-detect best available backend.\n\n Selection priority:\n 1. Check VSL_CODEC_BACKEND environment variable\n 2. Prefer V4L2 if device available and has M2M capability\n 3. Fall back to Hantro if V4L2 unavailable\n 4. Fail if no backend available"]
90pub const VSLCodecBackend_VSL_CODEC_BACKEND_AUTO: VSLCodecBackend = 0;
91#[doc = " Force Hantro/libcodec.so backend.\n\n Uses the proprietary VPU wrapper library. May be needed for:\n - Systems without V4L2 codec driver\n - Testing/debugging Hantro-specific behavior\n - Compatibility with older configurations"]
92pub const VSLCodecBackend_VSL_CODEC_BACKEND_HANTRO: VSLCodecBackend = 1;
93#[doc = " Force V4L2 kernel driver backend.\n\n Uses the V4L2 mem2mem driver (vsi_v4l2 on i.MX 8M Plus, wave6 on\n i.MX 95). The library auto-detects single-plane M2M vs MPLANE M2M\n at device open time. Provides:\n - 37-56x faster decode performance (vs Hantro libcodec.so)\n - Stable encoder (vs crashing libcodec.so)\n - Standard Linux API"]
94pub const VSLCodecBackend_VSL_CODEC_BACKEND_V4L2: VSLCodecBackend = 2;
95#[doc = " Codec backend selection for encoder/decoder.\n\n Allows selection between V4L2 kernel driver and Hantro user-space\n library (libcodec.so) backends. Use with vsl_decoder_create_ex() and\n vsl_encoder_create_ex() for explicit backend control.\n\n The VSL_CODEC_BACKEND environment variable can override the AUTO selection:\n - \"hantro\" - Force Hantro backend even if V4L2 available\n - \"v4l2\" - Force V4L2 backend (fail if unavailable)\n - \"auto\" - Auto-detect (default)\n\n @since 2.0"]
96pub type VSLCodecBackend = ::std::os::raw::c_uint;
97#[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."]
98pub type vsl_frame_cleanup = ::std::option::Option<unsafe extern "C" fn(frame: *mut VSLFrame)>;
99#[repr(C)]
100#[derive(Debug, Copy, Clone)]
101pub struct vsl_camera_buffer {
102 _unused: [u8; 0],
103}
104#[repr(C)]
105#[derive(Debug, Copy, Clone)]
106pub struct vsl_camera {
107 _unused: [u8; 0],
108}
109pub const VSLDecoderRetCode_VSL_DEC_SUCCESS: VSLDecoderRetCode = 0;
110pub const VSLDecoderRetCode_VSL_DEC_ERR: VSLDecoderRetCode = 1;
111pub const VSLDecoderRetCode_VSL_DEC_INIT_INFO: VSLDecoderRetCode = 2;
112pub const VSLDecoderRetCode_VSL_DEC_FRAME_DEC: VSLDecoderRetCode = 4;
113pub type VSLDecoderRetCode = ::std::os::raw::c_uint;
114#[doc = " Video capture device (camera, frame grabber) - has VIDEO_CAPTURE\ncapability"]
115pub const VSLDeviceType_VSL_V4L2_TYPE_CAMERA: VSLDeviceType = 1;
116#[doc = " Video output device (display, transmitter) - has VIDEO_OUTPUT capability"]
117pub const VSLDeviceType_VSL_V4L2_TYPE_OUTPUT: VSLDeviceType = 2;
118#[doc = " Video encoder (M2M: raw input → compressed output like H.264/HEVC)"]
119pub const VSLDeviceType_VSL_V4L2_TYPE_ENCODER: VSLDeviceType = 4;
120#[doc = " Video decoder (M2M: compressed input → raw output)"]
121pub const VSLDeviceType_VSL_V4L2_TYPE_DECODER: VSLDeviceType = 8;
122#[doc = " Image/video processor (M2M: raw input → raw output, e.g., scaler, ISP)"]
123pub const VSLDeviceType_VSL_V4L2_TYPE_ISP: VSLDeviceType = 16;
124#[doc = " Memory-to-memory device (generic, type not determined)"]
125pub const VSLDeviceType_VSL_V4L2_TYPE_M2M: VSLDeviceType = 32;
126#[doc = " Match any device type (for filtering)"]
127pub const VSLDeviceType_VSL_V4L2_TYPE_ANY: VSLDeviceType = 255;
128#[doc = " @enum VSLDeviceType\n @brief V4L2 device type classification\n\n Devices are classified based on their V4L2 capabilities and the types of\n pixel formats they support. For M2M (memory-to-memory) devices, the\n classification depends on whether the input/output formats are compressed.\n\n @since 2.2"]
129pub type VSLDeviceType = ::std::os::raw::c_uint;
130#[doc = " Memory-mapped buffers - kernel allocates, user mmaps"]
131pub const VSLMemoryType_VSL_V4L2_MEM_MMAP: VSLMemoryType = 1;
132#[doc = " User pointer buffers - user allocates, passes pointer to kernel"]
133pub const VSLMemoryType_VSL_V4L2_MEM_USERPTR: VSLMemoryType = 2;
134#[doc = " DMA buffer sharing - user passes dmabuf file descriptor"]
135pub const VSLMemoryType_VSL_V4L2_MEM_DMABUF: VSLMemoryType = 4;
136#[doc = " @enum VSLMemoryType\n @brief V4L2 buffer memory type capabilities\n\n Indicates which buffer memory types a device supports for streaming I/O.\n These values can be OR'd together as a bitmask.\n\n @since 2.2"]
137pub type VSLMemoryType = ::std::os::raw::c_uint;
138#[doc = " @struct VSLFrameRate\n @brief Frame rate descriptor as a rational number\n\n Frame rates are expressed as fractions to support non-integer rates\n like 29.97 fps (30000/1001) or 59.94 fps (60000/1001).\n\n @since 2.2"]
139#[repr(C)]
140#[derive(Debug, Copy, Clone)]
141pub struct VSLFrameRate {
142 #[doc = " Frame interval numerator (e.g., 1 for 30fps)"]
143 pub numerator: u32,
144 #[doc = " Frame interval denominator (e.g., 30 for 30fps)"]
145 pub denominator: u32,
146}
147#[allow(clippy::unnecessary_operation, clippy::identity_op)]
148const _: () = {
149 ["Size of VSLFrameRate"][::std::mem::size_of::<VSLFrameRate>() - 8usize];
150 ["Alignment of VSLFrameRate"][::std::mem::align_of::<VSLFrameRate>() - 4usize];
151 ["Offset of field: VSLFrameRate::numerator"]
152 [::std::mem::offset_of!(VSLFrameRate, numerator) - 0usize];
153 ["Offset of field: VSLFrameRate::denominator"]
154 [::std::mem::offset_of!(VSLFrameRate, denominator) - 4usize];
155};
156#[doc = " @struct VSLResolution\n @brief Video resolution with supported frame rates\n\n Describes a supported resolution and its available frame rates,\n as enumerated via `VIDIOC_ENUM_FRAMESIZES` and `VIDIOC_ENUM_FRAMEINTERVALS`.\n\n @since 2.2"]
157#[repr(C)]
158#[derive(Debug, Copy, Clone)]
159pub struct VSLResolution {
160 #[doc = " Width in pixels"]
161 pub width: u32,
162 #[doc = " Height in pixels"]
163 pub height: u32,
164 #[doc = " Array of supported frame rates"]
165 pub frame_rates: [VSLFrameRate; 16usize],
166 #[doc = " Number of valid entries in frame_rates"]
167 pub num_frame_rates: usize,
168}
169#[allow(clippy::unnecessary_operation, clippy::identity_op)]
170const _: () = {
171 ["Size of VSLResolution"][::std::mem::size_of::<VSLResolution>() - 144usize];
172 ["Alignment of VSLResolution"][::std::mem::align_of::<VSLResolution>() - 8usize];
173 ["Offset of field: VSLResolution::width"]
174 [::std::mem::offset_of!(VSLResolution, width) - 0usize];
175 ["Offset of field: VSLResolution::height"]
176 [::std::mem::offset_of!(VSLResolution, height) - 4usize];
177 ["Offset of field: VSLResolution::frame_rates"]
178 [::std::mem::offset_of!(VSLResolution, frame_rates) - 8usize];
179 ["Offset of field: VSLResolution::num_frame_rates"]
180 [::std::mem::offset_of!(VSLResolution, num_frame_rates) - 136usize];
181};
182#[doc = " @struct VSLFormat\n @brief Pixel format descriptor\n\n Describes a pixel format supported by a V4L2 device, including its\n fourcc code, human-readable description, and optionally the supported\n resolutions.\n\n @since 2.2"]
183#[repr(C)]
184#[derive(Debug, Copy, Clone)]
185pub struct VSLFormat {
186 #[doc = " V4L2 pixel format fourcc code (e.g., V4L2_PIX_FMT_NV12)"]
187 pub fourcc: u32,
188 #[doc = " Human-readable description from driver"]
189 pub description: [::std::os::raw::c_char; 32usize],
190 #[doc = " V4L2_FMT_FLAG_* flags"]
191 pub flags: u32,
192 #[doc = " True if this is a compressed format (H.264, HEVC, MJPEG, etc.)"]
193 pub compressed: bool,
194 #[doc = " Supported resolutions (populated by vsl_v4l2_enum_resolutions)"]
195 pub resolutions: *mut VSLResolution,
196 #[doc = " Number of valid entries in resolutions"]
197 pub num_resolutions: usize,
198}
199#[allow(clippy::unnecessary_operation, clippy::identity_op)]
200const _: () = {
201 ["Size of VSLFormat"][::std::mem::size_of::<VSLFormat>() - 64usize];
202 ["Alignment of VSLFormat"][::std::mem::align_of::<VSLFormat>() - 8usize];
203 ["Offset of field: VSLFormat::fourcc"][::std::mem::offset_of!(VSLFormat, fourcc) - 0usize];
204 ["Offset of field: VSLFormat::description"]
205 [::std::mem::offset_of!(VSLFormat, description) - 4usize];
206 ["Offset of field: VSLFormat::flags"][::std::mem::offset_of!(VSLFormat, flags) - 36usize];
207 ["Offset of field: VSLFormat::compressed"]
208 [::std::mem::offset_of!(VSLFormat, compressed) - 40usize];
209 ["Offset of field: VSLFormat::resolutions"]
210 [::std::mem::offset_of!(VSLFormat, resolutions) - 48usize];
211 ["Offset of field: VSLFormat::num_resolutions"]
212 [::std::mem::offset_of!(VSLFormat, num_resolutions) - 56usize];
213};
214#[doc = " @struct VSLDevice\n @brief V4L2 device descriptor\n\n Contains all information about a discovered V4L2 device including its\n path, driver information, capabilities, supported formats, and memory types.\n\n @note This structure is allocated by vsl_v4l2_enumerate() and must be freed\n with vsl_v4l2_device_list_free().\n\n @since 2.2"]
215#[repr(C)]
216#[derive(Debug, Copy, Clone)]
217pub struct VSLDevice {
218 #[doc = " Device path (e.g., \"/dev/video0\")"]
219 pub path: [::std::os::raw::c_char; 64usize],
220 #[doc = " Driver name (e.g., \"wave6-enc\", \"mxc-isi\")"]
221 pub driver: [::std::os::raw::c_char; 32usize],
222 #[doc = " Card/device name (e.g., \"wave6-enc\", \"mxc-isi-cap\")"]
223 pub card: [::std::os::raw::c_char; 32usize],
224 #[doc = " Bus info for grouping related devices (e.g., \"platform:wave6-enc\")"]
225 pub bus_info: [::std::os::raw::c_char; 64usize],
226 #[doc = " Raw V4L2 device capabilities from VIDIOC_QUERYCAP"]
227 pub caps: u32,
228 #[doc = " Classified device type"]
229 pub device_type: VSLDeviceType,
230 #[doc = " Supported memory types for capture queue (bitmask of VSLMemoryType)"]
231 pub capture_mem: VSLMemoryType,
232 #[doc = " Supported memory types for output queue (bitmask of VSLMemoryType)"]
233 pub output_mem: VSLMemoryType,
234 #[doc = " True if device uses multiplanar API (V4L2_CAP_VIDEO_*_MPLANE)"]
235 pub multiplanar: bool,
236 #[doc = " Capture queue formats (camera output, decoder output, encoder output)"]
237 pub capture_formats: *mut VSLFormat,
238 #[doc = " Number of capture formats"]
239 pub num_capture_formats: usize,
240 #[doc = " Output queue formats (encoder input, decoder input)"]
241 pub output_formats: *mut VSLFormat,
242 #[doc = " Number of output formats"]
243 pub num_output_formats: usize,
244}
245#[allow(clippy::unnecessary_operation, clippy::identity_op)]
246const _: () = {
247 ["Size of VSLDevice"][::std::mem::size_of::<VSLDevice>() - 248usize];
248 ["Alignment of VSLDevice"][::std::mem::align_of::<VSLDevice>() - 8usize];
249 ["Offset of field: VSLDevice::path"][::std::mem::offset_of!(VSLDevice, path) - 0usize];
250 ["Offset of field: VSLDevice::driver"][::std::mem::offset_of!(VSLDevice, driver) - 64usize];
251 ["Offset of field: VSLDevice::card"][::std::mem::offset_of!(VSLDevice, card) - 96usize];
252 ["Offset of field: VSLDevice::bus_info"]
253 [::std::mem::offset_of!(VSLDevice, bus_info) - 128usize];
254 ["Offset of field: VSLDevice::caps"][::std::mem::offset_of!(VSLDevice, caps) - 192usize];
255 ["Offset of field: VSLDevice::device_type"]
256 [::std::mem::offset_of!(VSLDevice, device_type) - 196usize];
257 ["Offset of field: VSLDevice::capture_mem"]
258 [::std::mem::offset_of!(VSLDevice, capture_mem) - 200usize];
259 ["Offset of field: VSLDevice::output_mem"]
260 [::std::mem::offset_of!(VSLDevice, output_mem) - 204usize];
261 ["Offset of field: VSLDevice::multiplanar"]
262 [::std::mem::offset_of!(VSLDevice, multiplanar) - 208usize];
263 ["Offset of field: VSLDevice::capture_formats"]
264 [::std::mem::offset_of!(VSLDevice, capture_formats) - 216usize];
265 ["Offset of field: VSLDevice::num_capture_formats"]
266 [::std::mem::offset_of!(VSLDevice, num_capture_formats) - 224usize];
267 ["Offset of field: VSLDevice::output_formats"]
268 [::std::mem::offset_of!(VSLDevice, output_formats) - 232usize];
269 ["Offset of field: VSLDevice::num_output_formats"]
270 [::std::mem::offset_of!(VSLDevice, num_output_formats) - 240usize];
271};
272#[doc = " @struct VSLDeviceList\n @brief List of discovered V4L2 devices\n\n Returned by vsl_v4l2_enumerate() and vsl_v4l2_enumerate_type().\n Must be freed with vsl_v4l2_device_list_free().\n\n @since 2.2"]
273#[repr(C)]
274#[derive(Debug, Copy, Clone)]
275pub struct VSLDeviceList {
276 #[doc = " Array of device descriptors"]
277 pub devices: *mut VSLDevice,
278 #[doc = " Number of devices in the array"]
279 pub count: usize,
280}
281#[allow(clippy::unnecessary_operation, clippy::identity_op)]
282const _: () = {
283 ["Size of VSLDeviceList"][::std::mem::size_of::<VSLDeviceList>() - 16usize];
284 ["Alignment of VSLDeviceList"][::std::mem::align_of::<VSLDeviceList>() - 8usize];
285 ["Offset of field: VSLDeviceList::devices"]
286 [::std::mem::offset_of!(VSLDeviceList, devices) - 0usize];
287 ["Offset of field: VSLDeviceList::count"]
288 [::std::mem::offset_of!(VSLDeviceList, count) - 8usize];
289};
290pub struct VideoStreamLibrary {
291 __library: ::libloading::Library,
292 pub vsl_version:
293 Result<unsafe extern "C" fn() -> *const ::std::os::raw::c_char, ::libloading::Error>,
294 pub vsl_timestamp: Result<unsafe extern "C" fn() -> i64, ::libloading::Error>,
295 pub vsl_host_init: Result<
296 unsafe extern "C" fn(path: *const ::std::os::raw::c_char) -> *mut VSLHost,
297 ::libloading::Error,
298 >,
299 pub vsl_host_release: Result<unsafe extern "C" fn(host: *mut VSLHost), ::libloading::Error>,
300 pub vsl_host_path: Result<
301 unsafe extern "C" fn(host: *const VSLHost) -> *const ::std::os::raw::c_char,
302 ::libloading::Error,
303 >,
304 pub vsl_host_poll: Result<
305 unsafe extern "C" fn(host: *mut VSLHost, wait: i64) -> ::std::os::raw::c_int,
306 ::libloading::Error,
307 >,
308 pub vsl_host_service: Result<
309 unsafe extern "C" fn(
310 host: *mut VSLHost,
311 sock: ::std::os::raw::c_int,
312 ) -> ::std::os::raw::c_int,
313 ::libloading::Error,
314 >,
315 pub vsl_host_process: Result<
316 unsafe extern "C" fn(host: *mut VSLHost) -> ::std::os::raw::c_int,
317 ::libloading::Error,
318 >,
319 pub vsl_host_sockets: Result<
320 unsafe extern "C" fn(
321 host: *mut VSLHost,
322 n_sockets: usize,
323 sockets: *mut ::std::os::raw::c_int,
324 max_sockets: *mut usize,
325 ) -> ::std::os::raw::c_int,
326 ::libloading::Error,
327 >,
328 pub vsl_host_post: Result<
329 unsafe extern "C" fn(
330 host: *mut VSLHost,
331 frame: *mut VSLFrame,
332 expires: i64,
333 duration: i64,
334 pts: i64,
335 dts: i64,
336 ) -> ::std::os::raw::c_int,
337 ::libloading::Error,
338 >,
339 pub vsl_host_drop: Result<
340 unsafe extern "C" fn(host: *mut VSLHost, frame: *mut VSLFrame) -> ::std::os::raw::c_int,
341 ::libloading::Error,
342 >,
343 pub vsl_client_init: Result<
344 unsafe extern "C" fn(
345 path: *const ::std::os::raw::c_char,
346 userptr: *mut ::std::os::raw::c_void,
347 reconnect: bool,
348 ) -> *mut VSLClient,
349 ::libloading::Error,
350 >,
351 pub vsl_client_release:
352 Result<unsafe extern "C" fn(client: *mut VSLClient), ::libloading::Error>,
353 pub vsl_client_disconnect:
354 Result<unsafe extern "C" fn(client: *mut VSLClient), ::libloading::Error>,
355 pub vsl_client_userptr: Result<
356 unsafe extern "C" fn(client: *mut VSLClient) -> *mut ::std::os::raw::c_void,
357 ::libloading::Error,
358 >,
359 pub vsl_client_path: Result<
360 unsafe extern "C" fn(client: *const VSLClient) -> *const ::std::os::raw::c_char,
361 ::libloading::Error,
362 >,
363 pub vsl_client_set_timeout:
364 Result<unsafe extern "C" fn(client: *mut VSLClient, timeout: f32), ::libloading::Error>,
365 pub vsl_frame_register: Result<
366 unsafe extern "C" fn(
367 host: *mut VSLHost,
368 serial: i64,
369 handle: ::std::os::raw::c_int,
370 width: ::std::os::raw::c_int,
371 height: ::std::os::raw::c_int,
372 fourcc: u32,
373 size: usize,
374 offset: usize,
375 expires: i64,
376 duration: i64,
377 pts: i64,
378 dts: i64,
379 cleanup: vsl_frame_cleanup,
380 userptr: *mut ::std::os::raw::c_void,
381 ) -> *mut VSLFrame,
382 ::libloading::Error,
383 >,
384 pub vsl_frame_init: Result<
385 unsafe extern "C" fn(
386 width: u32,
387 height: u32,
388 stride: u32,
389 fourcc: u32,
390 userptr: *mut ::std::os::raw::c_void,
391 cleanup: vsl_frame_cleanup,
392 ) -> *mut VSLFrame,
393 ::libloading::Error,
394 >,
395 pub vsl_frame_alloc: Result<
396 unsafe extern "C" fn(
397 frame: *mut VSLFrame,
398 path: *const ::std::os::raw::c_char,
399 ) -> ::std::os::raw::c_int,
400 ::libloading::Error,
401 >,
402 pub vsl_frame_unalloc: Result<unsafe extern "C" fn(frame: *mut VSLFrame), ::libloading::Error>,
403 pub vsl_frame_attach: Result<
404 unsafe extern "C" fn(
405 frame: *mut VSLFrame,
406 fd: ::std::os::raw::c_int,
407 size: usize,
408 offset: usize,
409 ) -> ::std::os::raw::c_int,
410 ::libloading::Error,
411 >,
412 pub vsl_frame_path: Result<
413 unsafe extern "C" fn(frame: *const VSLFrame) -> *const ::std::os::raw::c_char,
414 ::libloading::Error,
415 >,
416 pub vsl_frame_unregister:
417 Result<unsafe extern "C" fn(frame: *mut VSLFrame), ::libloading::Error>,
418 pub vsl_frame_copy: Result<
419 unsafe extern "C" fn(
420 target: *mut VSLFrame,
421 source: *mut VSLFrame,
422 crop: *const VSLRect,
423 ) -> ::std::os::raw::c_int,
424 ::libloading::Error,
425 >,
426 pub vsl_frame_userptr: Result<
427 unsafe extern "C" fn(frame: *mut VSLFrame) -> *mut ::std::os::raw::c_void,
428 ::libloading::Error,
429 >,
430 pub vsl_frame_set_userptr: Result<
431 unsafe extern "C" fn(frame: *mut VSLFrame, userptr: *mut ::std::os::raw::c_void),
432 ::libloading::Error,
433 >,
434 pub vsl_frame_wait: Result<
435 unsafe extern "C" fn(client: *mut VSLClient, until: i64) -> *mut VSLFrame,
436 ::libloading::Error,
437 >,
438 pub vsl_frame_release: Result<unsafe extern "C" fn(frame: *mut VSLFrame), ::libloading::Error>,
439 pub vsl_frame_trylock: Result<
440 unsafe extern "C" fn(frame: *mut VSLFrame) -> ::std::os::raw::c_int,
441 ::libloading::Error,
442 >,
443 pub vsl_frame_unlock: Result<
444 unsafe extern "C" fn(frame: *mut VSLFrame) -> ::std::os::raw::c_int,
445 ::libloading::Error,
446 >,
447 pub vsl_frame_serial:
448 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, ::libloading::Error>,
449 pub vsl_frame_timestamp:
450 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, ::libloading::Error>,
451 pub vsl_frame_duration:
452 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, ::libloading::Error>,
453 pub vsl_frame_pts:
454 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, ::libloading::Error>,
455 pub vsl_frame_dts:
456 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, ::libloading::Error>,
457 pub vsl_frame_expires:
458 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, ::libloading::Error>,
459 pub vsl_frame_fourcc:
460 Result<unsafe extern "C" fn(frame: *const VSLFrame) -> u32, ::libloading::Error>,
461 pub vsl_frame_width: Result<
462 unsafe extern "C" fn(frame: *const VSLFrame) -> ::std::os::raw::c_int,
463 ::libloading::Error,
464 >,
465 pub vsl_frame_height: Result<
466 unsafe extern "C" fn(frame: *const VSLFrame) -> ::std::os::raw::c_int,
467 ::libloading::Error,
468 >,
469 pub vsl_frame_stride: Result<
470 unsafe extern "C" fn(frame: *const VSLFrame) -> ::std::os::raw::c_int,
471 ::libloading::Error,
472 >,
473 pub vsl_frame_size: Result<
474 unsafe extern "C" fn(frame: *const VSLFrame) -> ::std::os::raw::c_int,
475 ::libloading::Error,
476 >,
477 pub vsl_frame_handle: Result<
478 unsafe extern "C" fn(frame: *const VSLFrame) -> ::std::os::raw::c_int,
479 ::libloading::Error,
480 >,
481 pub vsl_frame_paddr:
482 Result<unsafe extern "C" fn(frame: *mut VSLFrame) -> isize, ::libloading::Error>,
483 pub vsl_frame_mmap: Result<
484 unsafe extern "C" fn(frame: *mut VSLFrame, size: *mut usize) -> *mut ::std::os::raw::c_void,
485 ::libloading::Error,
486 >,
487 pub vsl_frame_munmap: Result<unsafe extern "C" fn(frame: *mut VSLFrame), ::libloading::Error>,
488 pub vsl_frame_sync: Result<
489 unsafe extern "C" fn(
490 frame: *const VSLFrame,
491 enable: ::std::os::raw::c_int,
492 mode: ::std::os::raw::c_int,
493 ) -> ::std::os::raw::c_int,
494 ::libloading::Error,
495 >,
496 pub vsl_fourcc_from_string: Result<
497 unsafe extern "C" fn(fourcc: *const ::std::os::raw::c_char) -> u32,
498 ::libloading::Error,
499 >,
500 pub vsl_encoder_create: Result<
501 unsafe extern "C" fn(
502 profile: VSLEncoderProfile,
503 outputFourcc: u32,
504 fps: ::std::os::raw::c_int,
505 ) -> *mut VSLEncoder,
506 ::libloading::Error,
507 >,
508 pub vsl_encoder_create_ex: Result<
509 unsafe extern "C" fn(
510 profile: VSLEncoderProfile,
511 outputFourcc: u32,
512 fps: ::std::os::raw::c_int,
513 backend: VSLCodecBackend,
514 ) -> *mut VSLEncoder,
515 ::libloading::Error,
516 >,
517 pub vsl_encoder_release:
518 Result<unsafe extern "C" fn(encoder: *mut VSLEncoder), ::libloading::Error>,
519 pub vsl_encode_frame: Result<
520 unsafe extern "C" fn(
521 encoder: *mut VSLEncoder,
522 source: *mut VSLFrame,
523 destination: *mut VSLFrame,
524 cropRegion: *const VSLRect,
525 keyframe: *mut ::std::os::raw::c_int,
526 ) -> ::std::os::raw::c_int,
527 ::libloading::Error,
528 >,
529 pub vsl_encoder_new_output_frame: Result<
530 unsafe extern "C" fn(
531 encoder: *const VSLEncoder,
532 width: ::std::os::raw::c_int,
533 height: ::std::os::raw::c_int,
534 duration: i64,
535 pts: i64,
536 dts: i64,
537 ) -> *mut VSLFrame,
538 ::libloading::Error,
539 >,
540 pub vsl_camera_open_device: Result<
541 unsafe extern "C" fn(filename: *const ::std::os::raw::c_char) -> *mut vsl_camera,
542 ::libloading::Error,
543 >,
544 pub vsl_camera_init_device: Result<
545 unsafe extern "C" fn(
546 ctx: *mut vsl_camera,
547 width: *mut ::std::os::raw::c_int,
548 height: *mut ::std::os::raw::c_int,
549 buf_count: *mut ::std::os::raw::c_int,
550 fourcc: *mut u32,
551 ) -> ::std::os::raw::c_int,
552 ::libloading::Error,
553 >,
554 pub vsl_camera_mirror: Result<
555 unsafe extern "C" fn(ctx: *const vsl_camera, mirror: bool) -> ::std::os::raw::c_int,
556 ::libloading::Error,
557 >,
558 pub vsl_camera_mirror_v: Result<
559 unsafe extern "C" fn(ctx: *const vsl_camera, mirror: bool) -> ::std::os::raw::c_int,
560 ::libloading::Error,
561 >,
562 pub vsl_camera_start_capturing: Result<
563 unsafe extern "C" fn(ctx: *mut vsl_camera) -> ::std::os::raw::c_int,
564 ::libloading::Error,
565 >,
566 pub vsl_camera_get_data: Result<
567 unsafe extern "C" fn(ctx: *mut vsl_camera) -> *mut vsl_camera_buffer,
568 ::libloading::Error,
569 >,
570 pub vsl_camera_release_buffer: Result<
571 unsafe extern "C" fn(
572 ctx: *mut vsl_camera,
573 buffer: *const vsl_camera_buffer,
574 ) -> ::std::os::raw::c_int,
575 ::libloading::Error,
576 >,
577 pub vsl_camera_stop_capturing: Result<
578 unsafe extern "C" fn(ctx: *const vsl_camera) -> ::std::os::raw::c_int,
579 ::libloading::Error,
580 >,
581 pub vsl_camera_uninit_device:
582 Result<unsafe extern "C" fn(ctx: *mut vsl_camera), ::libloading::Error>,
583 pub vsl_camera_close_device:
584 Result<unsafe extern "C" fn(ctx: *mut vsl_camera), ::libloading::Error>,
585 pub vsl_camera_is_dmabuf_supported: Result<
586 unsafe extern "C" fn(ctx: *const vsl_camera) -> ::std::os::raw::c_int,
587 ::libloading::Error,
588 >,
589 pub vsl_camera_get_queued_buf_count: Result<
590 unsafe extern "C" fn(ctx: *const vsl_camera) -> ::std::os::raw::c_int,
591 ::libloading::Error,
592 >,
593 pub vsl_camera_color_space:
594 Result<unsafe extern "C" fn(ctx: *const vsl_camera) -> u32, ::libloading::Error>,
595 pub vsl_camera_color_transfer:
596 Result<unsafe extern "C" fn(ctx: *const vsl_camera) -> u32, ::libloading::Error>,
597 pub vsl_camera_color_encoding:
598 Result<unsafe extern "C" fn(ctx: *const vsl_camera) -> u32, ::libloading::Error>,
599 pub vsl_camera_color_range:
600 Result<unsafe extern "C" fn(ctx: *const vsl_camera) -> u32, ::libloading::Error>,
601 pub vsl_camera_buffer_mmap: Result<
602 unsafe extern "C" fn(buffer: *mut vsl_camera_buffer) -> *mut ::std::os::raw::c_void,
603 ::libloading::Error,
604 >,
605 pub vsl_camera_buffer_dma_fd: Result<
606 unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> ::std::os::raw::c_int,
607 ::libloading::Error,
608 >,
609 pub vsl_camera_buffer_phys_addr:
610 Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u64, ::libloading::Error>,
611 pub vsl_camera_buffer_length:
612 Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, ::libloading::Error>,
613 pub vsl_camera_buffer_fourcc:
614 Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, ::libloading::Error>,
615 pub vsl_camera_buffer_bytes_per_line:
616 Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, ::libloading::Error>,
617 pub vsl_camera_buffer_sequence:
618 Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, ::libloading::Error>,
619 pub vsl_camera_buffer_timestamp: Result<
620 unsafe extern "C" fn(
621 buffer: *const vsl_camera_buffer,
622 seconds: *mut i64,
623 nanoseconds: *mut i64,
624 ),
625 ::libloading::Error,
626 >,
627 pub vsl_camera_enum_fmts: Result<
628 unsafe extern "C" fn(
629 ctx: *const vsl_camera,
630 codes: *mut u32,
631 size: ::std::os::raw::c_int,
632 ) -> ::std::os::raw::c_int,
633 ::libloading::Error,
634 >,
635 pub vsl_camera_enum_mplane_fmts: Result<
636 unsafe extern "C" fn(
637 ctx: *const vsl_camera,
638 codes: *mut u32,
639 size: ::std::os::raw::c_int,
640 ) -> ::std::os::raw::c_int,
641 ::libloading::Error,
642 >,
643 pub vsl_decoder_create: Result<
644 unsafe extern "C" fn(codec: VSLDecoderCodec, fps: ::std::os::raw::c_int) -> *mut VSLDecoder,
645 ::libloading::Error,
646 >,
647 pub vsl_decoder_create_ex: Result<
648 unsafe extern "C" fn(
649 codec: u32,
650 fps: ::std::os::raw::c_int,
651 backend: VSLCodecBackend,
652 ) -> *mut VSLDecoder,
653 ::libloading::Error,
654 >,
655 pub vsl_decode_frame: Result<
656 unsafe extern "C" fn(
657 decoder: *mut VSLDecoder,
658 data: *const ::std::os::raw::c_void,
659 data_length: ::std::os::raw::c_uint,
660 bytes_used: *mut usize,
661 output_frame: *mut *mut VSLFrame,
662 ) -> VSLDecoderRetCode,
663 ::libloading::Error,
664 >,
665 pub vsl_decoder_width: Result<
666 unsafe extern "C" fn(decoder: *const VSLDecoder) -> ::std::os::raw::c_int,
667 ::libloading::Error,
668 >,
669 pub vsl_decoder_height: Result<
670 unsafe extern "C" fn(decoder: *const VSLDecoder) -> ::std::os::raw::c_int,
671 ::libloading::Error,
672 >,
673 pub vsl_decoder_crop:
674 Result<unsafe extern "C" fn(decoder: *const VSLDecoder) -> VSLRect, ::libloading::Error>,
675 pub vsl_decoder_release: Result<
676 unsafe extern "C" fn(decoder: *mut VSLDecoder) -> ::std::os::raw::c_int,
677 ::libloading::Error,
678 >,
679 pub vsl_v4l2_enumerate:
680 Result<unsafe extern "C" fn() -> *mut VSLDeviceList, ::libloading::Error>,
681 pub vsl_v4l2_enumerate_type: Result<
682 unsafe extern "C" fn(type_mask: VSLDeviceType) -> *mut VSLDeviceList,
683 ::libloading::Error,
684 >,
685 pub vsl_v4l2_device_list_free:
686 Result<unsafe extern "C" fn(list: *mut VSLDeviceList), ::libloading::Error>,
687 pub vsl_v4l2_find_encoder: Result<
688 unsafe extern "C" fn(codec_fourcc: u32) -> *const ::std::os::raw::c_char,
689 ::libloading::Error,
690 >,
691 pub vsl_v4l2_find_decoder: Result<
692 unsafe extern "C" fn(codec_fourcc: u32) -> *const ::std::os::raw::c_char,
693 ::libloading::Error,
694 >,
695 pub vsl_v4l2_find_camera: Result<
696 unsafe extern "C" fn(format_fourcc: u32) -> *const ::std::os::raw::c_char,
697 ::libloading::Error,
698 >,
699 pub vsl_v4l2_find_camera_with_resolution: Result<
700 unsafe extern "C" fn(
701 format_fourcc: u32,
702 width: u32,
703 height: u32,
704 ) -> *const ::std::os::raw::c_char,
705 ::libloading::Error,
706 >,
707 pub vsl_v4l2_device_enum_formats: Result<
708 unsafe extern "C" fn(device: *mut VSLDevice) -> ::std::os::raw::c_int,
709 ::libloading::Error,
710 >,
711 pub vsl_v4l2_enum_resolutions: Result<
712 unsafe extern "C" fn(
713 device: *const VSLDevice,
714 fourcc: u32,
715 count: *mut usize,
716 ) -> *mut VSLResolution,
717 ::libloading::Error,
718 >,
719 pub vsl_v4l2_device_supports_format: Result<
720 unsafe extern "C" fn(device: *const VSLDevice, fourcc: u32, capture: bool) -> bool,
721 ::libloading::Error,
722 >,
723 pub vsl_v4l2_alloc_userptr: Result<
724 unsafe extern "C" fn(
725 size: usize,
726 dma_fd: *mut ::std::os::raw::c_int,
727 ) -> *mut ::std::os::raw::c_void,
728 ::libloading::Error,
729 >,
730 pub vsl_v4l2_free_userptr: Result<
731 unsafe extern "C" fn(
732 ptr: *mut ::std::os::raw::c_void,
733 size: usize,
734 dma_fd: ::std::os::raw::c_int,
735 ),
736 ::libloading::Error,
737 >,
738 pub vsl_v4l2_device_type_name: Result<
739 unsafe extern "C" fn(type_: VSLDeviceType) -> *const ::std::os::raw::c_char,
740 ::libloading::Error,
741 >,
742 pub vsl_v4l2_is_compressed_format:
743 Result<unsafe extern "C" fn(fourcc: u32) -> bool, ::libloading::Error>,
744 pub vsl_v4l2_fourcc_to_string: Result<
745 unsafe extern "C" fn(
746 fourcc: u32,
747 buf: *mut ::std::os::raw::c_char,
748 ) -> *mut ::std::os::raw::c_char,
749 ::libloading::Error,
750 >,
751}
752impl VideoStreamLibrary {
753 pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
754 where
755 P: ::libloading::AsFilename,
756 {
757 let library = ::libloading::Library::new(path)?;
758 Self::from_library(library)
759 }
760 pub unsafe fn from_library<L>(library: L) -> Result<Self, ::libloading::Error>
761 where
762 L: Into<::libloading::Library>,
763 {
764 let __library = library.into();
765 let vsl_version = __library.get(b"vsl_version\0").map(|sym| *sym);
766 let vsl_timestamp = __library.get(b"vsl_timestamp\0").map(|sym| *sym);
767 let vsl_host_init = __library.get(b"vsl_host_init\0").map(|sym| *sym);
768 let vsl_host_release = __library.get(b"vsl_host_release\0").map(|sym| *sym);
769 let vsl_host_path = __library.get(b"vsl_host_path\0").map(|sym| *sym);
770 let vsl_host_poll = __library.get(b"vsl_host_poll\0").map(|sym| *sym);
771 let vsl_host_service = __library.get(b"vsl_host_service\0").map(|sym| *sym);
772 let vsl_host_process = __library.get(b"vsl_host_process\0").map(|sym| *sym);
773 let vsl_host_sockets = __library.get(b"vsl_host_sockets\0").map(|sym| *sym);
774 let vsl_host_post = __library.get(b"vsl_host_post\0").map(|sym| *sym);
775 let vsl_host_drop = __library.get(b"vsl_host_drop\0").map(|sym| *sym);
776 let vsl_client_init = __library.get(b"vsl_client_init\0").map(|sym| *sym);
777 let vsl_client_release = __library.get(b"vsl_client_release\0").map(|sym| *sym);
778 let vsl_client_disconnect = __library.get(b"vsl_client_disconnect\0").map(|sym| *sym);
779 let vsl_client_userptr = __library.get(b"vsl_client_userptr\0").map(|sym| *sym);
780 let vsl_client_path = __library.get(b"vsl_client_path\0").map(|sym| *sym);
781 let vsl_client_set_timeout = __library.get(b"vsl_client_set_timeout\0").map(|sym| *sym);
782 let vsl_frame_register = __library.get(b"vsl_frame_register\0").map(|sym| *sym);
783 let vsl_frame_init = __library.get(b"vsl_frame_init\0").map(|sym| *sym);
784 let vsl_frame_alloc = __library.get(b"vsl_frame_alloc\0").map(|sym| *sym);
785 let vsl_frame_unalloc = __library.get(b"vsl_frame_unalloc\0").map(|sym| *sym);
786 let vsl_frame_attach = __library.get(b"vsl_frame_attach\0").map(|sym| *sym);
787 let vsl_frame_path = __library.get(b"vsl_frame_path\0").map(|sym| *sym);
788 let vsl_frame_unregister = __library.get(b"vsl_frame_unregister\0").map(|sym| *sym);
789 let vsl_frame_copy = __library.get(b"vsl_frame_copy\0").map(|sym| *sym);
790 let vsl_frame_userptr = __library.get(b"vsl_frame_userptr\0").map(|sym| *sym);
791 let vsl_frame_set_userptr = __library.get(b"vsl_frame_set_userptr\0").map(|sym| *sym);
792 let vsl_frame_wait = __library.get(b"vsl_frame_wait\0").map(|sym| *sym);
793 let vsl_frame_release = __library.get(b"vsl_frame_release\0").map(|sym| *sym);
794 let vsl_frame_trylock = __library.get(b"vsl_frame_trylock\0").map(|sym| *sym);
795 let vsl_frame_unlock = __library.get(b"vsl_frame_unlock\0").map(|sym| *sym);
796 let vsl_frame_serial = __library.get(b"vsl_frame_serial\0").map(|sym| *sym);
797 let vsl_frame_timestamp = __library.get(b"vsl_frame_timestamp\0").map(|sym| *sym);
798 let vsl_frame_duration = __library.get(b"vsl_frame_duration\0").map(|sym| *sym);
799 let vsl_frame_pts = __library.get(b"vsl_frame_pts\0").map(|sym| *sym);
800 let vsl_frame_dts = __library.get(b"vsl_frame_dts\0").map(|sym| *sym);
801 let vsl_frame_expires = __library.get(b"vsl_frame_expires\0").map(|sym| *sym);
802 let vsl_frame_fourcc = __library.get(b"vsl_frame_fourcc\0").map(|sym| *sym);
803 let vsl_frame_width = __library.get(b"vsl_frame_width\0").map(|sym| *sym);
804 let vsl_frame_height = __library.get(b"vsl_frame_height\0").map(|sym| *sym);
805 let vsl_frame_stride = __library.get(b"vsl_frame_stride\0").map(|sym| *sym);
806 let vsl_frame_size = __library.get(b"vsl_frame_size\0").map(|sym| *sym);
807 let vsl_frame_handle = __library.get(b"vsl_frame_handle\0").map(|sym| *sym);
808 let vsl_frame_paddr = __library.get(b"vsl_frame_paddr\0").map(|sym| *sym);
809 let vsl_frame_mmap = __library.get(b"vsl_frame_mmap\0").map(|sym| *sym);
810 let vsl_frame_munmap = __library.get(b"vsl_frame_munmap\0").map(|sym| *sym);
811 let vsl_frame_sync = __library.get(b"vsl_frame_sync\0").map(|sym| *sym);
812 let vsl_fourcc_from_string = __library.get(b"vsl_fourcc_from_string\0").map(|sym| *sym);
813 let vsl_encoder_create = __library.get(b"vsl_encoder_create\0").map(|sym| *sym);
814 let vsl_encoder_create_ex = __library.get(b"vsl_encoder_create_ex\0").map(|sym| *sym);
815 let vsl_encoder_release = __library.get(b"vsl_encoder_release\0").map(|sym| *sym);
816 let vsl_encode_frame = __library.get(b"vsl_encode_frame\0").map(|sym| *sym);
817 let vsl_encoder_new_output_frame = __library
818 .get(b"vsl_encoder_new_output_frame\0")
819 .map(|sym| *sym);
820 let vsl_camera_open_device = __library.get(b"vsl_camera_open_device\0").map(|sym| *sym);
821 let vsl_camera_init_device = __library.get(b"vsl_camera_init_device\0").map(|sym| *sym);
822 let vsl_camera_mirror = __library.get(b"vsl_camera_mirror\0").map(|sym| *sym);
823 let vsl_camera_mirror_v = __library.get(b"vsl_camera_mirror_v\0").map(|sym| *sym);
824 let vsl_camera_start_capturing = __library
825 .get(b"vsl_camera_start_capturing\0")
826 .map(|sym| *sym);
827 let vsl_camera_get_data = __library.get(b"vsl_camera_get_data\0").map(|sym| *sym);
828 let vsl_camera_release_buffer = __library
829 .get(b"vsl_camera_release_buffer\0")
830 .map(|sym| *sym);
831 let vsl_camera_stop_capturing = __library
832 .get(b"vsl_camera_stop_capturing\0")
833 .map(|sym| *sym);
834 let vsl_camera_uninit_device = __library.get(b"vsl_camera_uninit_device\0").map(|sym| *sym);
835 let vsl_camera_close_device = __library.get(b"vsl_camera_close_device\0").map(|sym| *sym);
836 let vsl_camera_is_dmabuf_supported = __library
837 .get(b"vsl_camera_is_dmabuf_supported\0")
838 .map(|sym| *sym);
839 let vsl_camera_get_queued_buf_count = __library
840 .get(b"vsl_camera_get_queued_buf_count\0")
841 .map(|sym| *sym);
842 let vsl_camera_color_space = __library.get(b"vsl_camera_color_space\0").map(|sym| *sym);
843 let vsl_camera_color_transfer = __library
844 .get(b"vsl_camera_color_transfer\0")
845 .map(|sym| *sym);
846 let vsl_camera_color_encoding = __library
847 .get(b"vsl_camera_color_encoding\0")
848 .map(|sym| *sym);
849 let vsl_camera_color_range = __library.get(b"vsl_camera_color_range\0").map(|sym| *sym);
850 let vsl_camera_buffer_mmap = __library.get(b"vsl_camera_buffer_mmap\0").map(|sym| *sym);
851 let vsl_camera_buffer_dma_fd = __library.get(b"vsl_camera_buffer_dma_fd\0").map(|sym| *sym);
852 let vsl_camera_buffer_phys_addr = __library
853 .get(b"vsl_camera_buffer_phys_addr\0")
854 .map(|sym| *sym);
855 let vsl_camera_buffer_length = __library.get(b"vsl_camera_buffer_length\0").map(|sym| *sym);
856 let vsl_camera_buffer_fourcc = __library.get(b"vsl_camera_buffer_fourcc\0").map(|sym| *sym);
857 let vsl_camera_buffer_bytes_per_line = __library
858 .get(b"vsl_camera_buffer_bytes_per_line\0")
859 .map(|sym| *sym);
860 let vsl_camera_buffer_sequence = __library
861 .get(b"vsl_camera_buffer_sequence\0")
862 .map(|sym| *sym);
863 let vsl_camera_buffer_timestamp = __library
864 .get(b"vsl_camera_buffer_timestamp\0")
865 .map(|sym| *sym);
866 let vsl_camera_enum_fmts = __library.get(b"vsl_camera_enum_fmts\0").map(|sym| *sym);
867 let vsl_camera_enum_mplane_fmts = __library
868 .get(b"vsl_camera_enum_mplane_fmts\0")
869 .map(|sym| *sym);
870 let vsl_decoder_create = __library.get(b"vsl_decoder_create\0").map(|sym| *sym);
871 let vsl_decoder_create_ex = __library.get(b"vsl_decoder_create_ex\0").map(|sym| *sym);
872 let vsl_decode_frame = __library.get(b"vsl_decode_frame\0").map(|sym| *sym);
873 let vsl_decoder_width = __library.get(b"vsl_decoder_width\0").map(|sym| *sym);
874 let vsl_decoder_height = __library.get(b"vsl_decoder_height\0").map(|sym| *sym);
875 let vsl_decoder_crop = __library.get(b"vsl_decoder_crop\0").map(|sym| *sym);
876 let vsl_decoder_release = __library.get(b"vsl_decoder_release\0").map(|sym| *sym);
877 let vsl_v4l2_enumerate = __library.get(b"vsl_v4l2_enumerate\0").map(|sym| *sym);
878 let vsl_v4l2_enumerate_type = __library.get(b"vsl_v4l2_enumerate_type\0").map(|sym| *sym);
879 let vsl_v4l2_device_list_free = __library
880 .get(b"vsl_v4l2_device_list_free\0")
881 .map(|sym| *sym);
882 let vsl_v4l2_find_encoder = __library.get(b"vsl_v4l2_find_encoder\0").map(|sym| *sym);
883 let vsl_v4l2_find_decoder = __library.get(b"vsl_v4l2_find_decoder\0").map(|sym| *sym);
884 let vsl_v4l2_find_camera = __library.get(b"vsl_v4l2_find_camera\0").map(|sym| *sym);
885 let vsl_v4l2_find_camera_with_resolution = __library
886 .get(b"vsl_v4l2_find_camera_with_resolution\0")
887 .map(|sym| *sym);
888 let vsl_v4l2_device_enum_formats = __library
889 .get(b"vsl_v4l2_device_enum_formats\0")
890 .map(|sym| *sym);
891 let vsl_v4l2_enum_resolutions = __library
892 .get(b"vsl_v4l2_enum_resolutions\0")
893 .map(|sym| *sym);
894 let vsl_v4l2_device_supports_format = __library
895 .get(b"vsl_v4l2_device_supports_format\0")
896 .map(|sym| *sym);
897 let vsl_v4l2_alloc_userptr = __library.get(b"vsl_v4l2_alloc_userptr\0").map(|sym| *sym);
898 let vsl_v4l2_free_userptr = __library.get(b"vsl_v4l2_free_userptr\0").map(|sym| *sym);
899 let vsl_v4l2_device_type_name = __library
900 .get(b"vsl_v4l2_device_type_name\0")
901 .map(|sym| *sym);
902 let vsl_v4l2_is_compressed_format = __library
903 .get(b"vsl_v4l2_is_compressed_format\0")
904 .map(|sym| *sym);
905 let vsl_v4l2_fourcc_to_string = __library
906 .get(b"vsl_v4l2_fourcc_to_string\0")
907 .map(|sym| *sym);
908 Ok(VideoStreamLibrary {
909 __library,
910 vsl_version,
911 vsl_timestamp,
912 vsl_host_init,
913 vsl_host_release,
914 vsl_host_path,
915 vsl_host_poll,
916 vsl_host_service,
917 vsl_host_process,
918 vsl_host_sockets,
919 vsl_host_post,
920 vsl_host_drop,
921 vsl_client_init,
922 vsl_client_release,
923 vsl_client_disconnect,
924 vsl_client_userptr,
925 vsl_client_path,
926 vsl_client_set_timeout,
927 vsl_frame_register,
928 vsl_frame_init,
929 vsl_frame_alloc,
930 vsl_frame_unalloc,
931 vsl_frame_attach,
932 vsl_frame_path,
933 vsl_frame_unregister,
934 vsl_frame_copy,
935 vsl_frame_userptr,
936 vsl_frame_set_userptr,
937 vsl_frame_wait,
938 vsl_frame_release,
939 vsl_frame_trylock,
940 vsl_frame_unlock,
941 vsl_frame_serial,
942 vsl_frame_timestamp,
943 vsl_frame_duration,
944 vsl_frame_pts,
945 vsl_frame_dts,
946 vsl_frame_expires,
947 vsl_frame_fourcc,
948 vsl_frame_width,
949 vsl_frame_height,
950 vsl_frame_stride,
951 vsl_frame_size,
952 vsl_frame_handle,
953 vsl_frame_paddr,
954 vsl_frame_mmap,
955 vsl_frame_munmap,
956 vsl_frame_sync,
957 vsl_fourcc_from_string,
958 vsl_encoder_create,
959 vsl_encoder_create_ex,
960 vsl_encoder_release,
961 vsl_encode_frame,
962 vsl_encoder_new_output_frame,
963 vsl_camera_open_device,
964 vsl_camera_init_device,
965 vsl_camera_mirror,
966 vsl_camera_mirror_v,
967 vsl_camera_start_capturing,
968 vsl_camera_get_data,
969 vsl_camera_release_buffer,
970 vsl_camera_stop_capturing,
971 vsl_camera_uninit_device,
972 vsl_camera_close_device,
973 vsl_camera_is_dmabuf_supported,
974 vsl_camera_get_queued_buf_count,
975 vsl_camera_color_space,
976 vsl_camera_color_transfer,
977 vsl_camera_color_encoding,
978 vsl_camera_color_range,
979 vsl_camera_buffer_mmap,
980 vsl_camera_buffer_dma_fd,
981 vsl_camera_buffer_phys_addr,
982 vsl_camera_buffer_length,
983 vsl_camera_buffer_fourcc,
984 vsl_camera_buffer_bytes_per_line,
985 vsl_camera_buffer_sequence,
986 vsl_camera_buffer_timestamp,
987 vsl_camera_enum_fmts,
988 vsl_camera_enum_mplane_fmts,
989 vsl_decoder_create,
990 vsl_decoder_create_ex,
991 vsl_decode_frame,
992 vsl_decoder_width,
993 vsl_decoder_height,
994 vsl_decoder_crop,
995 vsl_decoder_release,
996 vsl_v4l2_enumerate,
997 vsl_v4l2_enumerate_type,
998 vsl_v4l2_device_list_free,
999 vsl_v4l2_find_encoder,
1000 vsl_v4l2_find_decoder,
1001 vsl_v4l2_find_camera,
1002 vsl_v4l2_find_camera_with_resolution,
1003 vsl_v4l2_device_enum_formats,
1004 vsl_v4l2_enum_resolutions,
1005 vsl_v4l2_device_supports_format,
1006 vsl_v4l2_alloc_userptr,
1007 vsl_v4l2_free_userptr,
1008 vsl_v4l2_device_type_name,
1009 vsl_v4l2_is_compressed_format,
1010 vsl_v4l2_fourcc_to_string,
1011 })
1012 }
1013 #[doc = " Returns the VideoStream Library version string.\n\n @return Version string in \"MAJOR.MINOR.PATCH\" format (e.g., \"1.5.4\")\n @since 1.0"]
1014 pub unsafe fn vsl_version(&self) -> *const ::std::os::raw::c_char {
1015 (self
1016 .vsl_version
1017 .as_ref()
1018 .expect("Expected function, got error."))()
1019 }
1020 #[doc = " Returns the current timestamp in nanoseconds.\n\n Uses monotonic clock (CLOCK_MONOTONIC) for consistent timing across the\n system. This timestamp is used for frame timing and synchronization.\n\n @return Current time in nanoseconds since an unspecified starting point\n @since 1.0"]
1021 pub unsafe fn vsl_timestamp(&self) -> i64 {
1022 (self
1023 .vsl_timestamp
1024 .as_ref()
1025 .expect("Expected function, got error."))()
1026 }
1027 #[doc = " Creates a host on the requested path for inter-process frame sharing.\n\n The host manages a UNIX domain socket at the specified path and accepts\n connections from clients. Frames posted to the host are broadcast to all\n connected clients.\n\n @param path UNIX socket path (filesystem or abstract). If path starts with\n '/' it creates a filesystem socket, otherwise an abstract socket.\n @return Pointer to VSLHost object on success, NULL on failure (sets errno)\n @since 1.0\n @memberof VSLHost"]
1028 pub unsafe fn vsl_host_init(&self, path: *const ::std::os::raw::c_char) -> *mut VSLHost {
1029 (self
1030 .vsl_host_init
1031 .as_ref()
1032 .expect("Expected function, got error."))(path)
1033 }
1034 #[doc = " Releases the host, disconnecting all clients and releasing any allocated\n memory.\n\n Closes the UNIX socket, disconnects all clients, and frees all resources\n associated with the host. Any posted frames are released.\n\n @param host The host to release\n @since 1.0\n @memberof VSLHost"]
1035 pub unsafe fn vsl_host_release(&self, host: *mut VSLHost) {
1036 (self
1037 .vsl_host_release
1038 .as_ref()
1039 .expect("Expected function, got error."))(host)
1040 }
1041 #[doc = " Returns the bound path of the host.\n\n @param host The host instance\n @return UNIX socket path string (owned by host, do not free)\n @since 1.0\n @memberof VSLHost"]
1042 pub unsafe fn vsl_host_path(&self, host: *const VSLHost) -> *const ::std::os::raw::c_char {
1043 (self
1044 .vsl_host_path
1045 .as_ref()
1046 .expect("Expected function, got error."))(host)
1047 }
1048 #[doc = " Polls the list of available connections for activity.\n\n Waits for socket activity (new connections or client messages) using poll().\n Should be called in a loop before vsl_host_process(). Note frames are only\n expired by vsl_host_process(), so the wait parameter should be no greater\n than the desired frame expiration time to ensure timely cleanup.\n\n @param host The host instance\n @param wait Timeout in milliseconds. If >0, poll waits up to this duration.\n If 0, returns immediately. If <0, waits indefinitely.\n @return Number of sockets with activity, 0 on timeout, -1 on error (sets\n errno)\n @since 1.0\n @memberof VSLHost"]
1049 pub unsafe fn vsl_host_poll(&self, host: *mut VSLHost, wait: i64) -> ::std::os::raw::c_int {
1050 (self
1051 .vsl_host_poll
1052 .as_ref()
1053 .expect("Expected function, got error."))(host, wait)
1054 }
1055 #[doc = " Services a single client socket.\n\n Processes messages from a specific client socket. Does not accept new\n connections - use vsl_host_process() for that. Useful when you need to\n track errors for individual clients.\n\n @param host The host instance\n @param sock The client socket file descriptor to service\n @return 0 on success, -1 on error (sets errno, EPIPE if client disconnected)\n @since 1.0\n @memberof VSLHost"]
1056 pub unsafe fn vsl_host_service(
1057 &self,
1058 host: *mut VSLHost,
1059 sock: ::std::os::raw::c_int,
1060 ) -> ::std::os::raw::c_int {
1061 (self
1062 .vsl_host_service
1063 .as_ref()
1064 .expect("Expected function, got error."))(host, sock)
1065 }
1066 #[doc = " Process host tasks: expire old frames and service one client connection.\n\n First expires frames past their lifetime, then services the first available\n connection (accepting new clients or processing client messages). Should be\n called in a loop, typically after vsl_host_poll() indicates activity.\n\n @param host The host instance\n @return 0 on success, -1 on error (sets errno, ETIMEDOUT if no activity)\n @since 1.0\n @memberof VSLHost"]
1067 pub unsafe fn vsl_host_process(&self, host: *mut VSLHost) -> ::std::os::raw::c_int {
1068 (self
1069 .vsl_host_process
1070 .as_ref()
1071 .expect("Expected function, got error."))(host)
1072 }
1073 #[doc = " Request a copy of the sockets managed by the host.\n\n Returns socket file descriptors for the host's listening socket and all\n connected client sockets. The first socket is always the listening socket.\n The array should be refreshed frequently as sockets may become stale.\n\n Thread-safe: allows one thread to use sockets for messaging while another\n polls for reads.\n\n @param host The host instance\n @param n_sockets Size of the sockets array buffer\n @param sockets Buffer to receive socket file descriptors\n @param max_sockets If provided, populated with n_clients+1 (total sockets)\n @return 0 on success, -1 on error (sets errno to ENOBUFS if buffer too small)\n @since 1.0\n @memberof VSLHost"]
1074 pub unsafe fn vsl_host_sockets(
1075 &self,
1076 host: *mut VSLHost,
1077 n_sockets: usize,
1078 sockets: *mut ::std::os::raw::c_int,
1079 max_sockets: *mut usize,
1080 ) -> ::std::os::raw::c_int {
1081 (self
1082 .vsl_host_sockets
1083 .as_ref()
1084 .expect("Expected function, got error."))(host, n_sockets, sockets, max_sockets)
1085 }
1086 #[doc = " Registers the frame with the host and publishes it to subscribers.\n\n Transfers ownership of the frame to the host. The frame is broadcast to all\n connected clients and will be automatically released when it expires. Do not\n call vsl_frame_release() on frames posted to the host.\n\n @param host The host instance\n @param frame Frame to post (ownership transferred to host)\n @param expires Expiration time in nanoseconds (absolute, from\n vsl_timestamp())\n @param duration Frame duration in nanoseconds (-1 if unknown)\n @param pts Presentation timestamp in nanoseconds (-1 if unknown)\n @param dts Decode timestamp in nanoseconds (-1 if unknown)\n @return 0 on success, -1 on error (sets errno)\n @since 1.3\n @memberof VSLHost"]
1087 pub unsafe fn vsl_host_post(
1088 &self,
1089 host: *mut VSLHost,
1090 frame: *mut VSLFrame,
1091 expires: i64,
1092 duration: i64,
1093 pts: i64,
1094 dts: i64,
1095 ) -> ::std::os::raw::c_int {
1096 (self
1097 .vsl_host_post
1098 .as_ref()
1099 .expect("Expected function, got error."))(
1100 host, frame, expires, duration, pts, dts
1101 )
1102 }
1103 #[doc = " Drops the frame from the host.\n\n Removes the host association of the frame and returns ownership to the\n caller. Can be used to cancel a previously posted frame before it expires.\n\n @param host The host instance\n @param frame Frame to drop from host\n @return 0 on success, -1 on error (sets errno)\n @since 1.3\n @memberof VSLHost"]
1104 pub unsafe fn vsl_host_drop(
1105 &self,
1106 host: *mut VSLHost,
1107 frame: *mut VSLFrame,
1108 ) -> ::std::os::raw::c_int {
1109 (self
1110 .vsl_host_drop
1111 .as_ref()
1112 .expect("Expected function, got error."))(host, frame)
1113 }
1114 #[doc = " Creates a client and connects to the host at the provided path.\n\n Establishes a connection to a VSLHost via UNIX domain socket. The client\n can receive frames broadcast by the host.\n\n @param path UNIX socket path matching the host's path\n @param userptr Optional user data pointer (retrievable via\n vsl_client_userptr)\n @param reconnect If true, automatically reconnect if connection is lost\n @return Pointer to VSLClient object on success, NULL on failure (sets errno)\n @since 1.0\n @memberof VSLClient"]
1115 pub unsafe fn vsl_client_init(
1116 &self,
1117 path: *const ::std::os::raw::c_char,
1118 userptr: *mut ::std::os::raw::c_void,
1119 reconnect: bool,
1120 ) -> *mut VSLClient {
1121 (self
1122 .vsl_client_init
1123 .as_ref()
1124 .expect("Expected function, got error."))(path, userptr, reconnect)
1125 }
1126 #[doc = " Releases the client, disconnecting from the host and releasing allocated\n memory.\n\n Closes the socket connection, frees all resources, and invalidates any\n pending frames. Not thread-safe - use vsl_client_disconnect() for\n thread-safe disconnection before calling this.\n\n @param client The client to release\n @since 1.0\n @memberof VSLClient"]
1127 pub unsafe fn vsl_client_release(&self, client: *mut VSLClient) {
1128 (self
1129 .vsl_client_release
1130 .as_ref()
1131 .expect("Expected function, got error."))(client)
1132 }
1133 #[doc = " Disconnects from the VSLHost and stops all reconnection attempts.\n\n Thread-safe disconnect operation. Should be called before\n vsl_client_release() when shutting down a client session from a different\n thread.\n\n @param client The client to disconnect\n @since 1.1\n @memberof VSLClient"]
1134 pub unsafe fn vsl_client_disconnect(&self, client: *mut VSLClient) {
1135 (self
1136 .vsl_client_disconnect
1137 .as_ref()
1138 .expect("Expected function, got error."))(client)
1139 }
1140 #[doc = " Returns the optional userptr associated with this client connection.\n\n @param client The client instance\n @return User pointer provided to vsl_client_init(), or NULL if none\n @since 1.0\n @memberof VSLClient"]
1141 pub unsafe fn vsl_client_userptr(&self, client: *mut VSLClient) -> *mut ::std::os::raw::c_void {
1142 (self
1143 .vsl_client_userptr
1144 .as_ref()
1145 .expect("Expected function, got error."))(client)
1146 }
1147 #[doc = " Returns the path on which the client has connected to the host.\n\n @param client The client instance\n @return UNIX socket path string (owned by client, do not free)\n @since 1.0\n @memberof VSLClient"]
1148 pub unsafe fn vsl_client_path(
1149 &self,
1150 client: *const VSLClient,
1151 ) -> *const ::std::os::raw::c_char {
1152 (self
1153 .vsl_client_path
1154 .as_ref()
1155 .expect("Expected function, got error."))(client)
1156 }
1157 #[doc = " Sets the socket timeout for this client.\n\n Configures how long socket operations wait before timing out. Affects\n recv() calls when waiting for frames from the host.\n\n @param client The client instance\n @param timeout Timeout in seconds (e.g., 1.0 for 1 second)\n @since 1.0\n @memberof VSLClient"]
1158 pub unsafe fn vsl_client_set_timeout(&self, client: *mut VSLClient, timeout: f32) {
1159 (self
1160 .vsl_client_set_timeout
1161 .as_ref()
1162 .expect("Expected function, got error."))(client, timeout)
1163 }
1164 #[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"]
1165 pub unsafe fn vsl_frame_register(
1166 &self,
1167 host: *mut VSLHost,
1168 serial: i64,
1169 handle: ::std::os::raw::c_int,
1170 width: ::std::os::raw::c_int,
1171 height: ::std::os::raw::c_int,
1172 fourcc: u32,
1173 size: usize,
1174 offset: usize,
1175 expires: i64,
1176 duration: i64,
1177 pts: i64,
1178 dts: i64,
1179 cleanup: vsl_frame_cleanup,
1180 userptr: *mut ::std::os::raw::c_void,
1181 ) -> *mut VSLFrame {
1182 (self
1183 .vsl_frame_register
1184 .as_ref()
1185 .expect("Expected function, got error."))(
1186 host, serial, handle, width, height, fourcc, size, offset, expires, duration, pts, dts,
1187 cleanup, userptr,
1188 )
1189 }
1190 #[doc = " Initializes a VSLFrame without underlying frame buffer.\n\n Creates a frame descriptor with specified dimensions and format. To allocate\n backing memory, call vsl_frame_alloc(). To attach existing memory (e.g.,\n DmaBuf from camera), call vsl_frame_attach().\n\n @param width Frame width in pixels\n @param height Frame height in pixels\n @param stride Row stride in bytes (0 to auto-calculate from width)\n @param fourcc Pixel format as FOURCC code (e.g., VSL_FOURCC('N','V','1','2'))\n @param userptr Optional user data pointer\n @param cleanup Optional cleanup callback invoked on vsl_frame_release()\n @return Pointer to VSLFrame object, or NULL on failure\n @since 1.3\n @memberof VSLFrame"]
1191 pub unsafe fn vsl_frame_init(
1192 &self,
1193 width: u32,
1194 height: u32,
1195 stride: u32,
1196 fourcc: u32,
1197 userptr: *mut ::std::os::raw::c_void,
1198 cleanup: vsl_frame_cleanup,
1199 ) -> *mut VSLFrame {
1200 (self
1201 .vsl_frame_init
1202 .as_ref()
1203 .expect("Expected function, got error."))(
1204 width, height, stride, fourcc, userptr, cleanup,
1205 )
1206 }
1207 #[doc = " Allocates the underlying memory for the frame.\n\n Prefers DmaBuf allocation for zero-copy, falling back to POSIX shared memory\n if DmaBuf unavailable. If path is provided, it determines allocation type:\n - NULL: Try DmaBuf first, fallback to shared memory\n - Starts with \"/dev\": Use DmaBuf heap device at this path\n - Other paths: Use shared memory at this path\n\n Allocates height*stride bytes. For compressed formats (JPEG, H.264), the\n actual data size may be smaller. Use vsl_frame_copy() return value to get\n actual compressed size.\n\n @param frame Frame to allocate memory for\n @param path Optional allocation path (NULL for auto, /dev/... for DmaBuf\n heap)\n @return 0 on success, -1 on failure (sets errno)\n @since 1.3\n @memberof VSLFrame"]
1208 pub unsafe fn vsl_frame_alloc(
1209 &self,
1210 frame: *mut VSLFrame,
1211 path: *const ::std::os::raw::c_char,
1212 ) -> ::std::os::raw::c_int {
1213 (self
1214 .vsl_frame_alloc
1215 .as_ref()
1216 .expect("Expected function, got error."))(frame, path)
1217 }
1218 #[doc = " Frees the allocated buffer for this frame.\n\n Releases the underlying memory (DmaBuf or shared memory) but does not\n destroy the frame object. Use vsl_frame_release() to destroy the frame.\n\n @param frame Frame whose buffer should be freed\n @since 1.3\n @memberof VSLFrame"]
1219 pub unsafe fn vsl_frame_unalloc(&self, frame: *mut VSLFrame) {
1220 (self
1221 .vsl_frame_unalloc
1222 .as_ref()
1223 .expect("Expected function, got error."))(frame)
1224 }
1225 #[doc = " Attach the provided file descriptor to the VSLFrame.\n\n Associates an existing buffer (typically DmaBuf from camera or hardware\n accelerator) with the frame. The frame does not take ownership of the FD.\n\n @param frame Frame to attach buffer to\n @param fd File descriptor (typically DmaBuf) to attach\n @param size Buffer size in bytes (0 to use stride*height)\n @param offset Byte offset to frame data start (must provide size if offset>0)\n @return 0 on success, -1 on failure (sets errno)\n @since 1.3\n @memberof VSLFrame"]
1226 pub unsafe fn vsl_frame_attach(
1227 &self,
1228 frame: *mut VSLFrame,
1229 fd: ::std::os::raw::c_int,
1230 size: usize,
1231 offset: usize,
1232 ) -> ::std::os::raw::c_int {
1233 (self
1234 .vsl_frame_attach
1235 .as_ref()
1236 .expect("Expected function, got error."))(frame, fd, size, offset)
1237 }
1238 #[doc = " Returns the path to the underlying VSLFrame buffer.\n\n Returns the filesystem path for shared memory buffers or DmaBuf heap devices.\n Not available for externally created DmaBufs (e.g., from camera driver).\n\n @warning Not thread-safe. Use the returned string immediately.\n\n @param frame The frame instance\n @return Buffer path string (owned by frame), or NULL if unavailable\n @since 1.3\n @memberof VSLFrame"]
1239 pub unsafe fn vsl_frame_path(&self, frame: *const VSLFrame) -> *const ::std::os::raw::c_char {
1240 (self
1241 .vsl_frame_path
1242 .as_ref()
1243 .expect("Expected function, got error."))(frame)
1244 }
1245 #[doc = " Unregisters the frame, removing it from the host pool.\n\n @deprecated Use vsl_frame_release() instead, which handles cleanup properly.\n\n @param frame Frame to unregister\n @since 1.0\n @memberof VSLFrame"]
1246 pub unsafe fn vsl_frame_unregister(&self, frame: *mut VSLFrame) {
1247 (self
1248 .vsl_frame_unregister
1249 .as_ref()
1250 .expect("Expected function, got error."))(frame)
1251 }
1252 #[doc = " Copy the source frame into the target frame, with optional source crop.\n\n Handles format conversion, rescaling, and cropping using hardware\n acceleration when available (G2D on i.MX8). Both frames can be host or client\n frames. Automatically locks frames during copy (safe for free-standing frames\n too).\n\n Copy sequence: 1) Crop source, 2) Convert format, 3) Scale to target size.\n\n @warning Copying to/from a posted frame may cause visual tearing.\n\n @param target Destination frame (receives copied data)\n @param source Source frame to copy from\n @param crop Optional crop region in source coordinates (NULL for full frame)\n @return Number of bytes copied on success, -1 on failure (sets errno)\n @since 1.3\n @memberof VSLFrame"]
1253 pub unsafe fn vsl_frame_copy(
1254 &self,
1255 target: *mut VSLFrame,
1256 source: *mut VSLFrame,
1257 crop: *const VSLRect,
1258 ) -> ::std::os::raw::c_int {
1259 (self
1260 .vsl_frame_copy
1261 .as_ref()
1262 .expect("Expected function, got error."))(target, source, crop)
1263 }
1264 #[doc = " Returns the user pointer associated with this frame.\n\n @param frame The frame instance\n @return User pointer provided to vsl_frame_init(), or NULL if none\n @since 1.0\n @memberof VSLFrame"]
1265 pub unsafe fn vsl_frame_userptr(&self, frame: *mut VSLFrame) -> *mut ::std::os::raw::c_void {
1266 (self
1267 .vsl_frame_userptr
1268 .as_ref()
1269 .expect("Expected function, got error."))(frame)
1270 }
1271 #[doc = " Associate userptr with this frame.\n\n Sets or updates the user data pointer for this frame.\n\n @param frame The frame instance\n @param userptr User data pointer to associate with frame\n @since 1.0\n @memberof VSLFrame"]
1272 pub unsafe fn vsl_frame_set_userptr(
1273 &self,
1274 frame: *mut VSLFrame,
1275 userptr: *mut ::std::os::raw::c_void,
1276 ) {
1277 (self
1278 .vsl_frame_set_userptr
1279 .as_ref()
1280 .expect("Expected function, got error."))(frame, userptr)
1281 }
1282 #[doc = " Waits for a frame to arrive and returns a new frame object.\n\n Blocks until the host broadcasts a new frame. Frames with timestamp less\n than 'until' are ignored (useful for skipping old frames after a pause).\n\n Caller must lock the frame (vsl_frame_trylock) before accessing data,\n then unlock and release when done.\n\n @param client The client instance\n @param until Minimum timestamp in nanoseconds (0 to accept next frame)\n @return Pointer to VSLFrame object, or NULL on error (sets errno)\n @since 1.0\n @memberof VSLFrame"]
1283 pub unsafe fn vsl_frame_wait(&self, client: *mut VSLClient, until: i64) -> *mut VSLFrame {
1284 (self
1285 .vsl_frame_wait
1286 .as_ref()
1287 .expect("Expected function, got error."))(client, until)
1288 }
1289 #[doc = " Releases the frame, performing required cleanup.\n\n Unmaps memory if mapped, unlocks if locked. If frame was posted to a host,\n removes it. If client frame, decrements reference count. Invokes cleanup\n callback if registered.\n\n @param frame Frame to release\n @since 1.0\n @memberof VSLFrame"]
1290 pub unsafe fn vsl_frame_release(&self, frame: *mut VSLFrame) {
1291 (self
1292 .vsl_frame_release
1293 .as_ref()
1294 .expect("Expected function, got error."))(frame)
1295 }
1296 #[doc = " Attempts to lock the video frame.\n\n Locks the frame for exclusive access (prevents host from releasing it).\n Must be called before accessing frame data from a client. Always succeeds\n for host-owned frames.\n\n @param frame Frame to lock\n @return 0 on success, -1 on failure (frame expired or already unlocked)\n @since 1.0\n @memberof VSLFrame"]
1297 pub unsafe fn vsl_frame_trylock(&self, frame: *mut VSLFrame) -> ::std::os::raw::c_int {
1298 (self
1299 .vsl_frame_trylock
1300 .as_ref()
1301 .expect("Expected function, got error."))(frame)
1302 }
1303 #[doc = " Attempts to unlock the video frame.\n\n Releases the lock acquired by vsl_frame_trylock(), allowing the host to\n release the frame when it expires.\n\n @param frame Frame to unlock\n @return 0 on success, -1 on failure (sets errno)\n @since 1.0\n @memberof VSLFrame"]
1304 pub unsafe fn vsl_frame_unlock(&self, frame: *mut VSLFrame) -> ::std::os::raw::c_int {
1305 (self
1306 .vsl_frame_unlock
1307 .as_ref()
1308 .expect("Expected function, got error."))(frame)
1309 }
1310 #[doc = " Returns the serial frame count of the video frame.\n\n Frame serial is a monotonically increasing counter assigned by the host\n when frames are registered. Does not necessarily equal camera frame number.\n\n @param frame The frame instance\n @return Frame serial number (starts at 1)\n @since 1.0\n @memberof VSLFrame"]
1311 pub unsafe fn vsl_frame_serial(&self, frame: *const VSLFrame) -> i64 {
1312 (self
1313 .vsl_frame_serial
1314 .as_ref()
1315 .expect("Expected function, got error."))(frame)
1316 }
1317 #[doc = " Returns the timestamp for this frame in nanoseconds.\n\n Timestamp from vsl_timestamp() when frame was registered with host.\n Uses monotonic clock for consistent timing.\n\n @param frame The frame instance\n @return Frame timestamp in nanoseconds\n @since 1.0\n @memberof VSLFrame"]
1318 pub unsafe fn vsl_frame_timestamp(&self, frame: *const VSLFrame) -> i64 {
1319 (self
1320 .vsl_frame_timestamp
1321 .as_ref()
1322 .expect("Expected function, got error."))(frame)
1323 }
1324 #[doc = " Returns the duration for this frame in nanoseconds.\n\n Frame duration indicates how long this frame should be displayed.\n May be -1 if unknown or not applicable.\n\n @param frame The frame instance\n @return Frame duration in nanoseconds, or -1 if unknown\n @since 1.0\n @memberof VSLFrame"]
1325 pub unsafe fn vsl_frame_duration(&self, frame: *const VSLFrame) -> i64 {
1326 (self
1327 .vsl_frame_duration
1328 .as_ref()
1329 .expect("Expected function, got error."))(frame)
1330 }
1331 #[doc = " Returns the presentation timestamp for this frame in nanoseconds.\n\n PTS indicates when this frame should be presented/displayed in a stream.\n May be -1 if unknown or not applicable.\n\n @param frame The frame instance\n @return Presentation timestamp in nanoseconds, or -1 if unknown\n @since 1.0\n @memberof VSLFrame"]
1332 pub unsafe fn vsl_frame_pts(&self, frame: *const VSLFrame) -> i64 {
1333 (self
1334 .vsl_frame_pts
1335 .as_ref()
1336 .expect("Expected function, got error."))(frame)
1337 }
1338 #[doc = " Returns the decode timestamp for this frame in nanoseconds.\n\n DTS indicates when this frame should be decoded in a stream (important for\n B-frames in video codecs). May be -1 if unknown or not applicable.\n\n @param frame The frame instance\n @return Decode timestamp in nanoseconds, or -1 if unknown\n @since 1.0\n @memberof VSLFrame"]
1339 pub unsafe fn vsl_frame_dts(&self, frame: *const VSLFrame) -> i64 {
1340 (self
1341 .vsl_frame_dts
1342 .as_ref()
1343 .expect("Expected function, got error."))(frame)
1344 }
1345 #[doc = " Returns the expiration time for this frame in nanoseconds.\n\n Absolute timestamp (from vsl_timestamp()) when this frame will be expired\n by the host. Clients should lock frames before this time.\n\n @param frame The frame instance\n @return Expiration timestamp in nanoseconds\n @since 1.0\n @memberof VSLFrame"]
1346 pub unsafe fn vsl_frame_expires(&self, frame: *const VSLFrame) -> i64 {
1347 (self
1348 .vsl_frame_expires
1349 .as_ref()
1350 .expect("Expected function, got error."))(frame)
1351 }
1352 #[doc = " Returns the FOURCC code for the video frame.\n\n FOURCC identifies the pixel format (e.g., NV12, YUY2, JPEG, H264).\n Use VSL_FOURCC() macro to create fourcc codes.\n\n @param frame The frame instance\n @return FOURCC code as uint32_t\n @since 1.0\n @memberof VSLFrame"]
1353 pub unsafe fn vsl_frame_fourcc(&self, frame: *const VSLFrame) -> u32 {
1354 (self
1355 .vsl_frame_fourcc
1356 .as_ref()
1357 .expect("Expected function, got error."))(frame)
1358 }
1359 #[doc = " Returns the width in pixels of the video frame.\n\n @param frame The frame instance\n @return Frame width in pixels\n @since 1.0\n @memberof VSLFrame"]
1360 pub unsafe fn vsl_frame_width(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
1361 (self
1362 .vsl_frame_width
1363 .as_ref()
1364 .expect("Expected function, got error."))(frame)
1365 }
1366 #[doc = " Returns the height in pixels of the video frame.\n\n @param frame The frame instance\n @return Frame height in pixels\n @since 1.0\n @memberof VSLFrame"]
1367 pub unsafe fn vsl_frame_height(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
1368 (self
1369 .vsl_frame_height
1370 .as_ref()
1371 .expect("Expected function, got error."))(frame)
1372 }
1373 #[doc = " Returns the stride in bytes of the video frame.\n\n Stride is the number of bytes from the start of one row to the next.\n May be larger than width*bytes_per_pixel due to alignment requirements.\n\n @param frame The frame instance\n @return Row stride in bytes\n @since 1.3\n @memberof VSLFrame"]
1374 pub unsafe fn vsl_frame_stride(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
1375 (self
1376 .vsl_frame_stride
1377 .as_ref()
1378 .expect("Expected function, got error."))(frame)
1379 }
1380 #[doc = " Returns the size in bytes of the video frame buffer.\n\n For uncompressed formats, this is stride*height. For compressed formats\n (JPEG, H.264), this is the maximum buffer size, not the actual data size.\n\n @param frame The frame instance\n @return Buffer size in bytes\n @since 1.0\n @memberof VSLFrame"]
1381 pub unsafe fn vsl_frame_size(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
1382 (self
1383 .vsl_frame_size
1384 .as_ref()
1385 .expect("Expected function, got error."))(frame)
1386 }
1387 #[doc = " Returns the file descriptor for this frame.\n\n Returns the DmaBuf or shared memory file descriptor used for zero-copy\n sharing. Returns -1 if no file descriptor is associated (e.g., CPU-only\n memory).\n\n @param frame The frame instance\n @return File descriptor, or -1 if none\n @since 1.0\n @memberof VSLFrame"]
1388 pub unsafe fn vsl_frame_handle(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
1389 (self
1390 .vsl_frame_handle
1391 .as_ref()
1392 .expect("Expected function, got error."))(frame)
1393 }
1394 #[doc = " Returns the physical address of the frame.\n\n Physical address is available for DMA-capable buffers on platforms where\n the kernel provides physical address translation (some i.MX platforms).\n Note: This function caches the physical address internally on first call.\n\n @param frame The frame instance\n @return Physical address, or MMAP_FAILED ((intptr_t)-1) if DMA not supported\n @since 1.0\n @memberof VSLFrame"]
1395 pub unsafe fn vsl_frame_paddr(&self, frame: *mut VSLFrame) -> isize {
1396 (self
1397 .vsl_frame_paddr
1398 .as_ref()
1399 .expect("Expected function, got error."))(frame)
1400 }
1401 #[doc = " Maps the frame into the process memory space.\n\n Creates a memory mapping for CPU access to frame data. Frame must be locked\n (vsl_frame_trylock) for the duration of the mapping. Call vsl_frame_munmap()\n when done.\n\n @param frame The frame instance\n @param size Optional pointer to receive mapped size in bytes (may be NULL)\n @return Pointer to mapped memory, or NULL on failure\n @since 1.0\n @memberof VSLFrame"]
1402 pub unsafe fn vsl_frame_mmap(
1403 &self,
1404 frame: *mut VSLFrame,
1405 size: *mut usize,
1406 ) -> *mut ::std::os::raw::c_void {
1407 (self
1408 .vsl_frame_mmap
1409 .as_ref()
1410 .expect("Expected function, got error."))(frame, size)
1411 }
1412 #[doc = " Unmaps the frame from the process memory space.\n\n Releases the memory mapping created by vsl_frame_mmap(). Should be called\n when done accessing frame data.\n\n @param frame The frame instance to unmap\n @since 1.0\n @memberof VSLFrame"]
1413 pub unsafe fn vsl_frame_munmap(&self, frame: *mut VSLFrame) {
1414 (self
1415 .vsl_frame_munmap
1416 .as_ref()
1417 .expect("Expected function, got error."))(frame)
1418 }
1419 #[doc = " Cache synchronization session control for DMA-backed buffers.\n\n Controls CPU cache coherency for DMA buffers. Automatically called by\n mmap/munmap, but can be used manually for in-place frame updates.\n\n Call with enable=1 before accessing, enable=0 after modifying.\n Mode: DMA_BUF_SYNC_READ (CPU reads), DMA_BUF_SYNC_WRITE (CPU writes),\n or DMA_BUF_SYNC_RW (both).\n\n @param frame The frame object to synchronize\n @param enable 1 to start sync session, 0 to end it\n @param mode Sync mode: DMA_BUF_SYNC_READ, DMA_BUF_SYNC_WRITE, or\n DMA_BUF_SYNC_RW\n @return 0 on success, -1 on failure (sets errno)\n @since 1.3\n @memberof VSLFrame"]
1420 pub unsafe fn vsl_frame_sync(
1421 &self,
1422 frame: *const VSLFrame,
1423 enable: ::std::os::raw::c_int,
1424 mode: ::std::os::raw::c_int,
1425 ) -> ::std::os::raw::c_int {
1426 (self
1427 .vsl_frame_sync
1428 .as_ref()
1429 .expect("Expected function, got error."))(frame, enable, mode)
1430 }
1431 #[doc = " Returns a fourcc integer code from the string.\n\n Converts a 4-character string to FOURCC code. Example: \"NV12\" ->\n VSL_FOURCC('N','V','1','2').\n\n @param fourcc String containing exactly 4 characters (e.g., \"NV12\", \"YUY2\")\n @return FOURCC code as uint32_t, or 0 if invalid/unsupported\n @since 1.3"]
1432 pub unsafe fn vsl_fourcc_from_string(&self, fourcc: *const ::std::os::raw::c_char) -> u32 {
1433 (self
1434 .vsl_fourcc_from_string
1435 .as_ref()
1436 .expect("Expected function, got error."))(fourcc)
1437 }
1438 #[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"]
1439 pub unsafe fn vsl_encoder_create(
1440 &self,
1441 profile: VSLEncoderProfile,
1442 outputFourcc: u32,
1443 fps: ::std::os::raw::c_int,
1444 ) -> *mut VSLEncoder {
1445 (self
1446 .vsl_encoder_create
1447 .as_ref()
1448 .expect("Expected function, got error."))(profile, outputFourcc, fps)
1449 }
1450 #[doc = " @brief Creates VSLEncoder instance with explicit backend selection\n\n Extended version of vsl_encoder_create() that allows selecting a specific\n codec backend. Use this when you need to force V4L2 or Hantro backend.\n\n @param profile VSLEncoderProfile determining encode quality\n @param outputFourcc fourcc code defining the codec (H264 or HEVC)\n @param fps output stream fps\n @param backend Which backend to use (VSL_CODEC_BACKEND_AUTO, _V4L2, _HANTRO)\n @return VSLEncoder* new encoder instance, or NULL if backend unavailable\n\n @since 2.0"]
1451 pub unsafe fn vsl_encoder_create_ex(
1452 &self,
1453 profile: VSLEncoderProfile,
1454 outputFourcc: u32,
1455 fps: ::std::os::raw::c_int,
1456 backend: VSLCodecBackend,
1457 ) -> *mut VSLEncoder {
1458 (self
1459 .vsl_encoder_create_ex
1460 .as_ref()
1461 .expect("Expected function, got error."))(profile, outputFourcc, fps, backend)
1462 }
1463 #[doc = " @brief Destroys VSLEncoder instance\n\n Frees all resources associated with the encoder, including hardware\n resources. Do not use the encoder after calling this function.\n\n @param encoder VSLEncoder instance to destroy\n @since 1.3"]
1464 pub unsafe fn vsl_encoder_release(&self, encoder: *mut VSLEncoder) {
1465 (self
1466 .vsl_encoder_release
1467 .as_ref()
1468 .expect("Expected function, got error."))(encoder)
1469 }
1470 #[doc = " @brief Encode frame\n\n Encodes the source frame into the destination frame using hardware\n acceleration (Hantro VPU on i.MX 8M Plus, Wave6 VPU on i.MX 95).\n First call initializes the encoder with\n the given parameters. Subsequent calls must use identical source/destination\n dimensions, formats, and crop region.\n\n @param encoder VSLEncoder instance\n @param source Source frame (raw video data)\n @param destination Pre-allocated destination frame (receives encoded data)\n @param cropRegion Optional crop region in source coordinates (NULL for no\n crop)\n @param keyframe Optional output: set to 1 if encoded frame is IDR/keyframe,\n 0 otherwise. Pass NULL to ignore.\n @retval 0 on success\n @retval -1 on failure (check errno for details)\n @since 1.3"]
1471 pub unsafe fn vsl_encode_frame(
1472 &self,
1473 encoder: *mut VSLEncoder,
1474 source: *mut VSLFrame,
1475 destination: *mut VSLFrame,
1476 cropRegion: *const VSLRect,
1477 keyframe: *mut ::std::os::raw::c_int,
1478 ) -> ::std::os::raw::c_int {
1479 (self
1480 .vsl_encode_frame
1481 .as_ref()
1482 .expect("Expected function, got error."))(
1483 encoder,
1484 source,
1485 destination,
1486 cropRegion,
1487 keyframe,
1488 )
1489 }
1490 #[doc = " @brief Creates a new output frame for encoder\n\n Allocates a frame suitable for receiving encoded output from\n vsl_encode_frame(). The frame uses encoder-specific memory for efficient\n hardware encoding.\n\n @param encoder VSLEncoder instance\n @param width Encoded frame width in pixels (should match encoder source)\n @param height Encoded frame height in pixels (should match encoder source)\n @param duration Frame duration in nanoseconds (passed through to output)\n @param pts Presentation timestamp in nanoseconds (passed through to output)\n @param dts Decode timestamp in nanoseconds (passed through to output)\n @return Pointer to VSLFrame for encoded output, or NULL on failure\n @since 1.3"]
1491 pub unsafe fn vsl_encoder_new_output_frame(
1492 &self,
1493 encoder: *const VSLEncoder,
1494 width: ::std::os::raw::c_int,
1495 height: ::std::os::raw::c_int,
1496 duration: i64,
1497 pts: i64,
1498 dts: i64,
1499 ) -> *mut VSLFrame {
1500 (self
1501 .vsl_encoder_new_output_frame
1502 .as_ref()
1503 .expect("Expected function, got error."))(
1504 encoder, width, height, duration, pts, dts
1505 )
1506 }
1507 #[doc = " Opens the camera device specified by filename and allocates device memory.\n\n Opens a V4L2 video capture device (e.g., /dev/video0) and prepares it for\n streaming. The device is not yet configured - call vsl_camera_init_device()\n next.\n\n @param filename V4L2 device path (e.g., \"/dev/video0\")\n @return Pointer to vsl_camera context on success, NULL on failure\n @since 1.3\n @memberof VSLCamera"]
1508 pub unsafe fn vsl_camera_open_device(
1509 &self,
1510 filename: *const ::std::os::raw::c_char,
1511 ) -> *mut vsl_camera {
1512 (self
1513 .vsl_camera_open_device
1514 .as_ref()
1515 .expect("Expected function, got error."))(filename)
1516 }
1517 #[doc = " Initializes the camera device for streaming and allocates camera buffers.\n\n Negotiates format with the V4L2 driver. On entry, width/height/fourcc contain\n desired values (0 for driver default). On success, they're updated with\n actual negotiated values. Allocates buf_count buffers (updated with actual\n count).\n\n Must be called after vsl_camera_open_device() and before\n vsl_camera_start_capturing().\n\n @param ctx Camera context from vsl_camera_open_device()\n @param width Pointer to desired/actual width in pixels (0 for default)\n @param height Pointer to desired/actual height in pixels (0 for default)\n @param buf_count Pointer to desired/actual buffer count (0 for default)\n @param fourcc Pointer to desired/actual fourcc format (0 for default)\n @return 0 on success, -1 on error\n @since 1.3\n @memberof VSLCamera"]
1518 pub unsafe fn vsl_camera_init_device(
1519 &self,
1520 ctx: *mut vsl_camera,
1521 width: *mut ::std::os::raw::c_int,
1522 height: *mut ::std::os::raw::c_int,
1523 buf_count: *mut ::std::os::raw::c_int,
1524 fourcc: *mut u32,
1525 ) -> ::std::os::raw::c_int {
1526 (self
1527 .vsl_camera_init_device
1528 .as_ref()
1529 .expect("Expected function, got error."))(ctx, width, height, buf_count, fourcc)
1530 }
1531 #[doc = " Requests the camera to mirror the image left-to-right.\n\n Uses V4L2_CID_HFLIP control to flip the image horizontally.\n Not all cameras support this feature.\n\n @param ctx Camera context\n @param mirror true to enable horizontal flip, false to disable\n @return 0 on success, -1 if driver refused the request\n @since 1.3\n @memberof VSLCamera"]
1532 pub unsafe fn vsl_camera_mirror(
1533 &self,
1534 ctx: *const vsl_camera,
1535 mirror: bool,
1536 ) -> ::std::os::raw::c_int {
1537 (self
1538 .vsl_camera_mirror
1539 .as_ref()
1540 .expect("Expected function, got error."))(ctx, mirror)
1541 }
1542 #[doc = " Requests the camera to mirror the image top-to-bottom.\n\n Uses V4L2_CID_VFLIP control to flip the image vertically.\n Not all cameras support this feature.\n\n @param ctx Camera context\n @param mirror true to enable vertical flip, false to disable\n @return 0 on success, -1 if driver refused the request\n @since 1.3\n @memberof VSLCamera"]
1543 pub unsafe fn vsl_camera_mirror_v(
1544 &self,
1545 ctx: *const vsl_camera,
1546 mirror: bool,
1547 ) -> ::std::os::raw::c_int {
1548 (self
1549 .vsl_camera_mirror_v
1550 .as_ref()
1551 .expect("Expected function, got error."))(ctx, mirror)
1552 }
1553 #[doc = " Starts the camera stream.\n\n Begins V4L2 streaming (VIDIOC_STREAMON). Frames can now be captured with\n vsl_camera_get_data(). Must be called after vsl_camera_init_device().\n\n @param ctx Camera context\n @return 0 on success, -1 on error\n @since 1.3\n @memberof VSLCamera"]
1554 pub unsafe fn vsl_camera_start_capturing(&self, ctx: *mut vsl_camera) -> ::std::os::raw::c_int {
1555 (self
1556 .vsl_camera_start_capturing
1557 .as_ref()
1558 .expect("Expected function, got error."))(ctx)
1559 }
1560 #[doc = " Attempts to read a frame from the camera.\n\n Dequeues a filled buffer from the camera driver (VIDIOC_DQBUF). Blocks until\n a frame is available. Must be called after vsl_camera_start_capturing().\n\n After processing, call vsl_camera_release_buffer() to return the buffer to\n the driver's queue for reuse.\n\n @param ctx Camera context\n @return Pointer to camera buffer, or NULL on timeout/error\n @since 1.3\n @memberof VSLCamera"]
1561 pub unsafe fn vsl_camera_get_data(&self, ctx: *mut vsl_camera) -> *mut vsl_camera_buffer {
1562 (self
1563 .vsl_camera_get_data
1564 .as_ref()
1565 .expect("Expected function, got error."))(ctx)
1566 }
1567 #[doc = " Enqueues a buffer to be reused for frame capture.\n\n Returns the buffer to the camera driver's queue (VIDIOC_QBUF) so it can be\n filled with new frame data. Must be called after processing each buffer from\n vsl_camera_get_data().\n\n @param ctx Camera context\n @param buffer Buffer to release (from vsl_camera_get_data)\n @return 0 on success, -1 on error\n @since 1.3\n @memberof VSLCamera"]
1568 pub unsafe fn vsl_camera_release_buffer(
1569 &self,
1570 ctx: *mut vsl_camera,
1571 buffer: *const vsl_camera_buffer,
1572 ) -> ::std::os::raw::c_int {
1573 (self
1574 .vsl_camera_release_buffer
1575 .as_ref()
1576 .expect("Expected function, got error."))(ctx, buffer)
1577 }
1578 #[doc = " Stops the camera stream.\n\n Stops V4L2 streaming (VIDIOC_STREAMOFF). No more frames will be captured.\n Call before vsl_camera_uninit_device() and vsl_camera_close_device().\n\n @param ctx Camera context\n @return 0 on success, -1 on error\n @since 1.3\n @memberof VSLCamera"]
1579 pub unsafe fn vsl_camera_stop_capturing(
1580 &self,
1581 ctx: *const vsl_camera,
1582 ) -> ::std::os::raw::c_int {
1583 (self
1584 .vsl_camera_stop_capturing
1585 .as_ref()
1586 .expect("Expected function, got error."))(ctx)
1587 }
1588 #[doc = " Uninitializes the camera buffers and frees the buffer memory.\n\n Releases all allocated camera buffers. Ensure the device is not streaming\n (call vsl_camera_stop_capturing() first).\n\n @param ctx Camera context\n @since 1.3\n @memberof VSLCamera"]
1589 pub unsafe fn vsl_camera_uninit_device(&self, ctx: *mut vsl_camera) {
1590 (self
1591 .vsl_camera_uninit_device
1592 .as_ref()
1593 .expect("Expected function, got error."))(ctx)
1594 }
1595 #[doc = " Closes the camera device and frees the device memory.\n\n Closes the V4L2 device file descriptor and releases all resources.\n Ensure the device is not streaming (call vsl_camera_stop_capturing() and\n vsl_camera_uninit_device() first).\n\n @param ctx Camera context to close\n @since 1.3\n @memberof VSLCamera"]
1596 pub unsafe fn vsl_camera_close_device(&self, ctx: *mut vsl_camera) {
1597 (self
1598 .vsl_camera_close_device
1599 .as_ref()
1600 .expect("Expected function, got error."))(ctx)
1601 }
1602 #[doc = " Checks if DmaBuf export is supported on the camera.\n\n DmaBuf support allows zero-copy frame sharing with hardware accelerators\n (VPU, NPU, GPU). Requires V4L2 driver support for VIDIOC_EXPBUF.\n\n Must be called after vsl_camera_init_device().\n\n @param ctx Camera context\n @return 1 if DmaBuf supported, 0 if not supported\n @since 1.3\n @memberof VSLCamera"]
1603 pub unsafe fn vsl_camera_is_dmabuf_supported(
1604 &self,
1605 ctx: *const vsl_camera,
1606 ) -> ::std::os::raw::c_int {
1607 (self
1608 .vsl_camera_is_dmabuf_supported
1609 .as_ref()
1610 .expect("Expected function, got error."))(ctx)
1611 }
1612 #[doc = " Returns the number of buffers queued in the camera driver.\n\n Queued buffers are available for the driver to fill with new frames.\n If count reaches 0, vsl_camera_get_data() will block/timeout waiting for\n buffers to be released via vsl_camera_release_buffer().\n\n @param ctx Camera context\n @return Number of queued buffers\n @since 1.3\n @memberof VSLCamera"]
1613 pub unsafe fn vsl_camera_get_queued_buf_count(
1614 &self,
1615 ctx: *const vsl_camera,
1616 ) -> ::std::os::raw::c_int {
1617 (self
1618 .vsl_camera_get_queued_buf_count
1619 .as_ref()
1620 .expect("Expected function, got error."))(ctx)
1621 }
1622 #[doc = " Returns the V4L2 color space (primaries) negotiated for the camera.\n\n @param ctx Camera context\n @return `V4L2_COLORSPACE_*` enum value, or 0 if `ctx` is NULL or the\n driver left the field as `V4L2_COLORSPACE_DEFAULT`.\n @since 2.5\n @memberof VSLCamera"]
1623 pub unsafe fn vsl_camera_color_space(&self, ctx: *const vsl_camera) -> u32 {
1624 (self
1625 .vsl_camera_color_space
1626 .as_ref()
1627 .expect("Expected function, got error."))(ctx)
1628 }
1629 #[doc = " Returns the V4L2 transfer function negotiated for the camera.\n\n @param ctx Camera context\n @return `V4L2_XFER_FUNC_*` enum value, or 0 if `ctx` is NULL or the\n driver left the field as `V4L2_XFER_FUNC_DEFAULT`.\n @since 2.5\n @memberof VSLCamera"]
1630 pub unsafe fn vsl_camera_color_transfer(&self, ctx: *const vsl_camera) -> u32 {
1631 (self
1632 .vsl_camera_color_transfer
1633 .as_ref()
1634 .expect("Expected function, got error."))(ctx)
1635 }
1636 #[doc = " Returns the V4L2 YCbCr encoding negotiated for the camera.\n\n @param ctx Camera context\n @return `V4L2_YCBCR_ENC_*` enum value, or 0 if `ctx` is NULL or the\n driver left the field as `V4L2_YCBCR_ENC_DEFAULT`.\n @since 2.5\n @memberof VSLCamera"]
1637 pub unsafe fn vsl_camera_color_encoding(&self, ctx: *const vsl_camera) -> u32 {
1638 (self
1639 .vsl_camera_color_encoding
1640 .as_ref()
1641 .expect("Expected function, got error."))(ctx)
1642 }
1643 #[doc = " Returns the V4L2 quantization (color range) negotiated for the camera.\n\n @param ctx Camera context\n @return `V4L2_QUANTIZATION_*` enum value, or 0 if `ctx` is NULL or the\n driver left the field as `V4L2_QUANTIZATION_DEFAULT`.\n @since 2.5\n @memberof VSLCamera"]
1644 pub unsafe fn vsl_camera_color_range(&self, ctx: *const vsl_camera) -> u32 {
1645 (self
1646 .vsl_camera_color_range
1647 .as_ref()
1648 .expect("Expected function, got error."))(ctx)
1649 }
1650 #[doc = " Returns the mmap memory pointer of the camera buffer.\n\n Provides CPU access to the camera buffer's memory. The buffer is already\n mapped by the camera driver.\n\n @param buffer Camera buffer from vsl_camera_get_data()\n @return Pointer to mapped memory\n @since 1.3\n @memberof VSLCamera"]
1651 pub unsafe fn vsl_camera_buffer_mmap(
1652 &self,
1653 buffer: *mut vsl_camera_buffer,
1654 ) -> *mut ::std::os::raw::c_void {
1655 (self
1656 .vsl_camera_buffer_mmap
1657 .as_ref()
1658 .expect("Expected function, got error."))(buffer)
1659 }
1660 #[doc = " Returns the DmaBuf file descriptor of the camera buffer.\n\n Returns the DmaBuf FD for zero-copy sharing with hardware accelerators.\n Only available if vsl_camera_is_dmabuf_supported() returns true.\n\n @param buffer Camera buffer from vsl_camera_get_data()\n @return DmaBuf file descriptor, or -1 if DmaBuf not supported\n @since 1.3\n @memberof VSLCamera"]
1661 pub unsafe fn vsl_camera_buffer_dma_fd(
1662 &self,
1663 buffer: *const vsl_camera_buffer,
1664 ) -> ::std::os::raw::c_int {
1665 (self
1666 .vsl_camera_buffer_dma_fd
1667 .as_ref()
1668 .expect("Expected function, got error."))(buffer)
1669 }
1670 #[doc = " Returns the physical address of the camera buffer.\n\n Physical address is available on some platforms (certain i.MX drivers) for\n DMA operations. Not commonly used - prefer DmaBuf FD for portability.\n\n @param buffer Camera buffer from vsl_camera_get_data()\n @return Physical address, or 0 if not supported\n @since 1.3\n @memberof VSLCamera"]
1671 pub unsafe fn vsl_camera_buffer_phys_addr(&self, buffer: *const vsl_camera_buffer) -> u64 {
1672 (self
1673 .vsl_camera_buffer_phys_addr
1674 .as_ref()
1675 .expect("Expected function, got error."))(buffer)
1676 }
1677 #[doc = " Returns the length of the camera buffer in bytes.\n\n Buffer size as reported by the V4L2 driver. For multi-planar formats,\n this is the total size across all planes.\n\n @param buffer Camera buffer from vsl_camera_get_data()\n @return Buffer length in bytes\n @since 1.3\n @memberof VSLCamera"]
1678 pub unsafe fn vsl_camera_buffer_length(&self, buffer: *const vsl_camera_buffer) -> u32 {
1679 (self
1680 .vsl_camera_buffer_length
1681 .as_ref()
1682 .expect("Expected function, got error."))(buffer)
1683 }
1684 #[doc = " Returns the fourcc code of the camera buffer.\n\n Pixel format as negotiated with the driver during vsl_camera_init_device().\n\n @param buffer Camera buffer from vsl_camera_get_data()\n @return FOURCC code\n @since 1.3\n @memberof VSLCamera"]
1685 pub unsafe fn vsl_camera_buffer_fourcc(&self, buffer: *const vsl_camera_buffer) -> u32 {
1686 (self
1687 .vsl_camera_buffer_fourcc
1688 .as_ref()
1689 .expect("Expected function, got error."))(buffer)
1690 }
1691 #[doc = " Returns the V4L2-negotiated bytes-per-line for the camera buffer.\n\n Returns the exact row stride in **bytes** for plane 0 as negotiated with\n and returned by the driver. The value is captured from the `v4l2_format`\n struct populated by VIDIOC_S_FMT during `vsl_camera_init_device()` (and\n reflects any subsequent VIDIOC_G_FMT if queried later). This accounts\n for hardware alignment padding applied by the driver (e.g. Vivante/Mali\n 16-byte or 64-byte row alignment) and is correct for both single-plane\n (V4L2_BUF_TYPE_VIDEO_CAPTURE) and multi-plane\n (V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE) capture queues.\n\n For contiguous FOURCCs (NV12, YUYV, YU12 with num_planes=1) this is the\n full buffer's row stride. For non-contiguous \"M\" variants (NM12, YM12)\n it is the plane-0 (luma) stride — chroma strides are not exposed by this\n accessor and are out of scope until a multi-fd API is added.\n\n @param buffer Camera buffer from vsl_camera_get_data()\n @return Bytes-per-line (plane 0). Returns 0 if buffer is NULL.\n @since 2.4\n @memberof VSLCamera"]
1692 pub unsafe fn vsl_camera_buffer_bytes_per_line(&self, buffer: *const vsl_camera_buffer) -> u32 {
1693 (self
1694 .vsl_camera_buffer_bytes_per_line
1695 .as_ref()
1696 .expect("Expected function, got error."))(buffer)
1697 }
1698 #[doc = " Returns the capture-source frame sequence number for this buffer.\n\n Monotonic frame counter set by the capture source; increments per\n successfully delivered frame and may skip when frames are dropped by\n the driver or pipeline. Backend-neutral by design: on the V4L2\n backend this mirrors `struct v4l2_buffer::sequence` as populated by\n VIDIOC_DQBUF; a future libcamera backend would mirror\n `libcamera::FrameMetadata::sequence`.\n\n Semantics of gaps and the reset point on stream start are driver-\n and backend-specific and are not defined by this API — consult the\n underlying source's documentation before interpreting deltas. Some\n drivers (notably certain USB UVC webcams) do not populate the field\n and leave it permanently at 0; callers relying on the counter for\n drop detection should verify that consecutive reads actually\n increment before trusting the value.\n\n The counter is 32-bit and wraps at `UINT32_MAX`. At 60 fps that is\n ~2.3 years of continuous streaming. If the EdgeFirst schema's wider\n `uint64` sequence is required, the caller is responsible for\n extending this `uint32_t` across wraps.\n\n @param buffer Camera buffer from vsl_camera_get_data()\n @return Sequence number. Returns 0 if buffer is NULL (which is\n indistinguishable from a legitimate sequence of 0 — callers\n must NULL-check the buffer themselves).\n @since 2.5\n @memberof VSLCamera"]
1699 pub unsafe fn vsl_camera_buffer_sequence(&self, buffer: *const vsl_camera_buffer) -> u32 {
1700 (self
1701 .vsl_camera_buffer_sequence
1702 .as_ref()
1703 .expect("Expected function, got error."))(buffer)
1704 }
1705 #[doc = " Reads the timestamp of the camera buffer.\n\n Retrieves the capture timestamp from the V4L2 buffer. Time is relative to\n CLOCK_MONOTONIC when the frame was captured by the camera driver.\n\n @param buffer Camera buffer from vsl_camera_get_data()\n @param seconds Output pointer for timestamp seconds\n @param nanoseconds Output pointer for sub-second nanoseconds\n @since 1.3"]
1706 pub unsafe fn vsl_camera_buffer_timestamp(
1707 &self,
1708 buffer: *const vsl_camera_buffer,
1709 seconds: *mut i64,
1710 nanoseconds: *mut i64,
1711 ) {
1712 (self
1713 .vsl_camera_buffer_timestamp
1714 .as_ref()
1715 .expect("Expected function, got error."))(buffer, seconds, nanoseconds)
1716 }
1717 #[doc = " Lists the supported single-planar formats of the camera.\n\n Queries V4L2 device for available single-planar pixel formats. Call before\n vsl_camera_init_device() to determine what formats to request.\n\n @param ctx Camera context from vsl_camera_open_device()\n @param codes Array to receive fourcc codes\n @param size Size of codes array\n @return Number of formats written to codes array, or -1 on error\n @since 1.3"]
1718 pub unsafe fn vsl_camera_enum_fmts(
1719 &self,
1720 ctx: *const vsl_camera,
1721 codes: *mut u32,
1722 size: ::std::os::raw::c_int,
1723 ) -> ::std::os::raw::c_int {
1724 (self
1725 .vsl_camera_enum_fmts
1726 .as_ref()
1727 .expect("Expected function, got error."))(ctx, codes, size)
1728 }
1729 #[doc = " Lists the supported multi-planar formats of the camera.\n\n Queries V4L2 device for available multi-planar pixel formats (e.g., NV12,\n NV21 with separate Y and UV planes). Call before vsl_camera_init_device().\n\n @param ctx Camera context from vsl_camera_open_device()\n @param codes Array to receive fourcc codes\n @param size Size of codes array\n @return Number of formats written to codes array, or -1 on error\n @since 1.3"]
1730 pub unsafe fn vsl_camera_enum_mplane_fmts(
1731 &self,
1732 ctx: *const vsl_camera,
1733 codes: *mut u32,
1734 size: ::std::os::raw::c_int,
1735 ) -> ::std::os::raw::c_int {
1736 (self
1737 .vsl_camera_enum_mplane_fmts
1738 .as_ref()
1739 .expect("Expected function, got error."))(ctx, codes, size)
1740 }
1741 #[doc = " @brief Creates VSLDecoder instance\n\n Creates a hardware video decoder for H.264/H.265 using the best available\n backend (V4L2 preferred, Hantro fallback). The decoder is initialized on the\n first call to vsl_decode_frame().\n\n @param codec Codec type: VSL_DEC_H264 or VSL_DEC_HEVC\n @param fps Expected frame rate (used for buffer management)\n @return Pointer to VSLDecoder instance, or NULL on failure\n @since 1.4"]
1742 pub unsafe fn vsl_decoder_create(
1743 &self,
1744 codec: VSLDecoderCodec,
1745 fps: ::std::os::raw::c_int,
1746 ) -> *mut VSLDecoder {
1747 (self
1748 .vsl_decoder_create
1749 .as_ref()
1750 .expect("Expected function, got error."))(codec, fps)
1751 }
1752 #[doc = " @brief Creates VSLDecoder instance with explicit backend selection\n\n Creates a hardware video decoder with explicit backend selection. Use this\n when you need to force a specific backend instead of auto-detection.\n\n @param codec Codec fourcc: VSL_FOURCC('H','2','6','4') or\n VSL_FOURCC('H','E','V','C')\n @param fps Expected frame rate (used for buffer management)\n @param backend Backend to use (AUTO, HANTRO, or V4L2)\n @return Pointer to VSLDecoder instance, or NULL on failure\n @since 2.0"]
1753 pub unsafe fn vsl_decoder_create_ex(
1754 &self,
1755 codec: u32,
1756 fps: ::std::os::raw::c_int,
1757 backend: VSLCodecBackend,
1758 ) -> *mut VSLDecoder {
1759 (self
1760 .vsl_decoder_create_ex
1761 .as_ref()
1762 .expect("Expected function, got error."))(codec, fps, backend)
1763 }
1764 #[doc = " @brief Decode compressed video frame\n\n Decodes H.264/H.265 data into a raw frame using hardware acceleration.\n First call initializes the decoder. May require multiple calls to decode\n one frame (returns VSL_DEC_INIT_INFO or VSL_DEC_FRAME_DEC).\n\n @param decoder VSLDecoder instance from vsl_decoder_create()\n @param data Pointer to compressed video data\n @param data_length Length of compressed data in bytes\n @param bytes_used Output: number of bytes consumed from data\n @param output_frame Output: decoded frame (NULL if frame not yet complete)\n @return VSL_DEC_SUCCESS (frame decoded), VSL_DEC_INIT_INFO (need more calls),\n VSL_DEC_FRAME_DEC (frame in progress), or VSL_DEC_ERR (error)\n @since 1.4"]
1765 pub unsafe fn vsl_decode_frame(
1766 &self,
1767 decoder: *mut VSLDecoder,
1768 data: *const ::std::os::raw::c_void,
1769 data_length: ::std::os::raw::c_uint,
1770 bytes_used: *mut usize,
1771 output_frame: *mut *mut VSLFrame,
1772 ) -> VSLDecoderRetCode {
1773 (self
1774 .vsl_decode_frame
1775 .as_ref()
1776 .expect("Expected function, got error."))(
1777 decoder,
1778 data,
1779 data_length,
1780 bytes_used,
1781 output_frame,
1782 )
1783 }
1784 #[doc = " @brief Returns the decoded frame width\n\n Returns the width of decoded frames as determined from the stream headers.\n Only valid after decoder initialization (after first vsl_decode_frame()).\n\n @param decoder VSLDecoder instance\n @return Frame width in pixels\n @since 1.4"]
1785 pub unsafe fn vsl_decoder_width(&self, decoder: *const VSLDecoder) -> ::std::os::raw::c_int {
1786 (self
1787 .vsl_decoder_width
1788 .as_ref()
1789 .expect("Expected function, got error."))(decoder)
1790 }
1791 #[doc = " @brief Returns the decoded frame height\n\n Returns the height of decoded frames as determined from the stream headers.\n Only valid after decoder initialization (after first vsl_decode_frame()).\n\n @param decoder VSLDecoder instance\n @return Frame height in pixels\n @since 1.4"]
1792 pub unsafe fn vsl_decoder_height(&self, decoder: *const VSLDecoder) -> ::std::os::raw::c_int {
1793 (self
1794 .vsl_decoder_height
1795 .as_ref()
1796 .expect("Expected function, got error."))(decoder)
1797 }
1798 #[doc = " @brief Returns the decoder crop rectangle\n\n Returns the active video area within decoded frames, as specified in stream\n headers. Some encoded streams have padding that should be cropped.\n\n @param decoder VSLDecoder instance\n @return VSLRect with crop region (x, y, width, height)\n @since 1.4"]
1799 pub unsafe fn vsl_decoder_crop(&self, decoder: *const VSLDecoder) -> VSLRect {
1800 (self
1801 .vsl_decoder_crop
1802 .as_ref()
1803 .expect("Expected function, got error."))(decoder)
1804 }
1805 #[doc = " @brief Destroys VSLDecoder instance\n\n Frees all resources associated with the decoder, including hardware\n resources. Do not use the decoder after calling this function.\n\n @param decoder VSLDecoder instance to destroy\n @return 0 on success, -1 on error\n @since 1.4"]
1806 pub unsafe fn vsl_decoder_release(&self, decoder: *mut VSLDecoder) -> ::std::os::raw::c_int {
1807 (self
1808 .vsl_decoder_release
1809 .as_ref()
1810 .expect("Expected function, got error."))(decoder)
1811 }
1812 #[doc = " @brief Enumerates all V4L2 video devices in the system\n\n Scans `/dev/video*` and queries each device's capabilities using\n `VIDIOC_QUERYCAP`. Devices are classified by type (camera, encoder,\n decoder, etc.) based on their capabilities and supported formats.\n\n Format enumeration is performed automatically for each device.\n\n @return Device list on success (caller must free with\n vsl_v4l2_device_list_free()), or NULL on error\n @retval NULL Failed to enumerate (check errno)\n @retval errno=ENOMEM Out of memory\n @retval errno=EACCES Permission denied accessing /dev/video*\n\n @note Devices that are busy (EBUSY) or inaccessible are silently skipped.\n @note The returned list may be empty if no V4L2 devices are found.\n\n @par Example\n @code{.c}\n VSLDeviceList* list = vsl_v4l2_enumerate();\n if (list) {\n printf(\"Found %zu devices\\n\", list->count);\n for (size_t i = 0; i < list->count; i++) {\n printf(\" %s: %s\\n\", list->devices[i].path, list->devices[i].card);\n }\n vsl_v4l2_device_list_free(list);\n }\n @endcode\n\n @see vsl_v4l2_enumerate_type\n @see vsl_v4l2_device_list_free\n @since 2.2"]
1813 pub unsafe fn vsl_v4l2_enumerate(&self) -> *mut VSLDeviceList {
1814 (self
1815 .vsl_v4l2_enumerate
1816 .as_ref()
1817 .expect("Expected function, got error."))()
1818 }
1819 #[doc = " @brief Enumerates V4L2 devices filtered by type\n\n Same as vsl_v4l2_enumerate() but only returns devices matching the\n specified type mask.\n\n @param[in] type_mask Bitmask of VSLDeviceType values to include\n @return Filtered device list, or NULL on error\n\n @par Example\n @code{.c}\n // Find all encoders and decoders\n VSLDeviceList* codecs = vsl_v4l2_enumerate_type(\n VSL_V4L2_TYPE_ENCODER | VSL_V4L2_TYPE_DECODER);\n\n // Find only cameras\n VSLDeviceList* cameras = vsl_v4l2_enumerate_type(VSL_V4L2_TYPE_CAMERA);\n @endcode\n\n @see vsl_v4l2_enumerate\n @see VSLDeviceType\n @since 2.2"]
1820 pub unsafe fn vsl_v4l2_enumerate_type(&self, type_mask: VSLDeviceType) -> *mut VSLDeviceList {
1821 (self
1822 .vsl_v4l2_enumerate_type
1823 .as_ref()
1824 .expect("Expected function, got error."))(type_mask)
1825 }
1826 #[doc = " @brief Frees a device list returned by enumeration functions\n\n Releases all memory associated with the device list, including format\n and resolution arrays within each device.\n\n @param[in] list Device list to free (NULL is safe and does nothing)\n\n @since 2.2"]
1827 pub unsafe fn vsl_v4l2_device_list_free(&self, list: *mut VSLDeviceList) {
1828 (self
1829 .vsl_v4l2_device_list_free
1830 .as_ref()
1831 .expect("Expected function, got error."))(list)
1832 }
1833 #[doc = " @brief Finds the first encoder supporting a specific output codec\n\n Searches for an encoder device that can produce the specified compressed\n format (H.264, HEVC, MJPEG, etc.) on its capture queue.\n\n @param[in] codec_fourcc Output codec fourcc (e.g.,\n `VSL_FOURCC('H','2','6','4')`)\n @return Device path string on success, or NULL if not found\n\n @note The returned string points to static storage. Copy it if you need\n to keep it beyond the next call to any vsl_v4l2_find_* function.\n\n @par Example\n @code{.c}\n const char* h264_enc = vsl_v4l2_find_encoder(VSL_FOURCC('H','2','6','4'));\n const char* hevc_enc = vsl_v4l2_find_encoder(VSL_FOURCC('H','E','V','C'));\n const char* jpeg_enc = vsl_v4l2_find_encoder(VSL_FOURCC('M','J','P','G'));\n\n if (h264_enc) {\n printf(\"H.264 encoder: %s\\n\", h264_enc);\n }\n @endcode\n\n @see vsl_v4l2_find_decoder\n @since 2.2"]
1834 pub unsafe fn vsl_v4l2_find_encoder(&self, codec_fourcc: u32) -> *const ::std::os::raw::c_char {
1835 (self
1836 .vsl_v4l2_find_encoder
1837 .as_ref()
1838 .expect("Expected function, got error."))(codec_fourcc)
1839 }
1840 #[doc = " @brief Finds the first decoder supporting a specific input codec\n\n Searches for a decoder device that can accept the specified compressed\n format (H.264, HEVC, MJPEG, etc.) on its output queue.\n\n @param[in] codec_fourcc Input codec fourcc (e.g.,\n `VSL_FOURCC('H','E','V','C')`)\n @return Device path string on success, or NULL if not found\n\n @note The returned string points to static storage. Copy it if you need\n to keep it beyond the next call to any vsl_v4l2_find_* function.\n\n @see vsl_v4l2_find_encoder\n @since 2.2"]
1841 pub unsafe fn vsl_v4l2_find_decoder(&self, codec_fourcc: u32) -> *const ::std::os::raw::c_char {
1842 (self
1843 .vsl_v4l2_find_decoder
1844 .as_ref()
1845 .expect("Expected function, got error."))(codec_fourcc)
1846 }
1847 #[doc = " @brief Finds the first camera supporting a specific pixel format\n\n Searches for a capture device that supports the specified pixel format.\n\n @param[in] format_fourcc Pixel format fourcc (e.g.,\n `VSL_FOURCC('N','V','1','2')`)\n @return Device path string on success, or NULL if not found\n\n @par Example\n @code{.c}\n const char* nv12_cam = vsl_v4l2_find_camera(VSL_FOURCC('N','V','1','2'));\n const char* yuyv_cam = vsl_v4l2_find_camera(VSL_FOURCC('Y','U','Y','V'));\n @endcode\n\n @see vsl_v4l2_find_camera_with_resolution\n @since 2.2"]
1848 pub unsafe fn vsl_v4l2_find_camera(&self, format_fourcc: u32) -> *const ::std::os::raw::c_char {
1849 (self
1850 .vsl_v4l2_find_camera
1851 .as_ref()
1852 .expect("Expected function, got error."))(format_fourcc)
1853 }
1854 #[doc = " @brief Finds a camera supporting specific format and minimum resolution\n\n Searches for a capture device that supports the specified pixel format\n at the given minimum resolution or higher.\n\n @param[in] format_fourcc Pixel format fourcc\n @param[in] width Minimum width in pixels (0 for any)\n @param[in] height Minimum height in pixels (0 for any)\n @return Device path string on success, or NULL if not found\n\n @par Example\n @code{.c}\n // Find 1080p NV12 camera\n const char* cam = vsl_v4l2_find_camera_with_resolution(\n VSL_FOURCC('N','V','1','2'), 1920, 1080);\n @endcode\n\n @see vsl_v4l2_find_camera\n @since 2.2"]
1855 pub unsafe fn vsl_v4l2_find_camera_with_resolution(
1856 &self,
1857 format_fourcc: u32,
1858 width: u32,
1859 height: u32,
1860 ) -> *const ::std::os::raw::c_char {
1861 (self
1862 .vsl_v4l2_find_camera_with_resolution
1863 .as_ref()
1864 .expect("Expected function, got error."))(format_fourcc, width, height)
1865 }
1866 #[doc = " @brief Enumerates supported formats for a device\n\n Populates the device's capture_formats and/or output_formats arrays\n by querying the device with `VIDIOC_ENUM_FMT`.\n\n @param[in,out] device Device to enumerate formats for (modified in place)\n @return 0 on success, -1 on error\n @retval 0 Success\n @retval -1 Error (check errno)\n @retval errno=EBADF Device is not open\n @retval errno=ENOMEM Out of memory\n\n @note This is called automatically by vsl_v4l2_enumerate(). You only need\n to call this if you want to refresh format information.\n\n @since 2.2"]
1867 pub unsafe fn vsl_v4l2_device_enum_formats(
1868 &self,
1869 device: *mut VSLDevice,
1870 ) -> ::std::os::raw::c_int {
1871 (self
1872 .vsl_v4l2_device_enum_formats
1873 .as_ref()
1874 .expect("Expected function, got error."))(device)
1875 }
1876 #[doc = " @brief Enumerates supported resolutions for a format\n\n Queries the device for supported resolutions of the specified pixel format\n using `VIDIOC_ENUM_FRAMESIZES`.\n\n @param[in] device Device to query\n @param[in] fourcc Pixel format to enumerate resolutions for\n @param[out] count Number of resolutions found (output parameter)\n @return Array of resolutions on success (caller must free), or NULL if none\n\n @par Example\n @code{.c}\n size_t count;\n VSLResolution* res = vsl_v4l2_enum_resolutions(device,\n VSL_FOURCC('N','V','1','2'), &count);\n if (res) {\n for (size_t i = 0; i < count; i++) {\n printf(\" %ux%u\\n\", res[i].width, res[i].height);\n }\n free(res);\n }\n @endcode\n\n @since 2.2"]
1877 pub unsafe fn vsl_v4l2_enum_resolutions(
1878 &self,
1879 device: *const VSLDevice,
1880 fourcc: u32,
1881 count: *mut usize,
1882 ) -> *mut VSLResolution {
1883 (self
1884 .vsl_v4l2_enum_resolutions
1885 .as_ref()
1886 .expect("Expected function, got error."))(device, fourcc, count)
1887 }
1888 #[doc = " @brief Checks if a device supports a specific pixel format\n\n @param[in] device Device to check\n @param[in] fourcc Pixel format fourcc to look for\n @param[in] capture True to check capture formats, false for output formats\n @return true if format is supported, false otherwise\n\n @since 2.2"]
1889 pub unsafe fn vsl_v4l2_device_supports_format(
1890 &self,
1891 device: *const VSLDevice,
1892 fourcc: u32,
1893 capture: bool,
1894 ) -> bool {
1895 (self
1896 .vsl_v4l2_device_supports_format
1897 .as_ref()
1898 .expect("Expected function, got error."))(device, fourcc, capture)
1899 }
1900 #[doc = " @brief Allocates a buffer backed by DMA heap for use with V4L2 USERPTR\n\n This function allocates a buffer from the Linux DMA heap\n (`/dev/dma_heap/system`) that can be used with V4L2 USERPTR mode while\n remaining DMA-capable.\n\n This is useful for cameras that support USERPTR but not DMABUF export.\n By allocating the userptr buffer from DMA heap, the buffer can still be\n used zero-copy with downstream components that require DMA-capable memory\n (hardware encoders, display controllers, etc.).\n\n @param[in] size Size of buffer to allocate in bytes\n @param[out] dma_fd Output: DMA buffer file descriptor for downstream use\n @return Mapped buffer pointer on success, or NULL on error\n @retval NULL Failed to allocate (check errno)\n @retval errno=ENOMEM Out of memory\n @retval errno=ENOENT DMA heap device not found\n @retval errno=EACCES Permission denied\n\n @note Caller must free with vsl_v4l2_free_userptr()\n @note The returned pointer can be passed to V4L2 USERPTR operations\n @note The dma_fd can be passed to encoders/displays that accept DMABUF\n\n @par Example\n @code{.c}\n int dma_fd;\n size_t size = 1920 * 1080 * 3 / 2; // NV12 buffer\n void* ptr = vsl_v4l2_alloc_userptr(size, &dma_fd);\n if (ptr) {\n // Use ptr with V4L2 USERPTR for camera capture\n // Use dma_fd with encoder DMABUF import\n vsl_v4l2_free_userptr(ptr, size, dma_fd);\n }\n @endcode\n\n @see vsl_v4l2_free_userptr\n @since 2.2"]
1901 pub unsafe fn vsl_v4l2_alloc_userptr(
1902 &self,
1903 size: usize,
1904 dma_fd: *mut ::std::os::raw::c_int,
1905 ) -> *mut ::std::os::raw::c_void {
1906 (self
1907 .vsl_v4l2_alloc_userptr
1908 .as_ref()
1909 .expect("Expected function, got error."))(size, dma_fd)
1910 }
1911 #[doc = " @brief Frees a buffer allocated by vsl_v4l2_alloc_userptr()\n\n Unmaps the buffer and closes the DMA buffer file descriptor.\n\n @param[in] ptr Buffer pointer returned by vsl_v4l2_alloc_userptr()\n @param[in] size Size that was passed to vsl_v4l2_alloc_userptr()\n @param[in] dma_fd DMA fd that was returned by vsl_v4l2_alloc_userptr()\n\n @see vsl_v4l2_alloc_userptr\n @since 2.2"]
1912 pub unsafe fn vsl_v4l2_free_userptr(
1913 &self,
1914 ptr: *mut ::std::os::raw::c_void,
1915 size: usize,
1916 dma_fd: ::std::os::raw::c_int,
1917 ) {
1918 (self
1919 .vsl_v4l2_free_userptr
1920 .as_ref()
1921 .expect("Expected function, got error."))(ptr, size, dma_fd)
1922 }
1923 #[doc = " @brief Gets human-readable name for a device type\n\n @param[in] type Device type\n @return Static string (e.g., \"Camera\", \"Encoder\", \"Decoder\", \"ISP\")\n\n @since 2.2"]
1924 pub unsafe fn vsl_v4l2_device_type_name(
1925 &self,
1926 type_: VSLDeviceType,
1927 ) -> *const ::std::os::raw::c_char {
1928 (self
1929 .vsl_v4l2_device_type_name
1930 .as_ref()
1931 .expect("Expected function, got error."))(type_)
1932 }
1933 #[doc = " @brief Checks if a fourcc code represents a compressed video format\n\n Returns true for compressed formats including H.264, HEVC, VP8, VP9,\n MPEG-1/2/4, MJPEG, and JPEG.\n\n @param[in] fourcc Pixel format fourcc code\n @return true if compressed format, false if raw format\n\n @since 2.2"]
1934 pub unsafe fn vsl_v4l2_is_compressed_format(&self, fourcc: u32) -> bool {
1935 (self
1936 .vsl_v4l2_is_compressed_format
1937 .as_ref()
1938 .expect("Expected function, got error."))(fourcc)
1939 }
1940 #[doc = " @brief Converts a fourcc code to a printable 4-character string\n\n @param[in] fourcc Fourcc code to convert\n @param[out] buf Output buffer (must be at least 5 bytes for null\n terminator)\n @return buf pointer for convenience\n\n @par Example\n @code{.c}\n char buf[5];\n printf(\"Format: %s\\n\", vsl_v4l2_fourcc_to_string(VSL_FOURCC('N','V','1','2'),\n buf));\n // Output: Format: NV12\n @endcode\n\n @since 2.2"]
1941 pub unsafe fn vsl_v4l2_fourcc_to_string(
1942 &self,
1943 fourcc: u32,
1944 buf: *mut ::std::os::raw::c_char,
1945 ) -> *mut ::std::os::raw::c_char {
1946 (self
1947 .vsl_v4l2_fourcc_to_string
1948 .as_ref()
1949 .expect("Expected function, got error."))(fourcc, buf)
1950 }
1951}