libcamera: formats: Define FormatEnum type

Add an internal format.h and format.cpp files to collect libcamera image
format related types, helpers and structures. Define and document the
FormatEnum type, used to enumerate pixel image formats and associated
image resolutions.

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
This commit is contained in:
Jacopo Mondi
2019-03-12 12:03:22 +01:00
parent ee81275238
commit 8dcd871fec
5 changed files with 54 additions and 5 deletions

View File

@@ -0,0 +1,22 @@
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* formats.h - Libcamera image formats
*/
#ifndef __LIBCAMERA_FORMATS_H__
#define __LIBCAMERA_FORMATS_H__
#include <map>
#include <vector>
#include "geometry.h"
namespace libcamera {
typedef std::map<unsigned int, std::vector<SizeRange>> FormatEnum;
} /* namespace libcamera */
#endif /* __LIBCAMERA_FORMATS_H__ */

View File

@@ -11,6 +11,7 @@
#include <string>
#include <vector>
#include "formats.h"
#include "geometry.h"
#include "log.h"
#include "media_object.h"
@@ -42,8 +43,7 @@ public:
int setCrop(unsigned int pad, Rectangle *rect);
int setCompose(unsigned int pad, Rectangle *rect);
const std::map<unsigned int, std::vector<SizeRange>>
formats(unsigned int pad);
FormatEnum formats(unsigned int pad);
int getFormat(unsigned int pad, V4L2SubdeviceFormat *format);
int setFormat(unsigned int pad, V4L2SubdeviceFormat *format);