summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMickael Guene <mickael.guene@st.com>2019-06-11 13:37:11 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2019-06-11 17:04:09 +0300
commit846d4c7d3ee7ca059074b2c2d3aeaa941c3f0870 (patch)
treeb825e3da97ed30b2599abedeff1d189944c83654 /src
parentcefe067c5bdb4098fae3858289d629b74a3d9236 (diff)
libcamera: Fix CameraSensor::getFormat() search order
According to the documentation, the CameraSensor::getFormat() method should select the first media bus code from the mbusCodes parameter that is supported by the sensor. However, the current implementation wrongly selects the first media bus code from the codes supported by the sensor that is listed in the mbusCodes parameter. This results in the preference order specified by the caller being ignored. Fix it. Signed-off-by: Mickael Guene <mickael.guene@st.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/camera_sensor.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/libcamera/camera_sensor.cpp b/src/libcamera/camera_sensor.cpp
index 2b9d8fa5..cb6649ef 100644
--- a/src/libcamera/camera_sensor.cpp
+++ b/src/libcamera/camera_sensor.cpp
@@ -191,8 +191,8 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector<unsigned int> &mbu
{
V4L2SubdeviceFormat format{};
- for (unsigned int code : mbusCodes_) {
- if (std::any_of(mbusCodes.begin(), mbusCodes.end(),
+ for (unsigned int code : mbusCodes) {
+ if (std::any_of(mbusCodes_.begin(), mbusCodes_.end(),
[code](unsigned int c) { return c == code; })) {
format.mbus_code = code;
break;