From patchwork Fri Feb 1 15:42:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 475 Return-Path: Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id B962660DBB for ; Fri, 1 Feb 2019 16:42:40 +0100 (CET) X-Originating-IP: 91.183.179.147 Received: from uno.localdomain (unknown [91.183.179.147]) (Authenticated sender: jacopo@jmondi.org) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 63E351BF207; Fri, 1 Feb 2019 15:42:40 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Fri, 1 Feb 2019 16:42:44 +0100 Message-Id: <20190201154248.15006-4-jacopo@jmondi.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190201154248.15006-1-jacopo@jmondi.org> References: <20190201154248.15006-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 3/7] libcamera: v4l2_device: Rename parameters to s/g_fmt X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 01 Feb 2019 15:42:41 -0000 Rename parameters to get and set format functions to expand 'fmt' to 'format'. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart --- src/libcamera/include/v4l2_device.h | 12 ++-- src/libcamera/v4l2_device.cpp | 96 ++++++++++++++--------------- 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h index 70e3c00..e65a540 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 5ba89b9..8cf566c 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);