mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-06-26 16:41:25 +00:00
media: coda: split marking last meta into helper function
Split marking the last metadata entry into a helper function to simplify coda_decoder_cmd. Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
parent
12310819a2
commit
d2f1db8608
1 changed files with 22 additions and 14 deletions
|
@ -1153,6 +1153,26 @@ static int coda_try_decoder_cmd(struct file *file, void *fh,
|
||||||
return v4l2_m2m_ioctl_try_decoder_cmd(file, fh, dc);
|
return v4l2_m2m_ioctl_try_decoder_cmd(file, fh, dc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static bool coda_mark_last_meta(struct coda_ctx *ctx)
|
||||||
|
{
|
||||||
|
struct coda_buffer_meta *meta;
|
||||||
|
|
||||||
|
coda_dbg(1, ctx, "marking last meta\n");
|
||||||
|
|
||||||
|
spin_lock(&ctx->buffer_meta_lock);
|
||||||
|
if (list_empty(&ctx->buffer_meta_list)) {
|
||||||
|
spin_unlock(&ctx->buffer_meta_lock);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
meta = list_last_entry(&ctx->buffer_meta_list, struct coda_buffer_meta,
|
||||||
|
list);
|
||||||
|
meta->last = true;
|
||||||
|
|
||||||
|
spin_unlock(&ctx->buffer_meta_lock);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
static int coda_decoder_cmd(struct file *file, void *fh,
|
static int coda_decoder_cmd(struct file *file, void *fh,
|
||||||
struct v4l2_decoder_cmd *dc)
|
struct v4l2_decoder_cmd *dc)
|
||||||
{
|
{
|
||||||
|
@ -1197,22 +1217,10 @@ static int coda_decoder_cmd(struct file *file, void *fh,
|
||||||
stream_end = true;
|
stream_end = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
coda_dbg(1, ctx, "marking last meta\n");
|
if (coda_mark_last_meta(ctx))
|
||||||
|
|
||||||
/* Mark last meta */
|
|
||||||
spin_lock(&ctx->buffer_meta_lock);
|
|
||||||
if (!list_empty(&ctx->buffer_meta_list)) {
|
|
||||||
struct coda_buffer_meta *meta;
|
|
||||||
|
|
||||||
meta = list_last_entry(&ctx->buffer_meta_list,
|
|
||||||
struct coda_buffer_meta,
|
|
||||||
list);
|
|
||||||
meta->last = true;
|
|
||||||
stream_end = true;
|
stream_end = true;
|
||||||
} else {
|
else
|
||||||
wakeup = true;
|
wakeup = true;
|
||||||
}
|
|
||||||
spin_unlock(&ctx->buffer_meta_lock);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stream_end) {
|
if (stream_end) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue