Skip to content
Snippets Groups Projects
Commit 97f13412 authored by Mirela Rabulea's avatar Mirela Rabulea Committed by Leonard Crestez
Browse files

MLK-18998: mxc-jpeg: Fix jpeg format for gstreamer


Fix proposed by Bing Song.

Signed-off-by: default avatarMirela Rabulea <mirela.rabulea@nxp.com>
parent deb2b372
No related branches found
No related tags found
No related merge requests found
...@@ -204,7 +204,7 @@ static int enum_fmt(struct mxc_jpeg_fmt *mxc_formats, int n, ...@@ -204,7 +204,7 @@ static int enum_fmt(struct mxc_jpeg_fmt *mxc_formats, int n,
int i, num = 0; int i, num = 0;
for (i = 0; i < n; ++i) { 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 ? */ /* index-th format of type type found ? */
if (num == f->index) if (num == f->index)
break; break;
...@@ -789,16 +789,29 @@ static int mxc_jpeg_querycap(struct file *file, void *priv, ...@@ -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, static int mxc_jpeg_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f) struct v4l2_fmtdesc *f)
{ {
return enum_fmt(mxc_formats, MXC_NUM_FORMATS, f, struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(priv);
MXC_IN_FORMAT);
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, static int mxc_jpeg_enum_fmt_vid_out(struct file *file, void *priv,
struct v4l2_fmtdesc *f) struct v4l2_fmtdesc *f)
{ {
return enum_fmt(mxc_formats, MXC_NUM_FORMATS, f, struct mxc_jpeg_ctx *ctx = mxc_jpeg_fh_to_ctx(priv);
MXC_OUT_FORMAT);
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, static void mxc_jpeg_bound_align_image(u32 *w, unsigned int wmin,
unsigned int wmax, unsigned int walign, unsigned int wmax, unsigned int walign,
u32 *h, unsigned int hmin, u32 *h, unsigned int hmin,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment