Add buffer_v4l2_t
This commit is contained in:
parent
4a345ed048
commit
f6309fa3b3
@ -22,9 +22,9 @@ typedef struct buffer_s {
|
|||||||
bool is_keyframe : 1;
|
bool is_keyframe : 1;
|
||||||
} flags;
|
} flags;
|
||||||
|
|
||||||
struct {
|
union {
|
||||||
unsigned flags;
|
struct buffer_v4l2_s *v4l2;
|
||||||
} v4l2;
|
};
|
||||||
|
|
||||||
// State
|
// State
|
||||||
int mmap_reflinks;
|
int mmap_reflinks;
|
||||||
|
@ -151,13 +151,12 @@ buffer_t *buffer_list_dequeue(buffer_list_t *buf_list)
|
|||||||
buf->enqueued = false;
|
buf->enqueued = false;
|
||||||
buf->mmap_reflinks = 1;
|
buf->mmap_reflinks = 1;
|
||||||
|
|
||||||
E_LOG_DEBUG(buf_list, "Grabbed mmap buffer=%u, bytes=%d, used=%d, frame=%d, linked=%s, flags=%08x",
|
E_LOG_DEBUG(buf_list, "Grabbed mmap buffer=%u, bytes=%d, used=%d, frame=%d, linked=%s",
|
||||||
buf->index,
|
buf->index,
|
||||||
buf->length,
|
buf->length,
|
||||||
buf->used,
|
buf->used,
|
||||||
buf_list->frames,
|
buf_list->frames,
|
||||||
buf->dma_source ? buf->dma_source->name : NULL,
|
buf->dma_source ? buf->dma_source->name : NULL);
|
||||||
buf->v4l2.flags);
|
|
||||||
|
|
||||||
if (buf->dma_source) {
|
if (buf->dma_source) {
|
||||||
buf->dma_source->used = 0;
|
buf->dma_source->used = 0;
|
||||||
|
@ -12,6 +12,8 @@ int v4l2_buffer_open(buffer_t *buf)
|
|||||||
buffer_list_t *buf_list = buf->buf_list;
|
buffer_list_t *buf_list = buf->buf_list;
|
||||||
device_t *dev = buf_list->device;
|
device_t *dev = buf_list->device;
|
||||||
|
|
||||||
|
buf->v4l2 = calloc(1, sizeof(buffer_v4l2_t));
|
||||||
|
|
||||||
v4l2_buf.type = buf_list->v4l2->type;
|
v4l2_buf.type = buf_list->v4l2->type;
|
||||||
v4l2_buf.index = buf->index;
|
v4l2_buf.index = buf->index;
|
||||||
|
|
||||||
@ -70,6 +72,9 @@ void v4l2_buffer_close(buffer_t *buf)
|
|||||||
close(buf->dma_fd);
|
close(buf->dma_fd);
|
||||||
buf->dma_fd = -1;
|
buf->dma_fd = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
free(buf->v4l2);
|
||||||
|
buf->v4l2 = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int v4l2_buffer_enqueue(buffer_t *buf, const char *who)
|
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->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->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);
|
buf->captured_time_us = get_time_us(CLOCK_FROM_PARAMS, NULL, &v4l2_buf.timestamp, 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -20,6 +20,10 @@ typedef struct buffer_list_v4l2_s {
|
|||||||
int type;
|
int type;
|
||||||
} buffer_list_v4l2_t;
|
} buffer_list_v4l2_t;
|
||||||
|
|
||||||
|
typedef struct buffer_v4l2_s {
|
||||||
|
unsigned flags;
|
||||||
|
} buffer_v4l2_t;
|
||||||
|
|
||||||
int v4l2_device_open(device_t *dev);
|
int v4l2_device_open(device_t *dev);
|
||||||
void v4l2_device_close(device_t *dev);
|
void v4l2_device_close(device_t *dev);
|
||||||
int v4l2_device_set_decoder_start(device_t *dev, bool do_on);
|
int v4l2_device_set_decoder_start(device_t *dev, bool do_on);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user