From patchwork Sun Oct 27 23:43:07 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jacopo Mondi X-Patchwork-Id: 2243 Return-Path: Received: from relay7-d.mail.gandi.net (relay7-d.mail.gandi.net [217.70.183.200]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CA8966017C for ; Mon, 28 Oct 2019 00:41:27 +0100 (CET) X-Originating-IP: 93.2.121.143 Received: from uno.localdomain (143.121.2.93.rev.sfr.net [93.2.121.143]) (Authenticated sender: jacopo@jmondi.org) by relay7-d.mail.gandi.net (Postfix) with ESMTPSA id 7C03B20002; Sun, 27 Oct 2019 23:41:27 +0000 (UTC) From: Jacopo Mondi To: libcamera-devel@lists.libcamera.org Date: Mon, 28 Oct 2019 00:43:07 +0100 Message-Id: <20191027234312.35284-6-jacopo@jmondi.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191027234312.35284-1-jacopo@jmondi.org> References: <20191027234312.35284-1-jacopo@jmondi.org> MIME-Version: 1.0 Subject: [libcamera-devel] [PATCH 05/10] libcamera: Define PixelFormat type 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: Sun, 27 Oct 2019 23:41:28 -0000 Define a PixelFormat type as a simple typedef to an uin32_t which aliases the DRM/KMS-defined fourcc pixel format codes. The usage of a dedicated type allows better separation between image format codes used internally (ie. V4L2-defined pixel formats and media bus codes) and application-facing image formats which use the DRM_FORMAT_* pixel codes. Signed-off-by: Jacopo Mondi --- include/libcamera/meson.build | 1 + include/libcamera/pixelformats.h | 18 ++++++++++++++++++ src/libcamera/meson.build | 1 + src/libcamera/pixelformats.cpp | 28 ++++++++++++++++++++++++++++ 4 files changed, 48 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..c03335400b70 --- /dev/null +++ b/src/libcamera/pixelformats.cpp @@ -0,0 +1,28 @@ +/* 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 as a 32-bit unsigned integer. The values are + * defined in the Linux kernel DRM/KMS API (see linux/drm_fourcc.h). + * + * \todo Add support for format modifiers + */ + +} /* namespace libcamera */