v4l2-compliance: Verify metadata formats
PATCH 1/1 v4l2-compliance: Verify metadata formats
changes to testEnumFormats() and testGetFormats() to verify METADATA type. G_FMT sets node->valid_buftypes, so TRY/S_FMT does not get called for other input types, hence did not modify them.
--- utils/v4l2-compliance/v4l2-test-formats.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
utils/v4l2-compliance/v4l2-test-formats.cpp +13 -4
@@ -305,8 +305,6 @@ int testEnumFormats(struct node *node) case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: case V4L2_BUF_TYPE_SDR_CAPTURE: case V4L2_BUF_TYPE_SDR_OUTPUT: - case V4L2_BUF_TYPE_META_CAPTURE: - case V4L2_BUF_TYPE_META_OUTPUT: if (ret && (node->g_caps() & buftype2cap[type])) return fail("%s cap set, but no %s formats defined\n", buftype2s(type).c_str(), buftype2s(type).c_str());
@@ -314,6 +312,10 @@ int testEnumFormats(struct node *node) return fail("%s cap not set, but %s formats defined\n", buftype2s(type).c_str(), buftype2s(type).c_str()); break; + case V4L2_BUF_TYPE_META_CAPTURE: + case V4L2_BUF_TYPE_META_OUTPUT: + /* Metadata formats need not be present for all input types */ + break; default: if (!ret) return fail("Buffer type %s not allowed!\n", buftype2s(type).c_str());
@@ -599,8 +601,6 @@ int testGetFormats(struct node *node) case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: case V4L2_BUF_TYPE_SDR_CAPTURE: case V4L2_BUF_TYPE_SDR_OUTPUT: - case V4L2_BUF_TYPE_META_CAPTURE: - case V4L2_BUF_TYPE_META_OUTPUT: if (ret && (node->g_caps() & buftype2cap[type])) return fail("%s cap set, but no %s formats defined\n", buftype2s(type).c_str(), buftype2s(type).c_str());
@@ -608,6 +608,15 @@ int testGetFormats(struct node *node) return fail("%s cap not set, but %s formats defined\n", buftype2s(type).c_str(), buftype2s(type).c_str()); break; + case V4L2_BUF_TYPE_META_CAPTURE: + case V4L2_BUF_TYPE_META_OUTPUT: + if(ret && !node->buftype_pixfmts[type].empty()) + return fail("%s Get_format failed, but %s formats defined\n", + buftype2s(type).c_str(), buftype2s(type).c_str()); + if(!ret && node->buftype_pixfmts[type].empty()) + return fail("%s Get_format success, but no %s formats defined\n", + buftype2s(type).c_str(), buftype2s(type).c_str()); + break; default: /* ENUMFMT doesn't support other buftypes */ break;
Signature · 1 line
2.17.1
hverkuil at xs4all.nl (Hans Verkuil)
PATCH 1/1 v4l2-compliance: Verify metadata formats
Quoted 3 lines · Vandana BN
changes to
testEnumFormats()andtestGetFormats()to verify METADATA type.G_FMTsetsnode->valid_buftypes, so TRY/S_FMT does not get called for other input types, hence did not modify them.
This is a very confusing commit log.
The core problem is that for a given input or output there may not be any metadata formats defined. And that is what is fixed here.
Quoted 20 lines
Signed-off-by Vandana BN <bnvandana at gmail.com>--- utils/v4l2-compliance/v4l2-test-formats.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)utils/v4l2-compliance/v4l2-test-formats.cpp +0
-2@@ -305,8 +305,6 @@ int testEnumFormats(struct node *node) case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: case V4L2_BUF_TYPE_SDR_CAPTURE: case V4L2_BUF_TYPE_SDR_OUTPUT: - case V4L2_BUF_TYPE_META_CAPTURE: - case V4L2_BUF_TYPE_META_OUTPUT: if (ret && (node->g_caps() & buftype2cap[type])) return fail("%s cap set, but no %s formats defined\n", buftype2s(type).c_str(), buftype2s(type).c_str());
utils/v4l2-compliance/v4l2-test-formats.cpp int testEnumFormats(struct node *node) · line 317
Quoted 6 lines
utils/v4l2-compliance/v4l2-test-formats.cpp +3
-0@@ -314,6 +312,10 @@ int testEnumFormats(struct node *node) return fail("%s cap not set, but %s formats defined\n", buftype2s(type).c_str(), buftype2s(type).c_str()); break; + case V4L2_BUF_TYPE_META_CAPTURE: + case V4L2_BUF_TYPE_META_OUTPUT: + /* Metadata formats need not be present for all input types */
for all input types -> for the current input/output
Quoted 14 lines
utils/v4l2-compliance/v4l2-test-formats.cpp +1
-2+ break; default: if (!ret) return fail("Buffer type %s not allowed!\n", buftype2s(type).c_str());@@ -599,8 +601,6 @@ int testGetFormats(struct node *node) case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: case V4L2_BUF_TYPE_SDR_CAPTURE: case V4L2_BUF_TYPE_SDR_OUTPUT: - case V4L2_BUF_TYPE_META_CAPTURE: - case V4L2_BUF_TYPE_META_OUTPUT: if (ret && (node->g_caps() & buftype2cap[type])) return fail("%s cap set, but no %s formats defined\n", buftype2s(type).c_str(), buftype2s(type).c_str());
utils/v4l2-compliance/v4l2-test-formats.cpp int testGetFormats(struct node *node) · line 613
Quoted 6 lines
utils/v4l2-compliance/v4l2-test-formats.cpp +3
-0@@ -608,6 +608,15 @@ int testGetFormats(struct node *node) return fail("%s cap not set, but %s formats defined\n", buftype2s(type).c_str(), buftype2s(type).c_str()); break; + case V4L2_BUF_TYPE_META_CAPTURE: + case V4L2_BUF_TYPE_META_OUTPUT: + if(ret && !node->buftype_pixfmts[type].empty())
Space after 'if'.
utils/v4l2-compliance/v4l2-test-formats.cpp int testGetFormats(struct node *node) · line 614
Quoted 1 line
utils/v4l2-compliance/v4l2-test-formats.cpp +1
-0+ return fail("%s Get_format failed, but %s formats defined\n",
Get_format -> G_FMT
utils/v4l2-compliance/v4l2-test-formats.cpp int testGetFormats(struct node *node) · line 616
Quoted 2 lines
utils/v4l2-compliance/v4l2-test-formats.cpp +2
-0+ buftype2s(type).c_str(), buftype2s(type).c_str()); + if(!ret && node->buftype_pixfmts[type].empty())
Space after 'if'.
utils/v4l2-compliance/v4l2-test-formats.cpp int testGetFormats(struct node *node) · line 617
Quoted 1 line
utils/v4l2-compliance/v4l2-test-formats.cpp +1
-0+ return fail("%s Get_format success, but no %s formats defined\n",
G_FMT, 'no %s' -> 'no %s' (space too many.
utils/v4l2-compliance/v4l2-test-formats.cpp int testGetFormats(struct node *node) · line 622
Quoted 6 lines
utils/v4l2-compliance/v4l2-test-formats.cpp +2
-0+ buftype2s(type).c_str(), buftype2s(type).c_str()); + break; default: /* ENUMFMT doesn't support other buftypes */ break;
Regards,
Hans
PATCH v2 1/1 v4l2-compliance: Verify metadata formats
Metadata formats may not be defined for a given input or output type. This patch checks, if given input/output type enumerates metadata formats and validates G_FMT accordingly.
--- utils/v4l2-compliance/v4l2-test-formats.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
utils/v4l2-compliance/v4l2-test-formats.cpp +13 -4
@@ -305,8 +305,6 @@ int testEnumFormats(struct node *node) case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: case V4L2_BUF_TYPE_SDR_CAPTURE: case V4L2_BUF_TYPE_SDR_OUTPUT: - case V4L2_BUF_TYPE_META_CAPTURE: - case V4L2_BUF_TYPE_META_OUTPUT: if (ret && (node->g_caps() & buftype2cap[type])) return fail("%s cap set, but no %s formats defined\n", buftype2s(type).c_str(), buftype2s(type).c_str());
@@ -314,6 +312,10 @@ int testEnumFormats(struct node *node) return fail("%s cap not set, but %s formats defined\n", buftype2s(type).c_str(), buftype2s(type).c_str()); break; + case V4L2_BUF_TYPE_META_CAPTURE: + case V4L2_BUF_TYPE_META_OUTPUT: + /* Metadata formats need not be present for the current input/output */ + break; default: if (!ret) return fail("Buffer type %s not allowed!\n", buftype2s(type).c_str());
@@ -599,8 +601,6 @@ int testGetFormats(struct node *node) case V4L2_BUF_TYPE_VIDEO_OUTPUT_MPLANE: case V4L2_BUF_TYPE_SDR_CAPTURE: case V4L2_BUF_TYPE_SDR_OUTPUT: - case V4L2_BUF_TYPE_META_CAPTURE: - case V4L2_BUF_TYPE_META_OUTPUT: if (ret && (node->g_caps() & buftype2cap[type])) return fail("%s cap set, but no %s formats defined\n", buftype2s(type).c_str(), buftype2s(type).c_str());
@@ -608,6 +608,15 @@ int testGetFormats(struct node *node) return fail("%s cap not set, but %s formats defined\n", buftype2s(type).c_str(), buftype2s(type).c_str()); break; + case V4L2_BUF_TYPE_META_CAPTURE: + case V4L2_BUF_TYPE_META_OUTPUT: + if (ret && !node->buftype_pixfmts[type].empty()) + return fail("%s G_FMT failed, but %s formats defined\n", + buftype2s(type).c_str(), buftype2s(type).c_str()); + if (!ret && node->buftype_pixfmts[type].empty()) + return fail("%s G_FMT success, but no %s formats defined\n", + buftype2s(type).c_str(), buftype2s(type).c_str()); + break; default: /* ENUMFMT doesn't support other buftypes */ break;
Signature · 1 line
2.17.1