libcamera/include/libcamera/framebuffer_allocator.h
Kieran Bingham 6410d1d37c libcamera/base: Move class helpers to the base library
Move the class support infrastructure to the base library.

Reviewed-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Hirokazu Honda <hiroh@chromium.org>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
2021-06-25 16:11:03 +01:00

43 lines
957 B
C++

/* SPDX-License-Identifier: LGPL-2.1-or-later */
/*
* Copyright (C) 2019, Google Inc.
*
* framebuffer_allocator.h - FrameBuffer allocator
*/
#ifndef __LIBCAMERA_FRAMEBUFFER_ALLOCATOR_H__
#define __LIBCAMERA_FRAMEBUFFER_ALLOCATOR_H__
#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 */
#endif /* __LIBCAMERA_FRAMEBUFFER_ALLOCATOR_H__ */