From patchwork Mon Oct 28 11:02:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 2287 Return-Path: Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id 898C760C09 for ; Mon, 28 Oct 2019 12:02:20 +0100 (CET) Received: from pendragon.ideasonboard.com (unknown [91.217.168.176]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 3357CA4C for ; Mon, 28 Oct 2019 12:02:20 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1572260540; bh=lkimjnwOVeZng17bZvKn4isISlKoi/meuKCRFeIbQcc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=aRWFAE5TfoasmZr3sd6+WR3bkEp4mCi0tIxpRJ8pTdyv6EfjIPwka+XwS75+qDEhA dHigIX1YQtqIybNX0tPjM/0iHF1s52iXQQbfhoQL9buXfP3++SyybmkHSXnIvgNDp6 A0s7yvLMiYSJGPzsCKwtf9/ZZCAEdQxFF/Bn9C/E= From: Laurent Pinchart To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 13:02:05 +0200 Message-Id: <20191028110208.15751-5-laurent.pinchart@ideasonboard.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191028110208.15751-1-laurent.pinchart@ideasonboard.com> References: <20191028110208.15751-1-laurent.pinchart@ideasonboard.com> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH v2 4/7] libcamera: Define a PixelFormat type for application-facing formats X-BeenThere: libcamera-devel@lists.libcamera.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 28 Oct 2019 11:02:21 -0000 From: Jacopo Mondi Define a PixelFormat type as a simple typedef to an uin32_t. The usage of a dedicated type creates a cleaner and more self-described aPI. Signed-off-by: Jacopo Mondi Reviewed-by: Laurent Pinchart Reviewed-by: Kieran Bingham --- include/libcamera/meson.build | 1 + include/libcamera/pixelformats.h | 18 ++++++++++++++++++ src/libcamera/meson.build | 1 + src/libcamera/pixelformats.cpp | 26 ++++++++++++++++++++++++++ 4 files changed, 46 insertions(+) create mode 100644 include/libcamera/pixelformats.h create mode 100644 src/libcamera/pixelformats.cpp diff --git a/include/libcamera/meson.build b/include/libcamera/meson.build index ed8ff917e35a..99abf0609940 100644 --- a/include/libcamera/meson.build +++ b/include/libcamera/meson.build @@ -9,6 +9,7 @@ libcamera_api = files([ 'geometry.h', 'logging.h', 'object.h', + 'pixelformats.h', 'request.h', 'signal.h', 'stream.h', diff --git a/include/libcamera/pixelformats.h b/include/libcamera/pixelformats.h new file mode 100644 index 000000000000..6e25b8d8b76e --- /dev/null +++ b/include/libcamera/pixelformats.h @@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * pixelformats.h - libcamera pixel formats + */ +#ifndef __LIBCAMERA_PIXEL_FORMATS_H__ +#define __LIBCAMERA_PIXEL_FORMATS_H__ + +#include + +namespace libcamera { + +using PixelFormat = uint32_t; + +} /* namespace libcamera */ + +#endif /* __LIBCAMERA_PIXEL_FORMATS_H__ */ diff --git a/src/libcamera/meson.build b/src/libcamera/meson.build index d329820b9582..f201f408ef07 100644 --- a/src/libcamera/meson.build +++ b/src/libcamera/meson.build @@ -25,6 +25,7 @@ libcamera_sources = files([ 'message.cpp', 'object.cpp', 'pipeline_handler.cpp', + 'pixelformats.cpp', 'process.cpp', 'request.cpp', 'signal.cpp', diff --git a/src/libcamera/pixelformats.cpp b/src/libcamera/pixelformats.cpp new file mode 100644 index 000000000000..9377fb5e0749 --- /dev/null +++ b/src/libcamera/pixelformats.cpp @@ -0,0 +1,26 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2019, Google Inc. + * + * pixelformats.cpp - libcamera pixel formats + */ + +#include + +/** + * \file pixelformats.h + * \brief libcamera pixel formats + */ + +namespace libcamera { + +/** + * \typedef PixelFormat + * \brief libcamera image pixel format + * + * The PixelFormat type describes the format of images in the public libcamera + * API. It stores a FourCC value in a 32-bit unsigned integer. The values are + * defined in the Linux kernel V4L2 API (see linux/videodev2.h). + */ + +} /* namespace libcamera */