ESPHome
2026.3.0-dev
Loading...
Searching...
No Matches
esphome
components
camera
buffer_impl.cpp
Go to the documentation of this file.
1
#include "
buffer_impl.h
"
2
3
namespace
esphome::camera
{
4
5
BufferImpl::BufferImpl
(
size_t
size
) {
6
RAMAllocator<uint8_t>
allocator;
7
this->
data_
= allocator.
allocate
(
size
);
8
this->
size_
=
size
;
9
}
10
11
BufferImpl::BufferImpl
(
CameraImageSpec
*spec) {
12
RAMAllocator<uint8_t>
allocator;
13
this->
data_
= allocator.
allocate
(spec->
bytes_per_image
());
14
this->
size_
= spec->
bytes_per_image
();
15
}
16
17
BufferImpl::~BufferImpl
() {
18
if
(this->
data_
!=
nullptr
) {
19
RAMAllocator<uint8_t>
allocator;
20
allocator.
deallocate
(this->
data_
, this->
size_
);
21
}
22
}
23
24
}
// namespace esphome::camera
buffer_impl.h
esphome::RAMAllocator
An STL allocator that uses SPI or internal RAM.
Definition
helpers.h:1794
esphome::RAMAllocator::deallocate
void deallocate(T *p, size_t n)
Definition
helpers.h:1849
esphome::RAMAllocator::allocate
T * allocate(size_t n)
Definition
helpers.h:1811
esphome::camera::BufferImpl::BufferImpl
BufferImpl(size_t size)
Definition
buffer_impl.cpp:5
esphome::camera::BufferImpl::size_
size_t size_
Definition
buffer_impl.h:21
esphome::camera::BufferImpl::~BufferImpl
~BufferImpl() override
Definition
buffer_impl.cpp:17
esphome::camera::BufferImpl::data_
uint8_t * data_
Definition
buffer_impl.h:22
esphome::camera
Definition
buffer.h:6
esphome::size
size_t size
Definition
helpers.h:854
esphome::camera::CameraImageSpec
Specification of a caputured camera image.
Definition
camera.h:84
esphome::camera::CameraImageSpec::bytes_per_image
size_t bytes_per_image()
Definition
camera.h:101
Generated by
1.12.0