From 71f1a6fe22347fda79b58bb0c6dc7c43a6d7437f Mon Sep 17 00:00:00 2001 From: MrDave Date: Wed, 24 Mar 2021 22:13:52 -0600 Subject: [PATCH] Revise to use bools --- src/alg_sec.cpp | 6 ++-- src/conf.cpp | 73 +++++++++++++++++++++++---------------------- src/conf.hpp | 40 ++++++++++++------------- src/dbse.cpp | 4 +-- src/jpegutils.cpp | 18 +++++------ src/motion_loop.cpp | 28 ++++++++--------- src/motionplus.hpp | 44 +++++++++++++-------------- src/movie.cpp | 38 +++++++++++------------ src/movie.hpp | 8 ++--- src/netcam.cpp | 8 +++-- src/netcam.hpp | 18 +++++------ src/util.cpp | 23 +++++++------- src/util.hpp | 2 +- src/video_v4l2.cpp | 14 ++++----- src/video_v4l2.hpp | 4 +-- src/webu_json.cpp | 6 ++-- src/webu_post.cpp | 4 +-- 17 files changed, 171 insertions(+), 167 deletions(-) diff --git a/src/alg_sec.cpp b/src/alg_sec.cpp index 4ee538a0..d3a9cfd3 100644 --- a/src/alg_sec.cpp +++ b/src/alg_sec.cpp @@ -398,7 +398,7 @@ static void algsec_params_init(ctx_algsec_model &algmdl) memset(algmdl.algsec_params, 0, sizeof(struct ctx_params)); algmdl.algsec_params->params_array = NULL; algmdl.algsec_params->params_count = 0; - algmdl.algsec_params->update_params = TRUE; /*Set trigger to update parameters */ + algmdl.algsec_params->update_params = true; /*Set trigger to update parameters */ } /**Load the parms from the config to algsec struct */ @@ -452,10 +452,10 @@ static int algsec_load_models(ctx_cam *cam) /* If model fails to load, it sets method to zero*/ if (cam->algsec->models.method != 0){ - cam->algsec_inuse = TRUE; + cam->algsec_inuse = true; return 0; } else { - cam->algsec_inuse = FALSE; + cam->algsec_inuse = false; return -1; } diff --git a/src/conf.cpp b/src/conf.cpp index fcd43561..efaa1be2 100644 --- a/src/conf.cpp +++ b/src/conf.cpp @@ -868,18 +868,18 @@ struct ctx_parm_depr config_parms_depr[] = { { "","","",""} }; -static void conf_edit_set_bool(int &parm_dest, std::string &parm_in) +static void conf_edit_set_bool(bool &parm_dest, std::string &parm_in) { if ((parm_in == "1") || (parm_in == "yes") || (parm_in == "on") || (parm_in == "true") ) { - parm_dest = TRUE; + parm_dest = true; } else { - parm_dest = FALSE; + parm_dest = false; } } -static void conf_edit_get_bool(std::string &parm_dest, int &parm_in) +static void conf_edit_get_bool(std::string &parm_dest, bool &parm_in) { - if (parm_in == TRUE) { + if (parm_in == true) { parm_dest = "on"; } else { parm_dest = "off"; @@ -889,7 +889,7 @@ static void conf_edit_get_bool(std::string &parm_dest, int &parm_in) static void conf_edit_daemon(struct ctx_motapp *motapp, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - motapp->daemon = FALSE; + motapp->daemon = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(motapp->daemon, parm); } else if (pact == PARM_ACT_GET) { @@ -902,7 +902,7 @@ static void conf_edit_daemon(struct ctx_motapp *motapp, std::string &parm, enum static void conf_edit_setup_mode(struct ctx_motapp *motapp, std::string &parm, int pact) { if (pact == PARM_ACT_DFLT) { - motapp->setup_mode = FALSE; + motapp->setup_mode = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(motapp->setup_mode, parm); } else if (pact == PARM_ACT_GET) { @@ -1005,7 +1005,7 @@ static void conf_edit_log_type(struct ctx_motapp *motapp, std::string &parm, enu static void conf_edit_native_language(struct ctx_motapp *motapp, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - motapp->native_language = TRUE; + motapp->native_language = true; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(motapp->native_language, parm); } else if (pact == PARM_ACT_GET) { @@ -1464,7 +1464,7 @@ static void conf_edit_text_right(struct ctx_cam *cam, std::string &parm, enum PA static void conf_edit_text_changes(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->text_changes = FALSE; + cam->conf->text_changes = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->text_changes, parm); } else if (pact == PARM_ACT_GET) { @@ -1514,7 +1514,7 @@ static void conf_edit_text_event(struct ctx_cam *cam, std::string &parm, enum PA static void conf_edit_emulate_motion(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->emulate_motion = FALSE; + cam->conf->emulate_motion = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->emulate_motion, parm); } else if (pact == PARM_ACT_GET) { @@ -1660,7 +1660,7 @@ static void conf_edit_threshold_ratio(struct ctx_cam *cam, std::string &parm, en static void conf_edit_threshold_tune(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->threshold_tune = FALSE; + cam->conf->threshold_tune = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->threshold_tune, parm); } else if (pact == PARM_ACT_GET) { @@ -1743,7 +1743,7 @@ static void conf_edit_noise_level(struct ctx_cam *cam, std::string &parm, enum P static void conf_edit_noise_tune(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->noise_tune = TRUE; + cam->conf->noise_tune = true; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->noise_tune, parm); } else if (pact == PARM_ACT_GET) { @@ -2242,7 +2242,7 @@ static void conf_edit_snapshot_filename(struct ctx_cam *cam, std::string &parm, static void conf_edit_movie_output(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->movie_output = TRUE; + cam->conf->movie_output = true; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->movie_output, parm); } else if (pact == PARM_ACT_GET) { @@ -2255,7 +2255,7 @@ static void conf_edit_movie_output(struct ctx_cam *cam, std::string &parm, enum static void conf_edit_movie_output_motion(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->movie_output_motion = FALSE; + cam->conf->movie_output_motion = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->movie_output_motion, parm); } else if (pact == PARM_ACT_GET) { @@ -2338,7 +2338,7 @@ static void conf_edit_movie_codec(struct ctx_cam *cam, std::string &parm, enum P static void conf_edit_movie_passthrough(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->movie_passthrough = FALSE; + cam->conf->movie_passthrough = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->movie_passthrough, parm); } else if (pact == PARM_ACT_GET) { @@ -2364,7 +2364,7 @@ static void conf_edit_movie_filename(struct ctx_cam *cam, std::string &parm, enu static void conf_edit_movie_extpipe_use(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->movie_extpipe_use = FALSE; + cam->conf->movie_extpipe_use = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->movie_extpipe_use, parm); } else if (pact == PARM_ACT_GET) { @@ -2535,7 +2535,7 @@ static void conf_edit_webcontrol_port(struct ctx_cam *cam, std::string &parm, en static void conf_edit_webcontrol_ipv6(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->webcontrol_ipv6 = FALSE; + cam->conf->webcontrol_ipv6 = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->webcontrol_ipv6, parm); } else if (pact == PARM_ACT_GET) { @@ -2548,7 +2548,7 @@ static void conf_edit_webcontrol_ipv6(struct ctx_cam *cam, std::string &parm, en static void conf_edit_webcontrol_localhost(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->webcontrol_localhost = TRUE; + cam->conf->webcontrol_localhost = true; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->webcontrol_localhost, parm); } else if (pact == PARM_ACT_GET) { @@ -2643,7 +2643,7 @@ static void conf_edit_webcontrol_authentication(struct ctx_cam *cam, std::string static void conf_edit_webcontrol_tls(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->webcontrol_tls = FALSE; + cam->conf->webcontrol_tls = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->webcontrol_tls, parm); } else if (pact == PARM_ACT_GET) { @@ -2740,7 +2740,7 @@ static void conf_edit_stream_preview_scale(struct ctx_cam *cam, std::string &par static void conf_edit_stream_preview_newline(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->stream_preview_newline = FALSE; + cam->conf->stream_preview_newline = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->stream_preview_newline, parm); } else if (pact == PARM_ACT_GET) { @@ -2808,7 +2808,7 @@ static void conf_edit_stream_quality(struct ctx_cam *cam, std::string &parm, enu static void conf_edit_stream_grey(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->stream_grey = FALSE; + cam->conf->stream_grey = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->stream_grey, parm); } else if (pact == PARM_ACT_GET) { @@ -2821,7 +2821,7 @@ static void conf_edit_stream_grey(struct ctx_cam *cam, std::string &parm, enum P static void conf_edit_stream_motion(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->stream_motion = FALSE; + cam->conf->stream_motion = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->stream_motion, parm); } else if (pact == PARM_ACT_GET) { @@ -2965,7 +2965,7 @@ static void conf_edit_database_busy_timeout(struct ctx_cam *cam, std::string &pa static void conf_edit_sql_log_picture(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->sql_log_picture = FALSE; + cam->conf->sql_log_picture = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->sql_log_picture, parm); } else if (pact == PARM_ACT_GET) { @@ -2978,7 +2978,7 @@ static void conf_edit_sql_log_picture(struct ctx_cam *cam, std::string &parm, en static void conf_edit_sql_log_snapshot(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->sql_log_snapshot = FALSE; + cam->conf->sql_log_snapshot = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->sql_log_snapshot, parm); } else if (pact == PARM_ACT_GET) { @@ -2991,7 +2991,7 @@ static void conf_edit_sql_log_snapshot(struct ctx_cam *cam, std::string &parm, e static void conf_edit_sql_log_movie(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->sql_log_movie = FALSE; + cam->conf->sql_log_movie = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->sql_log_movie, parm); } else if (pact == PARM_ACT_GET) { @@ -3004,7 +3004,7 @@ static void conf_edit_sql_log_movie(struct ctx_cam *cam, std::string &parm, enum static void conf_edit_sql_log_timelapse(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->sql_log_timelapse = FALSE; + cam->conf->sql_log_timelapse = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->sql_log_timelapse, parm); } else if (pact == PARM_ACT_GET) { @@ -3056,7 +3056,7 @@ static void conf_edit_sql_query(struct ctx_cam *cam, std::string &parm, enum PAR static void conf_edit_ptz_auto_track(struct ctx_cam *cam, std::string &parm, enum PARM_ACT pact) { if (pact == PARM_ACT_DFLT) { - cam->conf->ptz_auto_track = FALSE; + cam->conf->ptz_auto_track = false; } else if (pact == PARM_ACT_SET) { conf_edit_set_bool(cam->conf->ptz_auto_track, parm); } else if (pact == PARM_ACT_GET) { @@ -3813,7 +3813,7 @@ static void conf_cmdline(struct ctx_motapp *motapp) conf_edit_set(motapp, true, 0, "log_file", optarg); break; case 'm': - motapp->pause = TRUE; + motapp->pause = true; break; case 'h': case '?': @@ -3836,7 +3836,7 @@ static void conf_camera_filenm(struct ctx_motapp *motapp) src_nm= src_nm.substr(0, src_nm.find_last_of("/")+1 ); indx = 1; - while (TRUE) { + while (true) { fullnm = src_nm + "camera" + std::to_string(indx) + ".conf"; /* MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, _("Trying %s"), fullnm.c_str()); @@ -3974,7 +3974,7 @@ static void conf_parm_camera_dir(struct ctx_motapp *motapp, std::string str) */ i = 0; while (motapp->cam_list[++i]); - motapp->cam_list[i-1]->from_conf_dir = TRUE; + motapp->cam_list[i-1]->from_conf_dir = true; } } closedir(dp); @@ -4049,9 +4049,9 @@ void conf_process(struct ctx_motapp *motapp, bool ismotapp, FILE *fp, int threa parm_val= std::string(arg1); } - if (mystreq(cmd,"camera_dir") && (threadnbr == 0) && (ismotapp == FALSE) ) { + if (mystreq(cmd,"camera_dir") && (threadnbr == 0) && (ismotapp == false) ) { conf_parm_camera_dir(motapp, parm_val); - } else if (mystreq(cmd,"camera") && (threadnbr == 0) && (ismotapp == FALSE)) { + } else if (mystreq(cmd,"camera") && (threadnbr == 0) && (ismotapp == false)) { conf_parm_camera(motapp, parm_val); } else if (mystrne(cmd,"camera") && mystrne(cmd,"camera_dir")) { conf_edit_set(motapp, ismotapp, threadnbr, parm_nm, parm_val); @@ -4065,7 +4065,8 @@ void conf_process(struct ctx_motapp *motapp, bool ismotapp, FILE *fp, int threa /** Write the configuration(s) to the log */ void conf_parms_log(struct ctx_cam **cam_list) { - int i, threadnbr, diff_val; + int i, threadnbr; + bool diff_val; std::string parm_val, parm_main; MOTION_LOG(INF, TYPE_ALL, NO_ERRNO @@ -4076,14 +4077,14 @@ void conf_parms_log(struct ctx_cam **cam_list) ,_("Camera %d - Config file: %s"), threadnbr, cam_list[threadnbr]->conf_filename); i = 0; while (config_parms[i].parm_name != "") { - diff_val = TRUE; + diff_val = true; conf_edit_get(cam_list[threadnbr], config_parms[i].parm_name , parm_val ,config_parms[i].parm_cat); if (threadnbr > 0) { conf_edit_get(cam_list[0], config_parms[i].parm_name , parm_main ,config_parms[i].parm_cat); if (parm_val == parm_main) { - diff_val = FALSE; + diff_val = false; } } if (diff_val) { @@ -4167,7 +4168,7 @@ void conf_parms_write(struct ctx_motapp *motapp) } if ((config_parms[indx].parm_name == "camera") && (indx_cam == 0)) { fprintf(conffile, "%s\n", config_parms[indx].parm_help.c_str()); - if (motapp->cam_list[0]->from_conf_dir == FALSE) { + if (motapp->cam_list[0]->from_conf_dir == false) { indx2 = 1; while (motapp->cam_list[indx2] != NULL) { if (parm_val.compare(0, 1, " ") == 0) { diff --git a/src/conf.hpp b/src/conf.hpp index 6702b2ab..8502d3ab 100644 --- a/src/conf.hpp +++ b/src/conf.hpp @@ -58,12 +58,12 @@ std::string locate_motion_style; std::string text_left; std::string text_right; - int text_changes; + bool text_changes; int text_scale; std::string text_event; /* Motion detection configuration parameters */ - int emulate_motion; + bool emulate_motion; int primary_method; int threshold; int threshold_maximum; @@ -71,12 +71,12 @@ int threshold_sdevy; int threshold_sdevxy; int threshold_ratio; - int threshold_tune; + bool threshold_tune; int secondary_interval; int secondary_method; std::string secondary_params; int noise_level; - int noise_tune; + bool noise_tune; std::string despeckle_filter; std::string area_detect; std::string mask_file; @@ -115,15 +115,15 @@ std::string snapshot_filename; /* Movie output configuration parameters */ - int movie_output; - int movie_output_motion; + bool movie_output; + bool movie_output_motion; int movie_max_time; int movie_bps; int movie_quality; std::string movie_codec; - int movie_passthrough; + bool movie_passthrough; std::string movie_filename; - int movie_extpipe_use; + bool movie_extpipe_use; std::string movie_extpipe; /* Timelapse movie configuration parameters */ @@ -139,13 +139,13 @@ /* Webcontrol configuration parameters */ int webcontrol_port; - int webcontrol_ipv6; - int webcontrol_localhost; + bool webcontrol_ipv6; + bool webcontrol_localhost; int webcontrol_parms; int webcontrol_interface; int webcontrol_auth_method; std::string webcontrol_authentication; - int webcontrol_tls; + bool webcontrol_tls; std::string webcontrol_cert; std::string webcontrol_key; std::string webcontrol_cors_header; @@ -153,12 +153,12 @@ /* Live stream configuration parameters */ int stream_preview_scale; - int stream_preview_newline; + bool stream_preview_newline; int stream_preview_method; - int stream_preview_ptz; + bool stream_preview_ptz; int stream_quality; - int stream_grey; - int stream_motion; + bool stream_grey; + bool stream_motion; int stream_maxrate; /* Database and SQL configuration parameters */ @@ -170,15 +170,15 @@ std::string database_password; int database_busy_timeout; - int sql_log_picture; - int sql_log_snapshot; - int sql_log_movie; - int sql_log_timelapse; + bool sql_log_picture; + bool sql_log_snapshot; + bool sql_log_movie; + bool sql_log_timelapse; std::string sql_query_start; std::string sql_query_stop; std::string sql_query; - int ptz_auto_track; /* Bool to enable auto tracking */ + bool ptz_auto_track; /* Bool to enable auto tracking */ int ptz_wait; /* Frames to wait after a PTZ move */ std::string ptz_move_track; /* Auto tracking command */ std::string ptz_pan_left; /* Pan left command */ diff --git a/src/dbse.cpp b/src/dbse.cpp index d620ab39..f626c12c 100644 --- a/src/dbse.cpp +++ b/src/dbse.cpp @@ -208,7 +208,7 @@ static void dbse_init_mysql(struct ctx_cam *cam) return; } #if (defined(MYSQL_VERSION_ID)) && (MYSQL_VERSION_ID > 50012) - my_bool my_true = TRUE; + my_bool my_true = true; mysql_options(cam->dbse->database_mysql, MYSQL_OPT_RECONNECT, &my_true); #endif #else @@ -247,7 +247,7 @@ static void dbse_init_mariadb(struct ctx_cam *cam) return; } #if (defined(MYSQL_VERSION_ID)) && (MYSQL_VERSION_ID > 50012) - my_bool my_true = TRUE; + my_bool my_true = true; mysql_options(cam->dbse->database_mariadb, MYSQL_OPT_RECONNECT, &my_true); #endif #else diff --git a/src/jpegutils.cpp b/src/jpegutils.cpp index e0e75545..4ee1ec18 100644 --- a/src/jpegutils.cpp +++ b/src/jpegutils.cpp @@ -200,7 +200,7 @@ static boolean jpgutl_fill_input_buffer(j_decompress_ptr cinfo) { cinfo->src->next_input_byte = EOI_data; cinfo->src->bytes_in_buffer = 2; - return TRUE; + return true; } /* @@ -352,7 +352,7 @@ METHODDEF(boolean) empty_output_buffer(j_compress_ptr cinfo) dest->pub.next_output_byte = dest->buf; dest->pub.free_in_buffer = dest->bufsize; - return FALSE; + return false; ERREXIT(cinfo, JERR_BUFFER_SIZE); } @@ -453,7 +453,7 @@ int jpgutl_decode_jpeg (unsigned char *jpeg_data_in, int jpeg_data_len, jpgutl_buffer_src (&dinfo, jpeg_data_in, jpeg_data_len); - jpeg_read_header (&dinfo, TRUE); + jpeg_read_header (&dinfo, true); //420 sampling is the default for YCbCr so no need to override. dinfo.out_color_space = JCS_YCbCr; @@ -561,9 +561,9 @@ int jpgutl_put_yuv420p(unsigned char *dest_image, int image_size, jpeg_set_colorspace(&cinfo, JCS_YCbCr); - cinfo.raw_data_in = TRUE; // Supply downsampled data + cinfo.raw_data_in = true; // Supply downsampled data #if JPEG_LIB_VERSION >= 70 - cinfo.do_fancy_downsampling = FALSE; // Fix segfault with v7 + cinfo.do_fancy_downsampling = false; // Fix segfault with v7 #endif cinfo.comp_info[0].h_samp_factor = 2; cinfo.comp_info[0].v_samp_factor = 2; @@ -572,13 +572,13 @@ int jpgutl_put_yuv420p(unsigned char *dest_image, int image_size, cinfo.comp_info[2].h_samp_factor = 1; cinfo.comp_info[2].v_samp_factor = 1; - jpeg_set_quality(&cinfo, quality, TRUE); + jpeg_set_quality(&cinfo, quality, true); cinfo.dct_method = JDCT_FASTEST; _jpeg_mem_dest(&cinfo, dest_image, image_size); // Data written to mem - jpeg_start_compress(&cinfo, TRUE); + jpeg_start_compress(&cinfo, true); put_jpeg_exif(&cinfo, cam, ts1, box); @@ -642,11 +642,11 @@ int jpgutl_put_grey(unsigned char *dest_image, int image_size, jpeg_set_defaults(&cjpeg); - jpeg_set_quality(&cjpeg, quality, TRUE); + jpeg_set_quality(&cjpeg, quality, true); cjpeg.dct_method = JDCT_FASTEST; _jpeg_mem_dest(&cjpeg, dest_image, image_size); // Data written to mem - jpeg_start_compress (&cjpeg, TRUE); + jpeg_start_compress (&cjpeg, true); put_jpeg_exif(&cjpeg, cam, ts1, box); diff --git a/src/motion_loop.cpp b/src/motion_loop.cpp index 06beff20..40c9dd35 100644 --- a/src/motion_loop.cpp +++ b/src/motion_loop.cpp @@ -367,7 +367,7 @@ void mlp_cam_close(struct ctx_cam *cam) MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO,_("calling mmalcam_cleanup")); mmalcam_cleanup(cam->mmalcam); cam->mmalcam = NULL; - cam->running_cam = FALSE; + cam->running_cam = false; return; } @@ -628,7 +628,7 @@ static void mlp_init_values(struct ctx_cam *cam) if ((cam->camera_type != CAMERA_TYPE_NETCAM) && (cam->movie_passthrough)) { MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Pass-through processing disabled.")); - cam->movie_passthrough = FALSE; + cam->movie_passthrough = false; } } @@ -1266,11 +1266,11 @@ static void mlp_actions_emulate(struct ctx_cam *cam) int indx; - if ( (cam->detecting_motion == FALSE) && (cam->movie_norm != NULL) ) { + if ( (cam->detecting_motion == false) && (cam->movie_norm != NULL) ) { movie_reset_start_time(cam->movie_norm, &cam->current_image->imgts); } - cam->detecting_motion = TRUE; + cam->detecting_motion = true; if (cam->conf->post_capture > 0) { cam->postcap = cam->conf->post_capture; } @@ -1305,10 +1305,10 @@ static void mlp_actions_motion(struct ctx_cam *cam) cam->current_image->flags |= (IMAGE_TRIGGER | IMAGE_SAVE); - if ( (cam->detecting_motion == FALSE) && (cam->movie_norm != NULL) ) { + if ( (cam->detecting_motion == false) && (cam->movie_norm != NULL) ) { movie_reset_start_time(cam->movie_norm, &cam->current_image->imgts); } - cam->detecting_motion = TRUE; + cam->detecting_motion = true; cam->postcap = cam->conf->post_capture; for (indx = 0; indx < cam->imgs.ring_size; indx++) { @@ -1332,11 +1332,11 @@ static void mlp_actions_event(struct ctx_cam *cam) if ((cam->conf->movie_max_time > 0) && (cam->event_nr == cam->prev_event) && ((cam->frame_curr_ts.tv_sec - cam->eventtime) >= cam->conf->movie_max_time)) { - cam->event_stop = TRUE; + cam->event_stop = true; } if ((cam->conf->event_gap > 0) && ((cam->frame_curr_ts.tv_sec - cam->lasttime) >= cam->conf->event_gap)) { - cam->event_stop = TRUE; + cam->event_stop = true; } if (cam->event_stop) { @@ -1365,8 +1365,8 @@ static void mlp_actions_event(struct ctx_cam *cam) cam->event_nr++; cam->text_event_string[0] = '\0'; } - cam->event_stop = FALSE; - cam->event_user = FALSE; + cam->event_stop = false; + cam->event_user = false; } } @@ -1388,9 +1388,9 @@ static void mlp_actions(struct ctx_cam *cam) } else { cam->current_image->flags |= IMAGE_PRECAP; if ((cam->conf->event_gap == 0) && cam->detecting_motion) { - cam->event_stop = TRUE; + cam->event_stop = true; } - cam->detecting_motion = FALSE; + cam->detecting_motion = false; } if (cam->current_image->flags & IMAGE_SAVE) { @@ -1651,9 +1651,9 @@ void *motion_loop(void *arg) { struct ctx_cam *cam =(struct ctx_cam *) arg; - cam->restart_cam = TRUE; + cam->restart_cam = true; cam->watchdog = cam->conf->watchdog_tmo; - cam->running_cam = TRUE; + cam->running_cam = true; if (mlp_init(cam) == 0) { while (!cam->finish_cam || cam->event_stop) { diff --git a/src/motionplus.hpp b/src/motionplus.hpp index 919f5e7c..8afce318 100644 --- a/src/motionplus.hpp +++ b/src/motionplus.hpp @@ -118,8 +118,6 @@ struct ctx_v4l2cam; #define UPDATE_REF_FRAME 1 #define RESET_REF_FRAME 2 -#define TRUE 1 -#define FALSE 0 #define AVGCNT 30 /* @@ -175,7 +173,7 @@ struct ctx_params_item { struct ctx_params { struct ctx_params_item *params_array; /*Array of the controls the user specified*/ int params_count; /*Count of the controls the user specified*/ - int update_params; /*Bool for whether to update the parameters on the device*/ + bool update_params; /*Bool for whether to update the parameters on the device*/ }; struct ctx_coord { @@ -278,7 +276,7 @@ struct ctx_cam { struct ctx_motapp *motapp; char conf_filename[PATH_MAX]; - int from_conf_dir; + bool from_conf_dir; int threadnr; pthread_t thread_id; @@ -299,7 +297,7 @@ struct ctx_cam { FILE *extpipe; int extpipe_open; - int algsec_inuse; /*Bool for whether we have secondary detection*/ + bool algsec_inuse; /*Bool for whether we have secondary detection*/ int track_posx; int track_posy; int camera_id; @@ -313,12 +311,12 @@ struct ctx_cam { int diffs_last[THRESHOLD_TUNE_LENGTH]; int smartmask_speed; - volatile unsigned int snapshot; /* Make a snapshot */ - volatile unsigned int event_stop; /* Boolean for whether to stop a event */ - volatile unsigned int event_user; /* Boolean for whether to user triggered an event */ - volatile unsigned int finish_cam; /* End the thread */ - volatile unsigned int restart_cam; /* Restart the thread when it ends */ - volatile unsigned int running_cam; + volatile bool snapshot; /* Make a snapshot */ + volatile bool event_stop; /* Boolean for whether to stop a event */ + volatile bool event_user; /* Boolean for whether to user triggered an event */ + volatile bool finish_cam; /* End the thread */ + volatile bool restart_cam; /* Restart the thread when it ends */ + bool running_cam; volatile int watchdog; int event_nr; @@ -330,7 +328,7 @@ struct ctx_cam { int postcap; /* downcounter, frames left to to send post event */ int shots; int ref_lag; - unsigned int detecting_motion; + bool detecting_motion; long frame_wait[AVGCNT]; /* Last wait times through motion loop*/ struct timespec frame_curr_ts; @@ -342,7 +340,7 @@ struct ctx_cam { unsigned int lastrate; unsigned int startup_frames; unsigned int frame_skip; - unsigned int pause; + volatile bool pause; int missing_frame_counter; /* counts failed attempts to fetch picture frame from camera */ unsigned int lost_connection; @@ -357,7 +355,7 @@ struct ctx_cam { char extpipefilename[PATH_MAX]; char extpipecmdline[PATH_MAX]; int movie_last_shot; - int movie_passthrough; + bool movie_passthrough; char timelapsefilename[PATH_MAX]; char motionfilename[PATH_MAX]; @@ -374,7 +372,7 @@ struct ctx_cam { unsigned int passflag; //only purpose is to flag first frame vs all others..... pthread_mutex_t parms_lock; - int parms_changed; /*bool indicating if the parms have changed */ + bool parms_changed; /*bool indicating if the parms have changed */ }; @@ -385,31 +383,31 @@ struct ctx_motapp { pthread_mutex_t global_lock; volatile int threads_running; - volatile int finish_all; - volatile int restart_all; - volatile int cam_add; /* Bool for whether to add a camera to the list */ + volatile bool finish_all; + volatile bool restart_all; + volatile bool cam_add; /* Bool for whether to add a camera to the list */ volatile int cam_delete; /* 0 for no action, other numbers specify camera to remove */ int argc; char **argv; - int daemon; + bool daemon; std::string conf_filename; std::string pid_file; std::string log_file; std::string log_type_str; int log_level; int log_type; - int setup_mode; - int pause; - int native_language; + bool setup_mode; + bool pause; + bool native_language; volatile int webcontrol_running; volatile int webcontrol_finish; struct MHD_Daemon *webcontrol_daemon; char webcontrol_digest_rand[12]; - int parms_changed; /*bool indicating if the parms have changed */ + bool parms_changed; /*bool indicating if the parms have changed */ pthread_mutex_t mutex_parms; /* mutex used to lock when changing parms */ pthread_mutex_t mutex_camlst; /* Lock the list of cams while adding/removing */ pthread_mutex_t mutex_post; /* mutex to allow for processing of post actions*/ diff --git a/src/movie.cpp b/src/movie.cpp index 5f62d611..61d46fa9 100644 --- a/src/movie.cpp +++ b/src/movie.cpp @@ -396,7 +396,7 @@ static int movie_set_pts(struct ctx_movie *movie, const struct timespec *ts1) } else movie->picture->pts = av_rescale_q(pts_interval,(AVRational){1, 1000000L},movie->strm_video->time_base) + movie->base_pts; - if (movie->test_mode == TRUE) { + if (movie->test_mode == true) { MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO ,_("PTS %" PRId64 " Base PTS %" PRId64 " ms interval %" PRId64 " timebase %d-%d") ,movie->picture->pts,movie->base_pts,pts_interval @@ -405,7 +405,7 @@ static int movie_set_pts(struct ctx_movie *movie, const struct timespec *ts1) if (movie->picture->pts <= movie->last_pts) { //We have a problem with our motion loop timing and sending frames or the rounding into the PTS. - if (movie->test_mode == TRUE) { + if (movie->test_mode == true) { MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO, _("BAD TIMING!! Frame skipped.")); } return -1; @@ -997,7 +997,7 @@ static void movie_passthru_reset(struct ctx_movie *movie) pthread_mutex_lock(&movie->netcam_data->mutex_pktarray); for(indx = 0; indx < movie->netcam_data->pktarray_size; indx++) { - movie->netcam_data->pktarray[indx].iswritten = FALSE; + movie->netcam_data->pktarray[indx].iswritten = false; } pthread_mutex_unlock(&movie->netcam_data->mutex_pktarray); @@ -1043,7 +1043,7 @@ static void movie_passthru_write(struct ctx_movie *movie, int indx) movie->pkt.data = NULL; movie->pkt.size = 0; - movie->netcam_data->pktarray[indx].iswritten = TRUE; + movie->netcam_data->pktarray[indx].iswritten = true; retcd = mycopy_packet(&movie->pkt, &movie->netcam_data->pktarray[indx].packet); if (retcd < 0) { @@ -1127,7 +1127,7 @@ static int movie_passthru_put(struct ctx_movie *movie, struct ctx_image_data *im indx = 0; } - while (TRUE){ + while (true){ if ((!movie->netcam_data->pktarray[indx].iswritten) && (movie->netcam_data->pktarray[indx].packet.size > 0) && (movie->netcam_data->pktarray[indx].idnbr > idnbr_lastwritten) && @@ -1638,12 +1638,12 @@ int movie_init_norm(struct ctx_cam *cam, struct timespec *ts1) if (cam->imgs.size_high > 0) { cam->movie_norm->width = cam->imgs.width_high; cam->movie_norm->height = cam->imgs.height_high; - cam->movie_norm->high_resolution = TRUE; + cam->movie_norm->high_resolution = true; cam->movie_norm->netcam_data = cam->netcam_high; } else { cam->movie_norm->width = cam->imgs.width; cam->movie_norm->height = cam->imgs.height; - cam->movie_norm->high_resolution = FALSE; + cam->movie_norm->high_resolution = true; cam->movie_norm->netcam_data = cam->netcam; } cam->movie_norm->tlapse = TIMELAPSE_NONE; @@ -1657,9 +1657,9 @@ int movie_init_norm(struct ctx_cam *cam, struct timespec *ts1) cam->movie_norm->gop_cnt = 0; cam->movie_norm->codec_name = codec; if (cam->conf->movie_codec == "test") { - cam->movie_norm->test_mode = TRUE; + cam->movie_norm->test_mode = true; } else { - cam->movie_norm->test_mode = FALSE; + cam->movie_norm->test_mode = false; } cam->movie_norm->motion_images = 0; cam->movie_norm->passthrough = cam->movie_passthrough; @@ -1707,13 +1707,13 @@ int movie_init_motion(struct ctx_cam *cam, struct timespec *ts1) cam->movie_motion->gop_cnt = 0; cam->movie_motion->codec_name = codec; if (cam->conf->movie_codec == "test") { - cam->movie_motion->test_mode = TRUE; + cam->movie_motion->test_mode = true; } else { - cam->movie_motion->test_mode = FALSE; + cam->movie_motion->test_mode = false; } - cam->movie_motion->motion_images = TRUE; - cam->movie_motion->passthrough = FALSE; - cam->movie_motion->high_resolution = FALSE; + cam->movie_motion->motion_images = true; + cam->movie_motion->passthrough = false; + cam->movie_motion->high_resolution = false; cam->movie_motion->netcam_data = NULL; retcd = movie_open(cam->movie_motion); @@ -1742,11 +1742,11 @@ int movie_init_timelapse(struct ctx_cam *cam, struct timespec *ts1) if ((cam->imgs.size_high > 0) && (!cam->movie_passthrough)) { cam->movie_timelapse->width = cam->imgs.width_high; cam->movie_timelapse->height = cam->imgs.height_high; - cam->movie_timelapse->high_resolution = TRUE; + cam->movie_timelapse->high_resolution = true; } else { cam->movie_timelapse->width = cam->imgs.width; cam->movie_timelapse->height = cam->imgs.height; - cam->movie_timelapse->high_resolution = FALSE; + cam->movie_timelapse->high_resolution = false; } cam->movie_timelapse->fps = cam->conf->timelapse_fps; cam->movie_timelapse->bps = cam->conf->movie_bps; @@ -1755,10 +1755,10 @@ int movie_init_timelapse(struct ctx_cam *cam, struct timespec *ts1) cam->movie_timelapse->start_time.tv_nsec = ts1->tv_nsec; cam->movie_timelapse->last_pts = -1; cam->movie_timelapse->base_pts = 0; - cam->movie_timelapse->test_mode = FALSE; + cam->movie_timelapse->test_mode = false; cam->movie_timelapse->gop_cnt = 0; - cam->movie_timelapse->motion_images = FALSE; - cam->movie_timelapse->passthrough = FALSE; + cam->movie_timelapse->motion_images = false; + cam->movie_timelapse->passthrough = false; cam->movie_timelapse->netcam_data = NULL; if (cam->conf->timelapse_codec == "mpg") { diff --git a/src/movie.hpp b/src/movie.hpp index 83c89fad..994bf48a 100644 --- a/src/movie.hpp +++ b/src/movie.hpp @@ -65,12 +65,12 @@ struct ctx_movie { const char *codec_name; int64_t last_pts; int64_t base_pts; - int test_mode; + bool test_mode; int gop_cnt; struct timespec start_time; - int high_resolution; - int motion_images; - int passthrough; + bool high_resolution; + bool motion_images; + bool passthrough; enum USER_CODEC preferred_codec; char *nal_info; int nal_info_len; diff --git a/src/netcam.cpp b/src/netcam.cpp index 00a8e563..38fa433b 100644 --- a/src/netcam.cpp +++ b/src/netcam.cpp @@ -333,7 +333,7 @@ static void netcam_close_context(struct ctx_netcam *netcam) } -static void netcam_pktarray_resize(struct ctx_cam *cam, int is_highres) +static void netcam_pktarray_resize(struct ctx_cam *cam, bool is_highres) { /* This is called from netcam_next and is on the motion loop thread * The netcam->mutex is locked around the call to this function. @@ -977,6 +977,7 @@ static struct ctx_netcam *netcam_new_context(void) static int netcam_interrupt(void *ctx) { + /* Must return as an int since this is a callback to a C function */ struct ctx_netcam *netcam = (struct ctx_netcam *)ctx; if (netcam->finish) { @@ -1198,7 +1199,8 @@ static int netcam_resize(struct ctx_netcam *netcam) static int netcam_read_image(struct ctx_netcam *netcam) { - int size_decoded, retcd, haveimage, errcnt; + int size_decoded, retcd, errcnt; + bool haveimage; char errstr[128]; netcam_buff *xchg; @@ -2162,7 +2164,7 @@ int netcam_next(struct ctx_cam *cam, struct ctx_image_data *img_data) return 0; } -void netcam_cleanup(struct ctx_cam *cam, int init_retry_flag) +void netcam_cleanup(struct ctx_cam *cam, bool init_retry_flag) { /* diff --git a/src/netcam.hpp b/src/netcam.hpp index a0f90cfb..2ed0e0e0 100644 --- a/src/netcam.hpp +++ b/src/netcam.hpp @@ -82,8 +82,8 @@ extern "C" { struct packet_item{ AVPacket packet; int64_t idnbr; - int iskey; - int iswritten; + bool iskey; + bool iswritten; struct timespec timestamp_ts; }; @@ -120,12 +120,12 @@ struct ctx_netcam { netcam_buff_ptr img_recv; /* The image buffer that is currently being processed */ netcam_buff_ptr img_latest; /* The most recent image buffer that finished processing */ - int interrupted; /* Boolean for whether interrupt has been tripped */ - int finish; /* Boolean for whether we are finishing the application */ - int high_resolution; /* Boolean for whether this context is the Norm or High */ - int handler_finished; /* Boolean for whether the handler is running or not */ - int first_image; /* Boolean for whether we have captured the first image */ - int passthrough; /* Boolean for whether we are doing pass-through processing */ + bool interrupted; /* Boolean for whether interrupt has been tripped */ + bool finish; /* Boolean for whether we are finishing the application */ + bool high_resolution; /* Boolean for whether this context is the Norm or High */ + bool handler_finished; /* Boolean for whether the handler is running or not */ + bool first_image; /* Boolean for whether we have captured the first image */ + bool passthrough; /* Boolean for whether we are doing pass-through processing */ char *path; /* The connection string to use for the camera */ char service[5]; /* String specifying the type of camera http, rtsp, v4l2 */ @@ -158,6 +158,6 @@ struct ctx_netcam { int netcam_setup(struct ctx_cam *cam); int netcam_next(struct ctx_cam *cam, struct ctx_image_data *img_data); -void netcam_cleanup(struct ctx_cam *cam, int init_retry_flag); +void netcam_cleanup(struct ctx_cam *cam, bool init_retry_flag); #endif /* _INCLUDE_NETCAM_H */ diff --git a/src/util.cpp b/src/util.cpp index f56ce2d7..364c801c 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -536,7 +536,7 @@ void mythreadname_get(char *threadname) #endif } -int mycheck_passthrough(struct ctx_cam *cam) +bool mycheck_passthrough(struct ctx_cam *cam) { #if (MYFFVER >= 57041) if (cam->movie_passthrough) { @@ -549,7 +549,7 @@ int mycheck_passthrough(struct ctx_cam *cam) MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("FFMPEG version too old. Disabling pass-through processing.")); } - return 0; + return false; #endif } @@ -599,20 +599,20 @@ void mytranslate_init(void) char* mytranslate_text(const char *msgid, int setnls) { - static int nls_enabled = TRUE; + static bool nls_enabled = true; if (setnls == 0) { if (nls_enabled) { MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Disabling native language support")); } - nls_enabled = FALSE; + nls_enabled = false; return NULL; } else if (setnls == 1) { if (!nls_enabled) { MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Enabling native language support")); } - nls_enabled = TRUE; + nls_enabled = true; return NULL; } else { @@ -1101,7 +1101,7 @@ void util_parms_parse(struct ctx_params *params, std::string confline) std::string parmline; - if ((params->update_params == FALSE) || + if ((params->update_params == false) || (confline == "")) { return; } @@ -1118,7 +1118,7 @@ void util_parms_parse(struct ctx_params *params, std::string confline) MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO,_("Finished parsing parameters: %s"), confline.c_str()); - params->update_params = FALSE; + params->update_params = false; return; @@ -1126,15 +1126,16 @@ void util_parms_parse(struct ctx_params *params, std::string confline) void util_parms_add_default(ctx_params *params, std::string parm_nm, std::string parm_vl) { - int indx, dflt; + int indx; + bool dflt; - dflt = TRUE; + dflt = true; for (indx = 0; indx < params->params_count; indx++) { if (mystreq(params->params_array[indx].param_name, parm_nm.c_str()) ) { - dflt = FALSE; + dflt = false; } } - if (dflt == TRUE) { + if (dflt == true) { util_parms_add(params, parm_nm.c_str(), parm_vl.c_str()); } diff --git a/src/util.hpp b/src/util.hpp index f4da421c..5ca1a4c4 100644 --- a/src/util.hpp +++ b/src/util.hpp @@ -105,7 +105,7 @@ void mythreadname_set(const char *abbr, int threadnbr, const char *threadname); void mythreadname_get(char *threadname); - int mycheck_passthrough(struct ctx_cam *cam); + bool mycheck_passthrough(struct ctx_cam *cam); char* mytranslate_text(const char *msgid, int setnls); void mytranslate_init(void); diff --git a/src/video_v4l2.cpp b/src/video_v4l2.cpp index cd923efb..8b6236ab 100644 --- a/src/video_v4l2.cpp +++ b/src/video_v4l2.cpp @@ -176,7 +176,7 @@ static void v4l2_ctrls_list(ctx_v4l2cam *v4l2cam) v4l2cam->devctrl_array[indx_ctrl].ctrl_default = vid_ctrl.default_value; v4l2cam->devctrl_array[indx_ctrl].ctrl_currval = vid_ctrl.default_value; v4l2cam->devctrl_array[indx_ctrl].ctrl_newval = vid_ctrl.default_value; - v4l2cam->devctrl_array[indx_ctrl].ctrl_menuitem = FALSE; + v4l2cam->devctrl_array[indx_ctrl].ctrl_menuitem = false; v4l2cam->devctrl_array[indx_ctrl].ctrl_name =(char*) malloc(32); sprintf(v4l2cam->devctrl_array[indx_ctrl].ctrl_name,"%s",vid_ctrl.name); @@ -197,7 +197,7 @@ static void v4l2_ctrls_list(ctx_v4l2cam *v4l2cam) indx_ctrl++; v4l2cam->devctrl_array[indx_ctrl].ctrl_id = vid_ctrl.id; v4l2cam->devctrl_array[indx_ctrl].ctrl_type = 0; - v4l2cam->devctrl_array[indx_ctrl].ctrl_menuitem = TRUE; + v4l2cam->devctrl_array[indx_ctrl].ctrl_menuitem = true; v4l2cam->devctrl_array[indx_ctrl].ctrl_name =(char*) malloc(32); sprintf(v4l2cam->devctrl_array[indx_ctrl].ctrl_name,"%s",vid_menu.name); @@ -261,7 +261,7 @@ static int v4l2_parms_set(ctx_v4l2cam *v4l2cam) int indx_dev, indx_user; if (v4l2cam->devctrl_count == 0) { - v4l2cam->params->update_params = FALSE; + v4l2cam->params->update_params = false; return 0; } @@ -891,14 +891,14 @@ static int v4l2_device_init(ctx_cam *cam) cam->v4l2cam->devctrl_count = 0; cam->v4l2cam->buffer_count= 0; cam->v4l2cam->pframe = -1; - cam->v4l2cam->finish = &cam->finish_cam; + cam->v4l2cam->finish = cam->finish_cam; cam->v4l2cam->buffers = NULL; cam->v4l2cam->params =(struct ctx_params*) mymalloc(sizeof(struct ctx_params)); memset(cam->v4l2cam->params, 0, sizeof(struct ctx_params)); cam->v4l2cam->params->params_array = NULL; cam->v4l2cam->params->params_count = 0; - cam->v4l2cam->params->update_params = TRUE; /*Set trigger to update the params */ + cam->v4l2cam->params->update_params = true; /*Set trigger to update the params */ util_parms_parse(cam->v4l2cam->params, cam->conf->v4l2_params); @@ -935,7 +935,7 @@ static void v4l2_device_select(ctx_cam *cam) { int retcd; - if (cam->v4l2cam->params->update_params == TRUE) { + if (cam->v4l2cam->params->update_params == true) { util_parms_parse(cam->v4l2cam->params, cam->conf->v4l2_params); @@ -1193,7 +1193,7 @@ void v4l2_cleanup(ctx_cam *cam) } cam->v4l2cam = NULL; - cam->running_cam = FALSE; + cam->running_cam = false; #else (void)cam; #endif // HAVE_V4L2 diff --git a/src/video_v4l2.hpp b/src/video_v4l2.hpp index 79f27f7e..3dfc6e67 100644 --- a/src/video_v4l2.hpp +++ b/src/video_v4l2.hpp @@ -43,7 +43,7 @@ struct ctx_v4l2cam_ctrl { int ctrl_newval; /* The new value to set for the control */ unsigned int ctrl_id; /* The ID number for the control as provided by the device*/ unsigned int ctrl_type; /* The type of control as reported by the device*/ - int ctrl_menuitem; /* bool for whether item is a menu item description */ + bool ctrl_menuitem; /* bool for whether item is a menu item description */ }; struct ctx_v4l2cam { @@ -64,7 +64,7 @@ struct ctx_v4l2cam { struct ctx_params *params; /*User parameters for the camera */ video_buff *buffers; int pframe; - volatile unsigned int *finish; /* End the thread */ + volatile bool finish; /* End the thread */ #ifdef HAVE_V4L2 struct v4l2_capability cap; struct v4l2_format src_fmt; diff --git a/src/webu_json.cpp b/src/webu_json.cpp index 3f73e381..1879fe56 100644 --- a/src/webu_json.cpp +++ b/src/webu_json.cpp @@ -110,7 +110,8 @@ static void webu_json_config_item(struct webui_ctx *webui, int indx_cam, int ind static void webu_json_config_parms(struct webui_ctx *webui, int indx_cam) { - int indx_parm, first; + int indx_parm; + bool first; std::string response; indx_parm = 0; @@ -146,7 +147,8 @@ static void webu_json_config_parms(struct webui_ctx *webui, int indx_cam) static void webu_json_config_cam_parms(struct webui_ctx *webui) { - int indx_cam, first; + int indx_cam; + bool first; indx_cam = 0; first = true; diff --git a/src/webu_post.cpp b/src/webu_post.cpp index 13fed7bc..79a2c4eb 100644 --- a/src/webu_post.cpp +++ b/src/webu_post.cpp @@ -337,10 +337,10 @@ static void webu_post_config(struct webui_ctx *webui) /* If changing language, do it now */ if (config_parms[indx2].parm_name == "native_language") { if (webui->motapp->native_language) { - mytranslate_text("", true); + mytranslate_text("", 1); MOTION_LOG(INF, TYPE_ALL, NO_ERRNO,_("Native Language : on")); } else { - mytranslate_text("", false); + mytranslate_text("", 0); MOTION_LOG(INF, TYPE_ALL, NO_ERRNO,_("Native Language : off")); } }