summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacopo Mondi <jacopo@jmondi.org>2019-02-01 09:55:35 +0100
committerJacopo Mondi <jacopo@jmondi.org>2019-02-03 12:16:11 +0100
commit755644fe64996ef9c2c6c5919119fabc53389de5 (patch)
tree8133fb4a52ae39a8dfe22feb329dc9f36ebdcbd4 /src
parent2f516306a7b72f3f13c1648161e79ba8778351ae (diff)
libcamera: v4l2_device: Rename parameters to s/g_fmt
Rename parameters to get and set format functions to expand 'fmt' to 'format'. Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Diffstat (limited to 'src')
-rw-r--r--src/libcamera/include/v4l2_device.h12
-rw-r--r--src/libcamera/v4l2_device.cpp96
2 files changed, 54 insertions, 54 deletions
diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h
index 70e3c005..e65a540c 100644
--- a/src/libcamera/include/v4l2_device.h
+++ b/src/libcamera/include/v4l2_device.h
@@ -86,15 +86,15 @@ public:
const char *deviceName() const { return caps_.card(); }
const char *busName() const { return caps_.bus_info(); }
- int getFormat(V4L2DeviceFormat *fmt);
- int setFormat(V4L2DeviceFormat *fmt);
+ int getFormat(V4L2DeviceFormat *format);
+ int setFormat(V4L2DeviceFormat *format);
private:
- int getFormatSingleplane(V4L2DeviceFormat *fmt);
- int setFormatSingleplane(V4L2DeviceFormat *fmt);
+ int getFormatSingleplane(V4L2DeviceFormat *format);
+ int setFormatSingleplane(V4L2DeviceFormat *format);
- int getFormatMultiplane(V4L2DeviceFormat *fmt);
- int setFormatMultiplane(V4L2DeviceFormat *fmt);
+ int getFormatMultiplane(V4L2DeviceFormat *format);
+ int setFormatMultiplane(V4L2DeviceFormat *format);
std::string deviceNode_;
int fd_;
diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp
index 5ba89b90..8cf566c5 100644
--- a/src/libcamera/v4l2_device.cpp
+++ b/src/libcamera/v4l2_device.cpp
@@ -282,58 +282,58 @@ void V4L2Device::close()
* \brief Retrieve the image format set on the V4L2 device
* \return 0 for success, a negative error code otherwise
*/
-int V4L2Device::getFormat(V4L2DeviceFormat *fmt)
+int V4L2Device::getFormat(V4L2DeviceFormat *format)
{
- return caps_.isMultiplanar() ? getFormatMultiplane(fmt) :
- getFormatSingleplane(fmt);
+ return caps_.isMultiplanar() ? getFormatMultiplane(format) :
+ getFormatSingleplane(format);
}
/**
* \brief Configure an image format on the V4L2 device
* \return 0 for success, a negative error code otherwise
*/
-int V4L2Device::setFormat(V4L2DeviceFormat *fmt)
+int V4L2Device::setFormat(V4L2DeviceFormat *format)
{
- return caps_.isMultiplanar() ? setFormatMultiplane(fmt) :
- setFormatSingleplane(fmt);
+ return caps_.isMultiplanar() ? setFormatMultiplane(format) :
+ setFormatSingleplane(format);
}
-int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *fmt)
+int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format)
{
- struct v4l2_format v4l2Fmt;
- struct v4l2_pix_format *pix = &v4l2Fmt.fmt.pix;
+ struct v4l2_format v4l2Format;
+ struct v4l2_pix_format *pix = &v4l2Format.fmt.pix;
int ret;
- v4l2Fmt.type = bufferType_;
- ret = ioctl(fd_, VIDIOC_G_FMT, &v4l2Fmt);
+ v4l2Format.type = bufferType_;
+ ret = ioctl(fd_, VIDIOC_G_FMT, &v4l2Format);
if (ret) {
ret = -errno;
LOG(Error) << "Unable to get format: " << strerror(-ret);
return ret;
}
- fmt->width = pix->width;
- fmt->height = pix->height;
- fmt->fourcc = pix->pixelformat;
- fmt->planes = 1;
- fmt->planesFmt[0].bpl = pix->bytesperline;
- fmt->planesFmt[0].size = pix->sizeimage;
+ format->width = pix->width;
+ format->height = pix->height;
+ format->fourcc = pix->pixelformat;
+ format->planes = 1;
+ format->planesFmt[0].bpl = pix->bytesperline;
+ format->planesFmt[0].size = pix->sizeimage;
return 0;
}
-int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *fmt)
+int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *format)
{
- struct v4l2_format v4l2Fmt;
- struct v4l2_pix_format *pix = &v4l2Fmt.fmt.pix;
+ struct v4l2_format v4l2Format;
+ struct v4l2_pix_format *pix = &v4l2Format.fmt.pix;
int ret;
- v4l2Fmt.type = bufferType_;
- pix->width = fmt->width;
- pix->height = fmt->height;
- pix->pixelformat = fmt->fourcc;
+ v4l2Format.type = bufferType_;
+ pix->width = format->width;
+ pix->height = format->height;
+ pix->pixelformat = format->fourcc;
- ret = ioctl(fd_, VIDIOC_S_FMT, &v4l2Fmt);
+ ret = ioctl(fd_, VIDIOC_S_FMT, &v4l2Format);
if (ret) {
ret = -errno;
LOG(Error) << "Unable to set format: " << strerror(-ret);
@@ -343,51 +343,51 @@ int V4L2Device::setFormatSingleplane(V4L2DeviceFormat *fmt)
return 0;
}
-int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *fmt)
+int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format)
{
- struct v4l2_format v4l2Fmt;
- struct v4l2_pix_format_mplane *pix = &v4l2Fmt.fmt.pix_mp;
+ struct v4l2_format v4l2Format;
+ struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp;
int ret;
- v4l2Fmt.type = bufferType_;
- ret = ioctl(fd_, VIDIOC_G_FMT, &v4l2Fmt);
+ v4l2Format.type = bufferType_;
+ ret = ioctl(fd_, VIDIOC_G_FMT, &v4l2Format);
if (ret) {
ret = -errno;
LOG(Error) << "Unable to get format: " << strerror(-ret);
return ret;
}
- fmt->width = pix->width;
- fmt->height = pix->height;
- fmt->fourcc = pix->pixelformat;
- fmt->planes = pix->num_planes;
+ format->width = pix->width;
+ format->height = pix->height;
+ format->fourcc = pix->pixelformat;
+ format->planes = pix->num_planes;
- for (unsigned int i = 0; i < fmt->planes; ++i) {
- fmt->planesFmt[i].bpl = pix->plane_fmt[i].bytesperline;
- fmt->planesFmt[i].size = pix->plane_fmt[i].sizeimage;
+ for (unsigned int i = 0; i < format->planes; ++i) {
+ format->planesFmt[i].bpl = pix->plane_fmt[i].bytesperline;
+ format->planesFmt[i].size = pix->plane_fmt[i].sizeimage;
}
return 0;
}
-int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *fmt)
+int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *format)
{
- struct v4l2_format v4l2Fmt;
- struct v4l2_pix_format_mplane *pix = &v4l2Fmt.fmt.pix_mp;
+ struct v4l2_format v4l2Format;
+ struct v4l2_pix_format_mplane *pix = &v4l2Format.fmt.pix_mp;
int ret;
- v4l2Fmt.type = bufferType_;
- pix->width = fmt->width;
- pix->height = fmt->height;
- pix->pixelformat = fmt->fourcc;
- pix->num_planes = fmt->planes;
+ v4l2Format.type = bufferType_;
+ pix->width = format->width;
+ pix->height = format->height;
+ pix->pixelformat = format->fourcc;
+ pix->num_planes = format->planes;
for (unsigned int i = 0; i < pix->num_planes; ++i) {
- pix->plane_fmt[i].bytesperline = fmt->planesFmt[i].bpl;
- pix->plane_fmt[i].sizeimage = fmt->planesFmt[i].size;
+ pix->plane_fmt[i].bytesperline = format->planesFmt[i].bpl;
+ pix->plane_fmt[i].sizeimage = format->planesFmt[i].size;
}
- ret = ioctl(fd_, VIDIOC_S_FMT, &v4l2Fmt);
+ ret = ioctl(fd_, VIDIOC_S_FMT, &v4l2Format);
if (ret) {
ret = -errno;
LOG(Error) << "Unable to set format: " << strerror(-ret);