41 return (B->tv_sec - A->tv_sec) * 1000000 + (B->tv_usec - A->tv_usec);
51 new_listener->
active =
true;
53 new_listener->
next = NULL;
54 new_listener->
async = NULL;
69 while (listener->
next != NULL)
70 listener = listener->
next;
73 listener->
next = new_listener;
struct video_listener * cv_add_to_device_async(struct video_config_t *device, cv_function func, int nice_level)
uint32_t buf_size
The buffer size.
volatile bool thread_running
void cv_attach_listener(struct video_config_t *device, struct video_listener *new_listener)
struct video_listener * cv_add_to_device(struct video_config_t *device, cv_function func)
void image_create(struct image_t *img, uint16_t width, uint16_t height, enum image_type type)
Create a new image.
void image_copy(struct image_t *input, struct image_t *output)
Copy an image from inut to output This will only work if the formats are the same.
Functions to obtain rt priority or set the nice level.
struct video_listener * listener
struct video_listener * cv_listener
The first computer vision listener in the linked list for this video device.
Computer vision framework for onboard processing.
volatile int thread_priority
bool add_video_device(struct video_config_t *device)
static uint32_t timeval_diff(struct timeval *A, struct timeval *B)
pthread_cond_t img_available
struct image_t *(* cv_function)(struct image_t *img)
void cv_run_device(struct video_config_t *device, struct image_t *img)
volatile bool img_processed
struct timeval ts
The timestamp of creation.
void * cv_async_thread(void *args)
pthread_mutex_t img_mutex
void cv_async_function(struct cv_async *async, struct image_t *img)
struct video_listener * next
static int set_nice_level(int level)
enum image_type type
The image type.