Loading...
Searching...
No Matches
framebuffer_allocator.h
Go to the documentation of this file.
/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* FrameBuffer allocator
*/
#pragma once
#include <map>
#include <memory>
#include <vector>
#include <libcamera/base/class.h>
namespace libcamera {
class Camera;
class FrameBuffer;
class Stream;
class FrameBufferAllocator
{
public:
FrameBufferAllocator(std::shared_ptr<Camera> camera);
~FrameBufferAllocator();
int allocate(Stream *stream);
int free(Stream *stream);
bool allocated() const { return !buffers_.empty(); }
const std::vector<std::unique_ptr<FrameBuffer>> &buffers(Stream *stream) const;
private:
LIBCAMERA_DISABLE_COPY(FrameBufferAllocator)
std::shared_ptr<Camera> camera_;
std::map<Stream *, std::vector<std::unique_ptr<FrameBuffer>>> buffers_;
};
} /* namespace libcamera */
libcamera::Camera
Camera device.
Definition camera.h:115
libcamera::FrameBufferAllocator
FrameBuffer allocator for applications.
Definition framebuffer_allocator.h:23
libcamera::FrameBufferAllocator::free
int free(Stream *stream)
Free buffers previously allocated for a stream.
Definition framebuffer_allocator.cpp:119
libcamera::FrameBufferAllocator::allocate
int allocate(Stream *stream)
Allocate buffers for a configured stream.
Definition framebuffer_allocator.cpp:86
libcamera::FrameBufferAllocator::allocated
bool allocated() const
Check if the allocator has allocated buffers for any stream.
Definition framebuffer_allocator.h:31
libcamera::FrameBufferAllocator::buffers
const std::vector< std::unique_ptr< FrameBuffer > > & buffers(Stream *stream) const
Retrieve the buffers allocated for a stream.
Definition framebuffer_allocator.cpp:148
libcamera::FrameBufferAllocator::FrameBufferAllocator
FrameBufferAllocator(std::shared_ptr< Camera > camera)
Construct a FrameBufferAllocator serving a camera.
Definition framebuffer_allocator.cpp:61
libcamera::FrameBuffer
Frame buffer data and its associated dynamic metadata.
Definition framebuffer.h:50
libcamera::Stream
Video stream for a camera.
Definition stream.h:76
libcamera
Top-level libcamera namespace.
Definition bound_method.h:15