mirror of
https://github.com/Motion-Project/motion.git
synced 2026-01-26 07:38:29 -05:00
Makeking changes according to http://www.lavrsen.dk/twiki/bin/view/Motion/IntuitiveOptionNamesDiscussion ( locate_motion, sql_log_movie , webcontrol_*, despeckle_filter. Add a wrapped #ifdef / #endif for FFMPEG in motion.c
This commit is contained in:
6
alg.c
6
alg.c
@@ -618,11 +618,11 @@ int alg_despeckle(struct context *cnt, int olddiffs)
|
||||
unsigned char *out = cnt->imgs.out;
|
||||
int width = cnt->imgs.width;
|
||||
int height = cnt->imgs.height;
|
||||
int done = 0, i, len = strlen(cnt->conf.despeckle);
|
||||
int done = 0, i, len = strlen(cnt->conf.despeckle_filter);
|
||||
unsigned char *common_buffer = cnt->imgs.common_buffer;
|
||||
|
||||
for (i = 0; i < len; i++) {
|
||||
switch (cnt->conf.despeckle[i]) {
|
||||
switch (cnt->conf.despeckle_filter[i]) {
|
||||
case 'E':
|
||||
if ((diffs = erode9(out, width, height, common_buffer, 0)) == 0) i = len;
|
||||
done = 1;
|
||||
@@ -648,7 +648,7 @@ int alg_despeckle(struct context *cnt, int olddiffs)
|
||||
}
|
||||
}
|
||||
|
||||
/* If conf.despeckle contains any valid action EeDdl */
|
||||
/* If conf.despeckle_filter contains any valid action EeDdl */
|
||||
if (done){
|
||||
if (done != 2) cnt->imgs.labelsize_max = 0; // Disable Labeling
|
||||
return diffs;
|
||||
|
||||
44
conf.c
44
conf.c
@@ -58,7 +58,7 @@ struct config conf_template = {
|
||||
gap: DEF_GAP,
|
||||
maxmpegtime: DEF_MAXMPEGTIME,
|
||||
snapshot_interval: 0,
|
||||
locate: "off",
|
||||
locate_motion: "off",
|
||||
input: IN_DEFAULT,
|
||||
norm: 0,
|
||||
frame_limit: DEF_MAXFRAMERATE,
|
||||
@@ -89,10 +89,10 @@ struct config conf_template = {
|
||||
stream_maxrate: 1,
|
||||
stream_localhost: 1,
|
||||
stream_limit: 0,
|
||||
control_port: 0,
|
||||
control_localhost: 1,
|
||||
control_html_output: 1,
|
||||
control_authentication:NULL,
|
||||
webcontrol_port: 0,
|
||||
webcontrol_localhost: 1,
|
||||
webcontrol_html_output: 1,
|
||||
webcontrol_authentication: NULL,
|
||||
frequency: 0,
|
||||
tuner_number: 0,
|
||||
timelapse: 0,
|
||||
@@ -114,7 +114,7 @@ struct config conf_template = {
|
||||
smart_mask_speed: 0,
|
||||
sql_log_image: 1,
|
||||
sql_log_snapshot: 1,
|
||||
sql_log_mpeg: 0,
|
||||
sql_log_movie: 0,
|
||||
sql_log_timelapse: 0,
|
||||
sql_query: DEF_SQL_QUERY,
|
||||
mysql_db: NULL,
|
||||
@@ -142,7 +142,7 @@ struct config conf_template = {
|
||||
text_right: DEF_TIMESTAMP,
|
||||
text_event: DEF_EVENTSTAMP,
|
||||
text_double: 0,
|
||||
despeckle: NULL,
|
||||
despeckle_filter: NULL,
|
||||
area_detect: NULL,
|
||||
minimum_motion_frames: 1,
|
||||
pid_file: NULL,
|
||||
@@ -470,13 +470,13 @@ config_param config_params[] = {
|
||||
print_bool
|
||||
},
|
||||
{
|
||||
"despeckle",
|
||||
"despeckle_filter",
|
||||
"# Despeckle motion image using (e)rode or (d)ilate or (l)abel (Default: not defined)\n"
|
||||
"# Recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid.\n"
|
||||
"# (l)abeling must only be used once and the 'l' must be the last letter.\n"
|
||||
"# Comment out to disable",
|
||||
0,
|
||||
CONF_OFFSET(despeckle),
|
||||
CONF_OFFSET(despeckle_filter),
|
||||
copy_string,
|
||||
print_string
|
||||
},
|
||||
@@ -719,7 +719,7 @@ config_param config_params[] = {
|
||||
print_int
|
||||
},
|
||||
{
|
||||
"locate",
|
||||
"locate_motion",
|
||||
"\n############################################################\n"
|
||||
"# Text Display\n"
|
||||
"# %Y = year, %m = month, %d = date,\n"
|
||||
@@ -736,7 +736,7 @@ config_param config_params[] = {
|
||||
"# Valid values: on, off and preview (default: off)\n"
|
||||
"# Set to 'preview' will only draw a box in preview_shot pictures.",
|
||||
0,
|
||||
CONF_OFFSET(locate),
|
||||
CONF_OFFSET(locate_motion),
|
||||
copy_string,
|
||||
print_string
|
||||
},
|
||||
@@ -923,38 +923,38 @@ config_param config_params[] = {
|
||||
print_int
|
||||
},
|
||||
{
|
||||
"control_port",
|
||||
"webcontrol_port",
|
||||
"\n############################################################\n"
|
||||
"# HTTP Based Control\n"
|
||||
"############################################################\n\n"
|
||||
"# TCP/IP port for the http server to listen on (default: 0 = disabled)",
|
||||
1,
|
||||
CONF_OFFSET(control_port),
|
||||
CONF_OFFSET(webcontrol_port),
|
||||
copy_int,
|
||||
print_int
|
||||
},
|
||||
{
|
||||
"control_localhost",
|
||||
"webcontrol_localhost",
|
||||
"# Restrict control connections to localhost only (default: on)",
|
||||
1,
|
||||
CONF_OFFSET(control_localhost),
|
||||
CONF_OFFSET(webcontrol_localhost),
|
||||
copy_bool,
|
||||
print_bool
|
||||
},
|
||||
{
|
||||
"control_html_output",
|
||||
"webcontrol_html_output",
|
||||
"# Output for http server, select off to choose raw text plain (default: on)",
|
||||
1,
|
||||
CONF_OFFSET(control_html_output),
|
||||
CONF_OFFSET(webcontrol_html_output),
|
||||
copy_bool,
|
||||
print_bool
|
||||
},
|
||||
{
|
||||
"control_authentication",
|
||||
"webcontrol_authentication",
|
||||
"# Authentication for the http based control. Syntax username:password\n"
|
||||
"# Default: not defined (Disabled)",
|
||||
1,
|
||||
CONF_OFFSET(control_authentication),
|
||||
CONF_OFFSET(webcontrol_authentication),
|
||||
copy_string,
|
||||
print_string
|
||||
},
|
||||
@@ -1195,10 +1195,10 @@ config_param config_params[] = {
|
||||
print_bool
|
||||
},
|
||||
{
|
||||
"sql_log_mpeg",
|
||||
"# Log to the database when creating motion triggered mpeg file (default: off)",
|
||||
"sql_log_movie",
|
||||
"# Log to the database when creating motion triggered movie file (default: off)",
|
||||
0,
|
||||
CONF_OFFSET(sql_log_mpeg),
|
||||
CONF_OFFSET(sql_log_movie),
|
||||
copy_bool,
|
||||
print_bool
|
||||
},
|
||||
|
||||
14
conf.h
14
conf.h
@@ -32,7 +32,7 @@ struct config {
|
||||
int gap;
|
||||
int maxmpegtime;
|
||||
int snapshot_interval;
|
||||
const char *locate;
|
||||
const char *locate_motion;
|
||||
int input;
|
||||
int norm;
|
||||
int frame_limit;
|
||||
@@ -64,10 +64,10 @@ struct config {
|
||||
int stream_maxrate;
|
||||
int stream_localhost;
|
||||
int stream_limit;
|
||||
int control_port;
|
||||
int control_localhost;
|
||||
int control_html_output;
|
||||
const char *control_authentication;
|
||||
int webcontrol_port;
|
||||
int webcontrol_localhost;
|
||||
int webcontrol_html_output;
|
||||
const char *webcontrol_authentication;
|
||||
unsigned long frequency;
|
||||
int tuner_number;
|
||||
int timelapse;
|
||||
@@ -89,7 +89,7 @@ struct config {
|
||||
int smart_mask_speed;
|
||||
int sql_log_image;
|
||||
int sql_log_snapshot;
|
||||
int sql_log_mpeg;
|
||||
int sql_log_movie;
|
||||
int sql_log_timelapse;
|
||||
const char *sql_query;
|
||||
const char *mysql_db;
|
||||
@@ -117,7 +117,7 @@ struct config {
|
||||
const char *text_right;
|
||||
const char *text_event;
|
||||
int text_double;
|
||||
const char *despeckle;
|
||||
const char *despeckle_filter;
|
||||
const char *area_detect;
|
||||
int minimum_motion_frames;
|
||||
char *pid_file;
|
||||
|
||||
18
configure
vendored
18
configure
vendored
@@ -1,6 +1,6 @@
|
||||
#! /bin/sh
|
||||
# Guess values for system-dependent variables and create Makefiles.
|
||||
# Generated by GNU Autoconf 2.61 for motion trunk-r345.
|
||||
# Generated by GNU Autoconf 2.61 for motion trunk-r347.
|
||||
#
|
||||
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
|
||||
@@ -572,8 +572,8 @@ SHELL=${CONFIG_SHELL-/bin/sh}
|
||||
# Identity of this package.
|
||||
PACKAGE_NAME='motion'
|
||||
PACKAGE_TARNAME='motion'
|
||||
PACKAGE_VERSION='trunk-r345'
|
||||
PACKAGE_STRING='motion trunk-r345'
|
||||
PACKAGE_VERSION='trunk-r347'
|
||||
PACKAGE_STRING='motion trunk-r347'
|
||||
PACKAGE_BUGREPORT=''
|
||||
|
||||
ac_unique_file="motion.c"
|
||||
@@ -1178,7 +1178,7 @@ if test "$ac_init_help" = "long"; then
|
||||
# Omit some internal or obsolete options to make the list less imposing.
|
||||
# This message is too long to be a string in the A/UX 3.1 sh.
|
||||
cat <<_ACEOF
|
||||
\`configure' configures motion trunk-r345 to adapt to many kinds of systems.
|
||||
\`configure' configures motion trunk-r347 to adapt to many kinds of systems.
|
||||
|
||||
Usage: $0 [OPTION]... [VAR=VALUE]...
|
||||
|
||||
@@ -1239,7 +1239,7 @@ fi
|
||||
|
||||
if test -n "$ac_init_help"; then
|
||||
case $ac_init_help in
|
||||
short | recursive ) echo "Configuration of motion trunk-r345:";;
|
||||
short | recursive ) echo "Configuration of motion trunk-r347:";;
|
||||
esac
|
||||
cat <<\_ACEOF
|
||||
|
||||
@@ -1375,7 +1375,7 @@ fi
|
||||
test -n "$ac_init_help" && exit $ac_status
|
||||
if $ac_init_version; then
|
||||
cat <<\_ACEOF
|
||||
motion configure trunk-r345
|
||||
motion configure trunk-r347
|
||||
generated by GNU Autoconf 2.61
|
||||
|
||||
Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
|
||||
@@ -1389,7 +1389,7 @@ cat >config.log <<_ACEOF
|
||||
This file contains any messages produced by compilers while
|
||||
running configure, to aid debugging if configure makes a mistake.
|
||||
|
||||
It was created by motion $as_me trunk-r345, which was
|
||||
It was created by motion $as_me trunk-r347, which was
|
||||
generated by GNU Autoconf 2.61. Invocation command line was
|
||||
|
||||
$ $0 $@
|
||||
@@ -7540,7 +7540,7 @@ exec 6>&1
|
||||
# report actual input values of CONFIG_FILES etc. instead of their
|
||||
# values after options handling.
|
||||
ac_log="
|
||||
This file was extended by motion $as_me trunk-r345, which was
|
||||
This file was extended by motion $as_me trunk-r347, which was
|
||||
generated by GNU Autoconf 2.61. Invocation command line was
|
||||
|
||||
CONFIG_FILES = $CONFIG_FILES
|
||||
@@ -7589,7 +7589,7 @@ Report bugs to <bug-autoconf@gnu.org>."
|
||||
_ACEOF
|
||||
cat >>$CONFIG_STATUS <<_ACEOF
|
||||
ac_cs_version="\\
|
||||
motion config.status trunk-r345
|
||||
motion config.status trunk-r347
|
||||
configured by $0, generated by GNU Autoconf 2.61,
|
||||
with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
|
||||
|
||||
|
||||
@@ -162,7 +162,7 @@ noise_tune on
|
||||
# Recommended value is EedDl. Any combination (and number of) of E, e, d, and D is valid.
|
||||
# (l)abeling must only be used once and the 'l' must be the last letter.
|
||||
# Comment out to disable
|
||||
despeckle EedDl
|
||||
despeckle_filter EedDl
|
||||
|
||||
# Detect motion in predefined areas (1 - 9). Areas are numbered like that: 1 2 3
|
||||
# A script (on_area_detected) is started immediately when motion is 4 5 6
|
||||
@@ -308,7 +308,7 @@ snapshot_interval 0
|
||||
# Locate and draw a box around the moving object.
|
||||
# Valid values: on, off and preview (default: off)
|
||||
# Set to 'preview' will only draw a box in preview_shot pictures.
|
||||
locate off
|
||||
locate_motion off
|
||||
|
||||
# Draws the timestamp using same options as C function strftime(3)
|
||||
# Default: %Y-%m-%d\n%T = date in ISO format and time in 24 hour clock
|
||||
@@ -420,17 +420,17 @@ stream_limit 0
|
||||
############################################################
|
||||
|
||||
# TCP/IP port for the http server to listen on (default: 0 = disabled)
|
||||
control_port 8080
|
||||
webcontrol_port 8080
|
||||
|
||||
# Restrict control connections to localhost only (default: on)
|
||||
control_localhost on
|
||||
webcontrol_localhost on
|
||||
|
||||
# Output for http server, select off to choose raw text plain (default: on)
|
||||
control_html_output on
|
||||
webcontrol_html_output on
|
||||
|
||||
# Authentication for the http based control. Syntax username:password
|
||||
# Default: not defined (Disabled)
|
||||
; control_authentication username:password
|
||||
; webcontrol_authentication username:password
|
||||
|
||||
|
||||
############################################################
|
||||
@@ -549,8 +549,8 @@ sql_log_image on
|
||||
# Log to the database when creating a snapshot image file (default: on)
|
||||
sql_log_snapshot on
|
||||
|
||||
# Log to the database when creating motion triggered mpeg file (default: off)
|
||||
sql_log_mpeg off
|
||||
# Log to the database when creating motion triggered movie file (default: off)
|
||||
sql_log_movie off
|
||||
|
||||
# Log to the database when creating timelapse mpeg file (default: off)
|
||||
sql_log_timelapse off
|
||||
|
||||
26
motion.1
26
motion.1
@@ -55,32 +55,32 @@ Values: 0 - 255 / Default: 0 (disabled)
|
||||
.br
|
||||
The contrast level for the video device.
|
||||
.TP
|
||||
.B control_authentication string
|
||||
.B webcontrol_authentication string
|
||||
Values: Max 4096 characters / Default: Not defined
|
||||
.br
|
||||
To protect HTTP Control by username and password, use this option for HTTP 1.1 Basic authentication. The string is specified as username:password. Do not specify this option for no authentication. This option must be placed in motion.conf and not in a thread config file.
|
||||
.TP
|
||||
.B control_html_output boolean
|
||||
.B webcontrol_html_output boolean
|
||||
Values: on, off / Default: on
|
||||
.br
|
||||
Enable HTML in the answer sent back to a browser connecting to the control_port. This option must be placed in motion.conf and not in a thread config file.
|
||||
Enable HTML in the answer sent back to a browser connecting to the webcontrol_port. This option must be placed in motion.conf and not in a thread config file.
|
||||
.TP
|
||||
.B control_localhost boolean
|
||||
.B webcontrol_localhost boolean
|
||||
Values: on, off / Default: on
|
||||
.br
|
||||
Limits the http (html) control to the localhost. This option must be placed in motion.conf and not in a thread config file.
|
||||
Limits the webcontrol to the localhost. This option must be placed in motion.conf and not in a thread config file.
|
||||
.TP
|
||||
.B control_port integer
|
||||
.B webcontrol_port integer
|
||||
Values: 0 - 65535 / Default: 0 (disabled)
|
||||
.br
|
||||
Sets the port number for the http (html using browser) based remote control. This option must be placed in motion.conf and not in a thread config file.
|
||||
Sets the port number for the http (html using browser) based remote webcontrol. This option must be placed in motion.conf and not in a thread config file.
|
||||
.TP
|
||||
.B daemon boolean
|
||||
Values: on, off / Default: off
|
||||
.br
|
||||
Start in daemon (background) mode and release terminal. This option must be placed in motion.conf and not in a thread config file.
|
||||
.TP
|
||||
.B despeckle string
|
||||
.B despeckle_filter string
|
||||
Values: EedDl / Default: Not defined
|
||||
.br
|
||||
Despeckle motion image using combinations of (E/e)rode or (D/d)ilate. And ending with optional (l)abeling.
|
||||
@@ -165,7 +165,7 @@ Values: 0 - 100 / Default: 0 (disabled)
|
||||
.br
|
||||
Ignore sudden massive light intensity changes given as a percentage of the picture area that changed intensity.
|
||||
.TP
|
||||
.B locate boolean
|
||||
.B locate_motion boolean
|
||||
Values: on, off, preview / Default: off
|
||||
.br
|
||||
Locate and draw a box around the moving object. Value 'preview' makes Motion only draw a box on a saved preview jpeg image and not on the saved mpeg movie.
|
||||
@@ -410,7 +410,7 @@ Values: on, off / Default: on
|
||||
.br
|
||||
Log to the database when creating motion triggered image file.
|
||||
.TP
|
||||
.B sql_log_mpeg boolean
|
||||
.B sql_log_movie boolean
|
||||
Values: on, off / Default: off
|
||||
.br
|
||||
Log to the database when creating motion triggered mpeg file.
|
||||
@@ -670,7 +670,7 @@ So always call the thread config files in the end of the motion.conf file. If yo
|
||||
.br
|
||||
If motion is built without specific features such as ffmpeg, mysql etc it will ignore the options that belongs to these features. You do not have to remove them or comment them out.
|
||||
.br
|
||||
If you run the http control command http://host:port/0/config/writeyes, motion will overwrite motion.conf and all the thread.conf files by autogenerated config files neatly formatted and only with the features included that Motion was built with. If you later re-build Motion with more features or upgrade to a new version, you can use your old config files, run the motion.conf.write command, and you will have new config files with the new options included all set to their default values. This makes upgrading very easy to do.
|
||||
If you run the webcontrol command http://host:port/0/config/writeyes, motion will overwrite motion.conf and all the thread.conf files by autogenerated config files neatly formatted and only with the features included that Motion was built with. If you later re-build Motion with more features or upgrade to a new version, you can use your old config files, run the motion.conf.write command, and you will have new config files with the new options included all set to their default values. This makes upgrading very easy to do.
|
||||
.TP
|
||||
.B Conversion Specifiers for Advanced Filename and Text Features
|
||||
The table below shows all the supported Conversion Specifiers you can use in the options text_left, text_right, snapshot_filename, jpeg_filename, ffmpeg_filename, timelapse_filename, on_area_detected, on_camera_lost, on_event_start, on_event_end, on_picture_save, on_movie_start, on_movie_end, and on_motion_detected.
|
||||
@@ -715,7 +715,7 @@ Equivalent to %Y-%m-%d (the ISO 8601 date format).
|
||||
The hour as a decimal number using a 24-hour clock (range 00 to 23).
|
||||
.TP
|
||||
.B %i
|
||||
Width of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate is on).
|
||||
Width of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate_motion is on).
|
||||
.TP
|
||||
.B %I
|
||||
The hour as a decimal number using a 12-hour clock (range 01 to 12).
|
||||
@@ -724,7 +724,7 @@ The hour as a decimal number using a 12-hour clock (range 01 to 12).
|
||||
The day of the year as a decimal number (range 001 to 366).
|
||||
.TP
|
||||
.B %J
|
||||
Height of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate is on).
|
||||
Height of the rectangle containing the motion pixels (the rectangle that is shown on the image when locate_motion is on).
|
||||
.TP
|
||||
.B %k
|
||||
The hour (24-hour clock) as a decimal number (range 0 to 23); single digits are preceded by a blank. (See also %H.)
|
||||
|
||||
36
motion.c
36
motion.c
@@ -199,7 +199,7 @@ static void image_save_as_preview(struct context *cnt, struct image_data *img)
|
||||
cnt->imgs.preview_image.diffs = 1;
|
||||
|
||||
/* If we have locate on it is already done */
|
||||
if (cnt->locate == LOCATE_PREVIEW) {
|
||||
if (cnt->locate_motion == LOCATE_PREVIEW) {
|
||||
alg_draw_location(&img->location, &cnt->imgs, cnt->imgs.width, cnt->imgs.preview_image.image, LOCATE_NORMAL);
|
||||
}
|
||||
}
|
||||
@@ -381,7 +381,7 @@ static void motion_detected(struct context *cnt, int dev, struct image_data *img
|
||||
struct coord *location = &img->location;
|
||||
|
||||
/* Draw location */
|
||||
if (cnt->locate == LOCATE_ON)
|
||||
if (cnt->locate_motion == LOCATE_ON)
|
||||
alg_draw_location(location, imgs, imgs->width, img->image, LOCATE_BOTH);
|
||||
|
||||
/* Calculate how centric motion is if configured preview center*/
|
||||
@@ -506,6 +506,7 @@ static void process_image_ring(struct context *cnt, unsigned int max_images)
|
||||
cnt->imgs.image_ring[cnt->imgs.image_ring_out].image, NULL, NULL,
|
||||
&cnt->imgs.image_ring[cnt->imgs.image_ring_out].timestamp_tm);
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
/* Check if we must add any "filler" frames into movie to keep up fps */
|
||||
if (cnt->imgs.image_ring[cnt->imgs.image_ring_out].shot == 0) {
|
||||
/* movie_last_shoot is -1 when file is created,
|
||||
@@ -540,6 +541,7 @@ static void process_image_ring(struct context *cnt, unsigned int max_images)
|
||||
* only when we not are within first sec */
|
||||
if (cnt->movie_last_shot >= 0)
|
||||
cnt->movie_last_shot = cnt->imgs.image_ring[cnt->imgs.image_ring_out].shot;
|
||||
#endif
|
||||
}
|
||||
|
||||
/* Mark the image as saved */
|
||||
@@ -767,7 +769,7 @@ static int motion_init(struct context *cnt)
|
||||
|
||||
cnt->sql_mask = cnt->conf.sql_log_image * (FTYPE_IMAGE + FTYPE_IMAGE_MOTION) +
|
||||
cnt->conf.sql_log_snapshot * FTYPE_IMAGE_SNAPSHOT +
|
||||
cnt->conf.sql_log_mpeg * (FTYPE_MPEG + FTYPE_MPEG_MOTION) +
|
||||
cnt->conf.sql_log_movie * (FTYPE_MPEG + FTYPE_MPEG_MOTION) +
|
||||
cnt->conf.sql_log_timelapse * FTYPE_MPEG_TIMELAPSE;
|
||||
#endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) */
|
||||
|
||||
@@ -1318,7 +1320,7 @@ static void *motion_loop(void *arg)
|
||||
}
|
||||
|
||||
/* Despeckle feature
|
||||
* First we run (as given by the despeckle option iterations
|
||||
* First we run (as given by the despeckle_filter option iterations
|
||||
* of erode and dilate algorithms.
|
||||
* Finally we run the labelling feature.
|
||||
* All this is done in the alg_despeckle code.
|
||||
@@ -1326,7 +1328,7 @@ static void *motion_loop(void *arg)
|
||||
cnt->current_image->total_labels = 0;
|
||||
cnt->imgs.largest_label = 0;
|
||||
olddiffs = 0;
|
||||
if (cnt->conf.despeckle && cnt->current_image->diffs > 0) {
|
||||
if (cnt->conf.despeckle_filter && cnt->current_image->diffs > 0) {
|
||||
olddiffs = cnt->current_image->diffs;
|
||||
cnt->current_image->diffs = alg_despeckle(cnt, olddiffs);
|
||||
}else if (cnt->imgs.labelsize_max)
|
||||
@@ -1639,11 +1641,11 @@ static void *motion_loop(void *arg)
|
||||
char msg[1024] = "\0";
|
||||
char part[100];
|
||||
|
||||
if (cnt->conf.despeckle) {
|
||||
if (cnt->conf.despeckle_filter) {
|
||||
snprintf(part, 99, "Raw changes: %5d - changes after '%s': %5d",
|
||||
olddiffs, cnt->conf.despeckle, cnt->current_image->diffs);
|
||||
olddiffs, cnt->conf.despeckle_filter, cnt->current_image->diffs);
|
||||
strcat(msg, part);
|
||||
if (strchr(cnt->conf.despeckle, 'l')){
|
||||
if (strchr(cnt->conf.despeckle_filter, 'l')){
|
||||
sprintf(part, " - labels: %3d", cnt->current_image->total_labels);
|
||||
strcat(msg, part);
|
||||
}
|
||||
@@ -1690,8 +1692,6 @@ static void *motion_loop(void *arg)
|
||||
|
||||
#ifdef HAVE_FFMPEG
|
||||
|
||||
|
||||
|
||||
if (cnt->conf.timelapse) {
|
||||
|
||||
/* Check to see if we should start a new timelapse file. We start one when
|
||||
@@ -1802,12 +1802,12 @@ static void *motion_loop(void *arg)
|
||||
else
|
||||
cnt->new_img = NEWIMG_OFF;
|
||||
|
||||
if (strcasecmp(cnt->conf.locate, "on") == 0)
|
||||
cnt->locate = LOCATE_ON;
|
||||
else if (strcasecmp(cnt->conf.locate, "preview") == 0)
|
||||
cnt->locate = LOCATE_PREVIEW;
|
||||
if (strcasecmp(cnt->conf.locate_motion, "on") == 0)
|
||||
cnt->locate_motion = LOCATE_ON;
|
||||
else if (strcasecmp(cnt->conf.locate_motion, "preview") == 0)
|
||||
cnt->locate_motion = LOCATE_PREVIEW;
|
||||
else
|
||||
cnt->locate = LOCATE_OFF;
|
||||
cnt->locate_motion = LOCATE_OFF;
|
||||
|
||||
/* Sanity check for smart_mask_speed, silly value disables smart mask */
|
||||
if (cnt->conf.smart_mask_speed < 0 || cnt->conf.smart_mask_speed > 10)
|
||||
@@ -1832,7 +1832,7 @@ static void *motion_loop(void *arg)
|
||||
*/
|
||||
cnt->sql_mask = cnt->conf.sql_log_image * (FTYPE_IMAGE + FTYPE_IMAGE_MOTION) +
|
||||
cnt->conf.sql_log_snapshot * FTYPE_IMAGE_SNAPSHOT +
|
||||
cnt->conf.sql_log_mpeg * (FTYPE_MPEG + FTYPE_MPEG_MOTION) +
|
||||
cnt->conf.sql_log_movie * (FTYPE_MPEG + FTYPE_MPEG_MOTION) +
|
||||
cnt->conf.sql_log_timelapse * FTYPE_MPEG_TIMELAPSE;
|
||||
#endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) */
|
||||
|
||||
@@ -2185,7 +2185,7 @@ static void start_motion_thread(struct context *cnt, pthread_attr_t *thread_attr
|
||||
|
||||
if (cnt->conf.stream_port != 0) {
|
||||
/* Compare against the control port. */
|
||||
if (cnt_list[0]->conf.control_port == cnt->conf.stream_port) {
|
||||
if (cnt_list[0]->conf.webcontrol_port == cnt->conf.stream_port) {
|
||||
motion_log(LOG_ERR, 0,
|
||||
"Stream port number %d for thread %d conflicts with the control port",
|
||||
cnt->conf.stream_port, cnt->threadnr);
|
||||
@@ -2324,7 +2324,7 @@ int main (int argc, char **argv)
|
||||
/* Create a thread for the control interface if requested. Create it
|
||||
* detached and with 'motion_web_control' as the thread function.
|
||||
*/
|
||||
if (cnt_list[0]->conf.control_port)
|
||||
if (cnt_list[0]->conf.webcontrol_port)
|
||||
pthread_create(&thread_id, &thread_attr, &motion_web_control, cnt_list);
|
||||
|
||||
if (cnt_list[0]->conf.setup_mode)
|
||||
|
||||
4
motion.h
4
motion.h
@@ -18,7 +18,6 @@
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#define __USE_GNU
|
||||
#include <string.h>
|
||||
@@ -26,7 +25,6 @@
|
||||
#include <fcntl.h>
|
||||
#include <time.h>
|
||||
#include <signal.h>
|
||||
#include <syslog.h>
|
||||
#include <limits.h>
|
||||
#include <errno.h>
|
||||
#include <sys/time.h>
|
||||
@@ -314,7 +312,7 @@ struct context {
|
||||
struct image_data *current_image; /* Pointer to a structure where the image, diffs etc is stored */
|
||||
unsigned short int new_img;
|
||||
|
||||
int locate;
|
||||
int locate_motion;
|
||||
struct rotdata rotate_data; /* rotation data is thread-specific */
|
||||
|
||||
int noise;
|
||||
|
||||
208
webhttpd.c
208
webhttpd.c
@@ -358,7 +358,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
const char *value = NULL;
|
||||
char *retval = NULL;
|
||||
/*call list*/
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/config><– back</a><br><br>\n<b>Thread %hu</b>\n<ul>", thread, thread);
|
||||
send_template(client_socket, res);
|
||||
@@ -447,7 +447,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -486,7 +486,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
/* FIXME need to assure that is a valid value */
|
||||
url_decode(Value, strlen(Value));
|
||||
conf_cmdparse(cnt + thread, config_params[i].param_name, Value);
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res,
|
||||
"<a href=/%hu/config/list><– back</a>"
|
||||
"<br><br>\n<b>Thread %hu</b>\n"
|
||||
@@ -505,7 +505,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_valid_syntax, NULL);
|
||||
else
|
||||
response_client(client_socket, not_valid_syntax_raw, NULL);
|
||||
@@ -536,7 +536,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
type = strdup("unknown");
|
||||
}
|
||||
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res,
|
||||
"<a href=/%hu/config/list><– back</a><br><br>\n"
|
||||
"<b>Thread %hu</b>\n<ul><li><a href=/%hu/config/set?%s>%s</a>"
|
||||
@@ -556,14 +556,14 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
}
|
||||
} else {
|
||||
/* Show param_name dialogue only for html output */
|
||||
if ( (cnt[0]->conf.control_html_output) && (command[0] != '\0') &&
|
||||
if ( (cnt[0]->conf.webcontrol_html_output) && (command[0] != '\0') &&
|
||||
(((length_uri = length_uri - strlen(command)) == 0 )) ) {
|
||||
i=0;
|
||||
while (config_params[i].param_name != NULL) {
|
||||
@@ -639,20 +639,20 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
send_template_end_client(client_socket);
|
||||
free(text_help);
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
}
|
||||
}
|
||||
} else if (length_uri == 0) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, set_template);
|
||||
sprintf(res, "<a href=/%hu/config><– back</a><br><br>\n<b>Thread %hu</b>\n"
|
||||
"<form name='n'>\n<select name='onames'>\n", thread, thread );
|
||||
@@ -680,7 +680,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -724,7 +724,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
type = config_type(&config_params[i]);
|
||||
if (!strcmp(type, "unknown")) {
|
||||
/*error doesn't exists this param_name */
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -744,7 +744,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
|
||||
if (value == NULL)
|
||||
value = config_params[i].print(cnt, NULL, i, 0);
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/config/get><– back</a><br><br>\n"
|
||||
"<b>Thread %hu</b><br>\n<ul><li>%s = %s "
|
||||
@@ -765,21 +765,21 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
}
|
||||
}
|
||||
} else if (length_uri == 0) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/config><– back</a><br><br>\n<b>Thread %hu</b><br>\n"
|
||||
"<form action=get>\n"
|
||||
@@ -804,7 +804,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_valid_syntax, NULL);
|
||||
else
|
||||
response_client(client_socket, not_valid_syntax_raw, NULL);
|
||||
@@ -813,7 +813,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
pointer = pointer + 5;
|
||||
length_uri = length_uri - 5;
|
||||
if (length_uri == 0) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/config><– back</a><br><br>"
|
||||
"Are you sure? <a href=/%hu/config/writeyes>Yes</a>\n", thread, thread);
|
||||
@@ -827,7 +827,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -838,7 +838,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
length_uri = length_uri - 8;
|
||||
if (length_uri == 0) {
|
||||
conf_print(cnt);
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/config><– back</a><br><br>\n<b>Thread %hu</b> write done !\n",
|
||||
thread, thread);
|
||||
@@ -851,7 +851,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
}
|
||||
else
|
||||
@@ -859,7 +859,7 @@ static unsigned short int config(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -898,7 +898,7 @@ static unsigned short int action(char *pointer, char *res, unsigned short int le
|
||||
cnt[thread]->makemovie = 1;
|
||||
}
|
||||
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/action><– back</a><br><br>\n"
|
||||
"makemovie for thread %hu done<br>\n", thread, thread);
|
||||
@@ -911,7 +911,7 @@ static unsigned short int action(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -930,7 +930,7 @@ static unsigned short int action(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
|
||||
cnt[thread]->snapshot = 1;
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/action><– back</a><br><br>\n"
|
||||
"snapshot for thread %hu done<br>\n", thread, thread);
|
||||
@@ -943,7 +943,7 @@ static unsigned short int action(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -957,7 +957,7 @@ static unsigned short int action(char *pointer, char *res, unsigned short int le
|
||||
if (thread == 0) {
|
||||
motion_log(LOG_DEBUG, 0, "httpd restart");
|
||||
kill(getpid(),SIGHUP);
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "restart in progress ... bye<br>\n<a href='/'>Home</a>");
|
||||
send_template(client_socket, res);
|
||||
@@ -975,7 +975,7 @@ static unsigned short int action(char *pointer, char *res, unsigned short int le
|
||||
cnt[thread]->finish = 1;
|
||||
}
|
||||
cnt[thread]->restart = 1;
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/action><– back</a><br><br>\n"
|
||||
"restart for thread %hu done<br>\n", thread, thread);
|
||||
@@ -988,7 +988,7 @@ static unsigned short int action(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -1002,7 +1002,7 @@ static unsigned short int action(char *pointer, char *res, unsigned short int le
|
||||
if (thread == 0) {
|
||||
motion_log(LOG_DEBUG, 0, "httpd quit");
|
||||
kill(getpid(),SIGQUIT);
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "quit in progress ... bye");
|
||||
send_template(client_socket, res);
|
||||
@@ -1019,7 +1019,7 @@ static unsigned short int action(char *pointer, char *res, unsigned short int le
|
||||
cnt[thread]->makemovie = 1;
|
||||
cnt[thread]->finish = 1;
|
||||
cnt[thread]->watchdog = WATCHDOG_OFF;
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/action><– back</a><br><br>\n"
|
||||
"quit for thread %hu done<br>\n", thread, thread);
|
||||
@@ -1033,13 +1033,13 @@ static unsigned short int action(char *pointer, char *res, unsigned short int le
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -1068,7 +1068,7 @@ static unsigned short int detection(char *pointer, char *res, unsigned short int
|
||||
if (length_uri == 0) {
|
||||
/*call status*/
|
||||
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/detection><– back</a><br><br><b>Thread %hu</b>"
|
||||
" Detection status %s\n", thread, thread,
|
||||
@@ -1083,7 +1083,7 @@ static unsigned short int detection(char *pointer, char *res, unsigned short int
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -1102,7 +1102,7 @@ static unsigned short int detection(char *pointer, char *res, unsigned short int
|
||||
cnt[thread]->pause = 0;
|
||||
}
|
||||
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/detection><– back</a><br><br>\n<b>Thread %hu</b>"
|
||||
" Detection resumed\n", thread, thread);
|
||||
@@ -1115,7 +1115,7 @@ static unsigned short int detection(char *pointer, char *res, unsigned short int
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -1134,7 +1134,7 @@ static unsigned short int detection(char *pointer, char *res, unsigned short int
|
||||
cnt[thread]->pause = 1;
|
||||
}
|
||||
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/detection><– back</a><br><br>\n<b>Thread %hu</b>"
|
||||
" Detection paused\n", thread, thread);
|
||||
@@ -1147,7 +1147,7 @@ static unsigned short int detection(char *pointer, char *res, unsigned short int
|
||||
}
|
||||
} else {
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -1158,7 +1158,7 @@ static unsigned short int detection(char *pointer, char *res, unsigned short int
|
||||
if (length_uri == 0) {
|
||||
|
||||
/*call connection*/
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/detection><– back</a><br><br>\n", thread);
|
||||
send_template(client_socket, res);
|
||||
@@ -1195,13 +1195,13 @@ static unsigned short int detection(char *pointer, char *res, unsigned short int
|
||||
}
|
||||
}else{
|
||||
/*error*/
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -1249,7 +1249,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
if (( question != '=' ) || (command[0] == '\0')) {
|
||||
/* no valid syntax */
|
||||
motion_log(LOG_WARNING, 0, "httpd debug race 1");
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_valid_syntax, NULL);
|
||||
else
|
||||
response_client(client_socket, not_valid_syntax_raw, NULL);
|
||||
@@ -1299,7 +1299,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
} else {
|
||||
/* no valid syntax */
|
||||
motion_log(LOG_WARNING, 0, "httpd debug race 2");
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_valid_syntax, NULL);
|
||||
else
|
||||
response_client(client_socket, not_valid_syntax_raw, NULL);
|
||||
@@ -1311,7 +1311,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
if ( !warningkill ) {
|
||||
motion_log(LOG_WARNING, 0, "httpd debug race 3");
|
||||
/* error value */
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, error_value, NULL);
|
||||
else
|
||||
response_client(client_socket, error_value_raw, NULL);
|
||||
@@ -1334,7 +1334,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
// Add the number of frame to skip for motion detection
|
||||
cnt[thread]->moved = track_move(pancnt, pancnt->video_dev, ¢, &pancnt->imgs, 1);
|
||||
if (cnt[thread]->moved) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b><br>\n"
|
||||
@@ -1349,7 +1349,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
}
|
||||
} else {
|
||||
/*error in track action*/
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b>\n", thread, thread);
|
||||
response_client(client_socket, track_error, res);
|
||||
@@ -1371,7 +1371,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
// Add the number of frame to skip for motion detection
|
||||
cnt[thread]->moved = track_move(tiltcnt, tiltcnt->video_dev, ¢, &tiltcnt->imgs, 1);
|
||||
if (cnt[thread]->moved) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b><br>\n"
|
||||
@@ -1386,7 +1386,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
}
|
||||
} else {
|
||||
/*error in track action*/
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b>\n", thread, thread);
|
||||
response_client(client_socket, track_error, res);
|
||||
@@ -1400,7 +1400,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
// 1000 is out of range for pwc
|
||||
cnt[thread]->moved = track_center(setcnt, setcnt->video_dev, 1, atoi(x_value), 1000);
|
||||
if (cnt[thread]->moved) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b><br>\n"
|
||||
@@ -1415,7 +1415,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
}
|
||||
} else {
|
||||
/*error in track action*/
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b>\n", thread, thread);
|
||||
response_client(client_socket, track_error, res);
|
||||
@@ -1430,7 +1430,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
// 1000 is out of range for pwc
|
||||
cnt[thread]->moved = track_center(setcnt, setcnt->video_dev, 1, 1000, atoi(y_value));
|
||||
if (cnt[thread]->moved) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b><br>\n"
|
||||
@@ -1445,7 +1445,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
}
|
||||
} else {
|
||||
/*error in track action*/
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b>\n", thread, thread);
|
||||
response_client(client_socket, track_error, res);
|
||||
@@ -1464,14 +1464,14 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
if ( ( question != '&' ) || (command[0] == '\0') ) {
|
||||
motion_log(LOG_WARNING, 0, "httpd debug race 4");
|
||||
if ( strstr(pointer, "&")) {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, error_value, NULL);
|
||||
else
|
||||
response_client(client_socket, error_value_raw, NULL);
|
||||
}
|
||||
/* no valid syntax */
|
||||
else{
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_valid_syntax, NULL);
|
||||
else
|
||||
response_client(client_socket, not_valid_syntax_raw, NULL);
|
||||
@@ -1488,7 +1488,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
if ( (pan) || (!tilt) || (X) || (Y) ) {
|
||||
motion_log(LOG_WARNING, 0, "httpd debug race 5");
|
||||
/* no valid syntax */
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_valid_syntax, NULL);
|
||||
else
|
||||
response_client(client_socket, not_valid_syntax_raw, NULL);
|
||||
@@ -1503,7 +1503,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
if ( (tilt) || (!pan) || (X) || (Y) ) {
|
||||
/* no valid syntax */
|
||||
motion_log(LOG_WARNING, 0, "httpd debug race 6");
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_valid_syntax, NULL);
|
||||
else
|
||||
response_client(client_socket, not_valid_syntax_raw, NULL);
|
||||
@@ -1519,7 +1519,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
motion_log(LOG_WARNING, 0, "httpd debug race 7");
|
||||
|
||||
/* no valid syntax */
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_valid_syntax, NULL);
|
||||
else
|
||||
response_client(client_socket, not_valid_syntax_raw, NULL);
|
||||
@@ -1534,7 +1534,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
if ( (Y) || (!X) || (pan) || (tilt) ) {
|
||||
motion_log(LOG_WARNING, 0, "httpd debug race 8");
|
||||
/* no valid syntax */
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_valid_syntax, NULL);
|
||||
else
|
||||
response_client(client_socket, not_valid_syntax_raw, NULL);
|
||||
@@ -1545,7 +1545,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
} else {
|
||||
motion_log(LOG_WARNING, 0, "httpd debug race 9");
|
||||
/* no valid syntax */
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_valid_syntax, NULL);
|
||||
else
|
||||
response_client(client_socket, not_valid_syntax_raw, NULL);
|
||||
@@ -1557,14 +1557,14 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
if ( ( warningkill < 2 ) && (question != '=') ) {
|
||||
motion_log(LOG_WARNING, 0, "httpd debug race 10");
|
||||
/* no valid syntax */
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_valid_syntax, NULL);
|
||||
else
|
||||
response_client(client_socket, not_valid_syntax_raw, NULL);
|
||||
return 1;
|
||||
}else if (( question == '=') && ( warningkill == 1)) {
|
||||
motion_log(LOG_WARNING, 0, "httpd debug race 11");
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, error_value, NULL);
|
||||
else
|
||||
response_client(client_socket, error_value_raw, NULL);
|
||||
@@ -1593,7 +1593,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
|
||||
if (length_uri != 0) {
|
||||
motion_log(LOG_WARNING, 0, "httpd debug race 12");
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, error_value, NULL);
|
||||
else
|
||||
response_client(client_socket, error_value_raw, NULL);
|
||||
@@ -1607,7 +1607,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
setcnt = cnt[thread];
|
||||
cnt[thread]->moved = track_center(setcnt, setcnt->video_dev, 1, atoi(x_value), atoi(y_value));
|
||||
if (cnt[thread]->moved) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b><br>\n"
|
||||
@@ -1622,7 +1622,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
}
|
||||
} else {
|
||||
/*error in track action*/
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b>\n", thread, thread);
|
||||
response_client(client_socket, track_error, res);
|
||||
@@ -1654,7 +1654,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
SLEEP(1,0);
|
||||
cnt[thread]->moved = track_move(relativecnt, relativecnt->video_dev, ¢, &relativecnt->imgs, 1);
|
||||
if (cnt[thread]->moved) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b><br>\n"
|
||||
@@ -1671,7 +1671,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
}
|
||||
else{
|
||||
/*error in track tilt*/
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b>\n", thread, thread);
|
||||
response_client(client_socket, track_error, res);
|
||||
@@ -1680,7 +1680,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
}
|
||||
|
||||
/*error in track pan*/
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br><b>Thread %hu</b>\n",
|
||||
thread, thread);
|
||||
response_client(client_socket, track_error, res);
|
||||
@@ -1688,7 +1688,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
response_client(client_socket, track_error_raw, NULL);
|
||||
}
|
||||
} else if (length_uri == 0) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>\n<b>Thread %hu</b><br>\n"
|
||||
"<form action='set'>\n"
|
||||
@@ -1710,7 +1710,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
}
|
||||
} else {
|
||||
/* error not valid command */
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -1719,7 +1719,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
pointer = pointer+6;
|
||||
length_uri = length_uri-6;
|
||||
if (length_uri==0) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>\n<b>Thread %hu</b>"
|
||||
"<br>track auto %s", thread, thread,
|
||||
@@ -1734,7 +1734,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
}
|
||||
} else {
|
||||
/* error not valid command */
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
}
|
||||
else
|
||||
@@ -1760,7 +1760,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
/* auto value=0|1|status*/
|
||||
|
||||
if (!strcmp(command, "status")) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b><br>"
|
||||
@@ -1781,7 +1781,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
if (active > -1 && active < 2) {
|
||||
autocnt = cnt[thread];
|
||||
autocnt->track.active = active;
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
"<b>Thread %hu</b>"
|
||||
@@ -1795,20 +1795,20 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
send_template_raw(client_socket, res);
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -1816,7 +1816,7 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
}
|
||||
else if (length_uri == 0) {
|
||||
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>\n<b>Thread %hu</b>\n"
|
||||
"<form action='auto'><select name='value'>\n"
|
||||
@@ -1833,13 +1833,13 @@ static unsigned short int track(char *pointer, char *res, unsigned short int len
|
||||
send_template_raw(client_socket, res);
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -1871,7 +1871,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
/* ROOT_URI -> GET / */
|
||||
if (! (strcmp (url, "/")) ) {
|
||||
unsigned short int y;
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<b>Motion "VERSION" Running [%hu] Threads</b><br>\n"
|
||||
"<a href='/0/'>All</a><br>\n", i);
|
||||
@@ -1927,7 +1927,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
pointer = pointer + 6;
|
||||
length_uri = length_uri - 6;
|
||||
if (length_uri == 0) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hd/><– back</a><br><br>\n"
|
||||
"<b>Thread %hd</b><br>\n"
|
||||
@@ -1949,7 +1949,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
length_uri--;
|
||||
config(pointer, res, length_uri, thread, client_socket, cnt);
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -1961,7 +1961,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
length_uri = length_uri - 6;
|
||||
/* call action() */
|
||||
if (length_uri == 0) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hd/><– back</a><br><br>\n"
|
||||
"<b>Thread %hd</b><br>\n"
|
||||
@@ -1986,7 +1986,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
return ret;
|
||||
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command,NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw,NULL);
|
||||
@@ -1997,7 +1997,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
pointer = pointer + 9;
|
||||
length_uri = length_uri - 9;
|
||||
if (length_uri == 0) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hd/><– back</a><br><br>\n"
|
||||
"<b>Thread %hd</b><br>\n"
|
||||
@@ -2019,7 +2019,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
/* call detection() */
|
||||
detection(pointer, res, length_uri, thread, client_socket, cnt);
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_valid_command, NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -2030,7 +2030,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
pointer = pointer + 5;
|
||||
length_uri = length_uri - 5;
|
||||
if (length_uri == 0) {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/%hd/><– back</a><br><br>\n"
|
||||
"<b>Thread %hd</b><br>\n"
|
||||
@@ -2054,7 +2054,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
track(pointer, res, length_uri, thread, client_socket, cnt);
|
||||
} else {
|
||||
/* error track not enable */
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hd/><– back</a>\n", thread);
|
||||
response_client(client_socket, not_track, res);
|
||||
}
|
||||
@@ -2062,7 +2062,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
response_client(client_socket, not_track_raw, NULL);
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hd/><– back</a>\n", thread);
|
||||
response_client(client_socket, not_found_response_valid_command, res);
|
||||
}
|
||||
@@ -2070,7 +2070,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hd/><– back</a>\n", thread);
|
||||
response_client(client_socket, not_found_response_valid_command, res);
|
||||
}
|
||||
@@ -2079,7 +2079,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
}
|
||||
} else {
|
||||
/* /thread_number/ requested */
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<a href=/><– back</a><br><br>\n<b>Thread %hd</b><br>\n"
|
||||
"<a href='/%hd/config'>config</a><br>\n"
|
||||
@@ -2096,7 +2096,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output) {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/><– back</a>\n");
|
||||
response_client(client_socket, not_found_response_valid, res);
|
||||
}
|
||||
@@ -2106,7 +2106,7 @@ static unsigned short int handle_get(int client_socket, const char *url, void *u
|
||||
}
|
||||
free(res);
|
||||
} else {
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
response_client(client_socket, not_found_response_template,NULL);
|
||||
else
|
||||
response_client(client_socket, not_found_response_template_raw,NULL);
|
||||
@@ -2185,7 +2185,7 @@ static unsigned short int read_client(int client_socket, void *userdata, char *a
|
||||
/* Check Protocol */
|
||||
if (strcmp(protocol, "HTTP/1.0") && strcmp (protocol, "HTTP/1.1")) {
|
||||
/* We don't understand this protocol. Report a bad response. */
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
warningkill = write(client_socket, bad_request_response, sizeof (bad_request_response));
|
||||
else
|
||||
warningkill = write(client_socket, bad_request_response_raw, sizeof (bad_request_response_raw));
|
||||
@@ -2198,7 +2198,7 @@ static unsigned short int read_client(int client_socket, void *userdata, char *a
|
||||
/* This server only implements the GET method. If client
|
||||
uses other method, report the failure. */
|
||||
char response[1024];
|
||||
if (cnt[0]->conf.control_html_output)
|
||||
if (cnt[0]->conf.webcontrol_html_output)
|
||||
snprintf(response, sizeof (response), bad_method_response_template, method);
|
||||
else
|
||||
snprintf(response, sizeof (response), bad_method_response_template_raw, method);
|
||||
@@ -2222,11 +2222,11 @@ static unsigned short int read_client(int client_socket, void *userdata, char *a
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Don't allow to change control_authentication from http control
|
||||
// Don't allow to change webcontrol_authentication from http control
|
||||
// If it has to be allowed reenable check_authentication()
|
||||
/*if ( !check_authentication(auth, authentication,
|
||||
strlen(cnt[0]->conf.control_authentication),
|
||||
cnt[0]->conf.control_authentication)) {
|
||||
strlen(cnt[0]->conf.webcontrol_authentication),
|
||||
cnt[0]->conf.webcontrol_authentication)) {
|
||||
*/
|
||||
|
||||
if (strcmp(auth, authentication)) {
|
||||
@@ -2322,9 +2322,9 @@ void httpd_run(struct context **cnt)
|
||||
hints.ai_family = AF_UNSPEC;
|
||||
hints.ai_socktype = SOCK_STREAM;
|
||||
|
||||
snprintf(portnumber, sizeof(portnumber), "%u", cnt[0]->conf.control_port);
|
||||
snprintf(portnumber, sizeof(portnumber), "%u", cnt[0]->conf.webcontrol_port);
|
||||
|
||||
val = getaddrinfo(cnt[0]->conf.control_localhost ? "localhost" : NULL, portnumber, &hints, &res);
|
||||
val = getaddrinfo(cnt[0]->conf.webcontrol_localhost ? "localhost" : NULL, portnumber, &hints, &res);
|
||||
|
||||
/* check != 0 to allow FreeBSD compatibility */
|
||||
if (val != 0) {
|
||||
@@ -2380,15 +2380,15 @@ void httpd_run(struct context **cnt)
|
||||
motion_log(LOG_DEBUG, 0, "motion-httpd/"VERSION" running, accepting connections");
|
||||
motion_log(LOG_DEBUG, 0, "motion-httpd: waiting for data on %s port TCP %s", hbuf, sbuf);
|
||||
|
||||
if (cnt[0]->conf.control_authentication != NULL ) {
|
||||
if (cnt[0]->conf.webcontrol_authentication != NULL ) {
|
||||
char *userpass = NULL;
|
||||
size_t auth_size = strlen(cnt[0]->conf.control_authentication);
|
||||
size_t auth_size = strlen(cnt[0]->conf.webcontrol_authentication);
|
||||
|
||||
authentication = (char *) mymalloc(BASE64_LENGTH(auth_size) + 1);
|
||||
userpass = mymalloc(auth_size + 4);
|
||||
/* base64_encode can read 3 bytes after the end of the string, initialize it */
|
||||
memset(userpass, 0, auth_size + 4);
|
||||
strcpy(userpass, cnt[0]->conf.control_authentication);
|
||||
strcpy(userpass, cnt[0]->conf.webcontrol_authentication);
|
||||
base64_encode(userpass, authentication, auth_size);
|
||||
free(userpass);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user