mirror of
https://github.com/rzeldent/esp32cam-rtsp.git
synced 2025-11-13 19:56:23 +00:00
46 lines
930 B
C++
46 lines
930 B
C++
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
#include <WiFiServer.h>
|
|
|
|
#include <string>
|
|
#include <list>
|
|
|
|
#include "micro_rtsp_camera.h"
|
|
#include "micro_rtsp_requests.h"
|
|
|
|
class micro_rtsp_server : WiFiServer
|
|
{
|
|
public:
|
|
micro_rtsp_server(const micro_rtsp_camera& source, unsigned frame_interval = 100);
|
|
~micro_rtsp_server();
|
|
|
|
void begin(unsigned short port = 554);
|
|
void end();
|
|
|
|
unsigned get_frame_interval() { return frame_interval_; }
|
|
unsigned set_frame_interval(unsigned value) { return frame_interval_ = value; }
|
|
|
|
void loop();
|
|
|
|
size_t clients() { return clients_.size(); }
|
|
|
|
class rtsp_client : public WiFiClient, public micro_rtsp_requests
|
|
{
|
|
public:
|
|
rtsp_client(const WiFiClient &client);
|
|
~rtsp_client();
|
|
|
|
void handle_request();
|
|
};
|
|
|
|
private:
|
|
const micro_rtsp_camera &source_;
|
|
|
|
unsigned frame_interval_;
|
|
|
|
unsigned long next_frame_update_;
|
|
|
|
unsigned long next_check_client_;
|
|
std::list<rtsp_client> clients_;
|
|
}; |