@@ -1004,6 +1004,8 @@ void testNode(struct node &node, struct node &node_m2m_cap, struct node &expbuf_
node.is_video = false;
node.is_meta = true;
}
+ if (node.g_caps() & V4L2_CAP_IO_MC)
+ node.is_io_mc = true;
/* Information Opts */
@@ -97,6 +97,7 @@ struct base_node {
bool is_meta;
bool is_touch;
bool is_m2m;
+ bool is_io_mc;
bool is_planar;
bool can_capture;
bool can_output;
@@ -447,7 +447,7 @@ static int testFormatsType(struct node *node, int ret, unsigned type, struct v4
fail_on_test(pix.bytesperline && pix.bytesperline < pix.width);
fail_on_test(!pix.sizeimage);
if (!node->is_m2m)
- fail_on_test(testColorspace(node->has_inputs || node->has_outputs,
+ fail_on_test(testColorspace(!node->is_io_mc,
pix.pixelformat, pix.colorspace,
pix.ycbcr_enc, pix.quantization));
fail_on_test(pix.field == V4L2_FIELD_ANY);
@@ -463,7 +463,7 @@ static int testFormatsType(struct node *node, int ret, unsigned type, struct v4
return fail("pixelformat %08x (%s) for buftype %d not reported by ENUM_FMT\n",
pix_mp.pixelformat, fcc2s(pix_mp.pixelformat).c_str(), type);
if (!node->is_m2m)
- fail_on_test(testColorspace(node->has_inputs || node->has_outputs,
+ fail_on_test(testColorspace(!node->is_io_mc,
pix_mp.pixelformat, pix_mp.colorspace,
pix_mp.ycbcr_enc, pix_mp.quantization));
fail_on_test(pix_mp.field == V4L2_FIELD_ANY);
@@ -466,6 +466,10 @@ int testInput(struct node *node)
if (!node->inputs && node->has_inputs)
return fail("no inputs found, but input capabilities set\n");
fail_on_test(node->is_m2m && node->inputs > 1);
+ if (node->is_io_mc) {
+ fail_on_test(!node->is_video && !node->is_meta);
+ fail_on_test(node->inputs != 1);
+ }
return 0;
}
@@ -836,6 +840,10 @@ int testOutput(struct node *node)
if (!node->outputs && node->has_outputs)
return fail("no outputs found, but output capabilities set\n");
fail_on_test(node->is_m2m && node->outputs > 1);
+ if (node->is_io_mc) {
+ fail_on_test(!node->is_video && !node->is_meta);
+ fail_on_test(node->outputs != 1);
+ }
return 0;
}
Add tests to check the behavior of VIDIOC_ENUM{INPUT,OUTPUT}, VIDIOC_G_{INPUT,OUTPUT} and VIDIOC_S_{INPUT,OUTPUT} when the V4L2_CAP_IO_MC is set. And the old 'node->has_inputs || node->has_outputs' argument for testColorspace() can now be replaced with !node->is_io_mc. Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> --- Supersedes https://patchwork.linuxtv.org/patch/62312. ---