Commit 4f31ff01 authored by Philipp Zabel's avatar Philipp Zabel Committed by Mauro Carvalho Chehab

[media] coda: default to h.264 decoder on invalid formats

If the user provides an invalid format, let the decoder device
default to h.264.
Acked-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarPhilipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: default avatarKamil Debski <k.debski@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <m.chehab@samsung.com>
parent 22e244b8
......@@ -683,7 +683,7 @@ static int coda_try_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_format *f)
{
struct coda_ctx *ctx = fh_to_ctx(priv);
struct coda_codec *codec;
struct coda_codec *codec = NULL;
struct vb2_queue *src_vq;
int ret;
......@@ -736,6 +736,12 @@ static int coda_try_fmt_vid_out(struct file *file, void *priv,
/* Determine codec by encoded format, returns NULL if raw or invalid */
codec = coda_find_codec(ctx->dev, f->fmt.pix.pixelformat,
V4L2_PIX_FMT_YUV420);
if (!codec && ctx->inst_type == CODA_INST_DECODER) {
codec = coda_find_codec(ctx->dev, V4L2_PIX_FMT_H264,
V4L2_PIX_FMT_YUV420);
if (!codec)
return -EINVAL;
}
if (!f->fmt.pix.colorspace)
f->fmt.pix.colorspace = V4L2_COLORSPACE_REC709;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment