[PATCH 10/11] [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. Signed-off-by: Philipp Zabel --- drivers/media/platform/coda.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c index e63226b..ed5fa4c 100644 --- a/drivers/media/platform/coda.c +++ b/drivers/media/platform/coda.c @@ -685,7 +685,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; @@ -738,6 +738,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; -- 2.0.1 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 10/11] [media] coda: default to h.264 decoder on invalid formats
On 07/17/2014 06:05 PM, Philipp Zabel wrote: > If the user provides an invalid format, let the decoder device > default to h.264. Acked-by: Hans Verkuil Regards, Hans > > Signed-off-by: Philipp Zabel > --- > drivers/media/platform/coda.c | 8 +++- > 1 file changed, 7 insertions(+), 1 deletion(-) > > diff --git a/drivers/media/platform/coda.c b/drivers/media/platform/coda.c > index e63226b..ed5fa4c 100644 > --- a/drivers/media/platform/coda.c > +++ b/drivers/media/platform/coda.c > @@ -685,7 +685,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; > > @@ -738,6 +738,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; > -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html