From patchwork Fri Feb 1 15:42:45 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 476 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 20F3660DB5 for ; Fri, 1 Feb 2019 16:42:41 +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 D4C531BF219; 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:45 +0100 Message-Id: <20190201154248.15006-5-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 4/7] libcamera: v4l2_device: Rename plane format fields 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 the number of valid plane formats to 'planesCount' and the actual per-plane size information array to 'planes'. Signed-off-by: Jacopo Mondi Acked-by: Laurent Pinchart --- src/libcamera/include/v4l2_device.h | 4 ++-- src/libcamera/v4l2_device.cpp | 29 ++++++++++++++--------------- 2 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/libcamera/include/v4l2_device.h b/src/libcamera/include/v4l2_device.h index e65a540..4ff48fb 100644 --- a/src/libcamera/include/v4l2_device.h +++ b/src/libcamera/include/v4l2_device.h @@ -63,8 +63,8 @@ public: struct { uint32_t size; uint32_t bpl; - } planesFmt[3]; - unsigned int planes; + } planes[3]; + unsigned int planesCount; }; class MediaEntity; diff --git a/src/libcamera/v4l2_device.cpp b/src/libcamera/v4l2_device.cpp index 8cf566c..0d4d60f 100644 --- a/src/libcamera/v4l2_device.cpp +++ b/src/libcamera/v4l2_device.cpp @@ -92,7 +92,7 @@ LOG_DEFINE_CATEGORY(V4L2) * * Formats defined as 'single planar' by the V4L2 APIs are represented with * V4L2DeviceFormat instances with a single plane - * (V4L2DeviceFormat::planes = 1). Semi-planar and multiplanar formats use + * (V4L2DeviceFormat::planesCount = 1). Semi-planar and multiplanar formats use * 2 and 3 planes respectively. * * V4L2DeviceFormat defines the exchange format between components that @@ -120,19 +120,18 @@ LOG_DEFINE_CATEGORY(V4L2) */ /** - * \var V4L2DeviceFormat::planesFmt + * \var V4L2DeviceFormat::planes * \brief The per-plane size information * * Images are stored in memory in one or more data planes. Each data plane * has a specific size and line length, which could differ from the image * visible sizes to accommodate line or plane padding data. * - * Only the first V4L2DeviceFormat::planes entries are considered valid. - * + * Only the first \ref planesCount entries are considered valid. */ /** - * \var V4L2DeviceFormat::planes + * \var V4L2DeviceFormat::planesCount * \brief The number of valid data planes */ @@ -315,9 +314,9 @@ int V4L2Device::getFormatSingleplane(V4L2DeviceFormat *format) 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; + format->planesCount = 1; + format->planes[0].bpl = pix->bytesperline; + format->planes[0].size = pix->sizeimage; return 0; } @@ -360,11 +359,11 @@ int V4L2Device::getFormatMultiplane(V4L2DeviceFormat *format) format->width = pix->width; format->height = pix->height; format->fourcc = pix->pixelformat; - format->planes = pix->num_planes; + format->planesCount = pix->num_planes; - 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; + for (unsigned int i = 0; i < format->planesCount; ++i) { + format->planes[i].bpl = pix->plane_fmt[i].bytesperline; + format->planes[i].size = pix->plane_fmt[i].sizeimage; } return 0; @@ -380,11 +379,11 @@ int V4L2Device::setFormatMultiplane(V4L2DeviceFormat *format) pix->width = format->width; pix->height = format->height; pix->pixelformat = format->fourcc; - pix->num_planes = format->planes; + pix->num_planes = format->planesCount; for (unsigned int i = 0; i < pix->num_planes; ++i) { - pix->plane_fmt[i].bytesperline = format->planesFmt[i].bpl; - pix->plane_fmt[i].sizeimage = format->planesFmt[i].size; + pix->plane_fmt[i].bytesperline = format->planes[i].bpl; + pix->plane_fmt[i].sizeimage = format->planes[i].size; } ret = ioctl(fd_, VIDIOC_S_FMT, &v4l2Format);