forked from easytarget/esp32-cam-webserver
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcam_streamer.h
36 lines (31 loc) · 1001 Bytes
/
cam_streamer.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#ifndef _INC_CAM_STREAMER
#define _INC_CAM_STREAMER
#include <esp_timer.h>
#include <esp_http_server.h>
#include <esp_camera.h>
#include <string.h>
#include <stdint.h>
#include <freertos/FreeRTOS.h>
#include <freertos/queue.h>
#include <freertos/task.h>
typedef struct {
QueueHandle_t clients;
TaskHandle_t task;
uint64_t last_updated;
int64_t frame_delay;
uint8_t buf_lock;
camera_fb_t *buf;
char part_buf[64];
size_t part_len;
httpd_handle_t server;
size_t num_clients;
} cam_streamer_t;
void cam_streamer_init(cam_streamer_t *s, httpd_handle_t server, uint16_t frame_delay);
void cam_streamer_set_frame_delay(cam_streamer_t *s, uint16_t frame_delay);
void cam_streamer_task(void *p);
void cam_streamer_start(cam_streamer_t *s);
void cam_streamer_stop(cam_streamer_t *s);
bool cam_streamer_enqueue_client(cam_streamer_t *s, int fd);
size_t cam_streamer_get_num_clients(cam_streamer_t *s);
void cam_streamer_dequeue_all_clients(cam_streamer_t *s);
#endif