1pub const VSL_VERSION: &[u8; 6] = b"2.4.0\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 vsi_v4l2 mem2mem driver. Provides:\n - 37-56x faster decode performance\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_buffer_mmap: Result<
594 unsafe extern "C" fn(buffer: *mut vsl_camera_buffer) -> *mut ::std::os::raw::c_void,
595 ::libloading::Error,
596 >,
597 pub vsl_camera_buffer_dma_fd: Result<
598 unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> ::std::os::raw::c_int,
599 ::libloading::Error,
600 >,
601 pub vsl_camera_buffer_phys_addr:
602 Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u64, ::libloading::Error>,
603 pub vsl_camera_buffer_length:
604 Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, ::libloading::Error>,
605 pub vsl_camera_buffer_fourcc:
606 Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, ::libloading::Error>,
607 pub vsl_camera_buffer_bytes_per_line:
608 Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, ::libloading::Error>,
609 pub vsl_camera_buffer_timestamp: Result<
610 unsafe extern "C" fn(
611 buffer: *const vsl_camera_buffer,
612 seconds: *mut i64,
613 nanoseconds: *mut i64,
614 ),
615 ::libloading::Error,
616 >,
617 pub vsl_camera_enum_fmts: Result<
618 unsafe extern "C" fn(
619 ctx: *const vsl_camera,
620 codes: *mut u32,
621 size: ::std::os::raw::c_int,
622 ) -> ::std::os::raw::c_int,
623 ::libloading::Error,
624 >,
625 pub vsl_camera_enum_mplane_fmts: Result<
626 unsafe extern "C" fn(
627 ctx: *const vsl_camera,
628 codes: *mut u32,
629 size: ::std::os::raw::c_int,
630 ) -> ::std::os::raw::c_int,
631 ::libloading::Error,
632 >,
633 pub vsl_decoder_create: Result<
634 unsafe extern "C" fn(codec: VSLDecoderCodec, fps: ::std::os::raw::c_int) -> *mut VSLDecoder,
635 ::libloading::Error,
636 >,
637 pub vsl_decoder_create_ex: Result<
638 unsafe extern "C" fn(
639 codec: u32,
640 fps: ::std::os::raw::c_int,
641 backend: VSLCodecBackend,
642 ) -> *mut VSLDecoder,
643 ::libloading::Error,
644 >,
645 pub vsl_decode_frame: Result<
646 unsafe extern "C" fn(
647 decoder: *mut VSLDecoder,
648 data: *const ::std::os::raw::c_void,
649 data_length: ::std::os::raw::c_uint,
650 bytes_used: *mut usize,
651 output_frame: *mut *mut VSLFrame,
652 ) -> VSLDecoderRetCode,
653 ::libloading::Error,
654 >,
655 pub vsl_decoder_width: Result<
656 unsafe extern "C" fn(decoder: *const VSLDecoder) -> ::std::os::raw::c_int,
657 ::libloading::Error,
658 >,
659 pub vsl_decoder_height: Result<
660 unsafe extern "C" fn(decoder: *const VSLDecoder) -> ::std::os::raw::c_int,
661 ::libloading::Error,
662 >,
663 pub vsl_decoder_crop:
664 Result<unsafe extern "C" fn(decoder: *const VSLDecoder) -> VSLRect, ::libloading::Error>,
665 pub vsl_decoder_release: Result<
666 unsafe extern "C" fn(decoder: *mut VSLDecoder) -> ::std::os::raw::c_int,
667 ::libloading::Error,
668 >,
669 pub vsl_v4l2_enumerate:
670 Result<unsafe extern "C" fn() -> *mut VSLDeviceList, ::libloading::Error>,
671 pub vsl_v4l2_enumerate_type: Result<
672 unsafe extern "C" fn(type_mask: VSLDeviceType) -> *mut VSLDeviceList,
673 ::libloading::Error,
674 >,
675 pub vsl_v4l2_device_list_free:
676 Result<unsafe extern "C" fn(list: *mut VSLDeviceList), ::libloading::Error>,
677 pub vsl_v4l2_find_encoder: Result<
678 unsafe extern "C" fn(codec_fourcc: u32) -> *const ::std::os::raw::c_char,
679 ::libloading::Error,
680 >,
681 pub vsl_v4l2_find_decoder: Result<
682 unsafe extern "C" fn(codec_fourcc: u32) -> *const ::std::os::raw::c_char,
683 ::libloading::Error,
684 >,
685 pub vsl_v4l2_find_camera: Result<
686 unsafe extern "C" fn(format_fourcc: u32) -> *const ::std::os::raw::c_char,
687 ::libloading::Error,
688 >,
689 pub vsl_v4l2_find_camera_with_resolution: Result<
690 unsafe extern "C" fn(
691 format_fourcc: u32,
692 width: u32,
693 height: u32,
694 ) -> *const ::std::os::raw::c_char,
695 ::libloading::Error,
696 >,
697 pub vsl_v4l2_device_enum_formats: Result<
698 unsafe extern "C" fn(device: *mut VSLDevice) -> ::std::os::raw::c_int,
699 ::libloading::Error,
700 >,
701 pub vsl_v4l2_enum_resolutions: Result<
702 unsafe extern "C" fn(
703 device: *const VSLDevice,
704 fourcc: u32,
705 count: *mut usize,
706 ) -> *mut VSLResolution,
707 ::libloading::Error,
708 >,
709 pub vsl_v4l2_device_supports_format: Result<
710 unsafe extern "C" fn(device: *const VSLDevice, fourcc: u32, capture: bool) -> bool,
711 ::libloading::Error,
712 >,
713 pub vsl_v4l2_alloc_userptr: Result<
714 unsafe extern "C" fn(
715 size: usize,
716 dma_fd: *mut ::std::os::raw::c_int,
717 ) -> *mut ::std::os::raw::c_void,
718 ::libloading::Error,
719 >,
720 pub vsl_v4l2_free_userptr: Result<
721 unsafe extern "C" fn(
722 ptr: *mut ::std::os::raw::c_void,
723 size: usize,
724 dma_fd: ::std::os::raw::c_int,
725 ),
726 ::libloading::Error,
727 >,
728 pub vsl_v4l2_device_type_name: Result<
729 unsafe extern "C" fn(type_: VSLDeviceType) -> *const ::std::os::raw::c_char,
730 ::libloading::Error,
731 >,
732 pub vsl_v4l2_is_compressed_format:
733 Result<unsafe extern "C" fn(fourcc: u32) -> bool, ::libloading::Error>,
734 pub vsl_v4l2_fourcc_to_string: Result<
735 unsafe extern "C" fn(
736 fourcc: u32,
737 buf: *mut ::std::os::raw::c_char,
738 ) -> *mut ::std::os::raw::c_char,
739 ::libloading::Error,
740 >,
741}
742impl VideoStreamLibrary {
743 pub unsafe fn new<P>(path: P) -> Result<Self, ::libloading::Error>
744 where
745 P: ::libloading::AsFilename,
746 {
747 let library = ::libloading::Library::new(path)?;
748 Self::from_library(library)
749 }
750 pub unsafe fn from_library<L>(library: L) -> Result<Self, ::libloading::Error>
751 where
752 L: Into<::libloading::Library>,
753 {
754 let __library = library.into();
755 let vsl_version = __library.get(b"vsl_version\0").map(|sym| *sym);
756 let vsl_timestamp = __library.get(b"vsl_timestamp\0").map(|sym| *sym);
757 let vsl_host_init = __library.get(b"vsl_host_init\0").map(|sym| *sym);
758 let vsl_host_release = __library.get(b"vsl_host_release\0").map(|sym| *sym);
759 let vsl_host_path = __library.get(b"vsl_host_path\0").map(|sym| *sym);
760 let vsl_host_poll = __library.get(b"vsl_host_poll\0").map(|sym| *sym);
761 let vsl_host_service = __library.get(b"vsl_host_service\0").map(|sym| *sym);
762 let vsl_host_process = __library.get(b"vsl_host_process\0").map(|sym| *sym);
763 let vsl_host_sockets = __library.get(b"vsl_host_sockets\0").map(|sym| *sym);
764 let vsl_host_post = __library.get(b"vsl_host_post\0").map(|sym| *sym);
765 let vsl_host_drop = __library.get(b"vsl_host_drop\0").map(|sym| *sym);
766 let vsl_client_init = __library.get(b"vsl_client_init\0").map(|sym| *sym);
767 let vsl_client_release = __library.get(b"vsl_client_release\0").map(|sym| *sym);
768 let vsl_client_disconnect = __library.get(b"vsl_client_disconnect\0").map(|sym| *sym);
769 let vsl_client_userptr = __library.get(b"vsl_client_userptr\0").map(|sym| *sym);
770 let vsl_client_path = __library.get(b"vsl_client_path\0").map(|sym| *sym);
771 let vsl_client_set_timeout = __library.get(b"vsl_client_set_timeout\0").map(|sym| *sym);
772 let vsl_frame_register = __library.get(b"vsl_frame_register\0").map(|sym| *sym);
773 let vsl_frame_init = __library.get(b"vsl_frame_init\0").map(|sym| *sym);
774 let vsl_frame_alloc = __library.get(b"vsl_frame_alloc\0").map(|sym| *sym);
775 let vsl_frame_unalloc = __library.get(b"vsl_frame_unalloc\0").map(|sym| *sym);
776 let vsl_frame_attach = __library.get(b"vsl_frame_attach\0").map(|sym| *sym);
777 let vsl_frame_path = __library.get(b"vsl_frame_path\0").map(|sym| *sym);
778 let vsl_frame_unregister = __library.get(b"vsl_frame_unregister\0").map(|sym| *sym);
779 let vsl_frame_copy = __library.get(b"vsl_frame_copy\0").map(|sym| *sym);
780 let vsl_frame_userptr = __library.get(b"vsl_frame_userptr\0").map(|sym| *sym);
781 let vsl_frame_set_userptr = __library.get(b"vsl_frame_set_userptr\0").map(|sym| *sym);
782 let vsl_frame_wait = __library.get(b"vsl_frame_wait\0").map(|sym| *sym);
783 let vsl_frame_release = __library.get(b"vsl_frame_release\0").map(|sym| *sym);
784 let vsl_frame_trylock = __library.get(b"vsl_frame_trylock\0").map(|sym| *sym);
785 let vsl_frame_unlock = __library.get(b"vsl_frame_unlock\0").map(|sym| *sym);
786 let vsl_frame_serial = __library.get(b"vsl_frame_serial\0").map(|sym| *sym);
787 let vsl_frame_timestamp = __library.get(b"vsl_frame_timestamp\0").map(|sym| *sym);
788 let vsl_frame_duration = __library.get(b"vsl_frame_duration\0").map(|sym| *sym);
789 let vsl_frame_pts = __library.get(b"vsl_frame_pts\0").map(|sym| *sym);
790 let vsl_frame_dts = __library.get(b"vsl_frame_dts\0").map(|sym| *sym);
791 let vsl_frame_expires = __library.get(b"vsl_frame_expires\0").map(|sym| *sym);
792 let vsl_frame_fourcc = __library.get(b"vsl_frame_fourcc\0").map(|sym| *sym);
793 let vsl_frame_width = __library.get(b"vsl_frame_width\0").map(|sym| *sym);
794 let vsl_frame_height = __library.get(b"vsl_frame_height\0").map(|sym| *sym);
795 let vsl_frame_stride = __library.get(b"vsl_frame_stride\0").map(|sym| *sym);
796 let vsl_frame_size = __library.get(b"vsl_frame_size\0").map(|sym| *sym);
797 let vsl_frame_handle = __library.get(b"vsl_frame_handle\0").map(|sym| *sym);
798 let vsl_frame_paddr = __library.get(b"vsl_frame_paddr\0").map(|sym| *sym);
799 let vsl_frame_mmap = __library.get(b"vsl_frame_mmap\0").map(|sym| *sym);
800 let vsl_frame_munmap = __library.get(b"vsl_frame_munmap\0").map(|sym| *sym);
801 let vsl_frame_sync = __library.get(b"vsl_frame_sync\0").map(|sym| *sym);
802 let vsl_fourcc_from_string = __library.get(b"vsl_fourcc_from_string\0").map(|sym| *sym);
803 let vsl_encoder_create = __library.get(b"vsl_encoder_create\0").map(|sym| *sym);
804 let vsl_encoder_create_ex = __library.get(b"vsl_encoder_create_ex\0").map(|sym| *sym);
805 let vsl_encoder_release = __library.get(b"vsl_encoder_release\0").map(|sym| *sym);
806 let vsl_encode_frame = __library.get(b"vsl_encode_frame\0").map(|sym| *sym);
807 let vsl_encoder_new_output_frame = __library
808 .get(b"vsl_encoder_new_output_frame\0")
809 .map(|sym| *sym);
810 let vsl_camera_open_device = __library.get(b"vsl_camera_open_device\0").map(|sym| *sym);
811 let vsl_camera_init_device = __library.get(b"vsl_camera_init_device\0").map(|sym| *sym);
812 let vsl_camera_mirror = __library.get(b"vsl_camera_mirror\0").map(|sym| *sym);
813 let vsl_camera_mirror_v = __library.get(b"vsl_camera_mirror_v\0").map(|sym| *sym);
814 let vsl_camera_start_capturing = __library
815 .get(b"vsl_camera_start_capturing\0")
816 .map(|sym| *sym);
817 let vsl_camera_get_data = __library.get(b"vsl_camera_get_data\0").map(|sym| *sym);
818 let vsl_camera_release_buffer = __library
819 .get(b"vsl_camera_release_buffer\0")
820 .map(|sym| *sym);
821 let vsl_camera_stop_capturing = __library
822 .get(b"vsl_camera_stop_capturing\0")
823 .map(|sym| *sym);
824 let vsl_camera_uninit_device = __library.get(b"vsl_camera_uninit_device\0").map(|sym| *sym);
825 let vsl_camera_close_device = __library.get(b"vsl_camera_close_device\0").map(|sym| *sym);
826 let vsl_camera_is_dmabuf_supported = __library
827 .get(b"vsl_camera_is_dmabuf_supported\0")
828 .map(|sym| *sym);
829 let vsl_camera_get_queued_buf_count = __library
830 .get(b"vsl_camera_get_queued_buf_count\0")
831 .map(|sym| *sym);
832 let vsl_camera_buffer_mmap = __library.get(b"vsl_camera_buffer_mmap\0").map(|sym| *sym);
833 let vsl_camera_buffer_dma_fd = __library.get(b"vsl_camera_buffer_dma_fd\0").map(|sym| *sym);
834 let vsl_camera_buffer_phys_addr = __library
835 .get(b"vsl_camera_buffer_phys_addr\0")
836 .map(|sym| *sym);
837 let vsl_camera_buffer_length = __library.get(b"vsl_camera_buffer_length\0").map(|sym| *sym);
838 let vsl_camera_buffer_fourcc = __library.get(b"vsl_camera_buffer_fourcc\0").map(|sym| *sym);
839 let vsl_camera_buffer_bytes_per_line = __library
840 .get(b"vsl_camera_buffer_bytes_per_line\0")
841 .map(|sym| *sym);
842 let vsl_camera_buffer_timestamp = __library
843 .get(b"vsl_camera_buffer_timestamp\0")
844 .map(|sym| *sym);
845 let vsl_camera_enum_fmts = __library.get(b"vsl_camera_enum_fmts\0").map(|sym| *sym);
846 let vsl_camera_enum_mplane_fmts = __library
847 .get(b"vsl_camera_enum_mplane_fmts\0")
848 .map(|sym| *sym);
849 let vsl_decoder_create = __library.get(b"vsl_decoder_create\0").map(|sym| *sym);
850 let vsl_decoder_create_ex = __library.get(b"vsl_decoder_create_ex\0").map(|sym| *sym);
851 let vsl_decode_frame = __library.get(b"vsl_decode_frame\0").map(|sym| *sym);
852 let vsl_decoder_width = __library.get(b"vsl_decoder_width\0").map(|sym| *sym);
853 let vsl_decoder_height = __library.get(b"vsl_decoder_height\0").map(|sym| *sym);
854 let vsl_decoder_crop = __library.get(b"vsl_decoder_crop\0").map(|sym| *sym);
855 let vsl_decoder_release = __library.get(b"vsl_decoder_release\0").map(|sym| *sym);
856 let vsl_v4l2_enumerate = __library.get(b"vsl_v4l2_enumerate\0").map(|sym| *sym);
857 let vsl_v4l2_enumerate_type = __library.get(b"vsl_v4l2_enumerate_type\0").map(|sym| *sym);
858 let vsl_v4l2_device_list_free = __library
859 .get(b"vsl_v4l2_device_list_free\0")
860 .map(|sym| *sym);
861 let vsl_v4l2_find_encoder = __library.get(b"vsl_v4l2_find_encoder\0").map(|sym| *sym);
862 let vsl_v4l2_find_decoder = __library.get(b"vsl_v4l2_find_decoder\0").map(|sym| *sym);
863 let vsl_v4l2_find_camera = __library.get(b"vsl_v4l2_find_camera\0").map(|sym| *sym);
864 let vsl_v4l2_find_camera_with_resolution = __library
865 .get(b"vsl_v4l2_find_camera_with_resolution\0")
866 .map(|sym| *sym);
867 let vsl_v4l2_device_enum_formats = __library
868 .get(b"vsl_v4l2_device_enum_formats\0")
869 .map(|sym| *sym);
870 let vsl_v4l2_enum_resolutions = __library
871 .get(b"vsl_v4l2_enum_resolutions\0")
872 .map(|sym| *sym);
873 let vsl_v4l2_device_supports_format = __library
874 .get(b"vsl_v4l2_device_supports_format\0")
875 .map(|sym| *sym);
876 let vsl_v4l2_alloc_userptr = __library.get(b"vsl_v4l2_alloc_userptr\0").map(|sym| *sym);
877 let vsl_v4l2_free_userptr = __library.get(b"vsl_v4l2_free_userptr\0").map(|sym| *sym);
878 let vsl_v4l2_device_type_name = __library
879 .get(b"vsl_v4l2_device_type_name\0")
880 .map(|sym| *sym);
881 let vsl_v4l2_is_compressed_format = __library
882 .get(b"vsl_v4l2_is_compressed_format\0")
883 .map(|sym| *sym);
884 let vsl_v4l2_fourcc_to_string = __library
885 .get(b"vsl_v4l2_fourcc_to_string\0")
886 .map(|sym| *sym);
887 Ok(VideoStreamLibrary {
888 __library,
889 vsl_version,
890 vsl_timestamp,
891 vsl_host_init,
892 vsl_host_release,
893 vsl_host_path,
894 vsl_host_poll,
895 vsl_host_service,
896 vsl_host_process,
897 vsl_host_sockets,
898 vsl_host_post,
899 vsl_host_drop,
900 vsl_client_init,
901 vsl_client_release,
902 vsl_client_disconnect,
903 vsl_client_userptr,
904 vsl_client_path,
905 vsl_client_set_timeout,
906 vsl_frame_register,
907 vsl_frame_init,
908 vsl_frame_alloc,
909 vsl_frame_unalloc,
910 vsl_frame_attach,
911 vsl_frame_path,
912 vsl_frame_unregister,
913 vsl_frame_copy,
914 vsl_frame_userptr,
915 vsl_frame_set_userptr,
916 vsl_frame_wait,
917 vsl_frame_release,
918 vsl_frame_trylock,
919 vsl_frame_unlock,
920 vsl_frame_serial,
921 vsl_frame_timestamp,
922 vsl_frame_duration,
923 vsl_frame_pts,
924 vsl_frame_dts,
925 vsl_frame_expires,
926 vsl_frame_fourcc,
927 vsl_frame_width,
928 vsl_frame_height,
929 vsl_frame_stride,
930 vsl_frame_size,
931 vsl_frame_handle,
932 vsl_frame_paddr,
933 vsl_frame_mmap,
934 vsl_frame_munmap,
935 vsl_frame_sync,
936 vsl_fourcc_from_string,
937 vsl_encoder_create,
938 vsl_encoder_create_ex,
939 vsl_encoder_release,
940 vsl_encode_frame,
941 vsl_encoder_new_output_frame,
942 vsl_camera_open_device,
943 vsl_camera_init_device,
944 vsl_camera_mirror,
945 vsl_camera_mirror_v,
946 vsl_camera_start_capturing,
947 vsl_camera_get_data,
948 vsl_camera_release_buffer,
949 vsl_camera_stop_capturing,
950 vsl_camera_uninit_device,
951 vsl_camera_close_device,
952 vsl_camera_is_dmabuf_supported,
953 vsl_camera_get_queued_buf_count,
954 vsl_camera_buffer_mmap,
955 vsl_camera_buffer_dma_fd,
956 vsl_camera_buffer_phys_addr,
957 vsl_camera_buffer_length,
958 vsl_camera_buffer_fourcc,
959 vsl_camera_buffer_bytes_per_line,
960 vsl_camera_buffer_timestamp,
961 vsl_camera_enum_fmts,
962 vsl_camera_enum_mplane_fmts,
963 vsl_decoder_create,
964 vsl_decoder_create_ex,
965 vsl_decode_frame,
966 vsl_decoder_width,
967 vsl_decoder_height,
968 vsl_decoder_crop,
969 vsl_decoder_release,
970 vsl_v4l2_enumerate,
971 vsl_v4l2_enumerate_type,
972 vsl_v4l2_device_list_free,
973 vsl_v4l2_find_encoder,
974 vsl_v4l2_find_decoder,
975 vsl_v4l2_find_camera,
976 vsl_v4l2_find_camera_with_resolution,
977 vsl_v4l2_device_enum_formats,
978 vsl_v4l2_enum_resolutions,
979 vsl_v4l2_device_supports_format,
980 vsl_v4l2_alloc_userptr,
981 vsl_v4l2_free_userptr,
982 vsl_v4l2_device_type_name,
983 vsl_v4l2_is_compressed_format,
984 vsl_v4l2_fourcc_to_string,
985 })
986 }
987 #[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"]
988 pub unsafe fn vsl_version(&self) -> *const ::std::os::raw::c_char {
989 (self
990 .vsl_version
991 .as_ref()
992 .expect("Expected function, got error."))()
993 }
994 #[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"]
995 pub unsafe fn vsl_timestamp(&self) -> i64 {
996 (self
997 .vsl_timestamp
998 .as_ref()
999 .expect("Expected function, got error."))()
1000 }
1001 #[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"]
1002 pub unsafe fn vsl_host_init(&self, path: *const ::std::os::raw::c_char) -> *mut VSLHost {
1003 (self
1004 .vsl_host_init
1005 .as_ref()
1006 .expect("Expected function, got error."))(path)
1007 }
1008 #[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"]
1009 pub unsafe fn vsl_host_release(&self, host: *mut VSLHost) {
1010 (self
1011 .vsl_host_release
1012 .as_ref()
1013 .expect("Expected function, got error."))(host)
1014 }
1015 #[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"]
1016 pub unsafe fn vsl_host_path(&self, host: *const VSLHost) -> *const ::std::os::raw::c_char {
1017 (self
1018 .vsl_host_path
1019 .as_ref()
1020 .expect("Expected function, got error."))(host)
1021 }
1022 #[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"]
1023 pub unsafe fn vsl_host_poll(&self, host: *mut VSLHost, wait: i64) -> ::std::os::raw::c_int {
1024 (self
1025 .vsl_host_poll
1026 .as_ref()
1027 .expect("Expected function, got error."))(host, wait)
1028 }
1029 #[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"]
1030 pub unsafe fn vsl_host_service(
1031 &self,
1032 host: *mut VSLHost,
1033 sock: ::std::os::raw::c_int,
1034 ) -> ::std::os::raw::c_int {
1035 (self
1036 .vsl_host_service
1037 .as_ref()
1038 .expect("Expected function, got error."))(host, sock)
1039 }
1040 #[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"]
1041 pub unsafe fn vsl_host_process(&self, host: *mut VSLHost) -> ::std::os::raw::c_int {
1042 (self
1043 .vsl_host_process
1044 .as_ref()
1045 .expect("Expected function, got error."))(host)
1046 }
1047 #[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"]
1048 pub unsafe fn vsl_host_sockets(
1049 &self,
1050 host: *mut VSLHost,
1051 n_sockets: usize,
1052 sockets: *mut ::std::os::raw::c_int,
1053 max_sockets: *mut usize,
1054 ) -> ::std::os::raw::c_int {
1055 (self
1056 .vsl_host_sockets
1057 .as_ref()
1058 .expect("Expected function, got error."))(host, n_sockets, sockets, max_sockets)
1059 }
1060 #[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"]
1061 pub unsafe fn vsl_host_post(
1062 &self,
1063 host: *mut VSLHost,
1064 frame: *mut VSLFrame,
1065 expires: i64,
1066 duration: i64,
1067 pts: i64,
1068 dts: i64,
1069 ) -> ::std::os::raw::c_int {
1070 (self
1071 .vsl_host_post
1072 .as_ref()
1073 .expect("Expected function, got error."))(
1074 host, frame, expires, duration, pts, dts
1075 )
1076 }
1077 #[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"]
1078 pub unsafe fn vsl_host_drop(
1079 &self,
1080 host: *mut VSLHost,
1081 frame: *mut VSLFrame,
1082 ) -> ::std::os::raw::c_int {
1083 (self
1084 .vsl_host_drop
1085 .as_ref()
1086 .expect("Expected function, got error."))(host, frame)
1087 }
1088 #[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"]
1089 pub unsafe fn vsl_client_init(
1090 &self,
1091 path: *const ::std::os::raw::c_char,
1092 userptr: *mut ::std::os::raw::c_void,
1093 reconnect: bool,
1094 ) -> *mut VSLClient {
1095 (self
1096 .vsl_client_init
1097 .as_ref()
1098 .expect("Expected function, got error."))(path, userptr, reconnect)
1099 }
1100 #[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"]
1101 pub unsafe fn vsl_client_release(&self, client: *mut VSLClient) {
1102 (self
1103 .vsl_client_release
1104 .as_ref()
1105 .expect("Expected function, got error."))(client)
1106 }
1107 #[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"]
1108 pub unsafe fn vsl_client_disconnect(&self, client: *mut VSLClient) {
1109 (self
1110 .vsl_client_disconnect
1111 .as_ref()
1112 .expect("Expected function, got error."))(client)
1113 }
1114 #[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"]
1115 pub unsafe fn vsl_client_userptr(&self, client: *mut VSLClient) -> *mut ::std::os::raw::c_void {
1116 (self
1117 .vsl_client_userptr
1118 .as_ref()
1119 .expect("Expected function, got error."))(client)
1120 }
1121 #[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"]
1122 pub unsafe fn vsl_client_path(
1123 &self,
1124 client: *const VSLClient,
1125 ) -> *const ::std::os::raw::c_char {
1126 (self
1127 .vsl_client_path
1128 .as_ref()
1129 .expect("Expected function, got error."))(client)
1130 }
1131 #[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"]
1132 pub unsafe fn vsl_client_set_timeout(&self, client: *mut VSLClient, timeout: f32) {
1133 (self
1134 .vsl_client_set_timeout
1135 .as_ref()
1136 .expect("Expected function, got error."))(client, timeout)
1137 }
1138 #[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"]
1139 pub unsafe fn vsl_frame_register(
1140 &self,
1141 host: *mut VSLHost,
1142 serial: i64,
1143 handle: ::std::os::raw::c_int,
1144 width: ::std::os::raw::c_int,
1145 height: ::std::os::raw::c_int,
1146 fourcc: u32,
1147 size: usize,
1148 offset: usize,
1149 expires: i64,
1150 duration: i64,
1151 pts: i64,
1152 dts: i64,
1153 cleanup: vsl_frame_cleanup,
1154 userptr: *mut ::std::os::raw::c_void,
1155 ) -> *mut VSLFrame {
1156 (self
1157 .vsl_frame_register
1158 .as_ref()
1159 .expect("Expected function, got error."))(
1160 host, serial, handle, width, height, fourcc, size, offset, expires, duration, pts, dts,
1161 cleanup, userptr,
1162 )
1163 }
1164 #[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"]
1165 pub unsafe fn vsl_frame_init(
1166 &self,
1167 width: u32,
1168 height: u32,
1169 stride: u32,
1170 fourcc: u32,
1171 userptr: *mut ::std::os::raw::c_void,
1172 cleanup: vsl_frame_cleanup,
1173 ) -> *mut VSLFrame {
1174 (self
1175 .vsl_frame_init
1176 .as_ref()
1177 .expect("Expected function, got error."))(
1178 width, height, stride, fourcc, userptr, cleanup,
1179 )
1180 }
1181 #[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"]
1182 pub unsafe fn vsl_frame_alloc(
1183 &self,
1184 frame: *mut VSLFrame,
1185 path: *const ::std::os::raw::c_char,
1186 ) -> ::std::os::raw::c_int {
1187 (self
1188 .vsl_frame_alloc
1189 .as_ref()
1190 .expect("Expected function, got error."))(frame, path)
1191 }
1192 #[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"]
1193 pub unsafe fn vsl_frame_unalloc(&self, frame: *mut VSLFrame) {
1194 (self
1195 .vsl_frame_unalloc
1196 .as_ref()
1197 .expect("Expected function, got error."))(frame)
1198 }
1199 #[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"]
1200 pub unsafe fn vsl_frame_attach(
1201 &self,
1202 frame: *mut VSLFrame,
1203 fd: ::std::os::raw::c_int,
1204 size: usize,
1205 offset: usize,
1206 ) -> ::std::os::raw::c_int {
1207 (self
1208 .vsl_frame_attach
1209 .as_ref()
1210 .expect("Expected function, got error."))(frame, fd, size, offset)
1211 }
1212 #[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"]
1213 pub unsafe fn vsl_frame_path(&self, frame: *const VSLFrame) -> *const ::std::os::raw::c_char {
1214 (self
1215 .vsl_frame_path
1216 .as_ref()
1217 .expect("Expected function, got error."))(frame)
1218 }
1219 #[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"]
1220 pub unsafe fn vsl_frame_unregister(&self, frame: *mut VSLFrame) {
1221 (self
1222 .vsl_frame_unregister
1223 .as_ref()
1224 .expect("Expected function, got error."))(frame)
1225 }
1226 #[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"]
1227 pub unsafe fn vsl_frame_copy(
1228 &self,
1229 target: *mut VSLFrame,
1230 source: *mut VSLFrame,
1231 crop: *const VSLRect,
1232 ) -> ::std::os::raw::c_int {
1233 (self
1234 .vsl_frame_copy
1235 .as_ref()
1236 .expect("Expected function, got error."))(target, source, crop)
1237 }
1238 #[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"]
1239 pub unsafe fn vsl_frame_userptr(&self, frame: *mut VSLFrame) -> *mut ::std::os::raw::c_void {
1240 (self
1241 .vsl_frame_userptr
1242 .as_ref()
1243 .expect("Expected function, got error."))(frame)
1244 }
1245 #[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"]
1246 pub unsafe fn vsl_frame_set_userptr(
1247 &self,
1248 frame: *mut VSLFrame,
1249 userptr: *mut ::std::os::raw::c_void,
1250 ) {
1251 (self
1252 .vsl_frame_set_userptr
1253 .as_ref()
1254 .expect("Expected function, got error."))(frame, userptr)
1255 }
1256 #[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"]
1257 pub unsafe fn vsl_frame_wait(&self, client: *mut VSLClient, until: i64) -> *mut VSLFrame {
1258 (self
1259 .vsl_frame_wait
1260 .as_ref()
1261 .expect("Expected function, got error."))(client, until)
1262 }
1263 #[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"]
1264 pub unsafe fn vsl_frame_release(&self, frame: *mut VSLFrame) {
1265 (self
1266 .vsl_frame_release
1267 .as_ref()
1268 .expect("Expected function, got error."))(frame)
1269 }
1270 #[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"]
1271 pub unsafe fn vsl_frame_trylock(&self, frame: *mut VSLFrame) -> ::std::os::raw::c_int {
1272 (self
1273 .vsl_frame_trylock
1274 .as_ref()
1275 .expect("Expected function, got error."))(frame)
1276 }
1277 #[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"]
1278 pub unsafe fn vsl_frame_unlock(&self, frame: *mut VSLFrame) -> ::std::os::raw::c_int {
1279 (self
1280 .vsl_frame_unlock
1281 .as_ref()
1282 .expect("Expected function, got error."))(frame)
1283 }
1284 #[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"]
1285 pub unsafe fn vsl_frame_serial(&self, frame: *const VSLFrame) -> i64 {
1286 (self
1287 .vsl_frame_serial
1288 .as_ref()
1289 .expect("Expected function, got error."))(frame)
1290 }
1291 #[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"]
1292 pub unsafe fn vsl_frame_timestamp(&self, frame: *const VSLFrame) -> i64 {
1293 (self
1294 .vsl_frame_timestamp
1295 .as_ref()
1296 .expect("Expected function, got error."))(frame)
1297 }
1298 #[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"]
1299 pub unsafe fn vsl_frame_duration(&self, frame: *const VSLFrame) -> i64 {
1300 (self
1301 .vsl_frame_duration
1302 .as_ref()
1303 .expect("Expected function, got error."))(frame)
1304 }
1305 #[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"]
1306 pub unsafe fn vsl_frame_pts(&self, frame: *const VSLFrame) -> i64 {
1307 (self
1308 .vsl_frame_pts
1309 .as_ref()
1310 .expect("Expected function, got error."))(frame)
1311 }
1312 #[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"]
1313 pub unsafe fn vsl_frame_dts(&self, frame: *const VSLFrame) -> i64 {
1314 (self
1315 .vsl_frame_dts
1316 .as_ref()
1317 .expect("Expected function, got error."))(frame)
1318 }
1319 #[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"]
1320 pub unsafe fn vsl_frame_expires(&self, frame: *const VSLFrame) -> i64 {
1321 (self
1322 .vsl_frame_expires
1323 .as_ref()
1324 .expect("Expected function, got error."))(frame)
1325 }
1326 #[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"]
1327 pub unsafe fn vsl_frame_fourcc(&self, frame: *const VSLFrame) -> u32 {
1328 (self
1329 .vsl_frame_fourcc
1330 .as_ref()
1331 .expect("Expected function, got error."))(frame)
1332 }
1333 #[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"]
1334 pub unsafe fn vsl_frame_width(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
1335 (self
1336 .vsl_frame_width
1337 .as_ref()
1338 .expect("Expected function, got error."))(frame)
1339 }
1340 #[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"]
1341 pub unsafe fn vsl_frame_height(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
1342 (self
1343 .vsl_frame_height
1344 .as_ref()
1345 .expect("Expected function, got error."))(frame)
1346 }
1347 #[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"]
1348 pub unsafe fn vsl_frame_stride(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
1349 (self
1350 .vsl_frame_stride
1351 .as_ref()
1352 .expect("Expected function, got error."))(frame)
1353 }
1354 #[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"]
1355 pub unsafe fn vsl_frame_size(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
1356 (self
1357 .vsl_frame_size
1358 .as_ref()
1359 .expect("Expected function, got error."))(frame)
1360 }
1361 #[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"]
1362 pub unsafe fn vsl_frame_handle(&self, frame: *const VSLFrame) -> ::std::os::raw::c_int {
1363 (self
1364 .vsl_frame_handle
1365 .as_ref()
1366 .expect("Expected function, got error."))(frame)
1367 }
1368 #[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"]
1369 pub unsafe fn vsl_frame_paddr(&self, frame: *mut VSLFrame) -> isize {
1370 (self
1371 .vsl_frame_paddr
1372 .as_ref()
1373 .expect("Expected function, got error."))(frame)
1374 }
1375 #[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"]
1376 pub unsafe fn vsl_frame_mmap(
1377 &self,
1378 frame: *mut VSLFrame,
1379 size: *mut usize,
1380 ) -> *mut ::std::os::raw::c_void {
1381 (self
1382 .vsl_frame_mmap
1383 .as_ref()
1384 .expect("Expected function, got error."))(frame, size)
1385 }
1386 #[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"]
1387 pub unsafe fn vsl_frame_munmap(&self, frame: *mut VSLFrame) {
1388 (self
1389 .vsl_frame_munmap
1390 .as_ref()
1391 .expect("Expected function, got error."))(frame)
1392 }
1393 #[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"]
1394 pub unsafe fn vsl_frame_sync(
1395 &self,
1396 frame: *const VSLFrame,
1397 enable: ::std::os::raw::c_int,
1398 mode: ::std::os::raw::c_int,
1399 ) -> ::std::os::raw::c_int {
1400 (self
1401 .vsl_frame_sync
1402 .as_ref()
1403 .expect("Expected function, got error."))(frame, enable, mode)
1404 }
1405 #[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"]
1406 pub unsafe fn vsl_fourcc_from_string(&self, fourcc: *const ::std::os::raw::c_char) -> u32 {
1407 (self
1408 .vsl_fourcc_from_string
1409 .as_ref()
1410 .expect("Expected function, got error."))(fourcc)
1411 }
1412 #[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"]
1413 pub unsafe fn vsl_encoder_create(
1414 &self,
1415 profile: VSLEncoderProfile,
1416 outputFourcc: u32,
1417 fps: ::std::os::raw::c_int,
1418 ) -> *mut VSLEncoder {
1419 (self
1420 .vsl_encoder_create
1421 .as_ref()
1422 .expect("Expected function, got error."))(profile, outputFourcc, fps)
1423 }
1424 #[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"]
1425 pub unsafe fn vsl_encoder_create_ex(
1426 &self,
1427 profile: VSLEncoderProfile,
1428 outputFourcc: u32,
1429 fps: ::std::os::raw::c_int,
1430 backend: VSLCodecBackend,
1431 ) -> *mut VSLEncoder {
1432 (self
1433 .vsl_encoder_create_ex
1434 .as_ref()
1435 .expect("Expected function, got error."))(profile, outputFourcc, fps, backend)
1436 }
1437 #[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"]
1438 pub unsafe fn vsl_encoder_release(&self, encoder: *mut VSLEncoder) {
1439 (self
1440 .vsl_encoder_release
1441 .as_ref()
1442 .expect("Expected function, got error."))(encoder)
1443 }
1444 #[doc = " @brief Encode frame\n\n Encodes the source frame into the destination frame using hardware\n acceleration (Hantro VPU on i.MX8). 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"]
1445 pub unsafe fn vsl_encode_frame(
1446 &self,
1447 encoder: *mut VSLEncoder,
1448 source: *mut VSLFrame,
1449 destination: *mut VSLFrame,
1450 cropRegion: *const VSLRect,
1451 keyframe: *mut ::std::os::raw::c_int,
1452 ) -> ::std::os::raw::c_int {
1453 (self
1454 .vsl_encode_frame
1455 .as_ref()
1456 .expect("Expected function, got error."))(
1457 encoder,
1458 source,
1459 destination,
1460 cropRegion,
1461 keyframe,
1462 )
1463 }
1464 #[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 (e.g., Hantro VPU\n EWL memory on i.MX8) for efficient 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"]
1465 pub unsafe fn vsl_encoder_new_output_frame(
1466 &self,
1467 encoder: *const VSLEncoder,
1468 width: ::std::os::raw::c_int,
1469 height: ::std::os::raw::c_int,
1470 duration: i64,
1471 pts: i64,
1472 dts: i64,
1473 ) -> *mut VSLFrame {
1474 (self
1475 .vsl_encoder_new_output_frame
1476 .as_ref()
1477 .expect("Expected function, got error."))(
1478 encoder, width, height, duration, pts, dts
1479 )
1480 }
1481 #[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"]
1482 pub unsafe fn vsl_camera_open_device(
1483 &self,
1484 filename: *const ::std::os::raw::c_char,
1485 ) -> *mut vsl_camera {
1486 (self
1487 .vsl_camera_open_device
1488 .as_ref()
1489 .expect("Expected function, got error."))(filename)
1490 }
1491 #[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"]
1492 pub unsafe fn vsl_camera_init_device(
1493 &self,
1494 ctx: *mut vsl_camera,
1495 width: *mut ::std::os::raw::c_int,
1496 height: *mut ::std::os::raw::c_int,
1497 buf_count: *mut ::std::os::raw::c_int,
1498 fourcc: *mut u32,
1499 ) -> ::std::os::raw::c_int {
1500 (self
1501 .vsl_camera_init_device
1502 .as_ref()
1503 .expect("Expected function, got error."))(ctx, width, height, buf_count, fourcc)
1504 }
1505 #[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"]
1506 pub unsafe fn vsl_camera_mirror(
1507 &self,
1508 ctx: *const vsl_camera,
1509 mirror: bool,
1510 ) -> ::std::os::raw::c_int {
1511 (self
1512 .vsl_camera_mirror
1513 .as_ref()
1514 .expect("Expected function, got error."))(ctx, mirror)
1515 }
1516 #[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"]
1517 pub unsafe fn vsl_camera_mirror_v(
1518 &self,
1519 ctx: *const vsl_camera,
1520 mirror: bool,
1521 ) -> ::std::os::raw::c_int {
1522 (self
1523 .vsl_camera_mirror_v
1524 .as_ref()
1525 .expect("Expected function, got error."))(ctx, mirror)
1526 }
1527 #[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"]
1528 pub unsafe fn vsl_camera_start_capturing(&self, ctx: *mut vsl_camera) -> ::std::os::raw::c_int {
1529 (self
1530 .vsl_camera_start_capturing
1531 .as_ref()
1532 .expect("Expected function, got error."))(ctx)
1533 }
1534 #[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"]
1535 pub unsafe fn vsl_camera_get_data(&self, ctx: *mut vsl_camera) -> *mut vsl_camera_buffer {
1536 (self
1537 .vsl_camera_get_data
1538 .as_ref()
1539 .expect("Expected function, got error."))(ctx)
1540 }
1541 #[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"]
1542 pub unsafe fn vsl_camera_release_buffer(
1543 &self,
1544 ctx: *mut vsl_camera,
1545 buffer: *const vsl_camera_buffer,
1546 ) -> ::std::os::raw::c_int {
1547 (self
1548 .vsl_camera_release_buffer
1549 .as_ref()
1550 .expect("Expected function, got error."))(ctx, buffer)
1551 }
1552 #[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"]
1553 pub unsafe fn vsl_camera_stop_capturing(
1554 &self,
1555 ctx: *const vsl_camera,
1556 ) -> ::std::os::raw::c_int {
1557 (self
1558 .vsl_camera_stop_capturing
1559 .as_ref()
1560 .expect("Expected function, got error."))(ctx)
1561 }
1562 #[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"]
1563 pub unsafe fn vsl_camera_uninit_device(&self, ctx: *mut vsl_camera) {
1564 (self
1565 .vsl_camera_uninit_device
1566 .as_ref()
1567 .expect("Expected function, got error."))(ctx)
1568 }
1569 #[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"]
1570 pub unsafe fn vsl_camera_close_device(&self, ctx: *mut vsl_camera) {
1571 (self
1572 .vsl_camera_close_device
1573 .as_ref()
1574 .expect("Expected function, got error."))(ctx)
1575 }
1576 #[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"]
1577 pub unsafe fn vsl_camera_is_dmabuf_supported(
1578 &self,
1579 ctx: *const vsl_camera,
1580 ) -> ::std::os::raw::c_int {
1581 (self
1582 .vsl_camera_is_dmabuf_supported
1583 .as_ref()
1584 .expect("Expected function, got error."))(ctx)
1585 }
1586 #[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"]
1587 pub unsafe fn vsl_camera_get_queued_buf_count(
1588 &self,
1589 ctx: *const vsl_camera,
1590 ) -> ::std::os::raw::c_int {
1591 (self
1592 .vsl_camera_get_queued_buf_count
1593 .as_ref()
1594 .expect("Expected function, got error."))(ctx)
1595 }
1596 #[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"]
1597 pub unsafe fn vsl_camera_buffer_mmap(
1598 &self,
1599 buffer: *mut vsl_camera_buffer,
1600 ) -> *mut ::std::os::raw::c_void {
1601 (self
1602 .vsl_camera_buffer_mmap
1603 .as_ref()
1604 .expect("Expected function, got error."))(buffer)
1605 }
1606 #[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"]
1607 pub unsafe fn vsl_camera_buffer_dma_fd(
1608 &self,
1609 buffer: *const vsl_camera_buffer,
1610 ) -> ::std::os::raw::c_int {
1611 (self
1612 .vsl_camera_buffer_dma_fd
1613 .as_ref()
1614 .expect("Expected function, got error."))(buffer)
1615 }
1616 #[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"]
1617 pub unsafe fn vsl_camera_buffer_phys_addr(&self, buffer: *const vsl_camera_buffer) -> u64 {
1618 (self
1619 .vsl_camera_buffer_phys_addr
1620 .as_ref()
1621 .expect("Expected function, got error."))(buffer)
1622 }
1623 #[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"]
1624 pub unsafe fn vsl_camera_buffer_length(&self, buffer: *const vsl_camera_buffer) -> u32 {
1625 (self
1626 .vsl_camera_buffer_length
1627 .as_ref()
1628 .expect("Expected function, got error."))(buffer)
1629 }
1630 #[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"]
1631 pub unsafe fn vsl_camera_buffer_fourcc(&self, buffer: *const vsl_camera_buffer) -> u32 {
1632 (self
1633 .vsl_camera_buffer_fourcc
1634 .as_ref()
1635 .expect("Expected function, got error."))(buffer)
1636 }
1637 #[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 reported by the\n driver via VIDIOC_G_FMT at negotiation time. This reflects any hardware\n alignment padding applied by the driver (e.g. Vivante/Mali 16-byte or\n 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"]
1638 pub unsafe fn vsl_camera_buffer_bytes_per_line(&self, buffer: *const vsl_camera_buffer) -> u32 {
1639 (self
1640 .vsl_camera_buffer_bytes_per_line
1641 .as_ref()
1642 .expect("Expected function, got error."))(buffer)
1643 }
1644 #[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"]
1645 pub unsafe fn vsl_camera_buffer_timestamp(
1646 &self,
1647 buffer: *const vsl_camera_buffer,
1648 seconds: *mut i64,
1649 nanoseconds: *mut i64,
1650 ) {
1651 (self
1652 .vsl_camera_buffer_timestamp
1653 .as_ref()
1654 .expect("Expected function, got error."))(buffer, seconds, nanoseconds)
1655 }
1656 #[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"]
1657 pub unsafe fn vsl_camera_enum_fmts(
1658 &self,
1659 ctx: *const vsl_camera,
1660 codes: *mut u32,
1661 size: ::std::os::raw::c_int,
1662 ) -> ::std::os::raw::c_int {
1663 (self
1664 .vsl_camera_enum_fmts
1665 .as_ref()
1666 .expect("Expected function, got error."))(ctx, codes, size)
1667 }
1668 #[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"]
1669 pub unsafe fn vsl_camera_enum_mplane_fmts(
1670 &self,
1671 ctx: *const vsl_camera,
1672 codes: *mut u32,
1673 size: ::std::os::raw::c_int,
1674 ) -> ::std::os::raw::c_int {
1675 (self
1676 .vsl_camera_enum_mplane_fmts
1677 .as_ref()
1678 .expect("Expected function, got error."))(ctx, codes, size)
1679 }
1680 #[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"]
1681 pub unsafe fn vsl_decoder_create(
1682 &self,
1683 codec: VSLDecoderCodec,
1684 fps: ::std::os::raw::c_int,
1685 ) -> *mut VSLDecoder {
1686 (self
1687 .vsl_decoder_create
1688 .as_ref()
1689 .expect("Expected function, got error."))(codec, fps)
1690 }
1691 #[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"]
1692 pub unsafe fn vsl_decoder_create_ex(
1693 &self,
1694 codec: u32,
1695 fps: ::std::os::raw::c_int,
1696 backend: VSLCodecBackend,
1697 ) -> *mut VSLDecoder {
1698 (self
1699 .vsl_decoder_create_ex
1700 .as_ref()
1701 .expect("Expected function, got error."))(codec, fps, backend)
1702 }
1703 #[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"]
1704 pub unsafe fn vsl_decode_frame(
1705 &self,
1706 decoder: *mut VSLDecoder,
1707 data: *const ::std::os::raw::c_void,
1708 data_length: ::std::os::raw::c_uint,
1709 bytes_used: *mut usize,
1710 output_frame: *mut *mut VSLFrame,
1711 ) -> VSLDecoderRetCode {
1712 (self
1713 .vsl_decode_frame
1714 .as_ref()
1715 .expect("Expected function, got error."))(
1716 decoder,
1717 data,
1718 data_length,
1719 bytes_used,
1720 output_frame,
1721 )
1722 }
1723 #[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"]
1724 pub unsafe fn vsl_decoder_width(&self, decoder: *const VSLDecoder) -> ::std::os::raw::c_int {
1725 (self
1726 .vsl_decoder_width
1727 .as_ref()
1728 .expect("Expected function, got error."))(decoder)
1729 }
1730 #[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"]
1731 pub unsafe fn vsl_decoder_height(&self, decoder: *const VSLDecoder) -> ::std::os::raw::c_int {
1732 (self
1733 .vsl_decoder_height
1734 .as_ref()
1735 .expect("Expected function, got error."))(decoder)
1736 }
1737 #[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"]
1738 pub unsafe fn vsl_decoder_crop(&self, decoder: *const VSLDecoder) -> VSLRect {
1739 (self
1740 .vsl_decoder_crop
1741 .as_ref()
1742 .expect("Expected function, got error."))(decoder)
1743 }
1744 #[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"]
1745 pub unsafe fn vsl_decoder_release(&self, decoder: *mut VSLDecoder) -> ::std::os::raw::c_int {
1746 (self
1747 .vsl_decoder_release
1748 .as_ref()
1749 .expect("Expected function, got error."))(decoder)
1750 }
1751 #[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"]
1752 pub unsafe fn vsl_v4l2_enumerate(&self) -> *mut VSLDeviceList {
1753 (self
1754 .vsl_v4l2_enumerate
1755 .as_ref()
1756 .expect("Expected function, got error."))()
1757 }
1758 #[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"]
1759 pub unsafe fn vsl_v4l2_enumerate_type(&self, type_mask: VSLDeviceType) -> *mut VSLDeviceList {
1760 (self
1761 .vsl_v4l2_enumerate_type
1762 .as_ref()
1763 .expect("Expected function, got error."))(type_mask)
1764 }
1765 #[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"]
1766 pub unsafe fn vsl_v4l2_device_list_free(&self, list: *mut VSLDeviceList) {
1767 (self
1768 .vsl_v4l2_device_list_free
1769 .as_ref()
1770 .expect("Expected function, got error."))(list)
1771 }
1772 #[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"]
1773 pub unsafe fn vsl_v4l2_find_encoder(&self, codec_fourcc: u32) -> *const ::std::os::raw::c_char {
1774 (self
1775 .vsl_v4l2_find_encoder
1776 .as_ref()
1777 .expect("Expected function, got error."))(codec_fourcc)
1778 }
1779 #[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"]
1780 pub unsafe fn vsl_v4l2_find_decoder(&self, codec_fourcc: u32) -> *const ::std::os::raw::c_char {
1781 (self
1782 .vsl_v4l2_find_decoder
1783 .as_ref()
1784 .expect("Expected function, got error."))(codec_fourcc)
1785 }
1786 #[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"]
1787 pub unsafe fn vsl_v4l2_find_camera(&self, format_fourcc: u32) -> *const ::std::os::raw::c_char {
1788 (self
1789 .vsl_v4l2_find_camera
1790 .as_ref()
1791 .expect("Expected function, got error."))(format_fourcc)
1792 }
1793 #[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"]
1794 pub unsafe fn vsl_v4l2_find_camera_with_resolution(
1795 &self,
1796 format_fourcc: u32,
1797 width: u32,
1798 height: u32,
1799 ) -> *const ::std::os::raw::c_char {
1800 (self
1801 .vsl_v4l2_find_camera_with_resolution
1802 .as_ref()
1803 .expect("Expected function, got error."))(format_fourcc, width, height)
1804 }
1805 #[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"]
1806 pub unsafe fn vsl_v4l2_device_enum_formats(
1807 &self,
1808 device: *mut VSLDevice,
1809 ) -> ::std::os::raw::c_int {
1810 (self
1811 .vsl_v4l2_device_enum_formats
1812 .as_ref()
1813 .expect("Expected function, got error."))(device)
1814 }
1815 #[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"]
1816 pub unsafe fn vsl_v4l2_enum_resolutions(
1817 &self,
1818 device: *const VSLDevice,
1819 fourcc: u32,
1820 count: *mut usize,
1821 ) -> *mut VSLResolution {
1822 (self
1823 .vsl_v4l2_enum_resolutions
1824 .as_ref()
1825 .expect("Expected function, got error."))(device, fourcc, count)
1826 }
1827 #[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"]
1828 pub unsafe fn vsl_v4l2_device_supports_format(
1829 &self,
1830 device: *const VSLDevice,
1831 fourcc: u32,
1832 capture: bool,
1833 ) -> bool {
1834 (self
1835 .vsl_v4l2_device_supports_format
1836 .as_ref()
1837 .expect("Expected function, got error."))(device, fourcc, capture)
1838 }
1839 #[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"]
1840 pub unsafe fn vsl_v4l2_alloc_userptr(
1841 &self,
1842 size: usize,
1843 dma_fd: *mut ::std::os::raw::c_int,
1844 ) -> *mut ::std::os::raw::c_void {
1845 (self
1846 .vsl_v4l2_alloc_userptr
1847 .as_ref()
1848 .expect("Expected function, got error."))(size, dma_fd)
1849 }
1850 #[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"]
1851 pub unsafe fn vsl_v4l2_free_userptr(
1852 &self,
1853 ptr: *mut ::std::os::raw::c_void,
1854 size: usize,
1855 dma_fd: ::std::os::raw::c_int,
1856 ) {
1857 (self
1858 .vsl_v4l2_free_userptr
1859 .as_ref()
1860 .expect("Expected function, got error."))(ptr, size, dma_fd)
1861 }
1862 #[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"]
1863 pub unsafe fn vsl_v4l2_device_type_name(
1864 &self,
1865 type_: VSLDeviceType,
1866 ) -> *const ::std::os::raw::c_char {
1867 (self
1868 .vsl_v4l2_device_type_name
1869 .as_ref()
1870 .expect("Expected function, got error."))(type_)
1871 }
1872 #[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"]
1873 pub unsafe fn vsl_v4l2_is_compressed_format(&self, fourcc: u32) -> bool {
1874 (self
1875 .vsl_v4l2_is_compressed_format
1876 .as_ref()
1877 .expect("Expected function, got error."))(fourcc)
1878 }
1879 #[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"]
1880 pub unsafe fn vsl_v4l2_fourcc_to_string(
1881 &self,
1882 fourcc: u32,
1883 buf: *mut ::std::os::raw::c_char,
1884 ) -> *mut ::std::os::raw::c_char {
1885 (self
1886 .vsl_v4l2_fourcc_to_string
1887 .as_ref()
1888 .expect("Expected function, got error."))(fourcc, buf)
1889 }
1890}