summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2020-03-16 10:07:26 +0200
committerNiklas Söderlund <niklas.soderlund@ragnatech.se>2020-03-18 18:02:40 +0100
commit718f5e99a966246de8d129902ad470872652b749 (patch)
tree0e16bc1b512304c8341c4a1334654d508631a7a7 /test
parent8c0bbcd3d3751a716eb8bf03e703aa6fdbe1bd3f (diff)
libcamera: PixelFormat: Make constructor explicit
To achieve the goal of preventing unwanted conversion between a DRM and a V4L2 FourCC, make the PixelFormat constructor that takes an integer value explicit. All users of pixel formats flagged by the compiler are fixed. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se> Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Diffstat (limited to 'test')
-rw-r--r--test/stream/stream_formats.cpp24
-rw-r--r--test/v4l2_videodevice/buffer_cache.cpp2
2 files changed, 13 insertions, 13 deletions
diff --git a/test/stream/stream_formats.cpp b/test/stream/stream_formats.cpp
index a391f5cd..92f1574b 100644
--- a/test/stream/stream_formats.cpp
+++ b/test/stream/stream_formats.cpp
@@ -55,40 +55,40 @@ protected:
{
/* Test discrete sizes */
StreamFormats discrete({
- { 1, { SizeRange(100, 100), SizeRange(200, 200) } },
- { 2, { SizeRange(300, 300), SizeRange(400, 400) } },
+ { PixelFormat(1), { SizeRange(100, 100), SizeRange(200, 200) } },
+ { PixelFormat(2), { SizeRange(300, 300), SizeRange(400, 400) } },
});
- if (testSizes("discrete 1", discrete.sizes(1),
+ if (testSizes("discrete 1", discrete.sizes(PixelFormat(1)),
{ Size(100, 100), Size(200, 200) }))
return TestFail;
- if (testSizes("discrete 2", discrete.sizes(2),
+ if (testSizes("discrete 2", discrete.sizes(PixelFormat(2)),
{ Size(300, 300), Size(400, 400) }))
return TestFail;
/* Test range sizes */
StreamFormats range({
- { 1, { SizeRange(640, 480, 640, 480) } },
- { 2, { SizeRange(640, 480, 800, 600, 8, 8) } },
- { 3, { SizeRange(640, 480, 800, 600, 16, 16) } },
- { 4, { SizeRange(128, 128, 4096, 4096, 128, 128) } },
+ { PixelFormat(1), { SizeRange(640, 480, 640, 480) } },
+ { PixelFormat(2), { SizeRange(640, 480, 800, 600, 8, 8) } },
+ { PixelFormat(3), { SizeRange(640, 480, 800, 600, 16, 16) } },
+ { PixelFormat(4), { SizeRange(128, 128, 4096, 4096, 128, 128) } },
});
- if (testSizes("range 1", range.sizes(1), { Size(640, 480) }))
+ if (testSizes("range 1", range.sizes(PixelFormat(1)), { Size(640, 480) }))
return TestFail;
- if (testSizes("range 2", range.sizes(2), {
+ if (testSizes("range 2", range.sizes(PixelFormat(2)), {
Size(640, 480), Size(720, 480),
Size(720, 576), Size(768, 480),
Size(800, 600) }))
return TestFail;
- if (testSizes("range 3", range.sizes(3), {
+ if (testSizes("range 3", range.sizes(PixelFormat(3)), {
Size(640, 480), Size(720, 480),
Size(720, 576), Size(768, 480) }))
return TestFail;
- if (testSizes("range 4", range.sizes(4), {
+ if (testSizes("range 4", range.sizes(PixelFormat(4)), {
Size(1024, 768), Size(1280, 1024),
Size(2048, 1152), Size(2048, 1536),
Size(2560, 2048), Size(3200, 2048), }))
diff --git a/test/v4l2_videodevice/buffer_cache.cpp b/test/v4l2_videodevice/buffer_cache.cpp
index e6edd2fa..d730e755 100644
--- a/test/v4l2_videodevice/buffer_cache.cpp
+++ b/test/v4l2_videodevice/buffer_cache.cpp
@@ -142,7 +142,7 @@ public:
const unsigned int numBuffers = 8;
StreamConfiguration cfg;
- cfg.pixelFormat = DRM_FORMAT_YUYV;
+ cfg.pixelFormat = PixelFormat(DRM_FORMAT_YUYV);
cfg.size = Size(600, 800);
cfg.bufferCount = numBuffers;