device: add helpers for count enqueued
This commit is contained in:
@ -309,3 +309,28 @@ void device_set_option_list(device_t *dev, const char *option_list)
|
||||
|
||||
free(start);
|
||||
}
|
||||
|
||||
int device_output_enqueued(device_t *dev)
|
||||
{
|
||||
if (dev->output_list)
|
||||
return buffer_list_count_enqueued(dev->output_list);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int device_capture_enqueued(device_t *dev, int *max)
|
||||
{
|
||||
int min_val = 100;
|
||||
int max_val = 0;
|
||||
|
||||
for (int i = 0; i < dev->n_capture_list; i++) {
|
||||
int count = buffer_list_count_enqueued(dev->capture_lists[i]);
|
||||
min_val = MIN(min_val, count);
|
||||
max_val = MAX(max_val, count);
|
||||
}
|
||||
|
||||
min_val = MIN(min_val, max_val);
|
||||
if (max) {
|
||||
*max = max_val;
|
||||
}
|
||||
return min_val;
|
||||
}
|
||||
|
@ -75,6 +75,9 @@ int device_set_rotation(device_t *dev, bool vflip, bool hflip);
|
||||
int device_set_option_string(device_t *dev, const char *option, const char *value);
|
||||
void device_set_option_list(device_t *dev, const char *option_list);
|
||||
|
||||
int device_output_enqueued(device_t *dev);
|
||||
int device_capture_enqueued(device_t *dev, int *max);
|
||||
|
||||
device_t *device_v4l2_open(const char *name, const char *path);
|
||||
device_t *device_libcamera_open(const char *name, const char *path);
|
||||
device_t *device_dummy_open(const char *name, const char *path);
|
||||
|
Reference in New Issue
Block a user