mirror of
https://github.com/esphome/esphome.git
synced 2026-09-20 11:38:48 +00:00
Add JPEG encoder support via new camera_encoder component (#9459)
Co-authored-by: J. Nick Koston <nick@koston.org> Co-authored-by: J. Nick Koston <nick@home-assistant.io> Co-authored-by: J. Nick Koston <nick+github@koston.org>
This commit is contained in:
co-authored by
J. Nick Koston
J. Nick Koston
J. Nick Koston
parent
983b3cb879
commit
e29f0ee7f8
@@ -0,0 +1,25 @@
|
||||
#pragma once
|
||||
|
||||
#include "esphome/components/camera/encoder.h"
|
||||
#include "esphome/core/helpers.h"
|
||||
|
||||
namespace esphome::camera_encoder {
|
||||
|
||||
class EncoderBufferImpl : public camera::EncoderBuffer {
|
||||
public:
|
||||
// --- EncoderBuffer ---
|
||||
bool set_buffer_size(size_t size) override;
|
||||
uint8_t *get_data() const override { return this->data_; }
|
||||
size_t get_size() const override { return this->size_; }
|
||||
size_t get_max_size() const override { return this->capacity_; }
|
||||
// ----------------------
|
||||
~EncoderBufferImpl() override;
|
||||
|
||||
protected:
|
||||
RAMAllocator<uint8_t> allocator_;
|
||||
size_t capacity_{};
|
||||
size_t size_{};
|
||||
uint8_t *data_{};
|
||||
};
|
||||
|
||||
} // namespace esphome::camera_encoder
|
||||
Reference in New Issue
Block a user