forked from xiaozhi/xiaozhi-esp32
feat: Add camera functions (lichuang-dev)
This commit is contained in:
38
main/boards/common/esp32_camera.h
Normal file
38
main/boards/common/esp32_camera.h
Normal file
@@ -0,0 +1,38 @@
|
||||
#ifndef ESP32_CAMERA_H
|
||||
#define ESP32_CAMERA_H
|
||||
|
||||
#include <esp_camera.h>
|
||||
#include <lvgl.h>
|
||||
#include <thread>
|
||||
#include <memory>
|
||||
|
||||
#include <freertos/FreeRTOS.h>
|
||||
#include <freertos/queue.h>
|
||||
|
||||
#include "camera.h"
|
||||
|
||||
struct JpegChunk {
|
||||
uint8_t* data;
|
||||
size_t len;
|
||||
};
|
||||
|
||||
class Esp32Camera : public Camera {
|
||||
private:
|
||||
camera_fb_t* fb_ = nullptr;
|
||||
lv_img_dsc_t preview_image_;
|
||||
std::string explain_url_;
|
||||
std::string explain_token_;
|
||||
std::thread preview_thread_;
|
||||
std::thread encoder_thread_;
|
||||
|
||||
QueueHandle_t jpeg_queue_ = nullptr;
|
||||
public:
|
||||
Esp32Camera(const camera_config_t& config);
|
||||
~Esp32Camera();
|
||||
|
||||
virtual void SetExplainUrl(const std::string& url, const std::string& token);
|
||||
virtual bool Capture();
|
||||
virtual std::string Explain(const std::string& question);
|
||||
};
|
||||
|
||||
#endif // ESP32_CAMERA_H
|
||||
Reference in New Issue
Block a user