libcamera: include/libcamera/framebuffer_allocator.h Source File

libcamera v0.4.0 Supporting cameras in Linux since 2019 |

Loading...
Searching...
No Matches
framebuffer_allocator.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 * FrameBuffer allocator
6 */
7
8#pragma once
9
10#include <map>
11#include <memory>
12#include <vector>
13
14#include <libcamera/base/class.h>
15
16namespace libcamera {
17
18class Camera;
19class FrameBuffer;
20class Stream;
21
22 class FrameBufferAllocator
23{
24public:
25 FrameBufferAllocator(std::shared_ptr<Camera> camera);
26 ~FrameBufferAllocator();
27
28 int allocate(Stream *stream);
29 int free(Stream *stream);
30
31 bool allocated() const { return !buffers_.empty(); }
32 const std::vector<std::unique_ptr<FrameBuffer>> &buffers(Stream *stream) const;
33
34private:
35 LIBCAMERA_DISABLE_COPY(FrameBufferAllocator)
36
37 std::shared_ptr<Camera> camera_;
38 std::map<Stream *, std::vector<std::unique_ptr<FrameBuffer>>> buffers_;
39};
40
41} /* 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:49
libcamera::Stream
Video stream for a camera.
Definition stream.h:76
libcamera
Top-level libcamera namespace.
Definition bound_method.h:15