5MP Motion Camera JPEG Image and Movie Catcher  1.1.1.1
A CGI interface to capture and display pictures and movies using OpenCV.
main.cpp File Reference
#include <iostream>
#include <thread>
#include <functional>
#include <cstdlib>
#include <sys/types.h>
#include <dirent.h>
#include "http_io.hpp"
#include "http_parser.hpp"
#include "base64.hpp"
#include "magic_mime.hpp"
#include "opencv_util.hpp"
#include "mjpeg_utils.hpp"

Macros

#define JPEG_DEST   (string) "/var/www/html/motion_camera/"
 

Typedefs

using b64 = Base64
 
using mu = mjpeg_utils
 

Functions

int main (int argc, char *argv[], char *envp[])
 

Macro Definition Documentation

◆ JPEG_DEST

#define JPEG_DEST   (string) "/var/www/html/motion_camera/"

Typedef Documentation

◆ b64

using b64 = Base64

◆ mu

using mu = mjpeg_utils

Function Documentation

◆ main()

int main ( int  argc,
char *  argv[],
char *  envp[] 
)

A program implementing the CGI for the purpose of storing images and data.

Parameters
argcThe count of command line arguments passed by the web server to the CGI (us).
argvThe command line argument strings.
envpThe system environment variables as key=value pairs.
Returns
Exit status.
See also
https://en.wikipedia.org/wiki/Common_Gateway_Interface

A lambda function for writing the Http_parser::files data to file storage. MIME types are checked with magic numbers in the data to confirm a match before writing. Non-matches are skipped.

Using a lambda makes it convenient to use a thread for this task.

The write_files lambda function is called in its own thread to permit the HTTP transaction to conclude (by sending the response) as early as possible.