Files
external_libcamera/include/libcamera/stream.h
Niklas Söderlund 70e53be538 libcamera: stream: Add basic stream usages
In preparation of reworking how a default configuration is retrieved
from a camera add stream usages. The usages will be used by applications
to describe how they intend to use a camera and replace the Stream IDs
when retrieving default configuration from the camera using
streamConfiguration().

Signed-off-by: Niklas Söderlund <niklas.soderlund@ragnatech.se>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
2019-04-05 22:07:24 +02:00

81 lines
1.3 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 <libcamera/buffer.h>
#include <libcamera/geometry.h>
namespace libcamera {
class Camera;
struct StreamConfiguration {
unsigned int width;
unsigned int height;
unsigned int pixelFormat;
unsigned int bufferCount;
};
class StreamUsage
{
public:
enum Role {
StillCapture,
VideoRecording,
Viewfinder,
};
Role role() const { return role_; }
const Size &size() const { return size_; }
protected:
explicit StreamUsage(Role role);
StreamUsage(Role role, int width, int height);
private:
Role role_;
Size size_;
};
class Stream final
{
public:
class StillCapture : public StreamUsage
{
public:
StillCapture();
};
class VideoRecording : public StreamUsage
{
public:
VideoRecording();
};
class Viewfinder : public StreamUsage
{
public:
Viewfinder(int width, int height);
};
Stream();
BufferPool &bufferPool() { return bufferPool_; }
const StreamConfiguration &configuration() const { return configuration_; }
private:
friend class Camera;
BufferPool bufferPool_;
StreamConfiguration configuration_;
};
} /* namespace libcamera */
#endif /* __LIBCAMERA_STREAM_H__ */