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