ESPHome 2026.11.0-dev
Loading...
Searching...
No Matches
rtsp_server.h
Go to the documentation of this file.
1#pragma once
2
4
5#ifdef USE_CAMERA
6
7#include <array>
8#include <memory>
9
11#ifdef USE_SOCKET_IPV4_ALLOW
13#endif
16#include "rtsp_session.h"
17
18namespace esphome::rtsp_server {
19
21 public:
22 explicit RTSPServer(uint16_t port) : port_(port) {}
23
24 void setup() override;
25 void loop() override;
26 void dump_config() override;
27 float get_setup_priority() const override;
28
29 void on_camera_image(const std::shared_ptr<camera::CameraImage> &image) override;
30#ifdef USE_SOCKET_IPV4_ALLOW
31 void set_allow(const socket::Ipv4AllowEntry *entries, size_t count) { this->allow_.set(entries, count); }
32#endif
33
34 protected:
36 void socket_failed_(const char *what);
37
39 std::array<RTSPSession, MAX_RTSP_CONNECTIONS> sessions_{};
40#ifdef USE_SOCKET_IPV4_ALLOW
42#endif
43 uint16_t port_;
44 bool streaming_{false};
45 bool frame_warned_{false};
46};
47
48} // namespace esphome::rtsp_server
49
50#endif
Listener interface for camera events.
Definition camera.h:46
void on_camera_image(const std::shared_ptr< camera::CameraImage > &image) override
socket::ListenSocket * socket_
Definition rtsp_server.h:38
float get_setup_priority() const override
void set_allow(const socket::Ipv4AllowEntry *entries, size_t count)
Definition rtsp_server.h:31
void socket_failed_(const char *what)
std::array< RTSPSession, MAX_RTSP_CONNECTIONS > sessions_
Definition rtsp_server.h:39
void accept_new_connections_(uint32_t now)
IPv4 peers that may connect. An empty list allows every peer.
Definition ipv4_allow.h:20
void set(const Ipv4AllowEntry *entries, size_t count)
Definition ipv4_allow.h:22
unsigned count
Definition gif.cpp:51
static void uint32_t
One allowed IPv4 network, network byte order, host bits cleared.
Definition ipv4_allow.h:14