Files
external_libcamera/include/libcamera/stream.h
Laurent Pinchart 77ae64eb24 libcamera: Refactor the camera configuration storage and API
Refactor the CameraConfiguration structure to not rely on Stream
instances. This is a step towards making the camera configuration object
more powerful with configuration validation using "try" semantics.

The CameraConfiguration now exposes a simple vector-like API to access
the contained stream configurations. Both operator[]() and at() are
provided to access elements. The isEmpty() method is renamed to empty()
and the methods reordered to match the std::vector class.

As applications need access to the Stream instances associated with the
configuration entries in order to associate buffers with streams when
creating requests, expose the stream selected by the pipeline handler
through a new StreamConfiguration::stream().

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Jacopo Mondi <jacopo@jmondi.org>
2019-05-23 00:27:14 +03:00

66 lines
1.1 KiB
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* stream.h - Video stream for a Camera
*/
#ifndef __LIBCAMERA_STREAM_H__
#define __LIBCAMERA_STREAM_H__
#include <string>
#include <vector>
#include <libcamera/buffer.h>
#include <libcamera/geometry.h>
namespace libcamera {
class Camera;
class Stream;
struct StreamConfiguration {
StreamConfiguration()
: stream_(nullptr)
{
}
unsigned int pixelFormat;
Size size;
unsigned int bufferCount;
Stream *stream() const { return stream_; }
void setStream(Stream *stream) { stream_ = stream; }
std::string toString() const;
private:
Stream *stream_;
};
enum StreamRole {
StillCapture,
VideoRecording,
Viewfinder,
};
using StreamRoles = std::vector<StreamRole>;
class Stream
{
public:
Stream();
BufferPool &bufferPool() { return bufferPool_; }
const StreamConfiguration &configuration() const { return configuration_; }
protected:
friend class Camera;
BufferPool bufferPool_;
StreamConfiguration configuration_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_STREAM_H__ */