libcamera v0.4.0+5314-fc77c53d-nvm
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
stream.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2019, Google Inc.
4 *
5 * Video stream for a Camera
6 */
7
8#pragma once
9
10#include <map>
11#include <ostream>
12#include <string>
13#include <vector>
14
17#include <libcamera/geometry.h>
19
20namespace libcamera {
21
22class Camera;
23class Stream;
24
26{
27public:
29 StreamFormats(const std::map<PixelFormat, std::vector<SizeRange>> &formats);
30
31 std::vector<PixelFormat> pixelformats() const;
32 std::vector<Size> sizes(const PixelFormat &pixelformat) const;
33
34 SizeRange range(const PixelFormat &pixelformat) const;
35
36private:
37 std::map<PixelFormat, std::vector<SizeRange>> formats_;
38};
39
43
46 unsigned int stride;
47 unsigned int frameSize;
48
49 unsigned int bufferCount;
50
51 std::optional<ColorSpace> colorSpace;
52
53 Stream *stream() const { return stream_; }
54 void setStream(Stream *stream) { stream_ = stream; }
55 const StreamFormats &formats() const { return formats_; }
56
57 std::string toString() const;
58
59private:
60 Stream *stream_;
61 StreamFormats formats_;
62};
63
64std::ostream &operator<<(std::ostream &out, const StreamConfiguration &cfg);
65
66enum class StreamRole {
67 Raw,
71};
72
73std::ostream &operator<<(std::ostream &out, StreamRole role);
74
75class Stream
76{
77public:
78 Stream();
79
81
82protected:
83 friend class Camera;
84
86};
87
88} /* namespace libcamera */
Camera device.
Definition camera.h:115
libcamera image pixel format
Definition pixel_format.h:17
Describe a range of sizes.
Definition geometry.h:201
Describe a two-dimensional size.
Definition geometry.h:53
Hold information about supported stream formats.
Definition stream.h:26
std::vector< Size > sizes(const PixelFormat &pixelformat) const
Retrieve the list of frame sizes supported for pixelformat.
Definition stream.cpp:131
SizeRange range(const PixelFormat &pixelformat) const
Retrieve the range of minimum and maximum sizes.
Definition stream.cpp:244
std::vector< PixelFormat > pixelformats() const
Retrieve the list of supported pixel formats.
Definition stream.cpp:107
Video stream for a camera.
Definition stream.h:76
const StreamConfiguration & configuration() const
Retrieve the active configuration of the stream.
Definition stream.h:80
StreamConfiguration configuration_
The stream configuration.
Definition stream.h:85
Stream()
Construct a stream with default parameters.
Definition stream.cpp:477
Class and enums to represent color spaces.
Frame buffer handling.
Data structures related to geometric objects.
Top-level libcamera namespace.
Definition bound_method.h:15
StreamRole
Identify the role a stream is intended to play.
Definition stream.h:66
std::ostream & operator<<(std::ostream &out, const Point &p)
Insert a text representation of a Point into an output stream.
Definition geometry.cpp:91
libcamera pixel format
Configuration parameters for a stream.
Definition stream.h:40
unsigned int bufferCount
Requested number of buffers to allocate for the stream.
Definition stream.h:49
Size size
Stream size in pixels.
Definition stream.h:45
const StreamFormats & formats() const
Retrieve advisory stream format information.
Definition stream.h:55
StreamConfiguration()
Definition stream.cpp:282
void setStream(Stream *stream)
Associate a stream with a configuration.
Definition stream.h:54
std::optional< ColorSpace > colorSpace
The ColorSpace for this stream.
Definition stream.h:51
std::string toString() const
Assemble and return a string describing the configuration.
Definition stream.cpp:393
PixelFormat pixelFormat
Stream pixel format.
Definition stream.h:44
Stream * stream() const
Retrieve the stream associated with the configuration.
Definition stream.h:53
unsigned int frameSize
Frame size for the stream, in bytes.
Definition stream.h:47
unsigned int stride
Image stride for the stream, in bytes.
Definition stream.h:46