forked from external-repos/esp32cam-rtsp
Added MDNS
This commit is contained in:
@@ -1,6 +1,5 @@
|
|||||||
#include "rtsp_server.h"
|
#include "rtsp_server.h"
|
||||||
#include <esp32-hal-log.h>
|
#include <esp32-hal-log.h>
|
||||||
#include <ESPmDNS.h>
|
|
||||||
#include <OV2640Streamer.h>
|
#include <OV2640Streamer.h>
|
||||||
|
|
||||||
// URI: e.g. rtsp://192.168.178.27:554/mjpeg/1
|
// URI: e.g. rtsp://192.168.178.27:554/mjpeg/1
|
||||||
@@ -9,9 +8,6 @@ rtsp_server::rtsp_server(OV2640 &cam, unsigned long interval, int port /*= 554*/
|
|||||||
{
|
{
|
||||||
log_i("Starting RTSP server");
|
log_i("Starting RTSP server");
|
||||||
WiFiServer::begin();
|
WiFiServer::begin();
|
||||||
// Add service to mDNS - rtsp
|
|
||||||
MDNS.addService("rtsp", "tcp", 554);
|
|
||||||
|
|
||||||
timer_.every(interval, client_handler, this);
|
timer_.every(interval, client_handler, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
18
src/main.cpp
18
src/main.cpp
@@ -1,16 +1,11 @@
|
|||||||
#include <Arduino.h>
|
#include <Arduino.h>
|
||||||
|
|
||||||
#include <soc/rtc_cntl_reg.h>
|
#include <soc/rtc_cntl_reg.h>
|
||||||
|
|
||||||
#include <IotWebConf.h>
|
#include <IotWebConf.h>
|
||||||
#include <IotWebConfTParameter.h>
|
#include <IotWebConfTParameter.h>
|
||||||
|
|
||||||
#include <OV2640.h>
|
#include <OV2640.h>
|
||||||
|
#include <ESPmDNS.h>
|
||||||
#include <rtsp_server.h>
|
#include <rtsp_server.h>
|
||||||
|
|
||||||
#include <frame_size.h>
|
#include <frame_size.h>
|
||||||
|
|
||||||
#include <esp32cam.h>
|
#include <esp32cam.h>
|
||||||
|
|
||||||
char frame_rate_val[6];
|
char frame_rate_val[6];
|
||||||
@@ -54,7 +49,7 @@ void handleRoot()
|
|||||||
html += "<h3>Settings</h3>";
|
html += "<h3>Settings</h3>";
|
||||||
html += "<ul>";
|
html += "<ul>";
|
||||||
html += "<li>Frame size: " + String(frame_size_val) + "</li>";
|
html += "<li>Frame size: " + String(frame_size_val) + "</li>";
|
||||||
html += "<li>Frame rate: " + String(frame_rate_val) + "</li>";
|
html += "<li>Frame rate: " + String(frame_rate_val) + " ms</li>";
|
||||||
html += "</ul>";
|
html += "</ul>";
|
||||||
html += "<br/>Go to <a href=\"config\">configure page</a> to change settings.";
|
html += "<br/>Go to <a href=\"config\">configure page</a> to change settings.";
|
||||||
html += "</body></html>";
|
html += "</body></html>";
|
||||||
@@ -149,6 +144,15 @@ void setup()
|
|||||||
{ iotWebConf.handleConfig(); });
|
{ iotWebConf.handleConfig(); });
|
||||||
web_server.onNotFound([]()
|
web_server.onNotFound([]()
|
||||||
{ iotWebConf.handleNotFound(); });
|
{ iotWebConf.handleNotFound(); });
|
||||||
|
|
||||||
|
// Set DNS to thingname
|
||||||
|
if (!MDNS.begin(iotWebConf.getThingName()))
|
||||||
|
log_e("Error setting up MDNS responder!");
|
||||||
|
|
||||||
|
// Add service to mDNS - http
|
||||||
|
MDNS.addService("http", "tcp", 80);
|
||||||
|
// Add service to mDNS - rtsp
|
||||||
|
MDNS.addService("rtsp", "tcp", 554);
|
||||||
}
|
}
|
||||||
|
|
||||||
void loop()
|
void loop()
|
||||||
|
|||||||
Reference in New Issue
Block a user