usb_cam::utils
Classes
Name | |
---|---|
struct | usb_cam::utils::buffer |
Types
Name | |
---|---|
enum | io_method_t { IO_METHOD_USERPTR, IO_METHOD_UNKNOWN, IO_METHOD_READ, IO_METHOD_MMAP} Read more on IO methods here: https://lwn.net/Articles/240667/. |
Functions
Name | |
---|---|
int | xioctl(int fd, uint64_t request, void * arg) |
io_method_t | io_method_from_string(const std::string & str) |
time_t | get_epoch_time_shift_us() Get epoch time shift in microseconds. |
timespec | calc_img_timestamp(const timeval & buffer_time, const time_t & epoch_time_shift_us) Calculate image timestamp from buffer time and epoch time shift. In this, the buffer time is first converted into microseconds before the epoch time shift, which is to be given in microseconds is added to it. Afterwards it is split into seconds and nanoseconds for the image timestamp. |
std::map< std::string, v4l2_capability > | available_devices() List currently available valid V4L2 devices Can be used to check if a device string is valid before starting up. |
Types Documentation
enum io_method_t
Enumerator | Value | Description |
---|---|---|
IO_METHOD_USERPTR | memory buffers allocated in the user space | |
IO_METHOD_UNKNOWN | ||
IO_METHOD_READ | read method copies the video frame between user and kernal space | |
IO_METHOD_MMAP | memory mapped buffers allocated in kernel space |
Read more on IO methods here: https://lwn.net/Articles/240667/.
Functions Documentation
function xioctl
inline int xioctl(
int fd,
uint64_t request,
void * arg
)
function io_method_from_string
inline io_method_t io_method_from_string(
const std::string & str
)
function get_epoch_time_shift_us
inline time_t get_epoch_time_shift_us()
Get epoch time shift in microseconds.
Run this at start of process to calculate epoch time shift https://stackoverflow.com/questions/10266451/where-does-v4l2-buffer-timestamp-value-starts-counting
function calc_img_timestamp
inline timespec calc_img_timestamp(
const timeval & buffer_time,
const time_t & epoch_time_shift_us
)
Calculate image timestamp from buffer time and epoch time shift. In this, the buffer time is first converted into microseconds before the epoch time shift, which is to be given in microseconds is added to it. Afterwards it is split into seconds and nanoseconds for the image timestamp.
function available_devices
inline std::map< std::string, v4l2_capability > available_devices()
List currently available valid V4L2 devices Can be used to check if a device string is valid before starting up.
Inspired by: http://stackoverflow.com/questions/4290834/how-to-get-a-list-of-video-capture-devices-web-cameras-on-linux-ubuntu-c
Updated on 2024-06-22 at 03:15:44 +0000