Initial commit (secrets isolated)
This commit is contained in:
39
lib/esp32cam-rtsp/include/README
Executable file
39
lib/esp32cam-rtsp/include/README
Executable file
@@ -0,0 +1,39 @@
|
||||
|
||||
This directory is intended for project header files.
|
||||
|
||||
A header file is a file containing C declarations and macro definitions
|
||||
to be shared between several project source files. You request the use of a
|
||||
header file in your project source file (C, C++, etc) located in `src` folder
|
||||
by including it, with the C preprocessing directive `#include'.
|
||||
|
||||
```src/main.c
|
||||
|
||||
#include "header.h"
|
||||
|
||||
int main (void)
|
||||
{
|
||||
...
|
||||
}
|
||||
```
|
||||
|
||||
Including a header file produces the same results as copying the header file
|
||||
into each source file that needs it. Such copying would be time-consuming
|
||||
and error-prone. With a header file, the related declarations appear
|
||||
in only one place. If they need to be changed, they can be changed in one
|
||||
place, and programs that include the header file will automatically use the
|
||||
new version when next recompiled. The header file eliminates the labor of
|
||||
finding and changing all the copies as well as the risk that a failure to
|
||||
find one copy will result in inconsistencies within a program.
|
||||
|
||||
In C, the usual convention is to give header files names that end with `.h'.
|
||||
It is most portable to use only letters, digits, dashes, and underscores in
|
||||
header file names, and at most one dot.
|
||||
|
||||
Read more about using header files in official GCC documentation:
|
||||
|
||||
* Include Syntax
|
||||
* Include Operation
|
||||
* Once-Only Headers
|
||||
* Computed Includes
|
||||
|
||||
https://gcc.gnu.org/onlinedocs/cpp/Header-Files.html
|
||||
11
lib/esp32cam-rtsp/include/format_duration.h
Executable file
11
lib/esp32cam-rtsp/include/format_duration.h
Executable file
@@ -0,0 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
String format_duration(time_t seconds)
|
||||
{
|
||||
auto days = seconds / (60 * 60 * 24);
|
||||
auto tm = gmtime(&seconds);
|
||||
String duration = days > 0 ? String(days) + " days, " : "";
|
||||
char time_buff[9];
|
||||
strftime(time_buff, 9, "%H:%M:%S", tm);
|
||||
return duration + time_buff;
|
||||
}
|
||||
72
lib/esp32cam-rtsp/include/format_number.h
Executable file
72
lib/esp32cam-rtsp/include/format_number.h
Executable file
@@ -0,0 +1,72 @@
|
||||
#pragma once
|
||||
|
||||
#include <Arduino.h>
|
||||
|
||||
String format_value(double value)
|
||||
{
|
||||
if (value == 0.0)
|
||||
return "0";
|
||||
|
||||
if (value < 0)
|
||||
return "-" + format_value(-value);
|
||||
|
||||
// No decimal places
|
||||
if (value >= 1)
|
||||
return String(value, 0);
|
||||
if (value < 0.00001)
|
||||
return String(value, 6);
|
||||
if (value < 0.0001)
|
||||
return String(value, 5);
|
||||
if (value < 0.001)
|
||||
return String(value, 4);
|
||||
if (value < 0.01)
|
||||
return String(value, 3);
|
||||
if (value < 0.1)
|
||||
return String(value, 2);
|
||||
return String(value, 1);
|
||||
}
|
||||
|
||||
String format_si(double value, int decimal_places = 2)
|
||||
{
|
||||
if (value == 0.0)
|
||||
return "0";
|
||||
|
||||
if (value < 0)
|
||||
return "-" + format_si(-value, decimal_places);
|
||||
|
||||
auto value_abs = fabs(value);
|
||||
if (value_abs < 1E-9)
|
||||
return String(value * 1E12, decimal_places) + "p";
|
||||
if (value_abs < 1E-6)
|
||||
return String(value * 1E9, decimal_places) + "n";
|
||||
if (value_abs < 1E-3)
|
||||
return String(value * 1E6, decimal_places) + "u";
|
||||
if (value_abs < 1)
|
||||
return String(value * 1E3, decimal_places) + "m";
|
||||
if (value_abs < 1E3)
|
||||
return String(value, decimal_places);
|
||||
if (value_abs < 1E6)
|
||||
return String(value / 1E3, decimal_places) + "k";
|
||||
if (value_abs < 1E9)
|
||||
return String(value / 1E6, decimal_places) + "M";
|
||||
if (value_abs < 1E12)
|
||||
return String(value / 1E9, decimal_places) + "G";
|
||||
if (value_abs < 1E15)
|
||||
return String(value / 1E12, decimal_places) + "T";
|
||||
|
||||
return "NaN";
|
||||
}
|
||||
|
||||
String format_memory(size_t bytes, int decimal_places = 2)
|
||||
{
|
||||
const char *suffix[] = {"B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"};
|
||||
auto val = (double)bytes;
|
||||
auto suffix_index = 0;
|
||||
while (val >= 1024.0)
|
||||
{
|
||||
val /= 1024;
|
||||
suffix_index++;
|
||||
}
|
||||
|
||||
return String(val, decimal_places) + " " + suffix[suffix_index];
|
||||
}
|
||||
28
lib/esp32cam-rtsp/include/lookup_camera_effect.h
Executable file
28
lib/esp32cam-rtsp/include/lookup_camera_effect.h
Executable file
@@ -0,0 +1,28 @@
|
||||
#pragma once
|
||||
|
||||
#include <string.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char name[11];
|
||||
const int value;
|
||||
} camera_effect_entry_t;
|
||||
|
||||
constexpr const camera_effect_entry_t camera_effects[] = {
|
||||
{"Normal", 0},
|
||||
{"Negative", 1},
|
||||
{"Grayscale", 2},
|
||||
{"Red tint", 3},
|
||||
{"Green tint", 4},
|
||||
{"Blue tint", 5},
|
||||
{"Sepia", 6}};
|
||||
|
||||
const int lookup_camera_effect(const char *name)
|
||||
{
|
||||
// Lookup table for the frame name to framesize_t
|
||||
for (const auto &entry : camera_effects)
|
||||
if (strncmp(entry.name, name, sizeof(entry.name)) == 0)
|
||||
return entry.value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
35
lib/esp32cam-rtsp/include/lookup_camera_frame_size.h
Executable file
35
lib/esp32cam-rtsp/include/lookup_camera_frame_size.h
Executable file
@@ -0,0 +1,35 @@
|
||||
#pragma once
|
||||
|
||||
#include <string.h>
|
||||
#include <sensor.h>
|
||||
|
||||
typedef struct frame_size_entry
|
||||
{
|
||||
const char name[17];
|
||||
const framesize_t frame_size;
|
||||
} frame_size_entry_t;
|
||||
|
||||
constexpr const frame_size_entry_t frame_sizes[] = {
|
||||
{"QQVGA (160x120)", FRAMESIZE_QQVGA},
|
||||
{"QCIF (176x144)", FRAMESIZE_QCIF},
|
||||
{"HQVGA (240x176)", FRAMESIZE_HQVGA},
|
||||
{"240x240", FRAMESIZE_240X240},
|
||||
{"QVGA (320x240)", FRAMESIZE_QVGA},
|
||||
{"CIF (400x296)", FRAMESIZE_CIF},
|
||||
{"HVGA (480x320)", FRAMESIZE_HVGA},
|
||||
{"VGA (640x480)", FRAMESIZE_VGA},
|
||||
{"SVGA (800x600)", FRAMESIZE_SVGA},
|
||||
{"XGA (1024x768)", FRAMESIZE_XGA},
|
||||
{"HD (1280x720)", FRAMESIZE_HD},
|
||||
{"SXGA (1280x1024)", FRAMESIZE_SXGA},
|
||||
{"UXGA (1600x1200)", FRAMESIZE_UXGA}};
|
||||
|
||||
const framesize_t lookup_frame_size(const char *pin)
|
||||
{
|
||||
// Lookup table for the frame name to framesize_t
|
||||
for (const auto &entry : frame_sizes)
|
||||
if (strncmp(entry.name, pin, sizeof(entry.name)) == 0)
|
||||
return entry.frame_size;
|
||||
|
||||
return FRAMESIZE_INVALID;
|
||||
}
|
||||
29
lib/esp32cam-rtsp/include/lookup_camera_gainceiling.h
Executable file
29
lib/esp32cam-rtsp/include/lookup_camera_gainceiling.h
Executable file
@@ -0,0 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include <string.h>
|
||||
#include <esp_camera.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char name[5];
|
||||
const gainceiling_t value;
|
||||
} camera_gainceiling_entry_t;
|
||||
|
||||
constexpr const camera_gainceiling_entry_t camera_gain_ceilings[] = {
|
||||
{"2X", GAINCEILING_2X},
|
||||
{"4X", GAINCEILING_4X},
|
||||
{"8X", GAINCEILING_8X},
|
||||
{"16X", GAINCEILING_16X},
|
||||
{"32X", GAINCEILING_32X},
|
||||
{"64X", GAINCEILING_64X},
|
||||
{"128X", GAINCEILING_128X}};
|
||||
|
||||
const gainceiling_t lookup_camera_gainceiling(const char *name)
|
||||
{
|
||||
// Lookup table for the frame name to framesize_t
|
||||
for (const auto &entry : camera_gain_ceilings)
|
||||
if (strncmp(entry.name, name, sizeof(entry.name)) == 0)
|
||||
return entry.value;
|
||||
|
||||
return GAINCEILING_2X;
|
||||
}
|
||||
26
lib/esp32cam-rtsp/include/lookup_camera_wb_mode.h
Executable file
26
lib/esp32cam-rtsp/include/lookup_camera_wb_mode.h
Executable file
@@ -0,0 +1,26 @@
|
||||
#pragma once
|
||||
|
||||
#include <string.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
const char name[7];
|
||||
const int value;
|
||||
} camera_wb_mode_entry_t;
|
||||
|
||||
constexpr const camera_wb_mode_entry_t camera_wb_modes[] = {
|
||||
{"Auto", 0},
|
||||
{"Sunny", 1},
|
||||
{"Cloudy", 2},
|
||||
{"Office", 3},
|
||||
{"Home", 4}};
|
||||
|
||||
const int lookup_camera_wb_mode(const char *name)
|
||||
{
|
||||
// Lookup table for the frame name to framesize_t
|
||||
for (const auto &entry : camera_wb_modes)
|
||||
if (strncmp(entry.name, name, sizeof(entry.name)) == 0)
|
||||
return entry.value;
|
||||
|
||||
return 0;
|
||||
}
|
||||
41
lib/esp32cam-rtsp/include/settings.h
Executable file
41
lib/esp32cam-rtsp/include/settings.h
Executable file
@@ -0,0 +1,41 @@
|
||||
#pragma once
|
||||
|
||||
#define APP_TITLE "ESP32CAM-RTSP"
|
||||
#define APP_VERSION "1.0"
|
||||
|
||||
#define WIFI_SSID "ESP32CAM-RTSP"
|
||||
#define WIFI_PASSWORD nullptr
|
||||
#define CONFIG_VERSION "1.6"
|
||||
|
||||
#define OTA_PASSWORD "ESP32CAM-RTSP"
|
||||
|
||||
#define RTSP_PORT 554
|
||||
|
||||
#define DEFAULT_FRAME_DURATION 200
|
||||
#define DEFAULT_FRAME_SIZE "VGA (640x480)"
|
||||
#define DEFAULT_JPEG_QUALITY (psramFound() ? 12 : 14)
|
||||
|
||||
#define DEFAULT_BRIGHTNESS 0
|
||||
#define DEFAULT_CONTRAST 0
|
||||
#define DEFAULT_SATURATION 0
|
||||
#define DEFAULT_EFFECT "Normal"
|
||||
#define DEFAULT_WHITE_BALANCE true
|
||||
#define DEFAULT_WHITE_BALANCE_GAIN true
|
||||
#define DEFAULT_WHITE_BALANCE_MODE "Auto"
|
||||
#define DEFAULT_EXPOSURE_CONTROL true
|
||||
#define DEFAULT_AEC2 true
|
||||
#define DEFAULT_AE_LEVEL 0
|
||||
#define DEFAULT_AEC_VALUE 300
|
||||
#define DEFAULT_GAIN_CONTROL true
|
||||
#define DEFAULT_AGC_GAIN 0
|
||||
#define DEFAULT_GAIN_CEILING "2X"
|
||||
#define DEFAULT_BPC false
|
||||
#define DEFAULT_WPC true
|
||||
#define DEFAULT_RAW_GAMMA true
|
||||
#define DEFAULT_LENC true
|
||||
#define DEFAULT_HORIZONTAL_MIRROR false
|
||||
#define DEFAULT_VERTICAL_MIRROR false
|
||||
#define DEFAULT_DCW true
|
||||
#define DEFAULT_COLORBAR false
|
||||
|
||||
#define DEFAULT_LED_INTENSITY 0
|
||||
Reference in New Issue
Block a user