This is so that applications can choose appropriate color spaces which will then be passed down to the V4L2 devices. The ColorSpace field is actually optional. If it is not set you will get the camera's default color space. Signed-off-by: David Plowman <david.plowman@raspberrypi.com> Reviewed-by: Umang Jain <umang.jain@ideasonboard.com> Reviewed-by: Jacopo Mondi <jacopo@jmondi.org> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
87 lines
1.6 KiB
C++
87 lines
1.6 KiB
C++
/* SPDX-License-Identifier: LGPL-2.1-or-later */
|
|
/*
|
|
* Copyright (C) 2019, Google Inc.
|
|
*
|
|
* stream.h - Video stream for a Camera
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include <map>
|
|
#include <memory>
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include <libcamera/color_space.h>
|
|
#include <libcamera/framebuffer.h>
|
|
#include <libcamera/geometry.h>
|
|
#include <libcamera/pixel_format.h>
|
|
|
|
namespace libcamera {
|
|
|
|
class Camera;
|
|
class Stream;
|
|
|
|
class StreamFormats
|
|
{
|
|
public:
|
|
StreamFormats();
|
|
StreamFormats(const std::map<PixelFormat, std::vector<SizeRange>> &formats);
|
|
|
|
std::vector<PixelFormat> pixelformats() const;
|
|
std::vector<Size> sizes(const PixelFormat &pixelformat) const;
|
|
|
|
SizeRange range(const PixelFormat &pixelformat) const;
|
|
|
|
private:
|
|
std::map<PixelFormat, std::vector<SizeRange>> formats_;
|
|
};
|
|
|
|
struct StreamConfiguration {
|
|
StreamConfiguration();
|
|
StreamConfiguration(const StreamFormats &formats);
|
|
|
|
PixelFormat pixelFormat;
|
|
Size size;
|
|
unsigned int stride;
|
|
unsigned int frameSize;
|
|
|
|
unsigned int bufferCount;
|
|
|
|
std::optional<ColorSpace> colorSpace;
|
|
|
|
Stream *stream() const { return stream_; }
|
|
void setStream(Stream *stream) { stream_ = stream; }
|
|
const StreamFormats &formats() const { return formats_; }
|
|
|
|
std::string toString() const;
|
|
|
|
private:
|
|
Stream *stream_;
|
|
StreamFormats formats_;
|
|
};
|
|
|
|
enum StreamRole {
|
|
Raw,
|
|
StillCapture,
|
|
VideoRecording,
|
|
Viewfinder,
|
|
};
|
|
|
|
using StreamRoles = std::vector<StreamRole>;
|
|
|
|
class Stream
|
|
{
|
|
public:
|
|
Stream();
|
|
|
|
const StreamConfiguration &configuration() const { return configuration_; }
|
|
|
|
protected:
|
|
friend class Camera;
|
|
|
|
StreamConfiguration configuration_;
|
|
};
|
|
|
|
} /* namespace libcamera */
|