first commit

This commit is contained in:
Rene Zeldenthuis
2022-07-03 23:42:14 +02:00
commit b0522218f6
12 changed files with 457 additions and 0 deletions

39
include/README Normal file
View 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

12
include/esp32cam.h Normal file
View File

@@ -0,0 +1,12 @@
#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.1"
#define RTSP_PORT 554
#define DEFAULT_FRAMERATE "20"
#define DEFAULT_FRAMESIZE "SVGA (800x600)"

53
include/frame_size.h Normal file
View File

@@ -0,0 +1,53 @@
#pragma once
#include <string.h>
#include <sensor.h>
typedef char frame_size_name_t[18];
typedef struct frame_size_entry
{
frame_size_name_t name;
framesize_t frame_size;
} frame_size_entry_t;
constexpr const frame_size_entry_t frame_sizes[] = {
{"96x96", FRAMESIZE_96X96},
{"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},
{"FHD (1920x1080)", FRAMESIZE_FHD},
{"P HD (2560x1440)", FRAMESIZE_P_HD},
{"P 3MP (2560x1600)", FRAMESIZE_P_3MP},
{"QXGA (2560x1920)", FRAMESIZE_QXGA},
{"QHD (2560x1440)", FRAMESIZE_QHD},
{"WQXGA (2560x1600)", FRAMESIZE_WQXGA},
{"P FHD (1080x1920)", FRAMESIZE_P_FHD},
{"QSXGA (2560x1920)", FRAMESIZE_QSXGA},
{"", FRAMESIZE_INVALID}};
framesize_t lookup_frame_size(const char *pin)
{
// Lookup table for the frame name to framesize_t
auto entry = &frame_sizes[0];
while (*entry->name)
{
if (strncmp(entry->name, pin, sizeof(frame_size_name_t)) == 0)
return entry->frame_size;
entry++;
}
return FRAMESIZE_INVALID;
}