aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Verkuil <hans.verkuil@cisco.com>2014-12-02 14:54:34 +0100
committerHans Verkuil <hans.verkuil@cisco.com>2014-12-02 14:54:34 +0100
commit5730aeb399ae1f31ea23d117fe013cdeef9d4808 (patch)
tree82db0295aeb4d3b2f5c8e384ac35719794255b8a
parent2967ecbf9546ea22c091dd01964ee66f1d3d1df0 (diff)
(c)v4l-helpers.h: add functions for flags, ycbcr_enc and quantization
Get/set these new pix_format fields. Actually, flags isn't new, it just was never support in these helpers. Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
-rw-r--r--utils/v4l2-compliance/cv4l-helpers.h6
-rw-r--r--utils/v4l2-compliance/v4l-helpers.h90
2 files changed, 96 insertions, 0 deletions
diff --git a/utils/v4l2-compliance/cv4l-helpers.h b/utils/v4l2-compliance/cv4l-helpers.h
index 400a9360..2fefaf59 100644
--- a/utils/v4l2-compliance/cv4l-helpers.h
+++ b/utils/v4l2-compliance/cv4l-helpers.h
@@ -652,6 +652,12 @@ public:
void s_pixelformat(__u32 pixelformat) { v4l_format_s_pixelformat(this, pixelformat); }
unsigned g_colorspace() { return v4l_format_g_colorspace(this); }
void s_colorspace(unsigned colorspace) { v4l_format_s_colorspace(this, colorspace); }
+ unsigned g_ycbcr_enc() { return v4l_format_g_ycbcr_enc(this); }
+ void s_ycbcr_enc(unsigned ycbcr_enc) { v4l_format_s_ycbcr_enc(this, ycbcr_enc); }
+ unsigned g_quantization() { return v4l_format_g_quantization(this); }
+ void s_quantization(unsigned quantization) { v4l_format_s_quantization(this, quantization); }
+ unsigned g_flags() { return v4l_format_g_flags(this); }
+ void s_flags(unsigned flags) { v4l_format_s_flags(this, flags); }
__u8 g_num_planes() { return v4l_format_g_num_planes(this); }
void s_num_planes(__u8 num_planes) { v4l_format_s_num_planes(this, num_planes); }
__u32 g_bytesperline(unsigned plane = 0) { return v4l_format_g_bytesperline(this, plane); }
diff --git a/utils/v4l2-compliance/v4l-helpers.h b/utils/v4l2-compliance/v4l-helpers.h
index 0cf4e081..040467e5 100644
--- a/utils/v4l2-compliance/v4l-helpers.h
+++ b/utils/v4l2-compliance/v4l-helpers.h
@@ -633,6 +633,96 @@ v4l_format_g_colorspace(const struct v4l2_format *fmt)
}
}
+static inline void v4l_format_s_ycbcr_enc(struct v4l2_format *fmt,
+ unsigned ycbcr_enc)
+{
+ switch (fmt->type) {
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+ fmt->fmt.pix.ycbcr_enc = ycbcr_enc;
+ break;
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
+ fmt->fmt.pix_mp.ycbcr_enc = ycbcr_enc;
+ break;
+ }
+}
+
+static inline unsigned
+v4l_format_g_ycbcr_enc(const struct v4l2_format *fmt)
+{
+ switch (fmt->type) {
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+ return fmt->fmt.pix.ycbcr_enc;
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
+ return fmt->fmt.pix_mp.ycbcr_enc;
+ default:
+ return 0;
+ }
+}
+
+static inline void v4l_format_s_quantization(struct v4l2_format *fmt,
+ unsigned quantization)
+{
+ switch (fmt->type) {
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+ fmt->fmt.pix.quantization = quantization;
+ break;
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
+ fmt->fmt.pix_mp.quantization = quantization;
+ break;
+ }
+}
+
+static inline unsigned
+v4l_format_g_quantization(const struct v4l2_format *fmt)
+{
+ switch (fmt->type) {
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+ return fmt->fmt.pix.quantization;
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
+ return fmt->fmt.pix_mp.quantization;
+ default:
+ return 0;
+ }
+}
+
+static inline void v4l_format_s_flags(struct v4l2_format *fmt,
+ unsigned flags)
+{
+ switch (fmt->type) {
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+ fmt->fmt.pix.flags = flags;
+ break;
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
+ fmt->fmt.pix_mp.flags = flags;
+ break;
+ }
+}
+
+static inline unsigned
+v4l_format_g_flags(const struct v4l2_format *fmt)
+{
+ switch (fmt->type) {
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+ return fmt->fmt.pix.flags;
+ case V4L2_BUF_TYPE_VIDEO_CAPTURE_MPLANE:
+ case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE:
+ return fmt->fmt.pix_mp.flags;
+ default:
+ return 0;
+ }
+}
+
static inline void v4l_format_s_num_planes(struct v4l2_format *fmt, __u8 num_planes)
{
switch (fmt->type) {

Privacy Policy