libcamera: v4l2_subdevice: Add colorSpace field to V4L2SubdeviceFormat
This adds a ColorSpace field to the V4L2SubdeviceFormat so that we can set and request particular color spaces from V4L2. This commit simply adds the field and fixes some occurrences of brace initializers that would otherwise be broken. A subsequent commit will pass and retrieve the value correctly to/from V4l2 itself. Signed-off-by: David Plowman <david.plowman@raspberrypi.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>
This commit is contained in:
parent
3e520cadf1
commit
c8a4b52e3a
5 changed files with 28 additions and 6 deletions
|
@ -642,6 +642,7 @@ V4L2SubdeviceFormat CameraSensor::getFormat(const std::vector<unsigned int> &mbu
|
|||
V4L2SubdeviceFormat format{
|
||||
.mbus_code = bestCode,
|
||||
.size = *bestSize,
|
||||
.colorSpace = ColorSpace::Raw,
|
||||
};
|
||||
|
||||
return format;
|
||||
|
|
|
@ -322,10 +322,9 @@ V4L2SubdeviceFormat CIO2Device::getSensorFormat(const std::vector<unsigned int>
|
|||
return {};
|
||||
}
|
||||
|
||||
V4L2SubdeviceFormat format{
|
||||
.mbus_code = bestCode,
|
||||
.size = bestSize,
|
||||
};
|
||||
V4L2SubdeviceFormat format{};
|
||||
format.mbus_code = bestCode;
|
||||
format.size = bestSize;
|
||||
|
||||
return format;
|
||||
}
|
||||
|
|
|
@ -457,7 +457,9 @@ int SimpleCameraData::init()
|
|||
* formats on the video node.
|
||||
*/
|
||||
for (unsigned int code : sensor_->mbusCodes()) {
|
||||
V4L2SubdeviceFormat format{ code, sensor_->resolution() };
|
||||
V4L2SubdeviceFormat format{};
|
||||
format.mbus_code = code;
|
||||
format.size = sensor_->resolution();
|
||||
|
||||
ret = setupFormats(&format, V4L2Subdevice::TryFormat);
|
||||
if (ret < 0) {
|
||||
|
@ -908,7 +910,9 @@ int SimplePipelineHandler::configure(Camera *camera, CameraConfiguration *c)
|
|||
return ret;
|
||||
|
||||
const SimpleCameraData::Configuration *pipeConfig = config->pipeConfig();
|
||||
V4L2SubdeviceFormat format{ pipeConfig->code, data->sensor_->resolution() };
|
||||
V4L2SubdeviceFormat format{};
|
||||
format.mbus_code = pipeConfig->code;
|
||||
format.size = data->sensor_->resolution();
|
||||
|
||||
ret = data->setupFormats(&format, V4L2Subdevice::ActiveFormat);
|
||||
if (ret < 0)
|
||||
|
|
|
@ -169,6 +169,21 @@ const std::map<uint32_t, V4L2SubdeviceFormatInfo> formatInfoMap = {
|
|||
* \brief The image size in pixels
|
||||
*/
|
||||
|
||||
/**
|
||||
* \var V4L2SubdeviceFormat::colorSpace
|
||||
* \brief The color space of the pixels
|
||||
*
|
||||
* The color space of the image. When setting the format this may be
|
||||
* unset, in which case the driver gets to use its default color space.
|
||||
* After being set, this value should contain the color space that
|
||||
* was actually used. If this value is unset, then the color space chosen
|
||||
* by the driver could not be represented by the ColorSpace class (and
|
||||
* should probably be added).
|
||||
*
|
||||
* It is up to the pipeline handler or application to check if the
|
||||
* resulting color space is acceptable.
|
||||
*/
|
||||
|
||||
/**
|
||||
* \brief Assemble and return a string describing the format
|
||||
* \return A string describing the V4L2SubdeviceFormat
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue