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.
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.
@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)
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.
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.
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.
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().
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().
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.
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.
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.
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.
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.
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.
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.
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.
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.
Function pointer definition which will be called as part of
@ref vsl_frame_unregister. This is typically used to free resources
associated with the frame on either client or host side.