diff options
author | Milan Zamazal <mzamazal@redhat.com> | 2024-03-22 20:50:32 +0100 |
---|---|---|
committer | Laurent Pinchart <laurent.pinchart@ideasonboard.com> | 2024-03-28 03:11:59 +0200 |
commit | 666f17affcad23118e110909331b499411b57562 (patch) | |
tree | 1f46cd8839d090767fe6501b6db0d7a5d79ce88c /src/apps/common/ppm_writer.h | |
parent | 48f3a25d7c5f6f4b2eef590c79d8eeaef32014d2 (diff) |
apps: cam: Add support for PPM output format
When file output is requested from cam app, it simply dumps the
processed data and it must be converted to a readable image format
manually. Let's add support for PPM output file format to make files
produced by cam directly readable by image display and processing
software.
For now, only BGR888 output format, which is the simplest one to use, is
supported but nothing prevents adding support for other output formats
if needed. Nevertheless, they would typically need byte reordering or
other conversions for PPM file format. It may be better to find a way to
dump the image data in other output formats directly using some of the
already existing file formats or raw file format converters.
Signed-off-by: Milan Zamazal <mzamazal@redhat.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Diffstat (limited to 'src/apps/common/ppm_writer.h')
-rw-r--r-- | src/apps/common/ppm_writer.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/src/apps/common/ppm_writer.h b/src/apps/common/ppm_writer.h new file mode 100644 index 00000000..4c38f5ce --- /dev/null +++ b/src/apps/common/ppm_writer.h @@ -0,0 +1,20 @@ +/* SPDX-License-Identifier: LGPL-2.1-or-later */ +/* + * Copyright (C) 2024, Red Hat, Inc. + * + * ppm_writer.h - PPM writer + */ + +#pragma once + +#include <libcamera/base/span.h> + +#include <libcamera/stream.h> + +class PPMWriter +{ +public: + static int write(const char *filename, + const libcamera::StreamConfiguration &config, + const libcamera::Span<uint8_t> &data); +}; |