VideoStreamLibrary

Struct VideoStreamLibrary 

Source
pub struct VideoStreamLibrary {
Show 78 fields pub vsl_version: Result<unsafe extern "C" fn() -> *const c_char, Error>, pub vsl_timestamp: Result<unsafe extern "C" fn() -> i64, Error>, pub vsl_host_init: Result<unsafe extern "C" fn(path: *const c_char) -> *mut VSLHost, Error>, pub vsl_host_release: Result<unsafe extern "C" fn(host: *mut VSLHost), Error>, pub vsl_host_path: Result<unsafe extern "C" fn(host: *const VSLHost) -> *const c_char, Error>, pub vsl_host_poll: Result<unsafe extern "C" fn(host: *mut VSLHost, wait: i64) -> c_int, Error>, pub vsl_host_service: Result<unsafe extern "C" fn(host: *mut VSLHost, sock: c_int) -> c_int, Error>, pub vsl_host_process: Result<unsafe extern "C" fn(host: *mut VSLHost) -> c_int, Error>, pub vsl_host_sockets: Result<unsafe extern "C" fn(host: *mut VSLHost, n_sockets: usize, sockets: *mut c_int, max_sockets: *mut usize) -> c_int, Error>, pub vsl_host_post: Result<unsafe extern "C" fn(host: *mut VSLHost, frame: *mut VSLFrame, expires: i64, duration: i64, pts: i64, dts: i64) -> c_int, Error>, pub vsl_host_drop: Result<unsafe extern "C" fn(host: *mut VSLHost, frame: *mut VSLFrame) -> c_int, Error>, pub vsl_client_init: Result<unsafe extern "C" fn(path: *const c_char, userptr: *mut c_void, reconnect: bool) -> *mut VSLClient, Error>, pub vsl_client_release: Result<unsafe extern "C" fn(client: *mut VSLClient), Error>, pub vsl_client_disconnect: Result<unsafe extern "C" fn(client: *mut VSLClient), Error>, pub vsl_client_userptr: Result<unsafe extern "C" fn(client: *mut VSLClient) -> *mut c_void, Error>, pub vsl_client_path: Result<unsafe extern "C" fn(client: *const VSLClient) -> *const c_char, Error>, pub vsl_client_set_timeout: Result<unsafe extern "C" fn(client: *mut VSLClient, timeout: f32), Error>, pub vsl_frame_register: Result<unsafe extern "C" fn(host: *mut VSLHost, serial: i64, handle: c_int, width: c_int, height: c_int, fourcc: u32, size: usize, offset: usize, expires: i64, duration: i64, pts: i64, dts: i64, cleanup: vsl_frame_cleanup, userptr: *mut c_void) -> *mut VSLFrame, Error>, pub vsl_frame_init: Result<unsafe extern "C" fn(width: u32, height: u32, stride: u32, fourcc: u32, userptr: *mut c_void, cleanup: vsl_frame_cleanup) -> *mut VSLFrame, Error>, pub vsl_frame_alloc: Result<unsafe extern "C" fn(frame: *mut VSLFrame, path: *const c_char) -> c_int, Error>, pub vsl_frame_unalloc: Result<unsafe extern "C" fn(frame: *mut VSLFrame), Error>, pub vsl_frame_attach: Result<unsafe extern "C" fn(frame: *mut VSLFrame, fd: c_int, size: usize, offset: usize) -> c_int, Error>, pub vsl_frame_path: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> *const c_char, Error>, pub vsl_frame_unregister: Result<unsafe extern "C" fn(frame: *mut VSLFrame), Error>, pub vsl_frame_copy: Result<unsafe extern "C" fn(target: *mut VSLFrame, source: *mut VSLFrame, crop: *const VSLRect) -> c_int, Error>, pub vsl_frame_userptr: Result<unsafe extern "C" fn(frame: *mut VSLFrame) -> *mut c_void, Error>, pub vsl_frame_set_userptr: Result<unsafe extern "C" fn(frame: *mut VSLFrame, userptr: *mut c_void), Error>, pub vsl_frame_wait: Result<unsafe extern "C" fn(client: *mut VSLClient, until: i64) -> *mut VSLFrame, Error>, pub vsl_frame_release: Result<unsafe extern "C" fn(frame: *mut VSLFrame), Error>, pub vsl_frame_trylock: Result<unsafe extern "C" fn(frame: *mut VSLFrame) -> c_int, Error>, pub vsl_frame_unlock: Result<unsafe extern "C" fn(frame: *mut VSLFrame) -> c_int, Error>, pub vsl_frame_serial: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, Error>, pub vsl_frame_timestamp: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, Error>, pub vsl_frame_duration: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, Error>, pub vsl_frame_pts: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, Error>, pub vsl_frame_dts: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, Error>, pub vsl_frame_expires: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, Error>, pub vsl_frame_fourcc: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> u32, Error>, pub vsl_frame_width: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> c_int, Error>, pub vsl_frame_height: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> c_int, Error>, pub vsl_frame_stride: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> c_int, Error>, pub vsl_frame_size: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> c_int, Error>, pub vsl_frame_handle: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> c_int, Error>, pub vsl_frame_paddr: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> isize, Error>, pub vsl_frame_mmap: Result<unsafe extern "C" fn(frame: *mut VSLFrame, size: *mut usize) -> *mut c_void, Error>, pub vsl_frame_munmap: Result<unsafe extern "C" fn(frame: *mut VSLFrame), Error>, pub vsl_frame_sync: Result<unsafe extern "C" fn(frame: *const VSLFrame, enable: c_int, mode: c_int) -> c_int, Error>, pub vsl_fourcc_from_string: Result<unsafe extern "C" fn(fourcc: *const c_char) -> u32, Error>, pub vsl_encoder_create: Result<unsafe extern "C" fn(profile: VSLEncoderProfile, outputFourcc: u32, fps: c_int) -> *mut VSLEncoder, Error>, pub vsl_encoder_release: Result<unsafe extern "C" fn(encoder: *mut VSLEncoder), Error>, pub vsl_encode_frame: Result<unsafe extern "C" fn(encoder: *mut VSLEncoder, source: *mut VSLFrame, destination: *mut VSLFrame, cropRegion: *const VSLRect, keyframe: *mut c_int) -> c_int, Error>, pub vsl_encoder_new_output_frame: Result<unsafe extern "C" fn(encoder: *const VSLEncoder, width: c_int, height: c_int, duration: i64, pts: i64, dts: i64) -> *mut VSLFrame, Error>, pub vsl_camera_open_device: Result<unsafe extern "C" fn(filename: *const c_char) -> *mut vsl_camera, Error>, pub vsl_camera_init_device: Result<unsafe extern "C" fn(ctx: *mut vsl_camera, width: *mut c_int, height: *mut c_int, buf_count: *mut c_int, fourcc: *mut u32) -> c_int, Error>, pub vsl_camera_mirror: Result<unsafe extern "C" fn(ctx: *const vsl_camera, mirror: bool) -> c_int, Error>, pub vsl_camera_mirror_v: Result<unsafe extern "C" fn(ctx: *const vsl_camera, mirror: bool) -> c_int, Error>, pub vsl_camera_start_capturing: Result<unsafe extern "C" fn(ctx: *mut vsl_camera) -> c_int, Error>, pub vsl_camera_get_data: Result<unsafe extern "C" fn(ctx: *mut vsl_camera) -> *mut vsl_camera_buffer, Error>, pub vsl_camera_release_buffer: Result<unsafe extern "C" fn(ctx: *mut vsl_camera, buffer: *const vsl_camera_buffer) -> c_int, Error>, pub vsl_camera_stop_capturing: Result<unsafe extern "C" fn(ctx: *const vsl_camera) -> c_int, Error>, pub vsl_camera_uninit_device: Result<unsafe extern "C" fn(ctx: *mut vsl_camera), Error>, pub vsl_camera_close_device: Result<unsafe extern "C" fn(ctx: *mut vsl_camera), Error>, pub vsl_camera_is_dmabuf_supported: Result<unsafe extern "C" fn(ctx: *const vsl_camera) -> c_int, Error>, pub vsl_camera_get_queued_buf_count: Result<unsafe extern "C" fn(ctx: *const vsl_camera) -> c_int, Error>, pub vsl_camera_buffer_mmap: Result<unsafe extern "C" fn(buffer: *mut vsl_camera_buffer) -> *mut c_void, Error>, pub vsl_camera_buffer_dma_fd: Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> c_int, Error>, pub vsl_camera_buffer_phys_addr: Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u64, Error>, pub vsl_camera_buffer_length: Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, Error>, pub vsl_camera_buffer_fourcc: Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, Error>, pub vsl_camera_buffer_timestamp: Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer, seconds: *mut i64, nanoseconds: *mut i64), Error>, pub vsl_camera_enum_fmts: Result<unsafe extern "C" fn(ctx: *const vsl_camera, codes: *mut u32, size: c_int) -> c_int, Error>, pub vsl_camera_enum_mplane_fmts: Result<unsafe extern "C" fn(ctx: *const vsl_camera, codes: *mut u32, size: c_int) -> c_int, Error>, pub vsl_decoder_create: Result<unsafe extern "C" fn(outputFourcc: u32, fps: c_int) -> *mut VSLDecoder, Error>, pub vsl_decode_frame: Result<unsafe extern "C" fn(decoder: *mut VSLDecoder, data: *const c_void, data_length: c_uint, bytes_used: *mut usize, output_frame: *mut *mut VSLFrame) -> VSLDecoderRetCode, Error>, pub vsl_decoder_width: Result<unsafe extern "C" fn(decoder: *const VSLDecoder) -> c_int, Error>, pub vsl_decoder_height: Result<unsafe extern "C" fn(decoder: *const VSLDecoder) -> c_int, Error>, pub vsl_decoder_crop: Result<unsafe extern "C" fn(decoder: *const VSLDecoder) -> VSLRect, Error>, pub vsl_decoder_release: Result<unsafe extern "C" fn(decoder: *mut VSLDecoder) -> c_int, Error>, /* private fields */
}

Fields§

§vsl_version: Result<unsafe extern "C" fn() -> *const c_char, Error>§vsl_timestamp: Result<unsafe extern "C" fn() -> i64, Error>§vsl_host_init: Result<unsafe extern "C" fn(path: *const c_char) -> *mut VSLHost, Error>§vsl_host_release: Result<unsafe extern "C" fn(host: *mut VSLHost), Error>§vsl_host_path: Result<unsafe extern "C" fn(host: *const VSLHost) -> *const c_char, Error>§vsl_host_poll: Result<unsafe extern "C" fn(host: *mut VSLHost, wait: i64) -> c_int, Error>§vsl_host_service: Result<unsafe extern "C" fn(host: *mut VSLHost, sock: c_int) -> c_int, Error>§vsl_host_process: Result<unsafe extern "C" fn(host: *mut VSLHost) -> c_int, Error>§vsl_host_sockets: Result<unsafe extern "C" fn(host: *mut VSLHost, n_sockets: usize, sockets: *mut c_int, max_sockets: *mut usize) -> c_int, Error>§vsl_host_post: Result<unsafe extern "C" fn(host: *mut VSLHost, frame: *mut VSLFrame, expires: i64, duration: i64, pts: i64, dts: i64) -> c_int, Error>§vsl_host_drop: Result<unsafe extern "C" fn(host: *mut VSLHost, frame: *mut VSLFrame) -> c_int, Error>§vsl_client_init: Result<unsafe extern "C" fn(path: *const c_char, userptr: *mut c_void, reconnect: bool) -> *mut VSLClient, Error>§vsl_client_release: Result<unsafe extern "C" fn(client: *mut VSLClient), Error>§vsl_client_disconnect: Result<unsafe extern "C" fn(client: *mut VSLClient), Error>§vsl_client_userptr: Result<unsafe extern "C" fn(client: *mut VSLClient) -> *mut c_void, Error>§vsl_client_path: Result<unsafe extern "C" fn(client: *const VSLClient) -> *const c_char, Error>§vsl_client_set_timeout: Result<unsafe extern "C" fn(client: *mut VSLClient, timeout: f32), Error>§vsl_frame_register: Result<unsafe extern "C" fn(host: *mut VSLHost, serial: i64, handle: c_int, width: c_int, height: c_int, fourcc: u32, size: usize, offset: usize, expires: i64, duration: i64, pts: i64, dts: i64, cleanup: vsl_frame_cleanup, userptr: *mut c_void) -> *mut VSLFrame, Error>§vsl_frame_init: Result<unsafe extern "C" fn(width: u32, height: u32, stride: u32, fourcc: u32, userptr: *mut c_void, cleanup: vsl_frame_cleanup) -> *mut VSLFrame, Error>§vsl_frame_alloc: Result<unsafe extern "C" fn(frame: *mut VSLFrame, path: *const c_char) -> c_int, Error>§vsl_frame_unalloc: Result<unsafe extern "C" fn(frame: *mut VSLFrame), Error>§vsl_frame_attach: Result<unsafe extern "C" fn(frame: *mut VSLFrame, fd: c_int, size: usize, offset: usize) -> c_int, Error>§vsl_frame_path: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> *const c_char, Error>§vsl_frame_unregister: Result<unsafe extern "C" fn(frame: *mut VSLFrame), Error>§vsl_frame_copy: Result<unsafe extern "C" fn(target: *mut VSLFrame, source: *mut VSLFrame, crop: *const VSLRect) -> c_int, Error>§vsl_frame_userptr: Result<unsafe extern "C" fn(frame: *mut VSLFrame) -> *mut c_void, Error>§vsl_frame_set_userptr: Result<unsafe extern "C" fn(frame: *mut VSLFrame, userptr: *mut c_void), Error>§vsl_frame_wait: Result<unsafe extern "C" fn(client: *mut VSLClient, until: i64) -> *mut VSLFrame, Error>§vsl_frame_release: Result<unsafe extern "C" fn(frame: *mut VSLFrame), Error>§vsl_frame_trylock: Result<unsafe extern "C" fn(frame: *mut VSLFrame) -> c_int, Error>§vsl_frame_unlock: Result<unsafe extern "C" fn(frame: *mut VSLFrame) -> c_int, Error>§vsl_frame_serial: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, Error>§vsl_frame_timestamp: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, Error>§vsl_frame_duration: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, Error>§vsl_frame_pts: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, Error>§vsl_frame_dts: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, Error>§vsl_frame_expires: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> i64, Error>§vsl_frame_fourcc: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> u32, Error>§vsl_frame_width: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> c_int, Error>§vsl_frame_height: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> c_int, Error>§vsl_frame_stride: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> c_int, Error>§vsl_frame_size: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> c_int, Error>§vsl_frame_handle: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> c_int, Error>§vsl_frame_paddr: Result<unsafe extern "C" fn(frame: *const VSLFrame) -> isize, Error>§vsl_frame_mmap: Result<unsafe extern "C" fn(frame: *mut VSLFrame, size: *mut usize) -> *mut c_void, Error>§vsl_frame_munmap: Result<unsafe extern "C" fn(frame: *mut VSLFrame), Error>§vsl_frame_sync: Result<unsafe extern "C" fn(frame: *const VSLFrame, enable: c_int, mode: c_int) -> c_int, Error>§vsl_fourcc_from_string: Result<unsafe extern "C" fn(fourcc: *const c_char) -> u32, Error>§vsl_encoder_create: Result<unsafe extern "C" fn(profile: VSLEncoderProfile, outputFourcc: u32, fps: c_int) -> *mut VSLEncoder, Error>§vsl_encoder_release: Result<unsafe extern "C" fn(encoder: *mut VSLEncoder), Error>§vsl_encode_frame: Result<unsafe extern "C" fn(encoder: *mut VSLEncoder, source: *mut VSLFrame, destination: *mut VSLFrame, cropRegion: *const VSLRect, keyframe: *mut c_int) -> c_int, Error>§vsl_encoder_new_output_frame: Result<unsafe extern "C" fn(encoder: *const VSLEncoder, width: c_int, height: c_int, duration: i64, pts: i64, dts: i64) -> *mut VSLFrame, Error>§vsl_camera_open_device: Result<unsafe extern "C" fn(filename: *const c_char) -> *mut vsl_camera, Error>§vsl_camera_init_device: Result<unsafe extern "C" fn(ctx: *mut vsl_camera, width: *mut c_int, height: *mut c_int, buf_count: *mut c_int, fourcc: *mut u32) -> c_int, Error>§vsl_camera_mirror: Result<unsafe extern "C" fn(ctx: *const vsl_camera, mirror: bool) -> c_int, Error>§vsl_camera_mirror_v: Result<unsafe extern "C" fn(ctx: *const vsl_camera, mirror: bool) -> c_int, Error>§vsl_camera_start_capturing: Result<unsafe extern "C" fn(ctx: *mut vsl_camera) -> c_int, Error>§vsl_camera_get_data: Result<unsafe extern "C" fn(ctx: *mut vsl_camera) -> *mut vsl_camera_buffer, Error>§vsl_camera_release_buffer: Result<unsafe extern "C" fn(ctx: *mut vsl_camera, buffer: *const vsl_camera_buffer) -> c_int, Error>§vsl_camera_stop_capturing: Result<unsafe extern "C" fn(ctx: *const vsl_camera) -> c_int, Error>§vsl_camera_uninit_device: Result<unsafe extern "C" fn(ctx: *mut vsl_camera), Error>§vsl_camera_close_device: Result<unsafe extern "C" fn(ctx: *mut vsl_camera), Error>§vsl_camera_is_dmabuf_supported: Result<unsafe extern "C" fn(ctx: *const vsl_camera) -> c_int, Error>§vsl_camera_get_queued_buf_count: Result<unsafe extern "C" fn(ctx: *const vsl_camera) -> c_int, Error>§vsl_camera_buffer_mmap: Result<unsafe extern "C" fn(buffer: *mut vsl_camera_buffer) -> *mut c_void, Error>§vsl_camera_buffer_dma_fd: Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> c_int, Error>§vsl_camera_buffer_phys_addr: Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u64, Error>§vsl_camera_buffer_length: Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, Error>§vsl_camera_buffer_fourcc: Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer) -> u32, Error>§vsl_camera_buffer_timestamp: Result<unsafe extern "C" fn(buffer: *const vsl_camera_buffer, seconds: *mut i64, nanoseconds: *mut i64), Error>§vsl_camera_enum_fmts: Result<unsafe extern "C" fn(ctx: *const vsl_camera, codes: *mut u32, size: c_int) -> c_int, Error>§vsl_camera_enum_mplane_fmts: Result<unsafe extern "C" fn(ctx: *const vsl_camera, codes: *mut u32, size: c_int) -> c_int, Error>§vsl_decoder_create: Result<unsafe extern "C" fn(outputFourcc: u32, fps: c_int) -> *mut VSLDecoder, Error>§vsl_decode_frame: Result<unsafe extern "C" fn(decoder: *mut VSLDecoder, data: *const c_void, data_length: c_uint, bytes_used: *mut usize, output_frame: *mut *mut VSLFrame) -> VSLDecoderRetCode, Error>§vsl_decoder_width: Result<unsafe extern "C" fn(decoder: *const VSLDecoder) -> c_int, Error>§vsl_decoder_height: Result<unsafe extern "C" fn(decoder: *const VSLDecoder) -> c_int, Error>§vsl_decoder_crop: Result<unsafe extern "C" fn(decoder: *const VSLDecoder) -> VSLRect, Error>§vsl_decoder_release: Result<unsafe extern "C" fn(decoder: *mut VSLDecoder) -> c_int, Error>

Implementations§

Source§

impl VideoStreamLibrary

Source

pub unsafe fn new<P>(path: P) -> Result<Self, Error>
where P: AsFilename,

Source

pub unsafe fn from_library<L>(library: L) -> Result<Self, Error>
where L: Into<Library>,

Source

pub unsafe fn vsl_version(&self) -> *const c_char

Returns the VideoStream Library version.

Source

pub unsafe fn vsl_timestamp(&self) -> i64

Source

pub unsafe fn vsl_host_init(&self, path: *const c_char) -> *mut VSLHost

Creates a host on the requested path. If the path is unavailable because of permissions or already exists then NULL is returned and errno is set.

@memberof VSLHost

Source

pub unsafe fn vsl_host_release(&self, host: *mut VSLHost)

Releases the host, disconnecting all clients and releasing any allocated memory.

@memberof VSLHost

Source

pub unsafe fn vsl_host_path(&self, host: *const VSLHost) -> *const c_char

Returns the bound path of the host.

@memberof VSLHost

Source

pub unsafe fn vsl_host_poll(&self, host: *mut VSLHost, wait: i64) -> c_int

Polls the list of available connections in our pool. If @param wait is >0 then poll will timeout after @param wait milliseconds. Note frames are only expired by the @ref vsl_host_process function so the @param wait parameter should be some value no greater than the desired expiration time.

@memberof VSLHost

Source

pub unsafe fn vsl_host_service(&self, host: *mut VSLHost, sock: c_int) -> c_int

Services a single client socket. Note this does not accept new sockets for that you must call @ref vsl_host_process(). The main advantage over calling this function is to see if individual client servicing resulted in an error.

@since 1.0 @memberof VSLHost

Source

pub unsafe fn vsl_host_process(&self, host: *mut VSLHost) -> c_int

Process the host tasks by first expiring old frames and then servicing the first available connection in our pool. This function should be called in a loop, generally blocked by @ref vsl_host_poll.

@memberof VSLHost

Source

pub unsafe fn vsl_host_sockets( &self, host: *mut VSLHost, n_sockets: usize, sockets: *mut c_int, max_sockets: *mut usize, ) -> c_int

Request a copy of the sockets managed by the host. There will always be at least one socket which is the connection socket which accepts new connections. Up to n_sockets socket descriptors will be copied into the sockets buffer, if n_sockets is fewer than the number of available sockets errno will be set to ENOBUFS. The n_socket parameter, if provided, will be populated with a value of n_clients+1 which can be used to query required space for the sockets buffer. It is suggested to provide a buffer which is larger than max_sockets to avoid race conditions where the number of sockets changes between calls to this function.

Note that the array of sockets should be refreshed often as once the function returns they may be stale. The API is implemented in such as way as to allow thread-safe operations where one thread may-be using the vsl sockets to send messages while another is polling for a read.

@memberof VSLHost

Source

pub unsafe fn vsl_host_post( &self, host: *mut VSLHost, frame: *mut VSLFrame, expires: i64, duration: i64, pts: i64, dts: i64, ) -> c_int

Registers the frame with the host and publishes it to subscribers.

@note A frame posted to this function transfers ownership to the host and should not have @ref vsl_frame_release called on it. This will be managed by the host on frame expiry.

Source

pub unsafe fn vsl_host_drop( &self, host: *mut VSLHost, frame: *mut VSLFrame, ) -> c_int

Drops the frame from the host. This is meant to be called from the frame but can also be used to remove the host association of the frame and return ownership to the caller.

@since 1.3 @memberof VSLHost

Source

pub unsafe fn vsl_client_init( &self, path: *const c_char, userptr: *mut c_void, reconnect: bool, ) -> *mut VSLClient

Creates a client and connects to the host at the provided path. If the connection cannot be made NULL is returned and errno is set.

@memberof VSLClient

Source

pub unsafe fn vsl_client_release(&self, client: *mut VSLClient)

Releases the client, disconnecting from the host and releasing allocated memory.

@memberof VSLClient

Source

pub unsafe fn vsl_client_disconnect(&self, client: *mut VSLClient)

Disconnects from the VSLHost and stops all reconnection attempts. This should be called as part of closing down a VSL client session. It is thread-safe unlike vsl_client_release which disposes of the client object.

@memberof VSLClient @since 1.1

Source

pub unsafe fn vsl_client_userptr(&self, client: *mut VSLClient) -> *mut c_void

Returns the optional userptr associated with this client connection.

@memberof VSLClient

Source

pub unsafe fn vsl_client_path(&self, client: *const VSLClient) -> *const c_char

Returns the path on which the client has connected to the host.

@memberof VSLClient

Source

pub unsafe fn vsl_client_set_timeout( &self, client: *mut VSLClient, timeout: f32, )

Sets the socket timeout for this client.

@memberof VSLClient

Source

pub unsafe fn vsl_frame_register( &self, host: *mut VSLHost, serial: i64, handle: c_int, width: c_int, height: c_int, fourcc: u32, size: usize, offset: usize, expires: i64, duration: i64, pts: i64, dts: i64, cleanup: vsl_frame_cleanup, userptr: *mut c_void, ) -> *mut VSLFrame

Creates and posts the video frame along with optional user pointer to any arbitrary data. Typically it would be used for holding a reference to the host’s view of the frame handle.

@deprecated The vsl_frame_register function is deprecated in favour of using the @ref vsl_frame_init(), @ref vsl_frame_alloc() or @ref vsl_frame_attach(), and @ref vsl_host_post() functions which separate frame creation from posting to the host for publishing to subscribers.

@note A frame created through this function is owned by the host and should not have @ref vsl_frame_release called on it. This will be managed by the host on frame expiry.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_init( &self, width: u32, height: u32, stride: u32, fourcc: u32, userptr: *mut c_void, cleanup: vsl_frame_cleanup, ) -> *mut VSLFrame

Initializes a VSLFrame without underlying frame buffer. To create the backing memory either call @ref vsl_frame_alloc() or to attach to an existing bufer use @ref vsl_frame_attach().

@since 1.3 @memberof VSLFrame

Source

pub unsafe fn vsl_frame_alloc( &self, frame: *mut VSLFrame, path: *const c_char, ) -> c_int

Allocates the underlying memory for the frame. This function will prefer to allocate using dmabuf and fallback to shared memory if dmabuf is not available, unless the frame has a path defined in which case shared memory is assumed. If the path begins with /dev then it assumed to point to a dmabuf-heap device. If path is NULL then the allocator will first attempt to create a dmabuf then fallback to shared memory.

Allocations will be based on a buffer large enough to hold height*stride bytes. If using a compressed fourcc such as JPEG the actual data will be smaller, this size can be captured when calling @ref vsl_frame_copy() as the function returns the number of bytes copied into the target frame. There is currently no method to capture the actual compressed size when receiving an already compressed frame. This limitation is because the size varies from frame to frame while the underlying buffer is of a fixed size. When the actual encoded size is important, the @ref vsl_frame_copy() should be called directly or the reported size communicated to the client through a separate channel.

@since 1.3 @memberof VSLFrame

Source

pub unsafe fn vsl_frame_unalloc(&self, frame: *mut VSLFrame)

Frees the allocated buffer for this frame. Does not release the frame itself for that use @ref vsl_frame_release().

@param frame @since 1.3 @memberof VSLFrame

Source

pub unsafe fn vsl_frame_attach( &self, frame: *mut VSLFrame, fd: c_int, size: usize, offset: usize, ) -> c_int

Attach the provided file descriptor to the VSLFrame. If size is not provided it is assumed to be stride*height bytes. If offset is provided then size MUST be provided, the offset is in bytes to the start of the frame.

@since 1.3 @memberof VSLFrame

Source

pub unsafe fn vsl_frame_path(&self, frame: *const VSLFrame) -> *const c_char

Returns the path to the underlying VSLFrame buffer. Note it will not always be available, such as when the frame was externally created. When no path is available NULL is returned.

@note This function is not thread-safe and you must use the string immediately.

@since 1.3 @memberof VSLFrame

Source

pub unsafe fn vsl_frame_unregister(&self, frame: *mut VSLFrame)

Unregisters the frame, removing it from the host pool.

@deprecated This function is deprecated in favour of calling @ref vsl_frame_release() which will handle the required cleanup.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_copy( &self, target: *mut VSLFrame, source: *mut VSLFrame, crop: *const VSLRect, ) -> c_int

Copy the source frame into the target frame, with optional source crop. The copy handles format conversion, rescaling to fit the target frame. Resize happens after the crop, if required.

Copy can happen between any frames, regardless of whether they are parented or not or have differing parents. The copy happens through the underlying buffers and will attempt to use available hardware accelerators.

The function will attempt to lock target and source. Since lock is a no-op when not a client frame it is safe even for free-standing frames. Copying to or from a posted frame is safe but is likely to cause visual corruption such as tearing.

@since 1.3 @memberof VSLFrame

Source

pub unsafe fn vsl_frame_userptr(&self, frame: *mut VSLFrame) -> *mut c_void

Returns the user pointer associated with this frame.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_set_userptr( &self, frame: *mut VSLFrame, userptr: *mut c_void, )

Associate userptr with this frame.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_wait( &self, client: *mut VSLClient, until: i64, ) -> *mut VSLFrame

Waits for a frame to arrive and returns a new frame object. Frames who’s timestamp is less than @param until will be ignored.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_release(&self, frame: *mut VSLFrame)

Releases the frame, performing required cleanup. If the frame was mapped it will be unmapped. If the frame was posted to a host it will be removed, if this is a client frame it will be unlocked.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_trylock(&self, frame: *mut VSLFrame) -> c_int

Attempts to lock the video frame.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_unlock(&self, frame: *mut VSLFrame) -> c_int

Attempts to unlock the video frame.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_serial(&self, frame: *const VSLFrame) -> i64

Returns the serial frame count of the video frame.

Note this frame serial tracks the count of frames registered on the host and does not necessarily equal the actual frame number from the camera.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_timestamp(&self, frame: *const VSLFrame) -> i64

Returns the timestamp for this frame in nanoseconds.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_duration(&self, frame: *const VSLFrame) -> i64

Returns the duration for this frame in nanoseconds.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_pts(&self, frame: *const VSLFrame) -> i64

Returns the presentation timestamp for this frame in nanoseconds.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_dts(&self, frame: *const VSLFrame) -> i64

Returns the decode timestamp for this frame in nanoseconds.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_expires(&self, frame: *const VSLFrame) -> i64

Returns the epiration time for this frame in milliseconds.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_fourcc(&self, frame: *const VSLFrame) -> u32

Returns the FOURCC code for the video frame.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_width(&self, frame: *const VSLFrame) -> c_int

Returns the width in pixels of the video frame.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_height(&self, frame: *const VSLFrame) -> c_int

Returns the height in pixels of the video frame.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_stride(&self, frame: *const VSLFrame) -> c_int

Returns the stride in bytes of the video frame, to go from one row to the next.

@since 1.3 @memberof VSLFrame

Source

pub unsafe fn vsl_frame_size(&self, frame: *const VSLFrame) -> c_int

Returns the size in bytes of the video frame.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_handle(&self, frame: *const VSLFrame) -> c_int

Returns the file descriptor for this frame or -1 if none is associated.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_paddr(&self, frame: *const VSLFrame) -> isize

Returns the physical address of the frame. If the frame does not support DMA then MMAP_FAILED is returned.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_mmap( &self, frame: *mut VSLFrame, size: *mut usize, ) -> *mut c_void

Maps the frame into the process’ memory space, optionally also sets the size of the frame if @param size is non-NULL. Ensure the frame is unmapped when no longer needed using @ref nn_frame_munmap().

Note that a frame must be locked for the duration of the mapping.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_munmap(&self, frame: *mut VSLFrame)

Maps the frame into the process’ memory space, optionally also sets the size of the frame if @param size is non-NULL.

@memberof VSLFrame

Source

pub unsafe fn vsl_frame_sync( &self, frame: *const VSLFrame, enable: c_int, mode: c_int, ) -> c_int

Cache synchronization session control for when using DMA-backed buffers. This happens automatically on mmap/munmap but the API is also available for cases where the frame is updated in-place during a mapping.

@param frame the frame object to synchronize @param enable whether the sync session is being enabled or disabled @param mode the synchronization mode controls READ, WRITE, or both. @since 1.3 @memberof VSLFrame

Source

pub unsafe fn vsl_fourcc_from_string(&self, fourcc: *const c_char) -> u32

Returns a fourcc integer code from the string. If the fourcc code is invalid or unsupported then 0 is returned.

Source

pub unsafe fn vsl_encoder_create( &self, profile: VSLEncoderProfile, outputFourcc: u32, fps: c_int, ) -> *mut VSLEncoder

@brief Creates VSLEncoder instance

@param profile VSLEncoderProfile determining encode quality @param outputFourcc fourcc code defining the codec @param fps output stream fps @return VSLEncoder* new encoder instance

Every encoder instance must be released using vsl_encoder_release

For Hantro VC8000e encoder initialization is performed when vsl_encode_frame is called for a first time

Source

pub unsafe fn vsl_encoder_release(&self, encoder: *mut VSLEncoder)

@brief Destroys VSLEncoder instance

@param encoder VSLEncoder* instance to destroy

Source

pub unsafe fn vsl_encode_frame( &self, encoder: *mut VSLEncoder, source: *mut VSLFrame, destination: *mut VSLFrame, cropRegion: *const VSLRect, keyframe: *mut c_int, ) -> c_int

@brief Encode frame @param encoder VSLEncoder instance @param source VSLFrame source @param destination VSLFrame destination @param cropRegion (optional) VSLRect that defines the crop region, NULL when destination and source sizes match @param keyframe (optional) VSL sets this to 1 if the encoded frame is a keyframe, otherwise 0. User can set to NULL to ignore param. @retval 0 on success @retval -1 on falure (check errno for details)

For Hantro VC8000e encoder initialization is performed when this function is called for a first time For Hantro VC8000e encoder source width, height and fourcc; destination width, height and fourcc; cropRegion parameters must match for all function calls throughout the lifetime of the encoder instance

Source

pub unsafe fn vsl_encoder_new_output_frame( &self, encoder: *const VSLEncoder, width: c_int, height: c_int, duration: i64, pts: i64, dts: i64, ) -> *mut VSLFrame

Source

pub unsafe fn vsl_camera_open_device( &self, filename: *const c_char, ) -> *mut vsl_camera

Opens the camera device specified by the @param filename and allocates device memory. If the device was not found or could not be recognized

Return NULL if the device was not found or could not be recognized. Otherwise returns a vsl_camera context which can be used in other vsl_camera functions.

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_init_device( &self, ctx: *mut vsl_camera, width: *mut c_int, height: *mut c_int, buf_count: *mut c_int, fourcc: *mut u32, ) -> c_int

Initialized the camera device in @param ctx for streaming and allocate camera buffers.

Then requests the camera to stream at the requested @param width and @param height using the requested @param fourcc code.

If @param width, @param height, or @param fourcc are 0, the respective value use the default provided by the driver

The @param width, @param height, @param fourcc parameters will be set to the actual width and height and fourcc that the camera driver sets the device to.

Returns -1 if an error is encountered when initializing the camera to stream, otherwise returns 0

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_mirror( &self, ctx: *const vsl_camera, mirror: bool, ) -> c_int

Requests the camera in @param ctx to mirror the image leftside right

Returns -1 if a mirror was requested but the camera driver refused the request, otherwise 0.

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_mirror_v( &self, ctx: *const vsl_camera, mirror: bool, ) -> c_int

Requests the camera in @param ctx to mirror the image upside down

Returns -1 if a mirror was requested but the camera driver refused the request, otherwise 0.

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_start_capturing(&self, ctx: *mut vsl_camera) -> c_int

Starts the camera stream.

Must be called after @ref vsl_camera_init_device

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_get_data( &self, ctx: *mut vsl_camera, ) -> *mut vsl_camera_buffer

Attempts to read a frame from the camera.

Must be called after @ref vsl_camera_start_capturing.

Ensure to call @ref vsl_camera_release_buffer after the buffer is done being used and allow the buffer to be reused for frame capture.

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_release_buffer( &self, ctx: *mut vsl_camera, buffer: *const vsl_camera_buffer, ) -> c_int

Enqueues a buffer to be reused for frame capture.

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_stop_capturing(&self, ctx: *const vsl_camera) -> c_int

Stops the camera stream.

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_uninit_device(&self, ctx: *mut vsl_camera)

Uninitializes the camera buffers and frees the buffer memory

Ensure that the device is not streaming. If @ref vsl_camera_start_capturing was called, ensure that @ref vsl_camera_stop_capturing is called before this function

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_close_device(&self, ctx: *mut vsl_camera)

Closes the camera device and frees the device memory

Ensure that the device is not streaming. If @ref vsl_camera_start_capturing was called, ensure that @ref vsl_camera_stop_capturing is called before this function

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_is_dmabuf_supported( &self, ctx: *const vsl_camera, ) -> c_int

Checks if dma buffers are supported on the camera

Ensure that this is called after @ref vsl_camera_init_device

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_get_queued_buf_count( &self, ctx: *const vsl_camera, ) -> c_int

Returns the number of queued buffers for the camera. @ref vsl_camera_get_data will timeout if there are 0 queued buffers.

The user can send buffers back to the buffer queue using @ref vsl_camera_release_buffer

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_buffer_mmap( &self, buffer: *mut vsl_camera_buffer, ) -> *mut c_void

Returns the mmap memory of the camera buffer

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_buffer_dma_fd( &self, buffer: *const vsl_camera_buffer, ) -> c_int

Returns the dmabuf file descriptor of the camera buffer

If the device does not support dmabuf, returns -1

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_buffer_phys_addr( &self, buffer: *const vsl_camera_buffer, ) -> u64

Returns the phys addr of the camera buffer

If the device does not support physical address, returns 0

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_buffer_length( &self, buffer: *const vsl_camera_buffer, ) -> u32

Returns the length of the camera buffer in bytes

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_buffer_fourcc( &self, buffer: *const vsl_camera_buffer, ) -> u32

Returns the fourcc code of the camera buffer

@memberof VSLCamera

Source

pub unsafe fn vsl_camera_buffer_timestamp( &self, buffer: *const vsl_camera_buffer, seconds: *mut i64, nanoseconds: *mut i64, )

Reads the timestamp of the camera buffer into @param seconds and @param nanoseconds. The seconds are relative to the monotonic time when the frame was captured, nanoseconds are the sub-seconds in nanoseconds.

Source

pub unsafe fn vsl_camera_enum_fmts( &self, ctx: *const vsl_camera, codes: *mut u32, size: c_int, ) -> c_int

Lists the supported single planar formats of the camera into @param codes as fourcc codes

Source

pub unsafe fn vsl_camera_enum_mplane_fmts( &self, ctx: *const vsl_camera, codes: *mut u32, size: c_int, ) -> c_int

Lists the supported multi planar formats of the camera into @param codes as fourcc codes

Source

pub unsafe fn vsl_decoder_create( &self, outputFourcc: u32, fps: c_int, ) -> *mut VSLDecoder

Source

pub unsafe fn vsl_decode_frame( &self, decoder: *mut VSLDecoder, data: *const c_void, data_length: c_uint, bytes_used: *mut usize, output_frame: *mut *mut VSLFrame, ) -> VSLDecoderRetCode

Source

pub unsafe fn vsl_decoder_width(&self, decoder: *const VSLDecoder) -> c_int

Source

pub unsafe fn vsl_decoder_height(&self, decoder: *const VSLDecoder) -> c_int

Source

pub unsafe fn vsl_decoder_crop(&self, decoder: *const VSLDecoder) -> VSLRect

Source

pub unsafe fn vsl_decoder_release(&self, decoder: *mut VSLDecoder) -> c_int

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.