mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-24 12:44:11 +08:00
media: videobuf2: Introduce vb2_find_buffer()
All users of vb2_find_timestamp() combine it with vb2_get_buffer() to retrieve a videobuf2 buffer, given a u64 timestamp. Introduce an API for this use-case. Users will be converted to the new API as follow-up commits. Signed-off-by: Ezequiel Garcia <ezequiel@collabora.com> Acked-by: Tomasz Figa <tfiga@chromium.org> Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
This commit is contained in:
parent
f0b4a9c46c
commit
9d042e457e
@ -638,6 +638,18 @@ int vb2_find_timestamp(const struct vb2_queue *q, u64 timestamp,
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(vb2_find_timestamp);
|
||||
|
||||
struct vb2_buffer *vb2_find_buffer(struct vb2_queue *q, u64 timestamp)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < q->num_buffers; i++)
|
||||
if (q->bufs[i]->copied_timestamp &&
|
||||
q->bufs[i]->timestamp == timestamp)
|
||||
return vb2_get_buffer(q, i);
|
||||
return NULL;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(vb2_find_buffer);
|
||||
|
||||
/*
|
||||
* vb2_querybuf() - query video buffer information
|
||||
* @q: videobuf queue
|
||||
|
@ -78,6 +78,16 @@ struct vb2_v4l2_buffer {
|
||||
int vb2_find_timestamp(const struct vb2_queue *q, u64 timestamp,
|
||||
unsigned int start_idx);
|
||||
|
||||
/**
|
||||
* vb2_find_buffer() - Find a buffer with given timestamp
|
||||
*
|
||||
* @q: pointer to &struct vb2_queue with videobuf2 queue.
|
||||
* @timestamp: the timestamp to find.
|
||||
*
|
||||
* Returns the buffer with the given @timestamp, or NULL if not found.
|
||||
*/
|
||||
struct vb2_buffer *vb2_find_buffer(struct vb2_queue *q, u64 timestamp);
|
||||
|
||||
int vb2_querybuf(struct vb2_queue *q, struct v4l2_buffer *b);
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user