mirror of
https://github.com/Motion-Project/motion.git
synced 2026-05-03 12:22:48 -04:00
Revise parm updates via webcontrol
This commit is contained in:
@@ -3119,7 +3119,7 @@ int conf_edit_set_active(struct ctx_motapp *motapp, int threadnbr
|
||||
while (config_parms[indx].parm_name != "") {
|
||||
if (parm_nm == config_parms[indx].parm_name) {
|
||||
pcat = config_parms[indx].parm_cat;
|
||||
if ((pcat == PARM_CAT_00) && (threadnbr == -1)) {
|
||||
if (pcat == PARM_CAT_00) {
|
||||
motapp->parms_changed = true;
|
||||
conf_edit_cat00(motapp, parm_nm, parm_val, PARM_ACT_SET);
|
||||
} else if ((config_parms[indx].parm_cat != PARM_CAT_00) && (threadnbr != -1)) {
|
||||
|
||||
103
src/logger.cpp
103
src/logger.cpp
@@ -18,12 +18,12 @@
|
||||
|
||||
static int log_mode = LOGMODE_SYSLOG;
|
||||
static FILE *logfile = NULL;
|
||||
static unsigned int log_level = LEVEL_DEFAULT;
|
||||
static unsigned int log_type = TYPE_DEFAULT;
|
||||
|
||||
static const char *log_type_str[] = {NULL, "COR", "STR", "ENC", "NET", "DBL", "EVT", "TRK", "VID", "ALL"};
|
||||
static const char *log_level_str[] = {"EMG", "ALR", "CRT", "ERR", "WRN", "NTC", "INF", "DBG", "ALL", NULL};
|
||||
static int log_level = LEVEL_DEFAULT;
|
||||
static int log_type = TYPE_DEFAULT;
|
||||
|
||||
static const char *log_type_str[] = {NULL, "COR", "STR", "ENC", "NET", "DBL", "EVT", "TRK", "VID", "ALL"};
|
||||
static const char *log_level_str[] = {NULL, "EMG", "ALR", "CRT", "ERR", "WRN", "NTC", "INF", "DBG", "ALL"};
|
||||
static struct ctx_motapp *log_motapp; /*Used to access the parms mutex for updates*/
|
||||
|
||||
/** Returns index of log type or 0 if not valid type. */
|
||||
static int log_get_type(const char *type) {
|
||||
@@ -40,25 +40,24 @@ static int log_get_type(const char *type) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
/** Gets string value for type log level. */
|
||||
static const char* log_get_type_str(unsigned int type) {
|
||||
return log_type_str[type];
|
||||
void log_set_type(const char *new_logtype) {
|
||||
|
||||
if ( mystreq(new_logtype, log_type_str[log_type]) ) return;
|
||||
|
||||
pthread_mutex_lock(&log_motapp->mutex_parms);
|
||||
log_type = log_get_type(new_logtype);
|
||||
pthread_mutex_unlock(&log_motapp->mutex_parms);
|
||||
|
||||
}
|
||||
|
||||
/** Sets log type level. */
|
||||
static void log_set_type(unsigned int type) {
|
||||
log_type = type;
|
||||
}
|
||||
void log_set_level(int new_loglevel) {
|
||||
|
||||
/** Gets string value for log level. */
|
||||
static const char* log_get_level_str(unsigned int level) {
|
||||
/* The array is zero based vs our level values are 1 based */
|
||||
return log_level_str[level-1];
|
||||
}
|
||||
if (new_loglevel == log_level) return;
|
||||
|
||||
pthread_mutex_lock(&log_motapp->mutex_parms);
|
||||
log_level = new_loglevel;
|
||||
pthread_mutex_unlock(&log_motapp->mutex_parms);
|
||||
|
||||
/** Sets log level. */
|
||||
static void log_set_level(unsigned int level) {
|
||||
log_level = level;
|
||||
}
|
||||
|
||||
/** Sets mode of logging, could be using syslog or files. */
|
||||
@@ -92,8 +91,7 @@ static void log_set_logfile(const char *logfile_name) {
|
||||
}
|
||||
|
||||
/** Return string with human readable time */
|
||||
static char *str_time(void)
|
||||
{
|
||||
static char *str_time(void) {
|
||||
static char buffer[16];
|
||||
time_t now = 0;
|
||||
|
||||
@@ -103,29 +101,10 @@ static char *str_time(void)
|
||||
}
|
||||
|
||||
/**
|
||||
* MOTION_LOG
|
||||
*
|
||||
* This routine is used for printing all informational, debug or error
|
||||
* messages produced by any of the other motion functions. It always
|
||||
* produces a message of the form "[n] {message}", and (if the param
|
||||
* 'errno_flag' is set) follows the message with the associated error
|
||||
* message from the library.
|
||||
*
|
||||
* Parameters:
|
||||
*
|
||||
* level logging level for the 'syslog' function
|
||||
*
|
||||
* type logging type.
|
||||
*
|
||||
* errno_flag if set, the log message should be followed by the
|
||||
* error message.
|
||||
* fmt the format string for producing the message
|
||||
* ap variable-length argument list
|
||||
*
|
||||
* Returns:
|
||||
* Nothing
|
||||
* messages produced by any of the other motion functions.
|
||||
*/
|
||||
void motion_log(int level, unsigned int type, int errno_flag,int fncname, const char *fmt, ...){
|
||||
void motion_log(int level, int type, int errno_flag,int fncname, const char *fmt, ...){
|
||||
int errno_save, n;
|
||||
char buf[1024]= {0};
|
||||
char usrfmt[1024]= {0};
|
||||
@@ -138,18 +117,16 @@ void motion_log(int level, unsigned int type, int errno_flag,int fncname, const
|
||||
static char flood_msg[1024];
|
||||
char flood_repeats[1024];
|
||||
char threadname[32];
|
||||
int applvl, apptyp;
|
||||
|
||||
pthread_mutex_lock(&log_motapp->mutex_parms);
|
||||
applvl = log_level;
|
||||
apptyp = log_type;
|
||||
pthread_mutex_unlock(&log_motapp->mutex_parms);
|
||||
|
||||
|
||||
/* Exit if level is greater than log_level */
|
||||
if ((unsigned int)level > log_level){
|
||||
return;
|
||||
}
|
||||
|
||||
/* Exit if type is not equal to log_type and not TYPE_ALL */
|
||||
if ((log_type != TYPE_ALL) && (type != log_type)){
|
||||
return;
|
||||
}
|
||||
/*Exit if not our level or type */
|
||||
if (level > applvl) return;
|
||||
if ((apptyp != TYPE_ALL) && (apptyp != type)) return;
|
||||
|
||||
threadnr = (unsigned long)pthread_getspecific(tls_key_threadnr);
|
||||
|
||||
@@ -161,11 +138,11 @@ void motion_log(int level, unsigned int type, int errno_flag,int fncname, const
|
||||
|
||||
if (log_mode == LOGMODE_FILE) {
|
||||
n = snprintf(buf, sizeof(buf), "[%d:%s] [%s] [%s] [%s] ",
|
||||
threadnr, threadname, log_get_level_str(level), log_get_type_str(type),
|
||||
threadnr, threadname, log_level_str[level], log_type_str[type],
|
||||
str_time());
|
||||
} else {
|
||||
n = snprintf(buf, sizeof(buf), "[%d:%s] [%s] [%s] ",
|
||||
threadnr, threadname, log_get_level_str(level), log_get_type_str(type));
|
||||
threadnr, threadname, log_level_str[level], log_type_str[type]);
|
||||
}
|
||||
|
||||
/* Prepend the format specifier for the function name */
|
||||
@@ -213,8 +190,8 @@ void motion_log(int level, unsigned int type, int errno_flag,int fncname, const
|
||||
} else {
|
||||
if (flood_cnt > 1){
|
||||
snprintf(flood_repeats,1024,"[%d:%s] [%s] [%s] Above message repeats %d times",
|
||||
threadnr, threadname, log_get_level_str(level)
|
||||
, log_get_type_str(type), flood_cnt-1);
|
||||
threadnr, threadname, log_level_str[level]
|
||||
, log_type_str[type], flood_cnt-1);
|
||||
switch (log_mode) {
|
||||
case LOGMODE_FILE:
|
||||
strncat(flood_repeats, "\n", 1024 - strlen(flood_repeats));
|
||||
@@ -259,7 +236,7 @@ void log_init(struct ctx_motapp *motapp){
|
||||
motapp->log_level = LEVEL_DEFAULT;
|
||||
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO
|
||||
,_("Using default log level (%s) (%d)")
|
||||
,log_get_level_str(motapp->log_level)
|
||||
,log_level_str[motapp->log_level]
|
||||
,motapp->log_level);
|
||||
}
|
||||
|
||||
@@ -290,10 +267,10 @@ void log_init(struct ctx_motapp *motapp){
|
||||
motapp->log_type = log_get_type(motapp->log_type_str.c_str());
|
||||
|
||||
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Using log type (%s) log level (%s)"),
|
||||
log_get_type_str(motapp->log_type), log_get_level_str(motapp->log_level));
|
||||
log_type_str[motapp->log_type], log_level_str[motapp->log_level]);
|
||||
|
||||
log_set_level(motapp->log_level);
|
||||
log_set_type(motapp->log_type);
|
||||
log_type = motapp->log_type;
|
||||
|
||||
}
|
||||
|
||||
@@ -307,4 +284,10 @@ void log_deinit(struct ctx_motapp *motapp){
|
||||
logfile = NULL;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void log_set_motapp(struct ctx_motapp *motapp){
|
||||
/* Need better design to avoid the need to do this. Extern motapp to whole app? */
|
||||
log_motapp = motapp; /* Set our static pointer used for locking parms mutex*/
|
||||
|
||||
}
|
||||
@@ -23,21 +23,17 @@
|
||||
#define SHOW_ERRNO 1 /* Flag to show message associated to errno */
|
||||
|
||||
/* Log levels */
|
||||
/* It would be HUGELY helpful to have the motion log values start at zero instead of
|
||||
1 but that would be a headache for historical compatability...maybe think about this
|
||||
as a break later on.
|
||||
*/
|
||||
#define LOG_ALL 9
|
||||
#define EMG 1 /* syslog 0 motion 1 */
|
||||
#define ALR 2 /* syslog 1 motion 2 */
|
||||
#define CRT 3 /* syslog 2 motion 3 */
|
||||
#define ERR 4 /* syslog 3 motion 4 */
|
||||
#define WRN 5 /* syslog 4 motion 5 */
|
||||
#define NTC 6 /* syslog 5 motion 6 */
|
||||
#define INF 7 /* syslog 6 motion 7 */
|
||||
#define DBG 8 /* syslog 7 motion 8 */
|
||||
#define ALL 9 /* syslog 8 motion 9 */
|
||||
#define LEVEL_DEFAULT NTC /* syslog 5 motion 6 default */
|
||||
#define EMG 1
|
||||
#define ALR 2
|
||||
#define CRT 3
|
||||
#define ERR 4
|
||||
#define WRN 5
|
||||
#define NTC 6
|
||||
#define INF 7
|
||||
#define DBG 8
|
||||
#define ALL 9
|
||||
#define LEVEL_DEFAULT NTC
|
||||
|
||||
/* Log types */
|
||||
#define TYPE_CORE 1 /* Core logs */
|
||||
@@ -54,8 +50,11 @@
|
||||
|
||||
#define MOTION_LOG(x, y, z, format, args...) motion_log(x, y, z, 1, format, __FUNCTION__, ##args)
|
||||
|
||||
void motion_log(int level, unsigned int type, int errno_flag,int fncname, const char *fmt, ...);
|
||||
void motion_log(int loglevel, int logtype, int errno_flag,int fncname, const char *fmt, ...);
|
||||
void log_init(struct ctx_motapp *motapp);
|
||||
void log_deinit(struct ctx_motapp *motapp);
|
||||
void log_set_level(int new_level);
|
||||
void log_set_type(const char *new_logtype);
|
||||
void log_set_motapp(struct ctx_motapp *motapp);
|
||||
|
||||
#endif
|
||||
|
||||
@@ -357,6 +357,8 @@ static void motion_ntc(void){
|
||||
/** Initialize upon start up or restart */
|
||||
static void motion_startup(struct ctx_motapp *motapp, int daemonize, int argc, char *argv[]) {
|
||||
|
||||
log_set_motapp(motapp); /* This is needed prior to any function possibly calling motion_log*/
|
||||
|
||||
conf_init_app(motapp, argc, argv);
|
||||
|
||||
log_init(motapp);
|
||||
@@ -579,6 +581,7 @@ static void motion_init(struct ctx_motapp *motapp){
|
||||
|
||||
motapp->cam_list = NULL;
|
||||
pthread_mutex_init(&motapp->global_lock, NULL);
|
||||
pthread_mutex_init(&motapp->mutex_parms,NULL);
|
||||
|
||||
motapp->threads_running = 0;
|
||||
motapp->finish_all = FALSE;
|
||||
@@ -675,6 +678,7 @@ int main (int argc, char **argv) {
|
||||
|
||||
pthread_key_delete(tls_key_threadnr);
|
||||
pthread_mutex_destroy(&motapp->global_lock);
|
||||
pthread_mutex_destroy(&motapp->mutex_parms);
|
||||
|
||||
delete motapp;
|
||||
|
||||
|
||||
@@ -398,6 +398,7 @@ struct ctx_motapp {
|
||||
struct MHD_Daemon *webcontrol_daemon;
|
||||
char webcontrol_digest_rand[8];
|
||||
int parms_changed; /*bool indicating if the parms have changed */
|
||||
pthread_mutex_t mutex_parms; /* mutex used to lock when changing parms */
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -1300,76 +1300,85 @@ static void mlp_loopback(struct ctx_cam *cam){
|
||||
static void mlp_parmsupdate(struct ctx_cam *cam){
|
||||
|
||||
/* Check for some config parameter changes but only every second */
|
||||
if ((cam->shots != 0) || (cam->parms_changed = false)) return;
|
||||
if (cam->shots != 0) return;
|
||||
|
||||
draw_init_scale(cam); /* Initialize and validate text_scale */
|
||||
if (cam->parms_changed ) {
|
||||
draw_init_scale(cam); /* Initialize and validate text_scale */
|
||||
|
||||
if (cam->conf->picture_output == "on"){
|
||||
cam->new_img = NEWIMG_ON;
|
||||
} else if (cam->conf->picture_output == "first"){
|
||||
cam->new_img = NEWIMG_FIRST;
|
||||
} else if (cam->conf->picture_output == "best"){
|
||||
cam->new_img = NEWIMG_BEST;
|
||||
} else if (cam->conf->picture_output == "center"){
|
||||
cam->new_img = NEWIMG_CENTER;
|
||||
} else {
|
||||
cam->new_img = NEWIMG_OFF;
|
||||
}
|
||||
|
||||
if (cam->conf->locate_motion_mode == "on") {
|
||||
cam->locate_motion_mode = LOCATE_ON;
|
||||
} else if (cam->conf->locate_motion_mode == "preview"){
|
||||
cam->locate_motion_mode = LOCATE_PREVIEW;
|
||||
} else {
|
||||
cam->locate_motion_mode = LOCATE_OFF;
|
||||
}
|
||||
|
||||
if (cam->conf->locate_motion_style == "box"){
|
||||
cam->locate_motion_style = LOCATE_BOX;
|
||||
} else if (cam->conf->locate_motion_style == "redbox"){
|
||||
cam->locate_motion_style = LOCATE_REDBOX;
|
||||
} else if (cam->conf->locate_motion_style == "cross"){
|
||||
cam->locate_motion_style = LOCATE_CROSS;
|
||||
} else if (cam->conf->locate_motion_style == "redcross"){
|
||||
cam->locate_motion_style = LOCATE_REDCROSS;
|
||||
} else {
|
||||
cam->locate_motion_style = LOCATE_BOX;
|
||||
}
|
||||
|
||||
if (cam->conf->smart_mask_speed != cam->smartmask_speed ||
|
||||
cam->smartmask_lastrate != cam->lastrate) {
|
||||
if (cam->conf->smart_mask_speed == 0) {
|
||||
memset(cam->imgs.smartmask, 0, cam->imgs.motionsize);
|
||||
memset(cam->imgs.smartmask_final, 255, cam->imgs.motionsize);
|
||||
if (cam->conf->picture_output == "on"){
|
||||
cam->new_img = NEWIMG_ON;
|
||||
} else if (cam->conf->picture_output == "first"){
|
||||
cam->new_img = NEWIMG_FIRST;
|
||||
} else if (cam->conf->picture_output == "best"){
|
||||
cam->new_img = NEWIMG_BEST;
|
||||
} else if (cam->conf->picture_output == "center"){
|
||||
cam->new_img = NEWIMG_CENTER;
|
||||
} else {
|
||||
cam->new_img = NEWIMG_OFF;
|
||||
}
|
||||
cam->smartmask_lastrate = cam->lastrate;
|
||||
cam->smartmask_speed = cam->conf->smart_mask_speed;
|
||||
cam->smartmask_ratio = 5 * cam->lastrate * (11 - cam->smartmask_speed);
|
||||
|
||||
if (cam->conf->locate_motion_mode == "on") {
|
||||
cam->locate_motion_mode = LOCATE_ON;
|
||||
} else if (cam->conf->locate_motion_mode == "preview"){
|
||||
cam->locate_motion_mode = LOCATE_PREVIEW;
|
||||
} else {
|
||||
cam->locate_motion_mode = LOCATE_OFF;
|
||||
}
|
||||
|
||||
if (cam->conf->locate_motion_style == "box"){
|
||||
cam->locate_motion_style = LOCATE_BOX;
|
||||
} else if (cam->conf->locate_motion_style == "redbox"){
|
||||
cam->locate_motion_style = LOCATE_REDBOX;
|
||||
} else if (cam->conf->locate_motion_style == "cross"){
|
||||
cam->locate_motion_style = LOCATE_CROSS;
|
||||
} else if (cam->conf->locate_motion_style == "redcross"){
|
||||
cam->locate_motion_style = LOCATE_REDCROSS;
|
||||
} else {
|
||||
cam->locate_motion_style = LOCATE_BOX;
|
||||
}
|
||||
|
||||
if (cam->conf->smart_mask_speed != cam->smartmask_speed ||
|
||||
cam->smartmask_lastrate != cam->lastrate) {
|
||||
if (cam->conf->smart_mask_speed == 0) {
|
||||
memset(cam->imgs.smartmask, 0, cam->imgs.motionsize);
|
||||
memset(cam->imgs.smartmask_final, 255, cam->imgs.motionsize);
|
||||
}
|
||||
cam->smartmask_lastrate = cam->lastrate;
|
||||
cam->smartmask_speed = cam->conf->smart_mask_speed;
|
||||
cam->smartmask_ratio = 5 * cam->lastrate * (11 - cam->smartmask_speed);
|
||||
}
|
||||
|
||||
dbse_sqlmask_update(cam);
|
||||
|
||||
cam->threshold = cam->conf->threshold;
|
||||
if (cam->conf->threshold_maximum > cam->conf->threshold ){
|
||||
cam->threshold_maximum = cam->conf->threshold_maximum;
|
||||
} else {
|
||||
cam->threshold_maximum = (cam->imgs.height * cam->imgs.width * 3) / 2;
|
||||
}
|
||||
|
||||
if (!cam->conf->noise_tune){
|
||||
cam->noise = cam->conf->noise_level;
|
||||
}
|
||||
|
||||
if (cam->netcam != NULL){
|
||||
pthread_mutex_lock(&cam->motapp->mutex_parms);
|
||||
cam->netcam->framerate = cam->conf->framerate;
|
||||
pthread_mutex_unlock(&cam->motapp->mutex_parms);
|
||||
}
|
||||
|
||||
if (cam->netcam_high != NULL){
|
||||
pthread_mutex_lock(&cam->motapp->mutex_parms);
|
||||
cam->netcam_high->framerate = cam->conf->framerate;
|
||||
pthread_mutex_unlock(&cam->motapp->mutex_parms);
|
||||
}
|
||||
cam->parms_changed = false;
|
||||
}
|
||||
|
||||
dbse_sqlmask_update(cam);
|
||||
|
||||
cam->threshold = cam->conf->threshold;
|
||||
if (cam->conf->threshold_maximum > cam->conf->threshold ){
|
||||
cam->threshold_maximum = cam->conf->threshold_maximum;
|
||||
} else {
|
||||
cam->threshold_maximum = (cam->imgs.height * cam->imgs.width * 3) / 2;
|
||||
}
|
||||
|
||||
if (!cam->conf->noise_tune){
|
||||
cam->noise = cam->conf->noise_level;
|
||||
}
|
||||
|
||||
if (cam->netcam != NULL){
|
||||
pthread_mutex_lock(&cam->netcam->mutex_parms);
|
||||
cam->netcam->framerate = cam->conf->framerate;
|
||||
pthread_mutex_unlock(&cam->netcam->mutex_parms);
|
||||
}
|
||||
|
||||
if (cam->netcam_high != NULL){
|
||||
pthread_mutex_lock(&cam->netcam_high->mutex_parms);
|
||||
cam->netcam_high->framerate = cam->conf->framerate;
|
||||
pthread_mutex_unlock(&cam->netcam_high->mutex_parms);
|
||||
if (cam->motapp->parms_changed) {
|
||||
log_set_level(cam->motapp->log_level);
|
||||
log_set_type(cam->motapp->log_type_str.c_str());
|
||||
cam->motapp->parms_changed = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1176,49 +1176,45 @@ static void netcam_set_parms (struct ctx_cam *cam, struct ctx_netcam *netcam ) {
|
||||
MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO
|
||||
,_("Setting up %s stream."),netcam->cameratype);
|
||||
|
||||
pthread_mutex_lock(&netcam->mutex_parms);
|
||||
mycheck_passthrough(cam); /* In case it was turned on via webcontrol */
|
||||
netcam->status = NETCAM_NOTCONNECTED;
|
||||
netcam->rtsp_uses_tcp =cam->conf->netcam_use_tcp;
|
||||
netcam->v4l2_palette = cam->conf->v4l2_palette;
|
||||
netcam->framerate = cam->conf->framerate;
|
||||
netcam->src_fps = cam->conf->framerate; /* Default to conf fps */
|
||||
netcam->motapp = cam->motapp;
|
||||
netcam->conf = cam->conf;
|
||||
netcam->img_recv =(netcam_buff_ptr) mymalloc(sizeof(netcam_buff));
|
||||
netcam->img_recv->ptr =(char*) mymalloc(NETCAM_BUFFSIZE);
|
||||
netcam->img_latest =(netcam_buff_ptr) mymalloc(sizeof(netcam_buff));
|
||||
netcam->img_latest->ptr =(char*) mymalloc(NETCAM_BUFFSIZE);
|
||||
netcam->pktarray_size = 0;
|
||||
netcam->pktarray_index = -1;
|
||||
netcam->pktarray = NULL;
|
||||
netcam->handler_finished = TRUE;
|
||||
netcam->first_image = TRUE;
|
||||
netcam->reconnect_count = 0;
|
||||
cam->conf->camera_name.copy(netcam->camera_name,PATH_MAX);
|
||||
|
||||
mycheck_passthrough(cam); /* In case it was turned on via webcontrol */
|
||||
netcam->status = NETCAM_NOTCONNECTED;
|
||||
netcam->rtsp_uses_tcp =cam->conf->netcam_use_tcp;
|
||||
netcam->v4l2_palette = cam->conf->v4l2_palette;
|
||||
netcam->framerate = cam->conf->framerate;
|
||||
netcam->src_fps = cam->conf->framerate; /* Default to conf fps */
|
||||
netcam->motapp = cam->motapp;
|
||||
netcam->conf = cam->conf;
|
||||
netcam->img_recv =(netcam_buff_ptr) mymalloc(sizeof(netcam_buff));
|
||||
netcam->img_recv->ptr =(char*) mymalloc(NETCAM_BUFFSIZE);
|
||||
netcam->img_latest =(netcam_buff_ptr) mymalloc(sizeof(netcam_buff));
|
||||
netcam->img_latest->ptr =(char*) mymalloc(NETCAM_BUFFSIZE);
|
||||
netcam->pktarray_size = 0;
|
||||
netcam->pktarray_index = -1;
|
||||
netcam->pktarray = NULL;
|
||||
netcam->handler_finished = TRUE;
|
||||
netcam->first_image = TRUE;
|
||||
netcam->reconnect_count = 0;
|
||||
cam->conf->camera_name.copy(netcam->camera_name,PATH_MAX);
|
||||
snprintf(netcam->threadname, 15, "%s",_("Unknown"));
|
||||
|
||||
snprintf(netcam->threadname, 15, "%s",_("Unknown"));
|
||||
clock_gettime(CLOCK_REALTIME, &netcam->interruptstarttime);
|
||||
clock_gettime(CLOCK_REALTIME, &netcam->interruptcurrenttime);
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &netcam->interruptstarttime);
|
||||
clock_gettime(CLOCK_REALTIME, &netcam->interruptcurrenttime);
|
||||
/* If this is the norm and we have a highres, then disable passthru on the norm */
|
||||
if ((!netcam->high_resolution) &&
|
||||
(cam->conf->netcam_highres != "")) {
|
||||
netcam->passthrough = FALSE;
|
||||
} else {
|
||||
netcam->passthrough = mycheck_passthrough(cam);
|
||||
}
|
||||
netcam->interruptduration = 5;
|
||||
netcam->interrupted = FALSE;
|
||||
|
||||
/* If this is the norm and we have a highres, then disable passthru on the norm */
|
||||
if ((!netcam->high_resolution) &&
|
||||
(cam->conf->netcam_highres != "")) {
|
||||
netcam->passthrough = FALSE;
|
||||
} else {
|
||||
netcam->passthrough = mycheck_passthrough(cam);
|
||||
}
|
||||
netcam->interruptduration = 5;
|
||||
netcam->interrupted = FALSE;
|
||||
clock_gettime(CLOCK_REALTIME, &netcam->frame_curr_tm);
|
||||
clock_gettime(CLOCK_REALTIME, &netcam->frame_prev_tm);
|
||||
|
||||
clock_gettime(CLOCK_REALTIME, &netcam->frame_curr_tm);
|
||||
clock_gettime(CLOCK_REALTIME, &netcam->frame_prev_tm);
|
||||
|
||||
netcam_set_path(cam, netcam);
|
||||
|
||||
pthread_mutex_unlock(&netcam->mutex_parms);
|
||||
netcam_set_path(cam, netcam);
|
||||
|
||||
}
|
||||
|
||||
@@ -1526,9 +1522,9 @@ static void netcam_handler_wait(struct ctx_netcam *netcam){
|
||||
int framerate;
|
||||
long usec_maxrate, usec_delay;
|
||||
|
||||
pthread_mutex_lock(&netcam->mutex_parms);
|
||||
pthread_mutex_lock(&netcam->motapp->mutex_parms);
|
||||
framerate = netcam->framerate;
|
||||
pthread_mutex_unlock(&netcam->mutex_parms);
|
||||
pthread_mutex_unlock(&netcam->motapp->mutex_parms);
|
||||
|
||||
if (framerate < 2) framerate = 2;
|
||||
|
||||
@@ -1646,7 +1642,6 @@ static int netcam_start_handler(struct ctx_netcam *netcam){
|
||||
pthread_mutex_init(&netcam->mutex, NULL);
|
||||
pthread_mutex_init(&netcam->mutex_pktarray, NULL);
|
||||
pthread_mutex_init(&netcam->mutex_transfer, NULL);
|
||||
pthread_mutex_init(&netcam->mutex_parms,NULL);
|
||||
|
||||
pthread_attr_init(&handler_attribute);
|
||||
pthread_attr_setdetachstate(&handler_attribute, PTHREAD_CREATE_DETACHED);
|
||||
@@ -1866,7 +1861,6 @@ void netcam_cleanup(struct ctx_cam *cam, int init_retry_flag){
|
||||
pthread_mutex_destroy(&netcam->mutex);
|
||||
pthread_mutex_destroy(&netcam->mutex_pktarray);
|
||||
pthread_mutex_destroy(&netcam->mutex_transfer);
|
||||
pthread_mutex_destroy(&netcam->mutex_parms);
|
||||
|
||||
free(netcam);
|
||||
netcam = NULL;
|
||||
|
||||
@@ -117,8 +117,6 @@ struct ctx_netcam {
|
||||
pthread_mutex_t mutex; /* mutex used with conditional waits */
|
||||
pthread_mutex_t mutex_transfer; /* mutex used with transferring stream info for pass-through */
|
||||
pthread_mutex_t mutex_pktarray; /* mutex used with the packet array */
|
||||
pthread_mutex_t mutex_parms; /* mutex used with the parms */
|
||||
|
||||
};
|
||||
|
||||
int netcam_setup(struct ctx_cam *cam);
|
||||
|
||||
@@ -703,10 +703,9 @@ static int webu_process_config_set(struct webui_ctx *webui) {
|
||||
* then we ignore the request
|
||||
*/
|
||||
if (config_parms[indx].parm_name != ""){
|
||||
if (strlen(webui->uri_parm1) > 0){
|
||||
|
||||
if (strlen(webui->uri_value1) > 0){
|
||||
conf_edit_set(webui->camlst[webui->thread_nbr]->motapp,webui->thread_nbr
|
||||
,config_parms[indx].parm_name, webui->uri_parm1);
|
||||
,config_parms[indx].parm_name, webui->uri_value1);
|
||||
|
||||
/*If we are updating vid parms, set the flag to update the device.*/
|
||||
if ((config_parms[indx].parm_name == "vid_control_params") &&
|
||||
|
||||
Reference in New Issue
Block a user