summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorTodor Tomov <todor.tomov@linaro.org>2017-07-07 04:48:47 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2017-07-20 06:54:35 -0400
commitf1923010b03c3c41c332dd11b93022d049da3104 (patch)
tree367a0a805abe84bf04a9c9d832209b9b26dad9fc /include
parent281ddc3cdc10413b98531d701ab5323c4f3ff1f4 (diff)
media: v4l2-mediabus: Add helper functions
Add helper functions for mbus to/from mplane pixel format conversion. Signed-off-by: Todor Tomov <todor.tomov@linaro.org> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'include')
-rw-r--r--include/media/v4l2-mediabus.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/include/media/v4l2-mediabus.h b/include/media/v4l2-mediabus.h
index 315c167a95dc..93f8afcb7a22 100644
--- a/include/media/v4l2-mediabus.h
+++ b/include/media/v4l2-mediabus.h
@@ -117,4 +117,30 @@ static inline void v4l2_fill_mbus_format(struct v4l2_mbus_framefmt *mbus_fmt,
mbus_fmt->code = code;
}
+static inline void v4l2_fill_pix_format_mplane(
+ struct v4l2_pix_format_mplane *pix_mp_fmt,
+ const struct v4l2_mbus_framefmt *mbus_fmt)
+{
+ pix_mp_fmt->width = mbus_fmt->width;
+ pix_mp_fmt->height = mbus_fmt->height;
+ pix_mp_fmt->field = mbus_fmt->field;
+ pix_mp_fmt->colorspace = mbus_fmt->colorspace;
+ pix_mp_fmt->ycbcr_enc = mbus_fmt->ycbcr_enc;
+ pix_mp_fmt->quantization = mbus_fmt->quantization;
+ pix_mp_fmt->xfer_func = mbus_fmt->xfer_func;
+}
+
+static inline void v4l2_fill_mbus_format_mplane(
+ struct v4l2_mbus_framefmt *mbus_fmt,
+ const struct v4l2_pix_format_mplane *pix_mp_fmt)
+{
+ mbus_fmt->width = pix_mp_fmt->width;
+ mbus_fmt->height = pix_mp_fmt->height;
+ mbus_fmt->field = pix_mp_fmt->field;
+ mbus_fmt->colorspace = pix_mp_fmt->colorspace;
+ mbus_fmt->ycbcr_enc = pix_mp_fmt->ycbcr_enc;
+ mbus_fmt->quantization = pix_mp_fmt->quantization;
+ mbus_fmt->xfer_func = pix_mp_fmt->xfer_func;
+}
+
#endif