Add buffer_v4l2_t

This commit is contained in:
Kamil Trzcinski
2022-04-10 16:05:58 +02:00
parent 4a345ed048
commit f6309fa3b3
4 changed files with 15 additions and 7 deletions

View File

@ -12,6 +12,8 @@ int v4l2_buffer_open(buffer_t *buf)
buffer_list_t *buf_list = buf->buf_list;
device_t *dev = buf_list->device;
buf->v4l2 = calloc(1, sizeof(buffer_v4l2_t));
v4l2_buf.type = buf_list->v4l2->type;
v4l2_buf.index = buf->index;
@ -70,6 +72,9 @@ void v4l2_buffer_close(buffer_t *buf)
close(buf->dma_fd);
buf->dma_fd = -1;
}
free(buf->v4l2);
buf->v4l2 = NULL;
}
int v4l2_buffer_enqueue(buffer_t *buf, const char *who)
@ -156,7 +161,7 @@ int v4l2_buffer_list_dequeue(buffer_list_t *buf_list, buffer_t **bufp)
buf->used = v4l2_buf.bytesused;
}
buf->v4l2.flags = v4l2_buf.flags;
buf->v4l2->flags = v4l2_buf.flags;
buf->flags.is_keyframe = (v4l2_buf.flags & V4L2_BUF_FLAG_KEYFRAME) != 0;
buf->captured_time_us = get_time_us(CLOCK_FROM_PARAMS, NULL, &v4l2_buf.timestamp, 0);
return 0;

View File

@ -20,6 +20,10 @@ typedef struct buffer_list_v4l2_s {
int type;
} buffer_list_v4l2_t;
typedef struct buffer_v4l2_s {
unsigned flags;
} buffer_v4l2_t;
int v4l2_device_open(device_t *dev);
void v4l2_device_close(device_t *dev);
int v4l2_device_set_decoder_start(device_t *dev, bool do_on);