summaryrefslogtreecommitdiff
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorMirela Rabulea <mirela.rabulea@nxp.com>2018-07-20 20:21:02 +0300
committerLeonard Crestez <leonard.crestez@nxp.com>2018-08-24 12:41:33 +0300
commited85de28304caca344c1cb53f83b907cd93e55b9 (patch)
tree7db62709409229e1917d4d505ea7c35b7cfd6507 /drivers/media/platform
parent0cf93ffb3bae1c8ad5f9e7208f320e13fc3109e4 (diff)
MLK-18998: mxc-jpeg: Fix jpeg format for gstreamer
Fix proposed by Bing Song. Signed-off-by: Mirela Rabulea <mirela.rabulea@nxp.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/imx8/mxc-jpeg.c23
1 files changed, 18 insertions, 5 deletions
diff --git a/drivers/media/platform/imx8/mxc-jpeg.c b/drivers/media/platform/imx8/mxc-jpeg.c
index 832c9ce490f3..fc6cb0f504d9 100644
--- a/drivers/media/platform/imx8/mxc-jpeg.c
+++ b/drivers/media/platform/imx8/mxc-jpeg.c
@@ -204,7 +204,7 @@ static int enum_fmt(struct mxc_jpeg_fmt *mxc_formats, int n,
int i, num = 0;
for (i = 0; i < n; ++i) {
- if (mxc_formats[i].flags & type) {
+ if (mxc_formats[i].flags == type) {
/* index-th format of type type found ? */
if (num == f->index)
break;
@@ -789,16 +789,29 @@ static int mxc_jpeg_querycap(struct file *file, void *priv,
static int mxc_jpeg_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
- return enum_fmt(mxc_formats, MXC_NUM_FORMATS, f,
- MXC_IN_FORMAT);
+ struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(priv);
+
+ if (ctx->mode == MXC_JPEG_ENCODE)
+ return enum_fmt(mxc_formats, MXC_NUM_FORMATS, f,
+ MXC_IN_FORMAT);
+ else
+ return enum_fmt(mxc_formats, MXC_NUM_FORMATS, f,
+ MXC_OUT_FORMAT);
}
static int mxc_jpeg_enum_fmt_vid_out(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
- return enum_fmt(mxc_formats, MXC_NUM_FORMATS, f,
- MXC_OUT_FORMAT);
+ struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(priv);
+
+ if (ctx->mode == MXC_JPEG_DECODE)
+ return enum_fmt(mxc_formats, MXC_NUM_FORMATS, f,
+ MXC_IN_FORMAT);
+ else
+ return enum_fmt(mxc_formats, MXC_NUM_FORMATS, f,
+ MXC_OUT_FORMAT);
}
+
static void mxc_jpeg_bound_align_image(u32 *w, unsigned int wmin,
unsigned int wmax, unsigned int walign,
u32 *h, unsigned int hmin,