Initialize the cam on start

This commit is contained in:
MrDave
2019-10-20 10:11:21 -06:00
committed by Mr-Dave
parent 24ef6c3e9a
commit 720a5a0f6e
3 changed files with 12 additions and 17 deletions

View File

@@ -955,6 +955,7 @@ static void conf_parm_camera(struct ctx_motapp *motapp, char *str) {
motapp->cam_list = (struct ctx_cam **)myrealloc(
motapp->cam_list, sizeof(struct ctx_cam *) * (indx_cams + 2), "config_camera");
motapp->cam_list[indx_cams] = new ctx_cam;
memset(motapp->cam_list[indx_cams],0,sizeof(struct ctx_cam));
motapp->cam_list[indx_cams + 1] = NULL;
conf_edit_dflt_cam(motapp->cam_list[indx_cams]);
@@ -1274,7 +1275,6 @@ void conf_init_app(struct ctx_motapp *motapp, int argc, char *argv[]){
/* Now we process the motion.conf config file and close it. */
if (fp) {
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Processing config file %s"), filename);
conf_edit_set(motapp, -1, (char*)"conf_filename", (char*)filename);
@@ -1298,6 +1298,7 @@ void conf_init_cams(struct ctx_motapp *motapp){
motapp->cam_list = (struct ctx_cam**)calloc(sizeof(struct ctx_cam *), 2);
motapp->cam_list[0] = new ctx_cam;
memset(motapp->cam_list[0],0,sizeof(struct ctx_cam));
motapp->cam_list[1] = NULL;
motapp->cam_list[0]->motapp = motapp;
@@ -1337,7 +1338,7 @@ void conf_deinit(struct ctx_motapp *motapp) {
indx = 0;
while (motapp->cam_list[indx] != NULL){
conf_edit_free(motapp->cam_list[indx]);
free(motapp->cam_list[indx]);
delete motapp->cam_list[indx];
indx++;
}

View File

@@ -2822,7 +2822,9 @@ void conf_edit_set(struct ctx_motapp *motapp, int threadnbr, char *cmd, char *ar
if (conf_edit_set_depr(motapp, threadnbr, cmd, arg1) == 0) return;
MOTION_LOG(ALR, TYPE_ALL, NO_ERRNO, _("Unknown config option \"%s\""), cmd);
if (threadnbr != -1){
MOTION_LOG(ALR, TYPE_ALL, NO_ERRNO, _("Unknown config option \"%s\""), cmd);
}
}

View File

@@ -385,15 +385,19 @@ static void mlp_init_buffers(struct ctx_cam *cam){
static void mlp_init_values(struct ctx_cam *cam) {
/* cam has been initialized to 0 upon creation
* so we only need to initialize non zero values*/
clock_gettime(CLOCK_REALTIME, &cam->frame_last_ts);
clock_gettime(CLOCK_REALTIME, &cam->frame_curr_ts);
cam->smartmask_speed = 0;
cam->event_nr = 1;
cam->prev_event = 0;
/* These are soon to be changed to bools so we leave the init for now*/
cam->detecting_motion = FALSE;
cam->event_user = FALSE;
cam->event_stop = FALSE;
cam->passflag = FALSE; //only purpose to flag first frame
/* Make sure to default the high res to zero */
cam->imgs.width_high = 0;
@@ -414,18 +418,6 @@ static void mlp_init_values(struct ctx_cam *cam) {
cam->minimum_frame_time_downcounter = cam->conf.minimum_frame_time;
cam->get_image = 1;
cam->olddiffs = 0;
cam->smartmask_ratio = 0;
cam->smartmask_count = 20;
cam->previous_diffs = 0;
cam->previous_location_x = 0;
cam->previous_location_y = 0;
cam->smartmask_lastrate = 0;
cam->passflag = 0; //only purpose to flag first frame
cam->movie_passthrough = cam->conf.movie_passthrough;
if ((cam->camera_type != CAMERA_TYPE_NETCAM) &&
(cam->movie_passthrough)) {