mirror of
				https://github.com/esphome/esphome.git
				synced 2025-10-31 07:03:55 +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:
		
							
								
								
									
										20
									
								
								esphome/components/camera/buffer_impl.cpp
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								esphome/components/camera/buffer_impl.cpp
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | ||||
| #include "buffer_impl.h" | ||||
|  | ||||
| namespace esphome::camera { | ||||
|  | ||||
| BufferImpl::BufferImpl(size_t size) { | ||||
|   this->data_ = this->allocator_.allocate(size); | ||||
|   this->size_ = size; | ||||
| } | ||||
|  | ||||
| BufferImpl::BufferImpl(CameraImageSpec *spec) { | ||||
|   this->data_ = this->allocator_.allocate(spec->bytes_per_image()); | ||||
|   this->size_ = spec->bytes_per_image(); | ||||
| } | ||||
|  | ||||
| BufferImpl::~BufferImpl() { | ||||
|   if (this->data_ != nullptr) | ||||
|     this->allocator_.deallocate(this->data_, this->size_); | ||||
| } | ||||
|  | ||||
| }  // namespace esphome::camera | ||||
		Reference in New Issue
	
	Block a user