#include <iostream>
#include <string>
#include <map>
#include <list>
#include <fstream>
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <syslog.h>
#include <sys/socket.h>
#include <sys/param.h>
#include <sys/ioctl.h>
#include <netinet/in.h>
#include <net/if.h>
#include <netdb.h>
#include <arpa/inet.h>
#include <linux/if_ether.h>
#include <sched.h>
Include dependency graph for sctl.cgi.cpp:
Go to the source code of this file.
Defines | |
#define | _KILLALL "/usr/bin/killall" |
#define | _FPCF "/usr/local/bin/fpcf" |
#define | _STR "/usr/local/bin/str" |
#define | _CONF_RUN "/var/state/streamer.conf" |
#define | _CONF "/etc/streamer.conf" |
#define | _STATUS_XML "/var/state/streamer.xml" |
#define | HEADER_TEXT 0x00 |
#define | HEADER_XML 0x01 |
#define | STREAMER_ELF "str" |
#define | STREAMER_LOCK "/dev/stream" |
#define | DEFAULT_PORT "20000" |
#define | DEFAULT_ADDR "232.0.0.1" |
#define | CMOSCAM_IOCTYPE 124 |
#define | IO_CCAM_JPEG 0x08 |
Functions | |
void | header (int type) |
bool | parse_string (const string &str, char delimiter, string &left, string &right) |
bool | streamer_start (map< string, string >) |
bool | streamer_stop (void) |
void | stream_status (void) |
bool | conf_save (map< string, string >) |
void | conf_load (ostream &stream) |
string | get_self_ip (string) |
void | stream_status_to_file (map< string, string > opts) |
int | main (int argc, char *argv[]) |
bool | streamer_is_run (void) |
bool | run_daemon (string prog, list< string > args) |
void | stop_compressor (void) |
#define _CONF "/etc/streamer.conf" |
#define _CONF_RUN "/var/state/streamer.conf" |
#define _FPCF "/usr/local/bin/fpcf" |
Definition at line 28 of file sctl.cgi.cpp.
#define _KILLALL "/usr/bin/killall" |
#define _STATUS_XML "/var/state/streamer.xml" |
Definition at line 32 of file sctl.cgi.cpp.
Referenced by stream_status(), and stream_status_to_file().
#define _STR "/usr/local/bin/str" |
#define CMOSCAM_IOCTYPE 124 |
Definition at line 239 of file sctl.cgi.cpp.
Referenced by grab_and_send(), i2c_ioctl(), main(), and stop_compressor().
#define DEFAULT_ADDR "232.0.0.1" |
#define DEFAULT_PORT "20000" |
#define HEADER_TEXT 0x00 |
#define HEADER_XML 0x01 |
#define IO_CCAM_JPEG 0x08 |
Definition at line 240 of file sctl.cgi.cpp.
Referenced by grab_and_send(), main(), and stop_compressor().
#define STREAMER_ELF "str" |
Definition at line 37 of file sctl.cgi.cpp.
#define STREAMER_LOCK "/dev/stream" |
void conf_load | ( | ostream & | stream | ) |
bool conf_save | ( | map< string, string > | ) |
Definition at line 280 of file sctl.cgi.cpp.
References _CONF_RUN, DEFAULT_ADDR, DEFAULT_PORT, and t.
Referenced by streamer_start().
string get_self_ip | ( | string | ) |
Definition at line 399 of file sctl.cgi.cpp.
Referenced by stream_status(), and stream_status_to_file().
void header | ( | int | type | ) |
int main | ( | int | argc, | |
char * | argv[] | |||
) |
*************************************************************************** ! FILE NAME : autoexposure.c ! DESCRIPTION: Daemon to adjust camera exposure and white balance ! Copyright (C) 2008 Elphel, Inc. ! -----------------------------------------------------------------------------** ! This program is free software: you can redistribute it and/or modify ! it under the terms of the GNU General Public License as published by ! the Free Software Foundation, either version 3 of the License, or ! (at your option) any later version. ! ! This program is distributed in the hope that it will be useful, ! but WITHOUT ANY WARRANTY; without even the implied warranty of ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ! GNU General Public License for more details. ! ! You should have received a copy of the GNU General Public License ! along with this program. If not, see <http://www.gnu.org/licenses/>. ! -----------------------------------------------------------------------------** ! !
array of histogram
colors 1 - r, 2 - g1, 4 - g2, 8 - b, 16 - w, 32 - g1+g2
enable requesting histogram calculation for the specified frame (0 - use/wait what available)
Sample from camvc.html http://192.168.0.9/pnghist.cgi?sqrt=1&scale=5&average=5&height=128&fillz=1&linterpz=0&draw=2&colors=41 FIXME: Some bump on low red - what is it?
instead of autoexp_fd
now try to mmap
Now find the index of the most recently available histogram (maybe will wait a little if it is not yet available for the current frame - use previous?)
wait for all histograms, not just Y (G1)
forward and cumulative histograms are needed
disable requesting histogram for the specified frame, rely on the available ones
request histograms for the previous frame
Ignore missing histograms here
cumul_hist_g[255] - total number of pixels for color G1
linear interpolation - also for high digital gains (near black with low gammas)
apply running average (if any)
calculate white if needed
calculate green if needed
now scale data
Definition at line 77 of file sctl.cgi.cpp.
References cmd, header, HEADER_TEXT, HEADER_XML, method, n, parse_string(), query, stream_status(), stream_status_to_file(), streamer_start(), streamer_stop(), and uri.
bool parse_string | ( | const string & | str, | |
char | delimiter, | |||
string & | left, | |||
string & | right | |||
) |
bool run_daemon | ( | string | prog, | |
list< string > | args | |||
) |
Definition at line 141 of file sctl.cgi.cpp.
References a, malloc(), stderr, stdout, and streamer_is_run().
Referenced by streamer_start(), and streamer_stop().
void stop_compressor | ( | void | ) |
Definition at line 241 of file sctl.cgi.cpp.
References CMOSCAM_IOCTYPE, and IO_CCAM_JPEG.
Referenced by streamer_stop().
void stream_status | ( | void | ) |
Definition at line 370 of file sctl.cgi.cpp.
References _STATUS_XML, get_self_ip(), and streamer_is_run().
Referenced by main().
void stream_status_to_file | ( | map< string, string > | opts | ) |
Definition at line 343 of file sctl.cgi.cpp.
References _STATUS_XML, get_self_ip(), and t.
Referenced by main().
bool streamer_is_run | ( | void | ) |
Definition at line 133 of file sctl.cgi.cpp.
References fd, and STREAMER_LOCK.
Referenced by run_daemon(), stream_status(), streamer_start(), and streamer_stop().
bool streamer_start | ( | map< string, string > | ) |
Definition at line 186 of file sctl.cgi.cpp.
References _STR, conf_save(), run_daemon(), streamer_is_run(), and t.
Referenced by main().
bool streamer_stop | ( | void | ) |
Definition at line 247 of file sctl.cgi.cpp.
References _KILLALL, run_daemon(), stop_compressor(), and streamer_is_run().
Referenced by main().