mirror of
https://git.libcamera.org/libcamera/libcamera.git
synced 2025-07-13 07:19:45 +03:00
libcamera: v4l2PixelFormat: Replace hex with fourCC
Print fourCC characters instead of the hex value in toString() as they are more informative. Also, write the tests for this in formats.cpp Signed-off-by: Kaaira Gupta <kgupta@es.iitr.ac.in> Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
This commit is contained in:
parent
6f553040fd
commit
2fbab8b077
2 changed files with 40 additions and 3 deletions
|
@ -8,6 +8,7 @@
|
|||
#include <iostream>
|
||||
#include <limits.h>
|
||||
|
||||
#include "utils.h"
|
||||
#include "v4l2_videodevice.h"
|
||||
|
||||
#include "v4l2_videodevice_test.h"
|
||||
|
@ -47,6 +48,28 @@ protected:
|
|||
return TestFail;
|
||||
}
|
||||
|
||||
std::vector<std::pair<uint32_t, const char *>> formats{
|
||||
{ V4L2_PIX_FMT_YUYV, "YUYV" },
|
||||
{ 0, "<INVALID>" },
|
||||
{ v4l2_fourcc(0, 1, 2, 3), "...." },
|
||||
{ V4L2_PIX_FMT_Y16_BE, "Y16 -BE" }
|
||||
};
|
||||
|
||||
for (const auto &format : formats) {
|
||||
if (V4L2PixelFormat(format.first).toString() != format.second) {
|
||||
cerr << "Failed to convert V4L2PixelFormat"
|
||||
<< utils::hex(format.first) << "to string"
|
||||
<< endl;
|
||||
return TestFail;
|
||||
}
|
||||
}
|
||||
|
||||
if (V4L2PixelFormat().toString() != "<INVALID>") {
|
||||
cerr << "Failed to convert default V4L2PixelFormat to string"
|
||||
<< endl;
|
||||
return TestFail;
|
||||
}
|
||||
|
||||
return TestPass;
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue