diff options
author | Philipp Zabel <p.zabel@pengutronix.de> | 2019-04-12 11:51:25 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab+samsung@kernel.org> | 2019-05-21 07:21:49 -0400 |
commit | 8e7479c7e72586497713b584c0f3258422152f03 (patch) | |
tree | 94cc0bc9e5820255b177227ee6ae266e3fd0e425 /drivers/media/platform/coda/coda-bit.c | |
parent | 736a33d2054659765e809711c74809e736d9e12e (diff) |
media: coda: add coda_frame_type_char helper
Add a function to translate from V4L2 buffer flags to 'I'/'P'/'B'
characters for debug output.
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+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/coda/coda-bit.c')
-rw-r--r-- | drivers/media/platform/coda/coda-bit.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/drivers/media/platform/coda/coda-bit.c b/drivers/media/platform/coda/coda-bit.c index eaa86737fa04..a0dbee2262e9 100644 --- a/drivers/media/platform/coda/coda-bit.c +++ b/drivers/media/platform/coda/coda-bit.c @@ -1456,6 +1456,13 @@ static int coda_prepare_encode(struct coda_ctx *ctx) return 0; } +static char coda_frame_type_char(u32 flags) +{ + return (flags & V4L2_BUF_FLAG_KEYFRAME) ? 'I' : + (flags & V4L2_BUF_FLAG_PFRAME) ? 'P' : + (flags & V4L2_BUF_FLAG_BFRAME) ? 'B' : '?'; +} + static void coda_finish_encode(struct coda_ctx *ctx) { struct vb2_v4l2_buffer *src_buf, *dst_buf; @@ -1512,8 +1519,7 @@ static void coda_finish_encode(struct coda_ctx *ctx) ctx->gopcounter = ctx->params.gop_size - 1; coda_dbg(1, ctx, "job finished: encoded %c frame (%d)\n", - (dst_buf->flags & V4L2_BUF_FLAG_KEYFRAME) ? 'I' : 'P', - dst_buf->sequence); + coda_frame_type_char(dst_buf->flags), dst_buf->sequence); } static void coda_seq_end_work(struct work_struct *work) @@ -2241,8 +2247,7 @@ static void coda_finish_decode(struct coda_ctx *ctx) coda_m2m_buf_done(ctx, dst_buf, VB2_BUF_STATE_DONE); coda_dbg(1, ctx, "job finished: decoded %c frame (%u/%u)\n", - (dst_buf->flags & V4L2_BUF_FLAG_KEYFRAME) ? 'I' : - ((dst_buf->flags & V4L2_BUF_FLAG_PFRAME) ? 'P' : 'B'), + coda_frame_type_char(dst_buf->flags), dst_buf->sequence, ctx->qsequence); } else { coda_dbg(1, ctx, "job finished: no frame decoded (%u/%u)\n", |