mirror of
https://github.com/Motion-Project/motion.git
synced 2026-04-21 14:37:02 -04:00
250
conf.c
250
conf.c
@@ -29,151 +29,142 @@
|
||||
|
||||
#include "motion.h"
|
||||
|
||||
#if (defined(BSD) && !defined(PWCBSD))
|
||||
#if (defined(__FreeBSD__) && !defined(PWCBSD))
|
||||
#include "video_freebsd.h"
|
||||
#else
|
||||
#include "video.h"
|
||||
#endif /* BSD */
|
||||
#endif
|
||||
|
||||
#define EXTENSION ".conf"
|
||||
|
||||
#ifndef HAVE_GET_CURRENT_DIR_NAME
|
||||
char *get_current_dir_name(void)
|
||||
{
|
||||
char *buf = mymalloc(MAXPATHLEN);
|
||||
getwd(buf);
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
#define stripnewline(x) {if ((x)[strlen(x)-1]=='\n') (x)[strlen(x) - 1] = 0; }
|
||||
|
||||
struct config conf_template = {
|
||||
camera_name: NULL,
|
||||
width: DEF_WIDTH,
|
||||
height: DEF_HEIGHT,
|
||||
quality: DEF_QUALITY,
|
||||
camera_id: 0,
|
||||
rotate_deg: 0,
|
||||
max_changes: DEF_CHANGES,
|
||||
threshold_tune: 0,
|
||||
output_pictures: "on",
|
||||
motion_img: 0,
|
||||
emulate_motion: 0,
|
||||
event_gap: DEF_EVENT_GAP,
|
||||
max_movie_time: DEF_MAXMOVIETIME,
|
||||
snapshot_interval: 0,
|
||||
locate_motion_mode: "off",
|
||||
locate_motion_style: "box",
|
||||
input: IN_DEFAULT,
|
||||
norm: 0,
|
||||
frame_limit: DEF_MAXFRAMERATE,
|
||||
quiet: 1,
|
||||
picture_type: "jpeg",
|
||||
noise: DEF_NOISELEVEL,
|
||||
noise_tune: 1,
|
||||
minimum_frame_time: 0,
|
||||
lightswitch: 0,
|
||||
autobright: 0,
|
||||
brightness: 0,
|
||||
contrast: 0,
|
||||
saturation: 0,
|
||||
hue: 0,
|
||||
power_line_frequency: -1,
|
||||
roundrobin_frames: 1,
|
||||
roundrobin_skip: 1,
|
||||
pre_capture: 0,
|
||||
post_capture: 0,
|
||||
switchfilter: 0,
|
||||
ffmpeg_output: 0,
|
||||
extpipe: NULL,
|
||||
useextpipe: 0,
|
||||
ffmpeg_output_debug: 0,
|
||||
ffmpeg_bps: DEF_FFMPEG_BPS,
|
||||
ffmpeg_vbr: DEF_FFMPEG_VBR,
|
||||
ffmpeg_video_codec: DEF_FFMPEG_CODEC,
|
||||
.camera_name = NULL,
|
||||
.width = DEF_WIDTH,
|
||||
.height = DEF_HEIGHT,
|
||||
.quality = DEF_QUALITY,
|
||||
.camera_id = 0,
|
||||
.rotate_deg = 0,
|
||||
.max_changes = DEF_CHANGES,
|
||||
.threshold_tune = 0,
|
||||
.output_pictures = "on",
|
||||
.motion_img = 0,
|
||||
.emulate_motion = 0,
|
||||
.event_gap = DEF_EVENT_GAP,
|
||||
.max_movie_time = DEF_MAXMOVIETIME,
|
||||
.snapshot_interval = 0,
|
||||
.locate_motion_mode = "off",
|
||||
.locate_motion_style = "box",
|
||||
.input = IN_DEFAULT,
|
||||
.norm = 0,
|
||||
.frame_limit = DEF_MAXFRAMERATE,
|
||||
.quiet = 1,
|
||||
.picture_type = "jpeg",
|
||||
.noise = DEF_NOISELEVEL,
|
||||
.noise_tune = 1,
|
||||
.minimum_frame_time = 0,
|
||||
.lightswitch = 0,
|
||||
.autobright = 0,
|
||||
.brightness = 0,
|
||||
.contrast = 0,
|
||||
.saturation = 0,
|
||||
.hue = 0,
|
||||
.power_line_frequency = -1,
|
||||
.roundrobin_frames = 1,
|
||||
.roundrobin_skip = 1,
|
||||
.pre_capture = 0,
|
||||
.post_capture = 0,
|
||||
.switchfilter = 0,
|
||||
.ffmpeg_output = 0,
|
||||
.extpipe = NULL,
|
||||
.useextpipe = 0,
|
||||
.ffmpeg_output_debug = 0,
|
||||
.ffmpeg_bps = DEF_FFMPEG_BPS,
|
||||
.ffmpeg_vbr = DEF_FFMPEG_VBR,
|
||||
.ffmpeg_video_codec = DEF_FFMPEG_CODEC,
|
||||
#ifdef HAVE_SDL
|
||||
sdl_threadnr: 0,
|
||||
#endif
|
||||
ipv6_enabled: 0,
|
||||
stream_port: 0,
|
||||
stream_quality: 50,
|
||||
stream_motion: 0,
|
||||
stream_maxrate: 1,
|
||||
stream_localhost: 1,
|
||||
stream_limit: 0,
|
||||
stream_auth_method: 0,
|
||||
stream_authentication: NULL,
|
||||
stream_preview_scale: 25,
|
||||
stream_preview_newline: 0,
|
||||
webcontrol_port: 0,
|
||||
webcontrol_localhost: 1,
|
||||
webcontrol_html_output: 1,
|
||||
webcontrol_authentication: NULL,
|
||||
frequency: 0,
|
||||
tuner_number: 0,
|
||||
timelapse: 0,
|
||||
timelapse_mode: DEF_TIMELAPSE_MODE,
|
||||
#if (defined(BSD))
|
||||
.ipv6_enabled = 0,
|
||||
.stream_port = 0,
|
||||
.stream_quality = 50,
|
||||
.stream_motion = 0,
|
||||
.stream_maxrate = 1,
|
||||
.stream_localhost = 1,
|
||||
.stream_limit = 0,
|
||||
.stream_auth_method = 0,
|
||||
.stream_authentication = NULL,
|
||||
.stream_preview_scale = 25,
|
||||
.stream_preview_newline = 0,
|
||||
.webcontrol_port = 0,
|
||||
.webcontrol_localhost = 1,
|
||||
.webcontrol_html_output = 1,
|
||||
.webcontrol_authentication = NULL,
|
||||
.frequency = 0,
|
||||
.tuner_number = 0,
|
||||
.timelapse = 0,
|
||||
.timelapse_mode = DEF_TIMELAPSE_MODE,
|
||||
#if (defined(__FreeBSD__))
|
||||
tuner_device: NULL,
|
||||
#endif
|
||||
video_device: VIDEO_DEVICE,
|
||||
v4l2_palette: DEF_PALETTE,
|
||||
vidpipe: NULL,
|
||||
filepath: NULL,
|
||||
imagepath: DEF_IMAGEPATH,
|
||||
moviepath: DEF_MOVIEPATH,
|
||||
snappath: DEF_SNAPPATH,
|
||||
timepath: DEF_TIMEPATH,
|
||||
on_event_start: NULL,
|
||||
on_event_end: NULL,
|
||||
mask_file: NULL,
|
||||
smart_mask_speed: 0,
|
||||
.video_device = VIDEO_DEVICE,
|
||||
.v4l2_palette = DEF_PALETTE,
|
||||
.vidpipe = NULL,
|
||||
.filepath = NULL,
|
||||
.imagepath = DEF_IMAGEPATH,
|
||||
.moviepath = DEF_MOVIEPATH,
|
||||
.snappath = DEF_SNAPPATH,
|
||||
.timepath = DEF_TIMEPATH,
|
||||
.on_event_start = NULL,
|
||||
.on_event_end = NULL,
|
||||
.mask_file = NULL,
|
||||
.smart_mask_speed = 0,
|
||||
#if defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3)
|
||||
sql_log_image: 1,
|
||||
sql_log_snapshot: 1,
|
||||
sql_log_movie: 0,
|
||||
sql_log_timelapse: 0,
|
||||
sql_query: DEF_SQL_QUERY,
|
||||
database_type: NULL,
|
||||
database_dbname: NULL,
|
||||
database_host: "localhost",
|
||||
database_user: NULL,
|
||||
database_password: NULL,
|
||||
database_port: 0,
|
||||
database_busy_timeout: 0,
|
||||
.sql_log_image = 1,
|
||||
.sql_log_snapshot = 1,
|
||||
.sql_log_movie = 0,
|
||||
.sql_log_timelapse = 0,
|
||||
.sql_query = DEF_SQL_QUERY,
|
||||
.database_type = NULL,
|
||||
.database_dbname = NULL,
|
||||
.database_host = "localhost",
|
||||
.database_user = NULL,
|
||||
.database_password = NULL,
|
||||
.database_port = 0,
|
||||
.database_busy_timeout = 0,
|
||||
#endif /* defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || define(HAVE_SQLITE3) */
|
||||
on_picture_save: NULL,
|
||||
on_motion_detected: NULL,
|
||||
on_area_detected: NULL,
|
||||
on_movie_start: NULL,
|
||||
on_movie_end: NULL,
|
||||
on_camera_lost: NULL,
|
||||
motionvidpipe: NULL,
|
||||
netcam_url: NULL,
|
||||
netcam_userpass: NULL,
|
||||
netcam_keepalive: "off",
|
||||
netcam_proxy: NULL,
|
||||
netcam_tolerant_check: 0,
|
||||
rtsp_uses_tcp: 1,
|
||||
.on_picture_save = NULL,
|
||||
.on_motion_detected = NULL,
|
||||
.on_area_detected = NULL,
|
||||
.on_movie_start = NULL,
|
||||
.on_movie_end = NULL,
|
||||
.on_camera_lost = NULL,
|
||||
.motionvidpipe = NULL,
|
||||
.netcam_url = NULL,
|
||||
.netcam_userpass = NULL,
|
||||
.netcam_keepalive = "off",
|
||||
.netcam_proxy = NULL,
|
||||
.netcam_tolerant_check = 0,
|
||||
.rtsp_uses_tcp = 1,
|
||||
#ifdef HAVE_MMAL
|
||||
mmalcam_name: NULL,
|
||||
mmalcam_control_params: NULL,
|
||||
#endif
|
||||
text_changes: 0,
|
||||
text_left: NULL,
|
||||
text_right: DEF_TIMESTAMP,
|
||||
text_event: DEF_EVENTSTAMP,
|
||||
text_double: 0,
|
||||
despeckle_filter: NULL,
|
||||
area_detect: NULL,
|
||||
minimum_motion_frames: 1,
|
||||
exif_text: NULL,
|
||||
pid_file: NULL,
|
||||
log_file: NULL,
|
||||
log_level: LEVEL_DEFAULT+10,
|
||||
log_type_str: NULL,
|
||||
camera_dir: sysconfdir"/conf.d"
|
||||
.text_changes = 0,
|
||||
.text_left = NULL,
|
||||
.text_right = DEF_TIMESTAMP,
|
||||
.text_event = DEF_EVENTSTAMP,
|
||||
.text_double = 0,
|
||||
.despeckle_filter = NULL,
|
||||
.area_detect = NULL,
|
||||
.minimum_motion_frames = 1,
|
||||
.exif_text = NULL,
|
||||
.pid_file = NULL,
|
||||
.log_file = NULL,
|
||||
.log_level = LEVEL_DEFAULT+10,
|
||||
.log_type_str = NULL,
|
||||
.camera_dir = sysconfdir"/conf.d"
|
||||
};
|
||||
|
||||
|
||||
@@ -310,7 +301,7 @@ config_param config_params[] = {
|
||||
copy_int,
|
||||
print_int
|
||||
},
|
||||
#if (defined(BSD))
|
||||
#if (defined(__FreeBSD__))
|
||||
{
|
||||
"tunerdevice",
|
||||
"# Tuner device to be used for capturing using tuner as source (default /dev/tuner0)\n"
|
||||
@@ -2009,20 +2000,19 @@ struct context **conf_load(struct context **cnt)
|
||||
}
|
||||
|
||||
if (!fp) { /* Command-line didn't work, try current dir. */
|
||||
char *path = NULL;
|
||||
char path[PATH_MAX];
|
||||
|
||||
if (cnt[0]->conf_filename[0])
|
||||
MOTION_LOG(ALR, TYPE_ALL, SHOW_ERRNO, "%s: Configfile %s not found - trying defaults.",
|
||||
filename);
|
||||
|
||||
if ((path = get_current_dir_name()) == NULL) {
|
||||
MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, "%s: Error get_current_dir_name");
|
||||
if (getcwd(path, sizeof(path)) == NULL) {
|
||||
MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, "%s: Error getcwd");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
snprintf(filename, PATH_MAX, "%s/motion.conf", path);
|
||||
fp = fopen (filename, "r");
|
||||
free(path);
|
||||
}
|
||||
|
||||
if (!fp) { /* Specified file does not exist... try default file. */
|
||||
|
||||
4
conf.h
4
conf.h
@@ -177,8 +177,4 @@ char *mystrdup(const char *);
|
||||
char *mystrcpy(char *, const char *);
|
||||
struct context **copy_string(struct context **, const char *, int);
|
||||
|
||||
#ifndef HAVE_GET_CURRENT_DIR_NAME
|
||||
char *get_current_dir_name(void);
|
||||
#endif
|
||||
|
||||
#endif /* _INCLUDE_CONF_H */
|
||||
|
||||
14
configure.ac
14
configure.ac
@@ -207,18 +207,6 @@ else
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
if test "x$PTHREAD_SUPPORT" = "xyes"; then
|
||||
AC_MSG_CHECKING([[for pthread_setname_np]])
|
||||
CFLAGS="$TEMP_CFLAGS"
|
||||
LIBS="$TEMP_LIBS"
|
||||
AC_LINK_IFELSE(
|
||||
[AC_LANG_PROGRAM([[#include <pthread.h>]], [[ pthread_setname_np(pthread_self(), "name")]])],
|
||||
[AC_DEFINE([[HAVE_PTHREAD_SETNAME_NP]], [[1]], [Define if you have pthread_setname_np function.])
|
||||
AC_MSG_RESULT([[yes]])],
|
||||
[AC_MSG_RESULT([[no]])] )
|
||||
fi
|
||||
|
||||
#
|
||||
# Check for sdl library
|
||||
#
|
||||
@@ -781,8 +769,6 @@ fi
|
||||
AC_HEADER_STDC
|
||||
AC_CHECK_HEADERS(stdio.h unistd.h stdint.h fcntl.h time.h signal.h sys/ioctl.h sys/mman.h linux/videodev.h linux/videodev2.h sys/param.h sys/types.h sys/videoio.h)
|
||||
|
||||
AC_CHECK_FUNCS(get_current_dir_name)
|
||||
|
||||
# Check if v4l2 is available
|
||||
SUPPORTED_V4L2=false
|
||||
SUPPORTED_V4L2_old=false
|
||||
|
||||
10
event.c
10
event.c
@@ -11,7 +11,7 @@
|
||||
#include "ffmpeg.h" /* must be first to avoid 'shadow' warning */
|
||||
#include "picture.h" /* already includes motion.h */
|
||||
#include "event.h"
|
||||
#if (!defined(BSD))
|
||||
#if (!defined(__FreeBSD__))
|
||||
#include "video.h"
|
||||
#endif
|
||||
|
||||
@@ -317,7 +317,7 @@ static void event_sdl_put(struct context *cnt,
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(BSD)
|
||||
#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(__FreeBSD__)
|
||||
static void event_vid_putpipe(struct context *cnt,
|
||||
motion_event type ATTRIBUTE_UNUSED,
|
||||
unsigned char *img, char *dummy ATTRIBUTE_UNUSED, void *devpipe,
|
||||
@@ -328,7 +328,7 @@ static void event_vid_putpipe(struct context *cnt,
|
||||
MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO, "%s: Failed to put image into video pipe");
|
||||
}
|
||||
}
|
||||
#endif /* !WITHOUT_V4L && !BSD */
|
||||
#endif /* !WITHOUT_V4L && !__FreeBSD__ */
|
||||
|
||||
const char *imageext(struct context *cnt)
|
||||
{
|
||||
@@ -973,7 +973,7 @@ struct event_handlers event_handlers[] = {
|
||||
event_sdl_put
|
||||
},
|
||||
#endif
|
||||
#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(BSD)
|
||||
#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(__FreeBSD__)
|
||||
{
|
||||
EVENT_IMAGE,
|
||||
event_vid_putpipe
|
||||
@@ -982,7 +982,7 @@ struct event_handlers event_handlers[] = {
|
||||
EVENT_IMAGEM,
|
||||
event_vid_putpipe
|
||||
},
|
||||
#endif /* !WITHOUT_V4L && !BSD */
|
||||
#endif /* !WITHOUT_V4L && !__FreeBSD__ */
|
||||
{
|
||||
EVENT_STREAM,
|
||||
event_stream_put
|
||||
|
||||
4
logger.c
4
logger.c
@@ -191,12 +191,8 @@ void motion_log(int level, unsigned int type, int errno_flag, const char *fmt, .
|
||||
*/
|
||||
errno_save = errno;
|
||||
|
||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
||||
char threadname[32] = "unknown";
|
||||
pthread_getname_np(pthread_self(), threadname, sizeof(threadname));
|
||||
#else /* HAVE_PTHREAD_SETNAME_NP */
|
||||
const char *threadname = "";
|
||||
#endif /* HAVE_PTHREAD_SETNAME_NP */
|
||||
|
||||
/*
|
||||
* Prefix the message with the log level string, log type string,
|
||||
|
||||
16
motion.c
16
motion.c
@@ -9,7 +9,7 @@
|
||||
#include "ffmpeg.h"
|
||||
#include "motion.h"
|
||||
|
||||
#if (defined(BSD) && !defined(PWCBSD))
|
||||
#if (defined(__FreeBSD__) && !defined(PWCBSD))
|
||||
#include "video_freebsd.h"
|
||||
#else
|
||||
#include "video.h"
|
||||
@@ -789,7 +789,7 @@ static int motion_init(struct context *cnt)
|
||||
/* create a reference frame */
|
||||
alg_update_reference_frame(cnt, RESET_REF_FRAME);
|
||||
|
||||
#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(BSD)
|
||||
#if defined(HAVE_LINUX_VIDEODEV_H) && !defined(WITHOUT_V4L) && !defined(__FreeBSD__)
|
||||
/* open video loopback devices if enabled */
|
||||
if (cnt->conf.vidpipe) {
|
||||
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Opening video loopback device for normal pictures");
|
||||
@@ -814,7 +814,7 @@ static int motion_init(struct context *cnt)
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
#endif /* !WITHOUT_V4L && !BSD */
|
||||
#endif /* !WITHOUT_V4L && !__FreeBSD__ */
|
||||
|
||||
#if defined(HAVE_MYSQL) || defined(HAVE_PGSQL) || defined(HAVE_SQLITE3)
|
||||
if (cnt->conf.database_type) {
|
||||
@@ -1104,16 +1104,14 @@ static void *motion_loop(void *arg)
|
||||
unsigned int get_image = 1; /* Flag used to signal that we capture new image when we run the loop */
|
||||
struct image_data *old_image;
|
||||
|
||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
||||
{
|
||||
char tname[16];
|
||||
snprintf(tname, sizeof(tname), "ml%d%s%s",
|
||||
cnt->threadnr,
|
||||
cnt->conf.camera_name ? ":" : "",
|
||||
cnt->conf.camera_name ? cnt->conf.camera_name : "");
|
||||
pthread_setname_np(pthread_self(), tname);
|
||||
MOTION_PTHREAD_SETNAME(tname);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Next two variables are used for snapshot and timelapse feature
|
||||
@@ -2322,11 +2320,11 @@ static void become_daemon(void)
|
||||
MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, "%s: Could not change directory");
|
||||
|
||||
|
||||
#if (defined(BSD))
|
||||
#if (defined(__FreeBSD__))
|
||||
setpgrp(0, getpid());
|
||||
#else
|
||||
setpgrp();
|
||||
#endif /* BSD */
|
||||
#endif /* __FreeBSD__ */
|
||||
|
||||
|
||||
if ((i = open("/dev/tty", O_RDWR)) >= 0) {
|
||||
@@ -3227,7 +3225,7 @@ size_t mystrftime(const struct context *cnt, char *s, size_t max, const char *us
|
||||
break;
|
||||
|
||||
case 'C': // text_event
|
||||
if (cnt->text_event_string && cnt->text_event_string[0])
|
||||
if (cnt->text_event_string[0])
|
||||
snprintf(tempstr, PATH_MAX, "%*s", width,
|
||||
cnt->text_event_string);
|
||||
else
|
||||
|
||||
7
motion.h
7
motion.h
@@ -70,6 +70,13 @@
|
||||
#include "sdl.h"
|
||||
#endif
|
||||
|
||||
#ifdef __APPLE__
|
||||
#define MOTION_PTHREAD_SETNAME(name) pthread_setname_np(name)
|
||||
#elif defined(__FreeBSD__)
|
||||
#define MOTION_PTHREAD_SETNAME(name) pthread_set_name_np(pthread_self(), name)
|
||||
#else
|
||||
#define MOTION_PTHREAD_SETNAME(name) pthread_setname_np(pthread_self(), name)
|
||||
#endif
|
||||
|
||||
/**
|
||||
* ATTRIBUTE_UNUSED:
|
||||
|
||||
6
netcam.c
6
netcam.c
@@ -948,7 +948,7 @@ static int netcam_connect(netcam_context_ptr netcam, int err_flag)
|
||||
}
|
||||
|
||||
/* Now the connect call will return immediately. */
|
||||
ret = connect(netcam->sock, &server, sizeof(server));
|
||||
ret = connect(netcam->sock, (struct sockaddr *)&server, sizeof(server));
|
||||
back_err = errno; /* Save the errno from connect */
|
||||
|
||||
/* If the connect failed with anything except EINPROGRESS, error. */
|
||||
@@ -1767,16 +1767,14 @@ static void *netcam_handler_loop(void *arg)
|
||||
netcam_context_ptr netcam = arg;
|
||||
struct context *cnt = netcam->cnt; /* Needed for the SETUP macro :-( */
|
||||
|
||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
||||
{
|
||||
char tname[16];
|
||||
snprintf(tname, sizeof(tname), "nc%d%s%s",
|
||||
cnt->threadnr,
|
||||
cnt->conf.camera_name ? ":" : "",
|
||||
cnt->conf.camera_name ? cnt->conf.camera_name : "");
|
||||
pthread_setname_np(pthread_self(), tname);
|
||||
MOTION_PTHREAD_SETNAME(tname);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Store the corresponding motion thread number in TLS also for this
|
||||
* thread (necessary for 'MOTION_LOG' to function properly).
|
||||
|
||||
@@ -458,7 +458,6 @@ static int netcam_rtsp_open_context(netcam_context_ptr netcam){
|
||||
return -1;
|
||||
}
|
||||
|
||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
||||
/* there is no way to set the avcodec thread names, but they inherit
|
||||
* our thread name - so temporarily change our thread name to the
|
||||
* desired name */
|
||||
@@ -470,15 +469,12 @@ static int netcam_rtsp_open_context(netcam_context_ptr netcam){
|
||||
netcam->cnt->threadnr,
|
||||
netcam->cnt->conf.camera_name ? ":" : "",
|
||||
netcam->cnt->conf.camera_name ? netcam->cnt->conf.camera_name : "");
|
||||
pthread_setname_np(pthread_self(), newtname);
|
||||
#endif
|
||||
MOTION_PTHREAD_SETNAME(newtname);
|
||||
|
||||
retcd = netcam_open_codec(&netcam->rtsp->video_stream_index, netcam->rtsp->format_context, AVMEDIA_TYPE_VIDEO);
|
||||
|
||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
||||
pthread_setname_np(pthread_self(), curtname);
|
||||
MOTION_PTHREAD_SETNAME(curtname);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (retcd < 0) {
|
||||
if (netcam->rtsp->status == RTSP_NOTCONNECTED){
|
||||
|
||||
40
stream.c
40
stream.c
@@ -179,9 +179,7 @@ static void* handle_basic_auth(void* param)
|
||||
"Pragma: no-cache\r\n"
|
||||
"WWW-Authenticate: Basic realm=\""STREAM_REALM"\"\r\n\r\n";
|
||||
|
||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
||||
pthread_setname_np(pthread_self(), "handle_basic_auth");
|
||||
#endif
|
||||
MOTION_PTHREAD_SETNAME("handle_basic_auth");
|
||||
|
||||
pthread_mutex_lock(&stream_auth_mutex);
|
||||
p->thread_count++;
|
||||
@@ -436,9 +434,7 @@ static void* handle_md5_digest(void* param)
|
||||
"</body>\n"
|
||||
"</html>\n";
|
||||
|
||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
||||
pthread_setname_np(pthread_self(), "handle_md5_digest");
|
||||
#endif
|
||||
MOTION_PTHREAD_SETNAME("handle_md5_digest");
|
||||
|
||||
pthread_mutex_lock(&stream_auth_mutex);
|
||||
p->thread_count++;
|
||||
@@ -577,7 +573,7 @@ Error:
|
||||
"Content-Type: text/html\r\n"
|
||||
"Keep-Alive: timeout=%i\r\n"
|
||||
"Connection: keep-alive\r\n"
|
||||
"Content-Length: %Zu\r\n\r\n",
|
||||
"Content-Length: %zu\r\n\r\n",
|
||||
request_auth_response_template, server_nonce,
|
||||
KEEP_ALIVE_TIMEOUT, strlen(auth_failed_html_template));
|
||||
if (write(p->sock, buffer, strlen(buffer)) < 0)
|
||||
@@ -717,15 +713,33 @@ Error:
|
||||
*/
|
||||
int http_bindsock(int port, int local, int ipv6_enabled)
|
||||
{
|
||||
int sd = socket(ipv6_enabled?AF_INET6:AF_INET, SOCK_STREAM, 0);
|
||||
int sd = socket(ipv6_enabled?AF_INET6:AF_INET, SOCK_STREAM, IPPROTO_TCP);
|
||||
|
||||
if (sd == -1)
|
||||
{
|
||||
MOTION_LOG(CRT, TYPE_STREAM, SHOW_ERRNO, "%s: error creating socket");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int yes = 1, no = 0;
|
||||
setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes));
|
||||
if (setsockopt(sd, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(yes)) != 0)
|
||||
{
|
||||
MOTION_LOG(CRT, TYPE_STREAM, SHOW_ERRNO, "%s: setting SO_REUSEADDR to yes failed");
|
||||
/* we can carry on even if this failed */
|
||||
}
|
||||
|
||||
if (ipv6_enabled)
|
||||
setsockopt(sd, IPPROTO_IPV6, IPV6_V6ONLY, &no, sizeof(no));
|
||||
{
|
||||
if (setsockopt(sd, IPPROTO_IPV6, IPV6_V6ONLY, &no, sizeof(no)) != 0)
|
||||
{
|
||||
MOTION_LOG(CRT, TYPE_STREAM, SHOW_ERRNO, "%s: setting IPV6_V6ONLY to no failed");
|
||||
/* we can carry on even if this failed */
|
||||
}
|
||||
}
|
||||
|
||||
const char *addr_str;
|
||||
struct sockaddr_storage sin;
|
||||
socklen_t sinsize;
|
||||
bzero(&sin, sizeof(struct sockaddr_storage));
|
||||
sin.ss_family = ipv6_enabled?AF_INET6:AF_INET;
|
||||
if (ipv6_enabled) {
|
||||
@@ -739,6 +753,7 @@ int http_bindsock(int port, int local, int ipv6_enabled)
|
||||
addr_str = "any IPv4/IPv6 address";
|
||||
sin6->sin6_addr = in6addr_any;
|
||||
}
|
||||
sinsize = sizeof(*sin6);
|
||||
} else {
|
||||
struct sockaddr_in *sin4 = (struct sockaddr_in*)&sin;
|
||||
sin4->sin_family = AF_INET;
|
||||
@@ -750,10 +765,11 @@ int http_bindsock(int port, int local, int ipv6_enabled)
|
||||
addr_str = "any IPv4 address";
|
||||
sin4->sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
}
|
||||
sinsize = sizeof(*sin4);
|
||||
}
|
||||
|
||||
if (bind(sd, (struct sockaddr*)&sin, sizeof(sin)) != 0) {
|
||||
MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO, "%s: error binding on %s port %d", addr_str, port);
|
||||
if (bind(sd, (struct sockaddr*)&sin, sinsize) != 0) {
|
||||
MOTION_LOG(CRT, TYPE_STREAM, SHOW_ERRNO, "%s: error binding on %s port %d", addr_str, port);
|
||||
close(sd);
|
||||
return -1;
|
||||
}
|
||||
|
||||
38
track.c
38
track.c
@@ -17,25 +17,25 @@
|
||||
|
||||
|
||||
struct trackoptions track_template = {
|
||||
dev: -1, /* dev open */
|
||||
port: NULL, /* char *port */
|
||||
motorx: 0, /* int motorx */
|
||||
motory: 0, /* int motory */
|
||||
maxx: 0, /* int maxx; */
|
||||
maxy: 0, /* int maxy; */
|
||||
minx: 0, /* int minx; */
|
||||
miny: 0, /* int miny; */
|
||||
homex: 128, /* int homex; */
|
||||
homey: 128, /* int homey; */
|
||||
motorx_reverse: 0, /* int reversed x servo; */
|
||||
motory_reverse: 0, /* int reversed y servo; */
|
||||
speed: TRACK_SPEED, /* speed */
|
||||
stepsize: TRACK_STEPSIZE, /* stepsize */
|
||||
active: 0, /* auto tracking active */
|
||||
minmaxfound: 0, /* flag for minmax values stored for pwc based camera */
|
||||
step_angle_x: 10, /* UVC step angle in degrees X-axis that camera moves during auto tracking */
|
||||
step_angle_y: 10, /* UVC step angle in degrees Y-axis that camera moves during auto tracking */
|
||||
move_wait: 10 /* number of frames to disable motion detection after camera moving */
|
||||
.dev = -1, /* dev open */
|
||||
.port = NULL, /* char *port */
|
||||
.motorx = 0, /* int motorx */
|
||||
.motory = 0, /* int motory */
|
||||
.maxx = 0, /* int maxx; */
|
||||
.maxy = 0, /* int maxy; */
|
||||
.minx = 0, /* int minx; */
|
||||
.miny = 0, /* int miny; */
|
||||
.homex = 128, /* int homex; */
|
||||
.homey = 128, /* int homey; */
|
||||
.motorx_reverse = 0, /* int reversed x servo; */
|
||||
.motory_reverse = 0, /* int reversed y servo; */
|
||||
.speed = TRACK_SPEED, /* speed */
|
||||
.stepsize = TRACK_STEPSIZE, /* stepsize */
|
||||
.active = 0, /* auto tracking active */
|
||||
.minmaxfound = 0, /* flag for minmax values stored for pwc based camera */
|
||||
.step_angle_x = 10, /* UVC step angle in degrees X-axis that camera moves during auto tracking */
|
||||
.step_angle_y = 10, /* UVC step angle in degrees Y-axis that camera moves during auto tracking */
|
||||
.move_wait = 10 /* number of frames to disable motion detection after camera moving */
|
||||
};
|
||||
|
||||
|
||||
|
||||
178
webhttpd.c
178
webhttpd.c
@@ -435,7 +435,7 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri,
|
||||
/*call list*/
|
||||
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>Camera %d%s%s</b>\n<ul>",
|
||||
sprintf(res, "<a href=/%u/config><– back</a><br><br>\n<b>Camera %d%s%s</b>\n<ul>",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -488,30 +488,30 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri,
|
||||
retval = mystrdup(thread_strings);
|
||||
}
|
||||
|
||||
sprintf(res, "<li><a href=/%hu/config/set?%s>%s</a> = %s</li>\n", thread,
|
||||
sprintf(res, "<li><a href=/%u/config/set?%s>%s</a> = %s</li>\n", thread,
|
||||
config_params[i].param_name, config_params[i].param_name, retval);
|
||||
free(retval);
|
||||
} else if (thread != 0) {
|
||||
/* get the value from main thread for the rest of threads */
|
||||
value = config_params[i].print(cnt, NULL, i, 0);
|
||||
|
||||
sprintf(res, "<li><a href=/%hu/config/set?%s>%s</a> = %s</li>\n", thread,
|
||||
sprintf(res, "<li><a href=/%u/config/set?%s>%s</a> = %s</li>\n", thread,
|
||||
config_params[i].param_name, config_params[i].param_name,
|
||||
value ? value : "(not defined)");
|
||||
} else {
|
||||
sprintf(res, "<li><a href=/%hu/config/set?%s>%s</a> = %s</li>\n", thread,
|
||||
sprintf(res, "<li><a href=/%u/config/set?%s>%s</a> = %s</li>\n", thread,
|
||||
config_params[i].param_name, config_params[i].param_name,
|
||||
"(not defined)");
|
||||
}
|
||||
|
||||
} else {
|
||||
sprintf(res, "<li><a href=/%hu/config/set?%s>%s</a> = %s</li>\n", thread,
|
||||
sprintf(res, "<li><a href=/%u/config/set?%s>%s</a> = %s</li>\n", thread,
|
||||
config_params[i].param_name, config_params[i].param_name, value);
|
||||
}
|
||||
send_template(client_socket, res);
|
||||
}
|
||||
|
||||
sprintf(res, "</ul><a href=/%hu/config><– back</a>", thread);
|
||||
sprintf(res, "</ul><a href=/%u/config><– back</a>", thread);
|
||||
send_template(client_socket, res);
|
||||
send_template_end_client(client_socket);
|
||||
} else {
|
||||
@@ -567,9 +567,9 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri,
|
||||
conf_cmdparse(cnt + thread, config_params[i].param_name, Value);
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res,
|
||||
"<a href=/%hu/config/list><– back</a>"
|
||||
"<a href=/%u/config/list><– back</a>"
|
||||
"<br><br>\n<b>Camera %d%s%s</b>\n"
|
||||
"<ul><li><a href=/%hu/config/set?%s>%s</a> = %s"
|
||||
"<ul><li><a href=/%u/config/set?%s>%s</a> = %s"
|
||||
"</li></ul><b>Done</b>",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
@@ -616,8 +616,8 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri,
|
||||
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res,
|
||||
"<a href=/%hu/config/list><– back</a><br><br>\n"
|
||||
"<b>Camera %d%s%s</b>\n<ul><li><a href=/%hu/config/set?%s>%s</a>"
|
||||
"<a href=/%u/config/list><– back</a><br><br>\n"
|
||||
"<b>Camera %d%s%s</b>\n<ul><li><a href=/%u/config/set?%s>%s</a>"
|
||||
"= %s</li></ul><br><b>Done</b>", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "",
|
||||
@@ -686,7 +686,7 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri,
|
||||
sprintf(option, "<option value='on'>on</option>\n"
|
||||
"<option value='off' selected>off</option>\n");
|
||||
|
||||
sprintf(res, "<a href=/%hu/config/list><– back</a><br><br>\n"
|
||||
sprintf(res, "<a href=/%u/config/list><– back</a><br><br>\n"
|
||||
"<b>Camera %d%s%s</b>\n"
|
||||
"<form action=set?>\n"
|
||||
"<b>%s</b> <select name='%s'>\n"
|
||||
@@ -707,7 +707,7 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri,
|
||||
value = config_params[i].print(cnt, NULL, i, 0);
|
||||
if (value == NULL) value = "";
|
||||
}
|
||||
sprintf(res, "<a href=/%hu/config/list><– back</a><br><br>\n"
|
||||
sprintf(res, "<a href=/%u/config/list><– back</a><br><br>\n"
|
||||
"<b>Camera %d%s%s</b>\n<form action=set?>\n"
|
||||
"<b>%s</b> <input type=text name='%s' value='%s' size=80>\n"
|
||||
"<input type='submit' value='set'>\n"
|
||||
@@ -739,7 +739,7 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri,
|
||||
} else if (length_uri == 0) {
|
||||
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>Camera %d%s%s</b>\n"
|
||||
sprintf(res, "<a href=/%u/config><– back</a><br><br>\n<b>Camera %d%s%s</b>\n"
|
||||
"<form name='n'>\n<select name='onames'>\n", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -834,7 +834,7 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri,
|
||||
value = config_params[i].print(cnt, NULL, i, 0);
|
||||
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"
|
||||
sprintf(res, "<a href=/%u/config/get><– back</a><br><br>\n"
|
||||
"<b>Camera %d%s%s</b><br>\n<ul><li>%s = %s "
|
||||
" <a href='%s#%s' target=_blank>"
|
||||
"[help]</a></li></ul><hr><i>%s</i>",
|
||||
@@ -872,7 +872,7 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri,
|
||||
} else if (length_uri == 0) {
|
||||
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>Camera %d%s%s</b><br>\n"
|
||||
sprintf(res, "<a href=/%u/config><– back</a><br><br>\n<b>Camera %d%s%s</b><br>\n"
|
||||
"<form action=get>\n"
|
||||
"<select name='query'>\n", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
@@ -908,8 +908,8 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri,
|
||||
if (length_uri == 0) {
|
||||
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);
|
||||
sprintf(res, "<a href=/%u/config><– back</a><br><br>"
|
||||
"Are you sure? <a href=/%u/config/writeyes>Yes</a>\n", thread, thread);
|
||||
send_template(client_socket, res);
|
||||
send_template_end_client(client_socket);
|
||||
} else {
|
||||
@@ -933,7 +933,7 @@ static unsigned int config(char *pointer, char *res, unsigned int length_uri,
|
||||
conf_print(cnt);
|
||||
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>Camera %d%s%s</b> write done !\n",
|
||||
sprintf(res, "<a href=/%u/config><– back</a><br><br>\n<b>Camera %d%s%s</b> write done !\n",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -996,13 +996,13 @@ static unsigned int action(char *pointer, char *res, unsigned int length_uri,
|
||||
|
||||
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);
|
||||
sprintf(res, "<a href=/%u/action><– back</a><br><br>\n"
|
||||
"makemovie for thread %u done<br>\n", thread, thread);
|
||||
send_template(client_socket, res);
|
||||
send_template_end_client(client_socket);
|
||||
} else {
|
||||
send_template_ini_client_raw(client_socket);
|
||||
sprintf(res, "makemovie for thread %hu\nDone\n", thread);
|
||||
sprintf(res, "makemovie for thread %u\nDone\n", thread);
|
||||
send_template_raw(client_socket, res);
|
||||
}
|
||||
} else {
|
||||
@@ -1028,13 +1028,13 @@ static unsigned int action(char *pointer, char *res, unsigned int length_uri,
|
||||
cnt[thread]->snapshot = 1;
|
||||
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);
|
||||
sprintf(res, "<a href=/%u/action><– back</a><br><br>\n"
|
||||
"snapshot for thread %u done<br>\n", thread, thread);
|
||||
send_template(client_socket, res);
|
||||
send_template_end_client(client_socket);
|
||||
} else {
|
||||
send_template_ini_client_raw(client_socket);
|
||||
sprintf(res, "snapshot for thread %hu\nDone\n", thread);
|
||||
sprintf(res, "snapshot for thread %u\nDone\n", thread);
|
||||
send_template_raw(client_socket, res);
|
||||
}
|
||||
} else {
|
||||
@@ -1074,13 +1074,13 @@ static unsigned int action(char *pointer, char *res, unsigned int length_uri,
|
||||
cnt[thread]->restart = 1;
|
||||
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);
|
||||
sprintf(res, "<a href=/%u/action><– back</a><br><br>\n"
|
||||
"restart for thread %u done<br>\n", thread, thread);
|
||||
send_template(client_socket, res);
|
||||
send_template_end_client(client_socket);
|
||||
} else {
|
||||
send_template_ini_client_raw(client_socket);
|
||||
sprintf(res, "restart for thread %hu\nDone\n", thread);
|
||||
sprintf(res, "restart for thread %u\nDone\n", thread);
|
||||
send_template_raw(client_socket, res);
|
||||
}
|
||||
}
|
||||
@@ -1119,13 +1119,13 @@ static unsigned int action(char *pointer, char *res, unsigned int length_uri,
|
||||
cnt[thread]->watchdog = WATCHDOG_OFF;
|
||||
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);
|
||||
sprintf(res, "<a href=/%u/action><– back</a><br><br>\n"
|
||||
"quit for thread %u done<br>\n", thread, thread);
|
||||
send_template(client_socket, res);
|
||||
send_template_end_client(client_socket);
|
||||
} else {
|
||||
send_template_ini_client_raw(client_socket);
|
||||
sprintf(res, "quit for thread %hu\nDone\n", thread);
|
||||
sprintf(res, "quit for thread %u\nDone\n", thread);
|
||||
send_template_raw(client_socket, res);
|
||||
}
|
||||
}
|
||||
@@ -1170,7 +1170,7 @@ static unsigned int detection(char *pointer, char *res, unsigned int length_uri,
|
||||
|
||||
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>Camera %d%s%s</b>"
|
||||
sprintf(res, "<a href=/%u/detection><– back</a><br><br><b>Camera %d%s%s</b>"
|
||||
" Detection status %s\n", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "",
|
||||
@@ -1206,7 +1206,7 @@ static unsigned int detection(char *pointer, char *res, unsigned int length_uri,
|
||||
|
||||
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>Camera %d%s%s</b>"
|
||||
sprintf(res, "<a href=/%u/detection><– back</a><br><br>\n<b>Camera %d%s%s</b>"
|
||||
" Detection resumed\n", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -1240,7 +1240,7 @@ static unsigned int detection(char *pointer, char *res, unsigned int length_uri,
|
||||
|
||||
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>Camera %d%s%s</b>"
|
||||
sprintf(res, "<a href=/%u/detection><– back</a><br><br>\n<b>Camera %d%s%s</b>"
|
||||
" Detection paused\n", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -1268,7 +1268,7 @@ static unsigned int detection(char *pointer, char *res, unsigned int length_uri,
|
||||
/* call connection */
|
||||
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);
|
||||
sprintf(res, "<a href=/%u/detection><– back</a><br><br>\n", thread);
|
||||
send_template(client_socket, res);
|
||||
if (thread == 0) {
|
||||
do{
|
||||
@@ -1453,7 +1453,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
if (cnt[thread]->moved) {
|
||||
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>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b><br>\n"
|
||||
"track set relative pan=%s<br>\n",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
@@ -1470,7 +1470,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
} else {
|
||||
/* error in track action */
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b>\n", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -1495,7 +1495,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
if (cnt[thread]->moved) {
|
||||
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>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b><br>\n"
|
||||
"track set relative tilt=%s\n",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
@@ -1512,7 +1512,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
} else {
|
||||
/* error in track action */
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b>\n", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -1529,7 +1529,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
if (cnt[thread]->moved) {
|
||||
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>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b><br>\n"
|
||||
"track set absolute x=%s\n",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
@@ -1546,7 +1546,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
} else {
|
||||
/* error in track action */
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b>\n", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -1564,7 +1564,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
if (cnt[thread]->moved) {
|
||||
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>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b><br>\n"
|
||||
"track set absolute y=%s<br>\n",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
@@ -1581,7 +1581,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
} else {
|
||||
/* error in track action */
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b>\n", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -1741,7 +1741,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
if (cnt[thread]->moved) {
|
||||
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>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b><br>\n"
|
||||
"track absolute set x=%s y=%s<br>\n",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
@@ -1758,7 +1758,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
} else {
|
||||
/* error in track action */
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b>\n", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -1796,7 +1796,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
if (cnt[thread]->moved) {
|
||||
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>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b><br>\n"
|
||||
"track relative pan=%s tilt=%s\n",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
@@ -1815,7 +1815,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
} else {
|
||||
/* error in track tilt */
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b>\n", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -1828,7 +1828,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
|
||||
/* error in track pan */
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hu/track><– back</a><br><br><b>Camera %d%s%s</b>\n",
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br><b>Camera %d%s%s</b>\n",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -1840,7 +1840,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
} else if (length_uri == 0) {
|
||||
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>Camera %d%s%s</b><br>\n"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>\n<b>Camera %d%s%s</b><br>\n"
|
||||
"<form action='set'>\n"
|
||||
"Pan<input type=text name='pan' value=''>\n"
|
||||
"Tilt<input type=text name='tilt' value=''>\n"
|
||||
@@ -1878,7 +1878,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
|
||||
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>Camera %d%s%s</b>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>\n<b>Camera %d%s%s</b>"
|
||||
"<br>track set center", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "");
|
||||
@@ -1902,7 +1902,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
if (length_uri==0) {
|
||||
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>Camera %d%s%s</b>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>\n<b>Camera %d%s%s</b>"
|
||||
"<br>track auto %s", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "",
|
||||
@@ -1936,7 +1936,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
pointer = pointer + 6;
|
||||
length_uri = length_uri - 6;
|
||||
warningkill = sscanf(pointer, "%255[-0-9a-z]" , command);
|
||||
if ((command != NULL) && (strlen(command) > 0)) {
|
||||
if (strlen(command) > 0) {
|
||||
struct context *autocnt;
|
||||
|
||||
/* auto value=0|1|status */
|
||||
@@ -1944,7 +1944,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
if (!strcmp(command, "status")) {
|
||||
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>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b><br>"
|
||||
"track auto %s", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
@@ -1967,7 +1967,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
autocnt->track.active = active;
|
||||
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>"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>"
|
||||
"<b>Camera %d%s%s</b>"
|
||||
"<br>track auto %s<br>", thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
@@ -2003,7 +2003,7 @@ static unsigned int track(char *pointer, char *res, unsigned int length_uri,
|
||||
|
||||
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>Camera %d%s%s</b>\n"
|
||||
sprintf(res, "<a href=/%u/track><– back</a><br><br>\n<b>Camera %d%s%s</b>\n"
|
||||
"<form action='auto'><select name='value'>\n"
|
||||
"<option value='0' %s>Disable</option><option value='1' %s>Enable</option>\n"
|
||||
"<option value='status'>status</option>\n"
|
||||
@@ -2067,7 +2067,7 @@ static unsigned int handle_get(int client_socket, const char *url, void *userdat
|
||||
//Send the webcontrol section if applicable
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
send_template_ini_client(client_socket, ini_template);
|
||||
sprintf(res, "<b>Motion "VERSION" Running [%hu] Cameras</b><br>\n"
|
||||
sprintf(res, "<b>Motion "VERSION" Running [%d] Cameras</b><br>\n"
|
||||
"<a href='/0/'>All</a>\n", i);
|
||||
send_template(client_socket, res);
|
||||
|
||||
@@ -2079,7 +2079,7 @@ static unsigned int handle_get(int client_socket, const char *url, void *userdat
|
||||
send_template(client_socket, res);
|
||||
counter = 0;
|
||||
}
|
||||
sprintf(res, "<a href='/%hu/'>Camera %d%s%s</a>\n", y, cnt[y]->conf.camera_id,
|
||||
sprintf(res, "<a href='/%d/'>Camera %d%s%s</a>\n", y, cnt[y]->conf.camera_id,
|
||||
cnt[y]->conf.camera_name ? " -- " : "",
|
||||
cnt[y]->conf.camera_name ? cnt[y]->conf.camera_name : "");
|
||||
send_template(client_socket, res);
|
||||
@@ -2112,10 +2112,10 @@ static unsigned int handle_get(int client_socket, const char *url, void *userdat
|
||||
send_template_end_client(client_socket);
|
||||
} else {
|
||||
send_template_ini_client_raw(client_socket);
|
||||
sprintf(res, "Motion "VERSION" Running [%hu] Cameras\n0\n", i);
|
||||
sprintf(res, "Motion "VERSION" Running [%d] Cameras\n0\n", i);
|
||||
send_template_raw(client_socket, res);
|
||||
for (y = 1; y < i; y++) {
|
||||
sprintf(res, "%hu\n", y);
|
||||
sprintf(res, "%d\n", y);
|
||||
send_template_raw(client_socket, res);
|
||||
}
|
||||
}
|
||||
@@ -2157,12 +2157,12 @@ static unsigned int handle_get(int client_socket, const char *url, void *userdat
|
||||
if (length_uri == 0) {
|
||||
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"
|
||||
sprintf(res, "<a href=/%d/><– back</a><br><br>\n"
|
||||
"<b>Camera %d%s%s</b><br>\n"
|
||||
"<a href=/%hd/config/list>list</a><br>\n"
|
||||
"<a href=/%hd/config/write>write</a><br>\n"
|
||||
"<a href=/%hd/config/set>set</a><br>\n"
|
||||
"<a href=/%hd/config/get>get</a><br>\n",
|
||||
"<a href=/%d/config/list>list</a><br>\n"
|
||||
"<a href=/%d/config/write>write</a><br>\n"
|
||||
"<a href=/%d/config/set>set</a><br>\n"
|
||||
"<a href=/%d/config/get>get</a><br>\n",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "",
|
||||
@@ -2193,12 +2193,12 @@ static unsigned int handle_get(int client_socket, const char *url, void *userdat
|
||||
if (length_uri == 0) {
|
||||
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"
|
||||
sprintf(res, "<a href=/%d/><– back</a><br><br>\n"
|
||||
"<b>Camera %d%s%s</b><br>\n"
|
||||
"<a href=/%hd/action/makemovie>makemovie</a><br>\n"
|
||||
"<a href=/%hd/action/snapshot>snapshot</a><br>\n"
|
||||
"<a href=/%hd/action/restart>restart</a><br>\n"
|
||||
"<a href=/%hd/action/quit>quit</a><br>\n",
|
||||
"<a href=/%d/action/makemovie>makemovie</a><br>\n"
|
||||
"<a href=/%d/action/snapshot>snapshot</a><br>\n"
|
||||
"<a href=/%d/action/restart>restart</a><br>\n"
|
||||
"<a href=/%d/action/quit>quit</a><br>\n",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "",
|
||||
@@ -2230,12 +2230,12 @@ static unsigned int handle_get(int client_socket, const char *url, void *userdat
|
||||
if (length_uri == 0) {
|
||||
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"
|
||||
sprintf(res, "<a href=/%d/><– back</a><br><br>\n"
|
||||
"<b>Camera %d%s%s</b><br>\n"
|
||||
"<a href=/%hd/detection/status>status</a><br>\n"
|
||||
"<a href=/%hd/detection/start>start</a><br>\n"
|
||||
"<a href=/%hd/detection/pause>pause</a><br>\n"
|
||||
"<a href=/%hd/detection/connection>connection</a><br>\n",
|
||||
"<a href=/%d/detection/status>status</a><br>\n"
|
||||
"<a href=/%d/detection/start>start</a><br>\n"
|
||||
"<a href=/%d/detection/pause>pause</a><br>\n"
|
||||
"<a href=/%d/detection/connection>connection</a><br>\n",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "",
|
||||
@@ -2264,12 +2264,12 @@ static unsigned int handle_get(int client_socket, const char *url, void *userdat
|
||||
if (length_uri == 0) {
|
||||
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"
|
||||
sprintf(res, "<a href=/%d/><– back</a><br><br>\n"
|
||||
"<b>Camera %d%s%s</b><br>\n"
|
||||
"<a href=/%hd/track/set>track set pan/tilt</a><br>\n"
|
||||
"<a href=/%hd/track/center>track center</a><br>\n"
|
||||
"<a href=/%hd/track/auto>track auto</a><br>\n"
|
||||
"<a href=/%hd/track/status>track status</a><br>\n",
|
||||
"<a href=/%d/track/set>track set pan/tilt</a><br>\n"
|
||||
"<a href=/%d/track/center>track center</a><br>\n"
|
||||
"<a href=/%d/track/auto>track auto</a><br>\n"
|
||||
"<a href=/%d/track/status>track status</a><br>\n",
|
||||
thread, cnt[thread]->conf.camera_id,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "",
|
||||
@@ -2291,7 +2291,7 @@ static unsigned int handle_get(int client_socket, const char *url, void *userdat
|
||||
} else {
|
||||
/* error track not enable */
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hd/><– back</a>\n", thread);
|
||||
sprintf(res, "<a href=/%d/><– back</a>\n", thread);
|
||||
response_client(client_socket, not_track, res);
|
||||
} else {
|
||||
response_client(client_socket, not_track_raw, NULL);
|
||||
@@ -2299,7 +2299,7 @@ static unsigned int handle_get(int client_socket, const char *url, void *userdat
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hd/><– back</a>\n", thread);
|
||||
sprintf(res, "<a href=/%d/><– back</a>\n", thread);
|
||||
response_client(client_socket, not_found_response_valid_command, res);
|
||||
} else {
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -2307,7 +2307,7 @@ static unsigned int handle_get(int client_socket, const char *url, void *userdat
|
||||
}
|
||||
} else {
|
||||
if (cnt[0]->conf.webcontrol_html_output) {
|
||||
sprintf(res, "<a href=/%hd/><– back</a>\n", thread);
|
||||
sprintf(res, "<a href=/%d/><– back</a>\n", thread);
|
||||
response_client(client_socket, not_found_response_valid_command, res);
|
||||
} else {
|
||||
response_client(client_socket, not_found_response_valid_command_raw, NULL);
|
||||
@@ -2317,11 +2317,11 @@ static unsigned int handle_get(int client_socket, const char *url, void *userdat
|
||||
/* /thread_number/ requested */
|
||||
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>Camera %d -- Thread %hd%s%s</b><br>\n"
|
||||
"<a href='/%hd/config'>config</a><br>\n"
|
||||
"<a href='/%hd/action'>action</a><br>\n"
|
||||
"<a href='/%hd/detection'>detection</a><br>\n"
|
||||
"<a href='/%hd/track'>track</a><br>\n",
|
||||
sprintf(res, "<a href=/><– back</a><br><br>\n<b>Camera %d -- Thread %d%s%s</b><br>\n"
|
||||
"<a href='/%d/config'>config</a><br>\n"
|
||||
"<a href='/%d/action'>action</a><br>\n"
|
||||
"<a href='/%d/detection'>detection</a><br>\n"
|
||||
"<a href='/%d/track'>track</a><br>\n",
|
||||
cnt[thread]->conf.camera_id, thread,
|
||||
cnt[thread]->conf.camera_name ? " -- " : "",
|
||||
cnt[thread]->conf.camera_name ? cnt[thread]->conf.camera_name : "",
|
||||
@@ -2571,7 +2571,7 @@ static int acceptnonblocking(int serverfd, int timeout)
|
||||
|
||||
if (select(serverfd + 1, &fds, NULL, NULL, &tm) > 0) {
|
||||
if (FD_ISSET(serverfd, &fds)) {
|
||||
if ((curfd = accept(serverfd, &client, &client_len)) > 0)
|
||||
if ((curfd = accept(serverfd, (struct sockaddr *)&client, &client_len)) > 0)
|
||||
return curfd;
|
||||
}
|
||||
}
|
||||
@@ -2658,9 +2658,7 @@ void *motion_web_control(void *arg)
|
||||
{
|
||||
struct context **cnt = arg;
|
||||
|
||||
#ifdef HAVE_PTHREAD_SETNAME_NP
|
||||
pthread_setname_np(pthread_self(), "web_control");
|
||||
#endif
|
||||
MOTION_PTHREAD_SETNAME("web_control");
|
||||
|
||||
httpd_run(cnt);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user