From 0163596f0a586adb30f5ad28210b6424ffca0d33 Mon Sep 17 00:00:00 2001 From: Mr-Dave Date: Thu, 6 Feb 2025 14:06:20 -0700 Subject: [PATCH] Revise from MOTPLS to MOTION --- doc/motion_build.html | 2 +- src/alg.cpp | 2 +- src/alg_sec.cpp | 68 +++--- src/allcam.cpp | 46 ++-- src/camera.cpp | 106 ++++---- src/conf.cpp | 534 ++++++++++++++++++++--------------------- src/dbse.cpp | 130 +++++----- src/dbse.hpp | 4 +- src/draw.cpp | 4 +- src/jpegutils.cpp | 10 +- src/libcam.cpp | 362 ++++++++++++++-------------- src/logger.cpp | 8 +- src/logger.hpp | 4 +- src/motion.cpp | 114 ++++----- src/motion.hpp | 18 +- src/movie.cpp | 166 ++++++------- src/netcam.cpp | 260 ++++++++++---------- src/picture.cpp | 62 ++--- src/rotate.cpp | 2 +- src/schedule.cpp | 26 +- src/sound.cpp | 124 +++++----- src/util.cpp | 74 +++--- src/video_convert.cpp | 6 +- src/video_loopback.cpp | 76 +++--- src/video_v4l2.cpp | 196 +++++++-------- src/webu.cpp | 54 ++--- src/webu_ans.cpp | 34 +-- src/webu_file.cpp | 6 +- src/webu_html.cpp | 2 +- src/webu_json.cpp | 2 +- src/webu_mpegts.cpp | 18 +- src/webu_post.cpp | 84 +++---- src/webu_stream.cpp | 14 +- 33 files changed, 1309 insertions(+), 1309 deletions(-) diff --git a/doc/motion_build.html b/doc/motion_build.html index 604b3671..8f9968f2 100644 --- a/doc/motion_build.html +++ b/doc/motion_build.html @@ -83,7 +83,7 @@ A script has also been written to allow users to create their own deb package from either a tagged release or the most current master branch of the code. Download the script by using the following - command. wget https://raw.githubusercontent.com/Motion-Project/motion-packaging/master/buildplus.sh + command. wget https://raw.githubusercontent.com/Motion-Project/motion-packaging/master/builddeb.sh

Review the script and specify the following few optional parameters. Username, EmailAddress, branch, install, arch. If diff --git a/src/alg.cpp b/src/alg.cpp index d9866948..4ad12710 100644 --- a/src/alg.cpp +++ b/src/alg.cpp @@ -885,7 +885,7 @@ void cls_alg::lightswitch() { if (cam->cfg->lightswitch_percent >= 1) { if (cam->current_image->diffs > (cam->imgs.motionsize * cam->cfg->lightswitch_percent / 100)) { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, _("Lightswitch detected")); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, _("Lightswitch detected")); if (cam->frame_skip < cam->cfg->lightswitch_frames) { cam->frame_skip = cam->cfg->lightswitch_frames; } diff --git a/src/alg_sec.cpp b/src/alg_sec.cpp index aaf1893a..69251d58 100644 --- a/src/alg_sec.cpp +++ b/src/alg_sec.cpp @@ -53,9 +53,9 @@ void cls_algsec::debug_notice(Mat &mat_dst, bool isdetect) if (cfg_log_level >= DBG) { if (first_pass == true) { - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO , "Secondary detect and debug enabled."); - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO , "Saving source and detected images to %s" , cfg_target_dir.c_str()); first_pass = false; @@ -149,8 +149,8 @@ void cls_algsec::label_image(Mat &mat_dst } catch ( cv::Exception& e ) { const char* err_msg = e.what(); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Disabling secondary detection")); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Disabling secondary detection")); method = "none"; } @@ -182,8 +182,8 @@ void cls_algsec::label_image(Mat &mat_dst, double confidence, Point classIdPoint } catch ( cv::Exception& e ) { const char* err_msg = e.what(); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Disabling secondary detection")); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Disabling secondary detection")); method = "none"; } @@ -219,13 +219,13 @@ void cls_algsec::get_image_roi(Mat &mat_src, Mat &mat_dst) } /* - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Base %d %d (%dx%d) img(%dx%d)" + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Base %d %d (%dx%d) img(%dx%d)" ,cam->current_image->location.minx ,cam->current_image->location.miny ,cam->current_image->location.width ,cam->current_image->location.height ,width,height); - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Opencv %d %d %d %d" + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Opencv %d %d %d %d" ,roi.x,roi.y,roi.width,roi.height); */ mat_dst = mat_src(roi); @@ -289,8 +289,8 @@ void cls_algsec::detect_hog() } catch ( cv::Exception& e ) { const char* err_msg = e.what(); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Disabling secondary detection")); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Disabling secondary detection")); method = "none"; } } @@ -319,8 +319,8 @@ void cls_algsec::detect_haar() } catch ( cv::Exception& e ) { const char* err_msg = e.what(); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Disabling secondary detection")); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Disabling secondary detection")); method = "none"; } } @@ -355,8 +355,8 @@ void cls_algsec::detect_dnn() } catch ( cv::Exception& e ) { const char* err_msg = e.what(); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Disabling secondary detection")); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Disabling secondary detection")); method = "none"; } } @@ -366,19 +366,19 @@ void cls_algsec::load_haar() try { if (model_file == "") { method = "none"; - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("No secondary model specified.")); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("No secondary model specified.")); return; } if (haar_cascade.load(model_file) == false) { /* Loading failed, reset method*/ method = "none"; - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Failed loading model %s") + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Failed loading model %s") ,model_file.c_str()); } } catch ( cv::Exception& e ) { const char* err_msg = e.what(); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Failed loading model %s") + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Failed loading model %s") , model_file.c_str()); method = "none"; } @@ -403,7 +403,7 @@ void cls_algsec::load_dnn() try { if (model_file == "") { method = "none"; - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("No secondary model specified.")); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("No secondary model specified.")); return; } net = readNet( @@ -416,7 +416,7 @@ void cls_algsec::load_dnn() ifs.open(dnn_classes_file.c_str()); if (ifs.is_open() == false) { method = "none"; - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Classes file not found: %s") ,dnn_classes_file.c_str()); return; @@ -428,8 +428,8 @@ void cls_algsec::load_dnn() } catch ( cv::Exception& e ) { const char* err_msg = e.what(); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Failed loading model %s") + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Error %s"),err_msg); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("Failed loading model %s") , model_file.c_str()); method = "none"; } @@ -443,7 +443,7 @@ void cls_algsec::params_log() if (method != "none") { for (indx=0;indxparams_cnt;indx++) { itm = ¶ms->params_array[indx]; - MOTPLS_SHT(INF, TYPE_ALL, NO_ERRNO, "%-25s %s" + MOTION_SHT(INF, TYPE_ALL, NO_ERRNO, "%-25s %s" ,itm->param_name.c_str(),itm->param_value.c_str()); } } @@ -596,7 +596,7 @@ void cls_algsec::handler() mythreadname_set("cv",cam->cfg->device_id, cam->cfg->device_name.c_str()); - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO,_("Secondary detection starting.")); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO,_("Secondary detection starting.")); handler_running = true; handler_stop = false; @@ -622,7 +622,7 @@ void cls_algsec::handler() is_started = false; handler_stop = false; handler_running = false; - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO,_("Secondary detection stopped.")); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO,_("Secondary detection stopped.")); pthread_exit(nullptr); } @@ -643,7 +643,7 @@ void cls_algsec::handler_startup() pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); retcd = pthread_create(&handler_thread, &thread_attr, &algsec_handler, this); if (retcd != 0) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start secondary detection")); + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start secondary detection")); handler_running = false; handler_stop = true; } @@ -663,10 +663,10 @@ void cls_algsec::handler_shutdown() waitcnt++; } if (waitcnt == cam->cfg->watchdog_tmo) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Normal shutdown of camera failed")); if (cam->cfg->watchdog_kill > 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Waiting additional %d seconds (watchdog_kill).") ,cam->cfg->watchdog_kill); waitcnt = 0; @@ -675,14 +675,14 @@ void cls_algsec::handler_shutdown() waitcnt++; } if (waitcnt == cam->cfg->watchdog_kill) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("No response to shutdown. Killing it.")); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Memory leaks will occur.")); pthread_kill(handler_thread, SIGVTALRM); } } else { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("watchdog_kill set to terminate application.")); exit(1); } @@ -726,12 +726,12 @@ void cls_algsec::detect() frame_cnt = frame_interval; if (frame_missed >10){ if (too_slow == 0) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO ,_("Your computer is too slow for these settings.")); } else if (too_slow == 10){ - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO ,_("Missed many frames for secondary detection.")); - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO ,_("Your computer is too slow.")); } too_slow++; diff --git a/src/allcam.cpp b/src/allcam.cpp index 0b8a423b..6c122752 100644 --- a/src/allcam.cpp +++ b/src/allcam.cpp @@ -93,13 +93,13 @@ void cls_allcam::getimg_src(cls_camera *p_cam, std::string imgtyp, u_char *dst_i } if ((p_cam->imgs.height != p_cam->all_sizes.src_h) || (p_cam->imgs.width != p_cam->all_sizes.src_w)) { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , "Image has changed. Device: %d" , p_cam->cfg->device_id); memset(src_img, 0x00, (uint)p_cam->all_sizes.src_sz); p_cam->all_sizes.reset = true; } else if (strm_c->img_data == nullptr) { - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO , "Could not get image for device %d" , p_cam->cfg->device_id); memset(src_img, 0x00, (uint)p_cam->all_sizes.src_sz); @@ -274,7 +274,7 @@ void cls_allcam::getsizes_scale() for (indx=0; indxcfg->device_id , p_cam->all_sizes.src_w, p_cam->all_sizes.src_h @@ -372,13 +372,13 @@ void cls_allcam::getsizes_offset_user() chk_sz = p_cam->all_loc.offset_col + p_cam->all_loc.offset_user_col; if (chk_sz < 0) { - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO , "Device %d invalid image column offset. (%d + %d) less than zero " , p_cam->cfg->device_id , p_cam->all_loc.offset_col , p_cam->all_loc.offset_user_col); } else if ((chk_sz + p_cam->all_sizes.dst_w) > all_sizes.src_w) { - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO , "Device %d invalid image column offset. (%d + %d) over image size" , p_cam->cfg->device_id , p_cam->all_loc.offset_col @@ -389,13 +389,13 @@ void cls_allcam::getsizes_offset_user() chk_sz = p_cam->all_loc.offset_row + p_cam->all_loc.offset_user_row; if (chk_sz < 0 ) { - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO , "Device %d invalid image row offset. (%d + %d) less than zero " , p_cam->cfg->device_id , p_cam->all_loc.offset_row , p_cam->all_loc.offset_user_row); } else if ((chk_sz + p_cam->all_sizes.dst_h) > all_sizes.src_h) { - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO , "Device %d invalid image row offset. (%d + %d) over image size" , p_cam->cfg->device_id , p_cam->all_loc.offset_row @@ -478,7 +478,7 @@ void cls_allcam::getsizes_pct() all_sizes.dst_h = dst_h; all_sizes.dst_sz = (dst_w * dst_h * 3)/2; - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO , "Combined Image Original Size %dx%d Scale %d New Size %dx%d" , all_sizes.src_w, all_sizes.src_h , dst_scale @@ -560,7 +560,7 @@ void cls_allcam::init_validate() if ((p_cam->all_loc.col == -1) || (p_cam->all_loc.row == -1)) { cfg_valid = false; - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , "No stream_preview_params for cam %d" , p_cam->cfg->device_id); } else { @@ -569,7 +569,7 @@ void cls_allcam::init_validate() if ((p_cam->all_loc.col == p_cam1->all_loc.col) && (p_cam->all_loc.row == p_cam1->all_loc.row) && (indx != indx1)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , "Duplicate stream_preview_params " " cam %d, cam %d row %d col %d" , p_cam->cfg->device_id @@ -581,14 +581,14 @@ void cls_allcam::init_validate() } } if (p_cam->all_loc.row == 0) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , "Invalid stream_preview_params row cam %d, row %d" , p_cam->cfg->device_id , p_cam->all_loc.row); cfg_valid = false; } if (p_cam->all_loc.col == 0) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , "Invalid stream_preview_params col cam %d, col %d" , p_cam->cfg->device_id , p_cam->all_loc.col); @@ -605,7 +605,7 @@ void cls_allcam::init_validate() } } if (chk == false) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , "Invalid stream_preview_params combination. " " Missing row %d", row); cfg_valid = false; @@ -619,7 +619,7 @@ void cls_allcam::init_validate() if ((col_chk+1) == col) { col_chk = col; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , "Invalid stream_preview_params combination. " " Missing row %d column %d", row, col_chk+1); cfg_valid = false; @@ -630,7 +630,7 @@ void cls_allcam::init_validate() } if (cfg_valid == false) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,"Creating default stream preview values"); row = 0; col = 0; @@ -659,7 +659,7 @@ void cls_allcam::init_cams() for (indx=0; indxcfg->device_id , p_cam->all_loc.row @@ -756,7 +756,7 @@ void cls_allcam::handler() timing(); } - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("All camera closed")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("All camera closed")); handler_running = false; pthread_exit(NULL); @@ -775,7 +775,7 @@ void cls_allcam::handler_startup() pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); retcd = pthread_create(&handler_thread, &thread_attr, &allcam_handler, this); if (retcd != 0) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start all camera thread.")); + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start all camera thread.")); handler_running = false; handler_stop = true; } @@ -795,10 +795,10 @@ void cls_allcam::handler_shutdown() waitcnt++; } if (waitcnt == app->cfg->watchdog_tmo) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Normal shutdown of all camera failed")); if (app->cfg->watchdog_kill > 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Waiting additional %d seconds (watchdog_kill).") ,app->cfg->watchdog_kill); waitcnt = 0; @@ -807,14 +807,14 @@ void cls_allcam::handler_shutdown() waitcnt++; } if (waitcnt == app->cfg->watchdog_kill) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("No response to shutdown. Killing it.")); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Memory leaks will occur.")); pthread_kill(handler_thread, SIGVTALRM); } } else { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("watchdog_kill set to terminate application.")); exit(1); } diff --git a/src/camera.cpp b/src/camera.cpp index acf9fd21..c7630082 100644 --- a/src/camera.cpp +++ b/src/camera.cpp @@ -53,7 +53,7 @@ void cls_camera::ring_resize() new_size = 1; } - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Resizing buffer to %d items"), new_size); tmp =(ctx_image_data*) mymalloc((uint)new_size * sizeof(ctx_image_data)); @@ -131,15 +131,15 @@ void cls_camera::ring_process_image() picture->process_norm(); if (movie_norm->put_image(current_image , ¤t_image->imgts) == -1) { - MOTPLS_LOG(ERR, TYPE_EVENTS, NO_ERRNO, _("Error encoding image")); + MOTION_LOG(ERR, TYPE_EVENTS, NO_ERRNO, _("Error encoding image")); } if (movie_motion->put_image(&imgs.image_motion , &imgs.image_motion.imgts) == -1) { - MOTPLS_LOG(ERR, TYPE_EVENTS, NO_ERRNO, _("Error encoding image")); + MOTION_LOG(ERR, TYPE_EVENTS, NO_ERRNO, _("Error encoding image")); } if (movie_extpipe->put_image(current_image , ¤t_image->imgts) == -1) { - MOTPLS_LOG(ERR, TYPE_EVENTS, NO_ERRNO, _("Error encoding image")); + MOTION_LOG(ERR, TYPE_EVENTS, NO_ERRNO, _("Error encoding image")); } } @@ -234,7 +234,7 @@ void cls_camera::detected_trigger() sprintf(eventid, "%05d", cfg->device_id); strftime(eventid+5, 15, "%Y%m%d%H%M%S", &evt_tm); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Motion detected - starting event %d"), + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Motion detected - starting event %d"), event_curr_nbr); mystrftime(this, text_event_string @@ -420,7 +420,7 @@ void cls_camera::cam_start() } else if (camera_type == CAMERA_TYPE_V4L2) { v4l2cam = new cls_v4l2cam(this); } else { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO ,_("No Camera device specified")); device_status = STATUS_CLOSED; } @@ -454,7 +454,7 @@ int cls_camera::cam_next(ctx_image_data *img_data) if (retcd == CAPTURE_SUCCESS) { imgsz = (imgs.width * imgs.height * 3) / 2; if (imgs.size_norm != imgsz) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Resetting image buffers")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Resetting image buffers")); device_status = STATUS_CLOSED; restart = true; return CAPTURE_FAILURE; @@ -481,7 +481,7 @@ void cls_camera::init_camera_type() } else if (cfg->v4l2_device != "") { camera_type = CAMERA_TYPE_V4L2; } else { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Unable to determine camera type")); camera_type = CAMERA_TYPE_UNKNOWN; handler_stop = true; @@ -512,9 +512,9 @@ void cls_camera::init_firstimage() if ((indx >= 5) || (device_status != STATUS_OPENED)) { if (device_status != STATUS_OPENED) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, "%s", "Unable to open camera"); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, "%s", "Unable to open camera"); } else { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, "%s", "Error capturing first image"); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, "%s", "Error capturing first image"); } for (indx = 0; indxmovie_passthrough; if ((camera_type != CAMERA_TYPE_NETCAM) && (movie_passthrough)) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Pass-through processing disabled.")); + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Pass-through processing disabled.")); movie_passthrough = false; } @@ -673,7 +673,7 @@ void cls_camera::init_cam_start() cam_start(); if (device_status == STATUS_CLOSED) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO,_("Failed to start camera.")); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO,_("Failed to start camera.")); imgs.width = cfg->width; imgs.height = cfg->height; } @@ -766,13 +766,13 @@ void cls_camera::init_cleandir_default() { if ((cleandir->action != "delete") && (cleandir->action != "script")) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Invalid clean directory action : %s") ,cleandir->action.c_str()); cleandir->action = ""; } if (cleandir->action == "") { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Setting default clean directory action to delete.")); cleandir->action = "delete"; } @@ -780,28 +780,28 @@ void cls_camera::init_cleandir_default() if ((cleandir->freq != "hourly") && (cleandir->freq != "daily") && (cleandir->freq != "weekly")) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Invalid clean directory freq : %s") ,cleandir->freq.c_str()); cleandir->freq = ""; } if (cleandir->freq == "") { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Setting default clean directory frequency to weekly.")); cleandir->freq = "weekly"; } if (cleandir->runtime == "") { if (cleandir->freq == "hourly") { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Setting default clean directory runtime to 15.")); cleandir->runtime = "15"; } else if (cleandir->freq == "daily") { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Setting default clean directory runtime to 0115.")); cleandir->runtime = "0115"; } else if (cleandir->freq == "weekly") { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Setting default clean directory runtime to mon-0115.")); cleandir->runtime = "mon-0115"; } @@ -811,25 +811,25 @@ void cls_camera::init_cleandir_default() (cleandir->dur_unit != "h") && (cleandir->dur_unit != "d") && (cleandir->dur_unit != "w")) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Invalid clean directory duration unit : %s") ,cleandir->dur_unit.c_str()); cleandir->dur_unit = ""; } if (cleandir->dur_unit == "") { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Setting default clean directory duration unit to d.")); cleandir->dur_unit = "d"; } if ((cleandir->dur_val == 0 )) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Invalid clean directory duration number : %d") ,cleandir->dur_val); cleandir->dur_val = -1; } if (cleandir->dur_val <= 0) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Setting default clean directory duration value to 7.")); cleandir->dur_val = 7; } @@ -856,7 +856,7 @@ void cls_camera::init_cleandir_runtime() p_min = mtoi(cleandir->runtime); } if ((p_min > 59) || (p_min < 0)) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Invalid clean directory hourly runtime : %s") ,cleandir->runtime.c_str()); cleandir->runtime = ""; @@ -877,7 +877,7 @@ void cls_camera::init_cleandir_runtime() } if ((p_min > 59) || (p_min < 0) || (p_hr > 23) || (p_hr < 0)) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Invalid clean directory daily runtime : %s") ,cleandir->runtime.c_str()); cleandir->runtime = ""; @@ -911,7 +911,7 @@ void cls_camera::init_cleandir_runtime() if ((p_min > 59) || (p_min < 0) || (p_hr > 23) || (p_hr < 0) || (p_dow == -1)) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Invalid clean directory weekly runtime : %s") ,cleandir->runtime.c_str()); cleandir->runtime = ""; @@ -931,7 +931,7 @@ void cls_camera::init_cleandir_runtime() cleandir->next_ts.tv_sec -= c_tm.tm_sec; if (cleandir->action == "delete") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO , _("Cleandir next run:%04d-%02d-%02d %02d:%02d Criteria:%d%s RemoveDir:%s") ,c_tm.tm_year+1900,c_tm.tm_mon+1,c_tm.tm_mday ,c_tm.tm_hour,c_tm.tm_min @@ -939,7 +939,7 @@ void cls_camera::init_cleandir_runtime() ,cleandir->dur_unit.c_str() ,cleandir->removedir ? "Y":"N"); } else { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO , _("Clean directory set to run script at %04d-%02d-%02d %02d:%02d") ,c_tm.tm_year+1900,c_tm.tm_mon+1,c_tm.tm_mday ,c_tm.tm_hour,c_tm.tm_min); @@ -1092,7 +1092,7 @@ void cls_camera::init_schedule() (sched_itm.en_min < 0) || (sched_itm.en_min > 59) || (sched_itm.st_hr > sched_itm.en_hr) || (pvl.length() != 9)) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Invalid schedule parameter: %s %s") , pnm.c_str(), pvl.c_str()); } else { @@ -1121,7 +1121,7 @@ void cls_camera::init_schedule() } else { action = "active"; } - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO ,_("Schedule: %s %02d:%02d to %02d:%02d %s") ,tst.c_str() ,sched_day[indx1].st_hr @@ -1153,7 +1153,7 @@ void cls_camera::init() mythreadname_set("cl",cfg->device_id, cfg->device_name.c_str()); - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO,_("Initialize Camera")); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO,_("Initialize Camera")); init_camera_type(); @@ -1193,12 +1193,12 @@ void cls_camera::init() init_ref(); if (device_status == STATUS_OPENED) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Camera %d started: motion detection %s"), cfg->device_id, pause ? _("disabled"):_("enabled")); if (cfg->emulate_motion) { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, _("Emulating motion")); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, _("Emulating motion")); } } @@ -1224,7 +1224,7 @@ void cls_camera::areadetect() util_exec_command(this, cfg->on_area_detected.c_str(), NULL); } areadetect_eventnbr = event_curr_nbr; /* Fire script only once per event */ - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO ,_("Motion in area %d detected."), z + 1); break; } @@ -1320,7 +1320,7 @@ int cls_camera::capture() connectionlosttime.tv_sec = 0; if (missing_frame_counter >= (cfg->device_tmo * cfg->framerate)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Video signal re-acquired")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Video signal re-acquired")); if (cfg->on_camera_found != "") { util_exec_command(this, cfg->on_camera_found.c_str(), NULL); } @@ -1362,7 +1362,7 @@ int cls_camera::capture() /* Write error message only once */ if (missing_frame_counter == (cfg->device_tmo * cfg->framerate)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Video signal lost - Adding grey image")); if (cfg->on_camera_lost != "") { util_exec_command(this, cfg->on_camera_lost.c_str(), NULL); @@ -1376,7 +1376,7 @@ int cls_camera::capture() } else if (camera_type == CAMERA_TYPE_V4L2) { v4l2cam->noimage(); } else { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO,_("Unknown camera type")); + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO,_("Unknown camera type")); } } } @@ -1625,7 +1625,7 @@ void cls_camera::actions_event() track_center(); if (algsec->detected) { - MOTPLS_LOG(NTC, TYPE_EVENTS + MOTION_LOG(NTC, TYPE_EVENTS , NO_ERRNO, _("Secondary detect")); if (cfg->on_secondary_detect != "") { util_exec_command(this @@ -1635,7 +1635,7 @@ void cls_camera::actions_event() } algsec->detected = false; - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("End of event %d"), event_curr_nbr); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("End of event %d"), event_curr_nbr); postcap = 0; event_curr_nbr++; @@ -1676,7 +1676,7 @@ void cls_camera::actions() info_sdev_max = current_image->location.stddev_xy; } /* - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO , "dev_x %d dev_y %d dev_xy %d, diff %d ratio %d" , current_image->location.stddev_x , current_image->location.stddev_y @@ -1776,7 +1776,7 @@ void cls_camera::timelapse() movie_timelapse->start(); if (movie_timelapse->put_image( current_image, ¤t_image->imgts) == -1) { - MOTPLS_LOG(ERR, TYPE_EVENTS, NO_ERRNO, _("Error encoding image")); + MOTION_LOG(ERR, TYPE_EVENTS, NO_ERRNO, _("Error encoding image")); } } @@ -1846,13 +1846,13 @@ void cls_camera::check_schedule() } } if (prev != pause) { - MOTPLS_LOG(NTC, TYPE_EVENTS, NO_ERRNO + MOTION_LOG(NTC, TYPE_EVENTS, NO_ERRNO , _("Scheduled action. Motion detection %s") , pause ? _("disabled"):_("enabled")); } /* - MOTPLS_LOG(NTC, TYPE_EVENTS, NO_ERRNO + MOTION_LOG(NTC, TYPE_EVENTS, NO_ERRNO , "Motion %02d:%02d %02d:%02d detection %d %d" ,schedule[cur_dy][indx].st_hr ,schedule[cur_dy][indx].st_min @@ -1912,7 +1912,7 @@ void cls_camera::handler() cleanup(); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Camera closed")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Camera closed")); handler_running = false; pthread_exit(NULL); @@ -1931,7 +1931,7 @@ void cls_camera::handler_startup() pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); retcd = pthread_create(&handler_thread, &thread_attr, &camera_handler, this); if (retcd != 0) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start camera thread.")); + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start camera thread.")); handler_running = false; handler_stop = true; } @@ -1951,10 +1951,10 @@ void cls_camera::handler_shutdown() waitcnt++; } if (waitcnt == cfg->watchdog_tmo) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Normal shutdown of camera failed")); if (cfg->watchdog_kill > 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Waiting additional %d seconds (watchdog_kill).") ,cfg->watchdog_kill); waitcnt = 0; @@ -1963,14 +1963,14 @@ void cls_camera::handler_shutdown() waitcnt++; } if (waitcnt == cfg->watchdog_kill) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("No response to shutdown. Killing it.")); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Memory leaks will occur.")); pthread_kill(handler_thread, SIGVTALRM); } } else { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("watchdog_kill set to terminate application.")); exit(1); } diff --git a/src/conf.cpp b/src/conf.cpp index b89101f7..0a33f856 100644 --- a/src/conf.cpp +++ b/src/conf.cpp @@ -470,7 +470,7 @@ void cls_config::edit_daemon(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, daemon); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","daemon",_("daemon")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","daemon",_("daemon")); } void cls_config::edit_conf_filename(std::string &parm, enum PARM_ACT pact) @@ -483,7 +483,7 @@ void cls_config::edit_conf_filename(std::string &parm, enum PARM_ACT pact) parm = conf_filename; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","log_file",_("log_file")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","log_file",_("log_file")); } void cls_config::edit_pid_file(std::string &parm, int pact) @@ -496,7 +496,7 @@ void cls_config::edit_pid_file(std::string &parm, int pact) parm = pid_file; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","pid_file",_("pid_file")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","pid_file",_("pid_file")); } void cls_config::edit_log_file(std::string &parm, enum PARM_ACT pact) @@ -516,7 +516,7 @@ void cls_config::edit_log_file(std::string &parm, enum PARM_ACT pact) parm = log_file; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","log_file",_("log_file")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","log_file",_("log_file")); } void cls_config::edit_log_level(std::string &parm, enum PARM_ACT pact) @@ -527,7 +527,7 @@ void cls_config::edit_log_level(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 9)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid log_level %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid log_level %d"),parm_in); } else { log_level = parm_in; } @@ -541,7 +541,7 @@ void cls_config::edit_log_level(std::string &parm, enum PARM_ACT pact) } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","log_level",_("log_level")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","log_level",_("log_level")); } void cls_config::edit_log_fflevel(std::string &parm, enum PARM_ACT pact) @@ -552,7 +552,7 @@ void cls_config::edit_log_fflevel(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 9)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid log_fflevel %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid log_fflevel %d"),parm_in); } else { log_fflevel = parm_in; } @@ -566,7 +566,7 @@ void cls_config::edit_log_fflevel(std::string &parm, enum PARM_ACT pact) } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","log_fflevel",_("log_fflevel")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","log_fflevel",_("log_fflevel")); } void cls_config::edit_log_type(std::string &parm, enum PARM_ACT pact) @@ -581,7 +581,7 @@ void cls_config::edit_log_type(std::string &parm, enum PARM_ACT pact) (parm == "VID") || (parm == "ALL")) { log_type_str = parm; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid log_type %s"),parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid log_type %s"),parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = log_type_str; @@ -592,7 +592,7 @@ void cls_config::edit_log_type(std::string &parm, enum PARM_ACT pact) parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","log_type",_("log_type")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","log_type",_("log_type")); } void cls_config::edit_native_language(std::string &parm, enum PARM_ACT pact) @@ -605,7 +605,7 @@ void cls_config::edit_native_language(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, native_language); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","native_language",_("native_language")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","native_language",_("native_language")); } void cls_config::edit_device_name(std::string &parm, enum PARM_ACT pact) @@ -618,7 +618,7 @@ void cls_config::edit_device_name(std::string &parm, enum PARM_ACT pact) parm = device_name; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","device_name",_("device_name")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","device_name",_("device_name")); } void cls_config::edit_device_id(std::string &parm, enum PARM_ACT pact) @@ -636,14 +636,14 @@ void cls_config::edit_device_id(std::string &parm, enum PARM_ACT pact) return; } if (parm_in < 1) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid device_id %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid device_id %d"),parm_in); } else if (parm_in > 32000) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid device_id %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid device_id %d"),parm_in); } else { for (indx=0;indxcam_list.size();indx++){ if ((app->cam_list[indx]->conf_src->device_id == parm_in) && (app->cam_list[indx]->cfg != this)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Duplicate device_id %d not permitted"),parm_in); return; } @@ -651,7 +651,7 @@ void cls_config::edit_device_id(std::string &parm, enum PARM_ACT pact) for (indx=0;indxsnd_list.size();indx++){ if ((app->snd_list[indx]->conf_src->device_id == parm_in) && (app->snd_list[indx]->cfg != this)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Duplicate device_id %d not permitted"),parm_in); return; } @@ -663,7 +663,7 @@ void cls_config::edit_device_id(std::string &parm, enum PARM_ACT pact) parm = std::to_string(device_id); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","device_id",_("device_id")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","device_id",_("device_id")); } void cls_config::edit_device_tmo(std::string &parm, enum PARM_ACT pact) @@ -674,7 +674,7 @@ void cls_config::edit_device_tmo(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if (parm_in < 1) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid device_tmo %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid device_tmo %d"),parm_in); } else { device_tmo = parm_in; } @@ -682,7 +682,7 @@ void cls_config::edit_device_tmo(std::string &parm, enum PARM_ACT pact) parm = std::to_string(device_tmo); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","device_tmo",_("device_tmo")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","device_tmo",_("device_tmo")); } void cls_config::edit_pause(std::string &parm, enum PARM_ACT pact) @@ -698,18 +698,18 @@ void cls_config::edit_pause(std::string &parm, enum PARM_ACT pact) if ((parm == "schedule") || (parm == "on") || (parm == "off")) { pause = parm; } else if ((parm == "1") || (parm == "yes") || (parm == "true")) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO , _("Old type specified for pause %s. Use 'on' instead") ,parm.c_str()); pause = "on"; } else if ((parm == "0") || (parm == "no") || (parm == "false")) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO , _("Old type specified for pause %s. Use 'off' instead") ,parm.c_str()); pause = "off"; } } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid pause %s"),parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid pause %s"),parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = pause; @@ -719,7 +719,7 @@ void cls_config::edit_pause(std::string &parm, enum PARM_ACT pact) parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","pause",_("pause")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","pause",_("pause")); } void cls_config::edit_schedule_params(std::string &parm, enum PARM_ACT pact) @@ -732,7 +732,7 @@ void cls_config::edit_schedule_params(std::string &parm, enum PARM_ACT pact) parm = schedule_params; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","schedule_params",_("schedule_params")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","schedule_params",_("schedule_params")); } void cls_config::edit_cleandir_params(std::string &parm, enum PARM_ACT pact) @@ -745,7 +745,7 @@ void cls_config::edit_cleandir_params(std::string &parm, enum PARM_ACT pact) parm = cleandir_params; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","cleandir_params",_("cleandir_params")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","cleandir_params",_("cleandir_params")); } void cls_config::edit_config_dir(std::string &parm, enum PARM_ACT pact) @@ -758,7 +758,7 @@ void cls_config::edit_config_dir(std::string &parm, enum PARM_ACT pact) parm = config_dir; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","config_dir",_("config_dir")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","config_dir",_("config_dir")); } void cls_config::edit_target_dir(std::string &parm, enum PARM_ACT pact) @@ -767,14 +767,14 @@ void cls_config::edit_target_dir(std::string &parm, enum PARM_ACT pact) target_dir = "."; } else if (pact == PARM_ACT_SET) { if (parm.find("%", 0) != std::string::npos) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Invalid target_dir. Conversion specifiers not permitted. %s") , parm.c_str()); } else if (parm == "") { target_dir = "."; } else if (parm.substr(parm.length()-1,1) == "/") { target_dir = parm.substr(0, parm.length()-1); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO,"Removing trailing '/' from target_dir"); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,"Removing trailing '/' from target_dir"); } else { target_dir = parm; } @@ -782,7 +782,7 @@ void cls_config::edit_target_dir(std::string &parm, enum PARM_ACT pact) parm = target_dir; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","target_dir",_("target_dir")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","target_dir",_("target_dir")); } void cls_config::edit_watchdog_tmo(std::string &parm, enum PARM_ACT pact) @@ -793,7 +793,7 @@ void cls_config::edit_watchdog_tmo(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if (parm_in < 1) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid watchdog timeout %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid watchdog timeout %d"),parm_in); } else { watchdog_tmo = parm_in; } @@ -801,7 +801,7 @@ void cls_config::edit_watchdog_tmo(std::string &parm, enum PARM_ACT pact) parm = std::to_string(watchdog_tmo); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","watchdog_tmo",_("watchdog_tmo")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","watchdog_tmo",_("watchdog_tmo")); } void cls_config::edit_watchdog_kill(std::string &parm, enum PARM_ACT pact) @@ -812,7 +812,7 @@ void cls_config::edit_watchdog_kill(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if (parm_in < 0) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid watchdog kill timeout %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid watchdog kill timeout %d"),parm_in); } else { watchdog_kill = parm_in; } @@ -820,7 +820,7 @@ void cls_config::edit_watchdog_kill(std::string &parm, enum PARM_ACT pact) parm = std::to_string(watchdog_kill); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","watchdog_kill",_("watchdog_kill")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","watchdog_kill",_("watchdog_kill")); } void cls_config::edit_v4l2_device(std::string &parm, enum PARM_ACT pact) @@ -833,7 +833,7 @@ void cls_config::edit_v4l2_device(std::string &parm, enum PARM_ACT pact) parm = v4l2_device; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","v4l2_device",_("v4l2_device")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","v4l2_device",_("v4l2_device")); } void cls_config::edit_v4l2_params(std::string &parm, enum PARM_ACT pact) @@ -846,7 +846,7 @@ void cls_config::edit_v4l2_params(std::string &parm, enum PARM_ACT pact) parm = v4l2_params; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","v4l2_params",_("v4l2_params")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","v4l2_params",_("v4l2_params")); } void cls_config::edit_netcam_url(std::string &parm, enum PARM_ACT pact) @@ -859,7 +859,7 @@ void cls_config::edit_netcam_url(std::string &parm, enum PARM_ACT pact) parm = netcam_url; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","netcam_url",_("netcam_url")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","netcam_url",_("netcam_url")); } void cls_config::edit_netcam_params(std::string &parm, enum PARM_ACT pact) @@ -872,7 +872,7 @@ void cls_config::edit_netcam_params(std::string &parm, enum PARM_ACT pact) parm = netcam_params; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","netcam_params",_("netcam_params")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","netcam_params",_("netcam_params")); } void cls_config::edit_netcam_high_url(std::string &parm, enum PARM_ACT pact) @@ -885,7 +885,7 @@ void cls_config::edit_netcam_high_url(std::string &parm, enum PARM_ACT pact) parm = netcam_high_url; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","netcam_high_url",_("netcam_high_url")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","netcam_high_url",_("netcam_high_url")); } void cls_config::edit_netcam_high_params(std::string &parm, enum PARM_ACT pact) @@ -898,7 +898,7 @@ void cls_config::edit_netcam_high_params(std::string &parm, enum PARM_ACT pact) parm = netcam_high_params; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","netcam_high_params",_("netcam_high_params")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","netcam_high_params",_("netcam_high_params")); } void cls_config::edit_netcam_userpass(std::string &parm, enum PARM_ACT pact) @@ -911,7 +911,7 @@ void cls_config::edit_netcam_userpass(std::string &parm, enum PARM_ACT pact) parm = netcam_userpass; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","netcam_userpass",_("netcam_userpass")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","netcam_userpass",_("netcam_userpass")); } void cls_config::edit_libcam_device(std::string &parm, enum PARM_ACT pact) @@ -924,7 +924,7 @@ void cls_config::edit_libcam_device(std::string &parm, enum PARM_ACT pact) parm = libcam_device; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","libcam_device",_("libcam_device")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","libcam_device",_("libcam_device")); } void cls_config::edit_libcam_params(std::string &parm, enum PARM_ACT pact) @@ -937,7 +937,7 @@ void cls_config::edit_libcam_params(std::string &parm, enum PARM_ACT pact) parm = libcam_params; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","libcam_params",_("libcam_params")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","libcam_params",_("libcam_params")); } void cls_config::edit_width(std::string &parm, enum PARM_ACT pact) @@ -948,12 +948,12 @@ void cls_config::edit_width(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 64) || (parm_in > 9999)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid width %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid width %d"),parm_in); } else if (parm_in % 8) { - MOTPLS_LOG(CRT, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(CRT, TYPE_NETCAM, NO_ERRNO ,_("Image width (%d) requested is not modulo 8."), parm_in); parm_in = parm_in - (parm_in % 8) + 8; - MOTPLS_LOG(CRT, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(CRT, TYPE_NETCAM, NO_ERRNO ,_("Adjusting width to next higher multiple of 8 (%d)."), parm_in); width = parm_in; } else { @@ -963,7 +963,7 @@ void cls_config::edit_width(std::string &parm, enum PARM_ACT pact) parm = std::to_string(width); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","width",_("width")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","width",_("width")); } void cls_config::edit_height(std::string &parm, enum PARM_ACT pact) @@ -974,12 +974,12 @@ void cls_config::edit_height(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 64) || (parm_in > 9999)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid height %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid height %d"),parm_in); } else if (parm_in % 8) { - MOTPLS_LOG(CRT, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(CRT, TYPE_NETCAM, NO_ERRNO ,_("Image height (%d) requested is not modulo 8."), parm_in); parm_in = parm_in - (parm_in % 8) + 8; - MOTPLS_LOG(CRT, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(CRT, TYPE_NETCAM, NO_ERRNO ,_("Adjusting height to next higher multiple of 8 (%d)."), parm_in); height = parm_in; } else { @@ -989,7 +989,7 @@ void cls_config::edit_height(std::string &parm, enum PARM_ACT pact) parm = std::to_string(height); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","height",_("height")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","height",_("height")); } void cls_config::edit_framerate(std::string &parm, enum PARM_ACT pact) @@ -1000,7 +1000,7 @@ void cls_config::edit_framerate(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 2) || (parm_in > 100)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid framerate %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid framerate %d"),parm_in); } else { framerate = parm_in; } @@ -1008,7 +1008,7 @@ void cls_config::edit_framerate(std::string &parm, enum PARM_ACT pact) parm = std::to_string(framerate); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","framerate",_("framerate")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","framerate",_("framerate")); } void cls_config::edit_rotate(std::string &parm, enum PARM_ACT pact) @@ -1020,7 +1020,7 @@ void cls_config::edit_rotate(std::string &parm, enum PARM_ACT pact) parm_in = atoi(parm.c_str()); if ((parm_in != 0) && (parm_in != 90) && (parm_in != 180) && (parm_in != 270) ) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid rotate %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid rotate %d"),parm_in); } else { rotate = parm_in; } @@ -1030,7 +1030,7 @@ void cls_config::edit_rotate(std::string &parm, enum PARM_ACT pact) parm = "[\"0\",\"90\",\"180\",\"270\"]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","rotate",_("rotate")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","rotate",_("rotate")); } void cls_config::edit_flip_axis(std::string &parm, enum PARM_ACT pact) @@ -1043,7 +1043,7 @@ void cls_config::edit_flip_axis(std::string &parm, enum PARM_ACT pact) } else if (parm == "") { flip_axis = "none"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid flip_axis %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid flip_axis %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = flip_axis; @@ -1052,7 +1052,7 @@ void cls_config::edit_flip_axis(std::string &parm, enum PARM_ACT pact) } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","flip_axis",_("flip_axis")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","flip_axis",_("flip_axis")); } void cls_config::edit_locate_motion_mode(std::string &parm, enum PARM_ACT pact) @@ -1065,7 +1065,7 @@ void cls_config::edit_locate_motion_mode(std::string &parm, enum PARM_ACT pact) } else if (parm == "") { locate_motion_mode = "off"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid locate_motion_mode %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid locate_motion_mode %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = locate_motion_mode; @@ -1073,7 +1073,7 @@ void cls_config::edit_locate_motion_mode(std::string &parm, enum PARM_ACT pact) parm = "[\"off\",\"on\",\"preview\"]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","locate_motion_mode",_("locate_motion_mode")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","locate_motion_mode",_("locate_motion_mode")); } void cls_config::edit_locate_motion_style(std::string &parm, enum PARM_ACT pact) @@ -1087,7 +1087,7 @@ void cls_config::edit_locate_motion_style(std::string &parm, enum PARM_ACT pact) } else if (parm == "") { locate_motion_style = "box"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid locate_motion_style %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid locate_motion_style %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = locate_motion_style; @@ -1095,7 +1095,7 @@ void cls_config::edit_locate_motion_style(std::string &parm, enum PARM_ACT pact) parm = "[\"box\",\"redbox\",\"cross\",\"redcross\"]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","locate_motion_style",_("locate_motion_style")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","locate_motion_style",_("locate_motion_style")); } void cls_config::edit_text_left(std::string &parm, enum PARM_ACT pact) @@ -1108,7 +1108,7 @@ void cls_config::edit_text_left(std::string &parm, enum PARM_ACT pact) parm = text_left; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","text_left",_("text_left")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","text_left",_("text_left")); } void cls_config::edit_text_right(std::string &parm, enum PARM_ACT pact) @@ -1121,7 +1121,7 @@ void cls_config::edit_text_right(std::string &parm, enum PARM_ACT pact) parm = text_right; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","text_right",_("text_right")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","text_right",_("text_right")); } void cls_config::edit_text_changes(std::string &parm, enum PARM_ACT pact) @@ -1134,7 +1134,7 @@ void cls_config::edit_text_changes(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, text_changes); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","text_changes",_("text_changes")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","text_changes",_("text_changes")); } void cls_config::edit_text_scale(std::string &parm, enum PARM_ACT pact) @@ -1145,7 +1145,7 @@ void cls_config::edit_text_scale(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 10)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid text_scale %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid text_scale %d"),parm_in); } else { text_scale = parm_in; } @@ -1158,7 +1158,7 @@ void cls_config::edit_text_scale(std::string &parm, enum PARM_ACT pact) parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","text_scale",_("text_scale")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","text_scale",_("text_scale")); } void cls_config::edit_text_event(std::string &parm, enum PARM_ACT pact) @@ -1171,7 +1171,7 @@ void cls_config::edit_text_event(std::string &parm, enum PARM_ACT pact) parm = text_event; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","text_event",_("text_event")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","text_event",_("text_event")); } void cls_config::edit_emulate_motion(std::string &parm, enum PARM_ACT pact) @@ -1184,7 +1184,7 @@ void cls_config::edit_emulate_motion(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, emulate_motion); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","emulate_motion",_("emulate_motion")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","emulate_motion",_("emulate_motion")); } void cls_config::edit_threshold(std::string &parm, enum PARM_ACT pact) @@ -1195,7 +1195,7 @@ void cls_config::edit_threshold(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 2147483647)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold %d"),parm_in); } else { threshold = parm_in; } @@ -1203,7 +1203,7 @@ void cls_config::edit_threshold(std::string &parm, enum PARM_ACT pact) parm = std::to_string(threshold); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold",_("threshold")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold",_("threshold")); } void cls_config::edit_threshold_maximum(std::string &parm, enum PARM_ACT pact) @@ -1214,7 +1214,7 @@ void cls_config::edit_threshold_maximum(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) ) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold_maximum %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold_maximum %d"),parm_in); } else { threshold_maximum = parm_in; } @@ -1222,7 +1222,7 @@ void cls_config::edit_threshold_maximum(std::string &parm, enum PARM_ACT pact) parm = std::to_string(threshold_maximum); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_maximum",_("threshold_maximum")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_maximum",_("threshold_maximum")); } void cls_config::edit_threshold_sdevx(std::string &parm, enum PARM_ACT pact) @@ -1233,7 +1233,7 @@ void cls_config::edit_threshold_sdevx(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) ) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold_sdevx %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold_sdevx %d"),parm_in); } else { threshold_sdevx = parm_in; } @@ -1241,7 +1241,7 @@ void cls_config::edit_threshold_sdevx(std::string &parm, enum PARM_ACT pact) parm = std::to_string(threshold_sdevx); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_sdevx",_("threshold_sdevx")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_sdevx",_("threshold_sdevx")); } void cls_config::edit_threshold_sdevy(std::string &parm, enum PARM_ACT pact) @@ -1252,7 +1252,7 @@ void cls_config::edit_threshold_sdevy(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) ) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold_sdevy %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold_sdevy %d"),parm_in); } else { threshold_sdevy = parm_in; } @@ -1260,7 +1260,7 @@ void cls_config::edit_threshold_sdevy(std::string &parm, enum PARM_ACT pact) parm = std::to_string(threshold_sdevy); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_sdevy",_("threshold_sdevy")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_sdevy",_("threshold_sdevy")); } void cls_config::edit_threshold_sdevxy(std::string &parm, enum PARM_ACT pact) @@ -1271,7 +1271,7 @@ void cls_config::edit_threshold_sdevxy(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) ) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold_sdevxy %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold_sdevxy %d"),parm_in); } else { threshold_sdevxy = parm_in; } @@ -1279,7 +1279,7 @@ void cls_config::edit_threshold_sdevxy(std::string &parm, enum PARM_ACT pact) parm = std::to_string(threshold_sdevxy); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_sdevxy",_("threshold_sdevxy")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_sdevxy",_("threshold_sdevxy")); } void cls_config::edit_threshold_ratio(std::string &parm, enum PARM_ACT pact) @@ -1290,7 +1290,7 @@ void cls_config::edit_threshold_ratio(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 100) ) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold_ratio %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold_ratio %d"),parm_in); } else { threshold_ratio = parm_in; } @@ -1298,7 +1298,7 @@ void cls_config::edit_threshold_ratio(std::string &parm, enum PARM_ACT pact) parm = std::to_string(threshold_ratio); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_ratio",_("threshold_ratio")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_ratio",_("threshold_ratio")); } void cls_config::edit_threshold_ratio_change(std::string &parm, enum PARM_ACT pact) @@ -1309,7 +1309,7 @@ void cls_config::edit_threshold_ratio_change(std::string &parm, enum PARM_ACT pa } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 255) ) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold_ratio_change %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid threshold_ratio_change %d"),parm_in); } else { threshold_ratio_change = parm_in; } @@ -1317,7 +1317,7 @@ void cls_config::edit_threshold_ratio_change(std::string &parm, enum PARM_ACT pa parm = std::to_string(threshold_ratio_change); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_ratio_change",_("threshold_ratio_change")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_ratio_change",_("threshold_ratio_change")); } void cls_config::edit_threshold_tune(std::string &parm, enum PARM_ACT pact) @@ -1330,7 +1330,7 @@ void cls_config::edit_threshold_tune(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, threshold_tune); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_tune",_("threshold_tune")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","threshold_tune",_("threshold_tune")); } void cls_config::edit_secondary_method(std::string &parm, enum PARM_ACT pact) @@ -1344,7 +1344,7 @@ void cls_config::edit_secondary_method(std::string &parm, enum PARM_ACT pact) } else if (parm == "") { secondary_method = "none"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid secondary_method %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid secondary_method %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = secondary_method; @@ -1352,7 +1352,7 @@ void cls_config::edit_secondary_method(std::string &parm, enum PARM_ACT pact) parm = "[\"none\",\"haar\",\"hog\",\"dnn\"]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","secondary_method",_("secondary_method")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","secondary_method",_("secondary_method")); } void cls_config::edit_secondary_params(std::string &parm, enum PARM_ACT pact) @@ -1365,7 +1365,7 @@ void cls_config::edit_secondary_params(std::string &parm, enum PARM_ACT pact) parm = secondary_params; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","secondary_params",_("secondary_params")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","secondary_params",_("secondary_params")); } void cls_config::edit_noise_level(std::string &parm, enum PARM_ACT pact) @@ -1376,7 +1376,7 @@ void cls_config::edit_noise_level(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 255)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid noise_level %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid noise_level %d"),parm_in); } else { noise_level = parm_in; } @@ -1384,7 +1384,7 @@ void cls_config::edit_noise_level(std::string &parm, enum PARM_ACT pact) parm = std::to_string(noise_level); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","noise_level",_("noise_level")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","noise_level",_("noise_level")); } void cls_config::edit_noise_tune(std::string &parm, enum PARM_ACT pact) @@ -1397,7 +1397,7 @@ void cls_config::edit_noise_tune(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, noise_tune); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","noise_tune",_("noise_tune")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","noise_tune",_("noise_tune")); } void cls_config::edit_despeckle_filter(std::string &parm, enum PARM_ACT pact) @@ -1410,7 +1410,7 @@ void cls_config::edit_despeckle_filter(std::string &parm, enum PARM_ACT pact) parm = despeckle_filter; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","despeckle_filter",_("despeckle_filter")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","despeckle_filter",_("despeckle_filter")); } void cls_config::edit_area_detect(std::string &parm, enum PARM_ACT pact) @@ -1423,7 +1423,7 @@ void cls_config::edit_area_detect(std::string &parm, enum PARM_ACT pact) parm = area_detect; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","area_detect",_("area_detect")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","area_detect",_("area_detect")); } void cls_config::edit_mask_file(std::string &parm, enum PARM_ACT pact) @@ -1436,7 +1436,7 @@ void cls_config::edit_mask_file(std::string &parm, enum PARM_ACT pact) parm = mask_file; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","mask_file",_("mask_file")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","mask_file",_("mask_file")); } void cls_config::edit_mask_privacy(std::string &parm, enum PARM_ACT pact) @@ -1449,7 +1449,7 @@ void cls_config::edit_mask_privacy(std::string &parm, enum PARM_ACT pact) parm = mask_privacy; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","mask_privacy",_("mask_privacy")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","mask_privacy",_("mask_privacy")); } void cls_config::edit_smart_mask_speed(std::string &parm, enum PARM_ACT pact) @@ -1460,7 +1460,7 @@ void cls_config::edit_smart_mask_speed(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 10)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid smart_mask_speed %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid smart_mask_speed %d"),parm_in); } else { smart_mask_speed = parm_in; } @@ -1473,7 +1473,7 @@ void cls_config::edit_smart_mask_speed(std::string &parm, enum PARM_ACT pact) parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","smart_mask_speed",_("smart_mask_speed")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","smart_mask_speed",_("smart_mask_speed")); } void cls_config::edit_lightswitch_percent(std::string &parm, enum PARM_ACT pact) @@ -1484,7 +1484,7 @@ void cls_config::edit_lightswitch_percent(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 100)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid lightswitch_percent %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid lightswitch_percent %d"),parm_in); } else { lightswitch_percent = parm_in; } @@ -1492,7 +1492,7 @@ void cls_config::edit_lightswitch_percent(std::string &parm, enum PARM_ACT pact) parm = std::to_string(lightswitch_percent); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","lightswitch_percent",_("lightswitch_percent")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","lightswitch_percent",_("lightswitch_percent")); } void cls_config::edit_lightswitch_frames(std::string &parm, enum PARM_ACT pact) @@ -1503,7 +1503,7 @@ void cls_config::edit_lightswitch_frames(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 1000)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid lightswitch_frames %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid lightswitch_frames %d"),parm_in); } else { lightswitch_frames = parm_in; } @@ -1511,7 +1511,7 @@ void cls_config::edit_lightswitch_frames(std::string &parm, enum PARM_ACT pact) parm = std::to_string(lightswitch_frames); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","lightswitch_frames",_("lightswitch_frames")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","lightswitch_frames",_("lightswitch_frames")); } void cls_config::edit_minimum_motion_frames(std::string &parm, enum PARM_ACT pact) @@ -1522,7 +1522,7 @@ void cls_config::edit_minimum_motion_frames(std::string &parm, enum PARM_ACT pac } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 10000)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid minimum_motion_frames %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid minimum_motion_frames %d"),parm_in); } else { minimum_motion_frames = parm_in; } @@ -1530,7 +1530,7 @@ void cls_config::edit_minimum_motion_frames(std::string &parm, enum PARM_ACT pac parm = std::to_string(minimum_motion_frames); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","minimum_motion_frames",_("minimum_motion_frames")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","minimum_motion_frames",_("minimum_motion_frames")); } void cls_config::edit_static_object_time(std::string &parm, enum PARM_ACT pact) @@ -1541,7 +1541,7 @@ void cls_config::edit_static_object_time(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if (parm_in < 1) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid static_object_time %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid static_object_time %d"),parm_in); } else { static_object_time = parm_in; } @@ -1549,7 +1549,7 @@ void cls_config::edit_static_object_time(std::string &parm, enum PARM_ACT pact) parm = std::to_string(static_object_time); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","static_object_time",_("static_object_time")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","static_object_time",_("static_object_time")); } void cls_config::edit_event_gap(std::string &parm, enum PARM_ACT pact) @@ -1560,7 +1560,7 @@ void cls_config::edit_event_gap(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 2147483647)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid event_gap %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid event_gap %d"),parm_in); } else { event_gap = parm_in; } @@ -1568,7 +1568,7 @@ void cls_config::edit_event_gap(std::string &parm, enum PARM_ACT pact) parm = std::to_string(event_gap); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","event_gap",_("event_gap")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","event_gap",_("event_gap")); } void cls_config::edit_pre_capture(std::string &parm, enum PARM_ACT pact) @@ -1579,7 +1579,7 @@ void cls_config::edit_pre_capture(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 1000)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid pre_capture %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid pre_capture %d"),parm_in); } else { pre_capture = parm_in; } @@ -1587,7 +1587,7 @@ void cls_config::edit_pre_capture(std::string &parm, enum PARM_ACT pact) parm = std::to_string(pre_capture); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","pre_capture",_("pre_capture")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","pre_capture",_("pre_capture")); } void cls_config::edit_post_capture(std::string &parm, enum PARM_ACT pact) @@ -1598,7 +1598,7 @@ void cls_config::edit_post_capture(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 2147483647)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid post_capture %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid post_capture %d"),parm_in); } else { post_capture = parm_in; } @@ -1606,7 +1606,7 @@ void cls_config::edit_post_capture(std::string &parm, enum PARM_ACT pact) parm = std::to_string(post_capture); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","post_capture",_("post_capture")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","post_capture",_("post_capture")); } void cls_config::edit_on_event_start(std::string &parm, enum PARM_ACT pact) @@ -1619,7 +1619,7 @@ void cls_config::edit_on_event_start(std::string &parm, enum PARM_ACT pact) parm = on_event_start; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_event_start",_("on_event_start")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_event_start",_("on_event_start")); } void cls_config::edit_on_event_end(std::string &parm, enum PARM_ACT pact) @@ -1632,7 +1632,7 @@ void cls_config::edit_on_event_end(std::string &parm, enum PARM_ACT pact) parm = on_event_end; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_event_end",_("on_event_end")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_event_end",_("on_event_end")); } void cls_config::edit_on_picture_save(std::string &parm, enum PARM_ACT pact) @@ -1645,7 +1645,7 @@ void cls_config::edit_on_picture_save(std::string &parm, enum PARM_ACT pact) parm = on_picture_save; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_picture_save",_("on_picture_save")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_picture_save",_("on_picture_save")); } void cls_config::edit_on_area_detected(std::string &parm, enum PARM_ACT pact) @@ -1658,7 +1658,7 @@ void cls_config::edit_on_area_detected(std::string &parm, enum PARM_ACT pact) parm = on_area_detected; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_area_detected",_("on_area_detected")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_area_detected",_("on_area_detected")); } void cls_config::edit_on_motion_detected(std::string &parm, enum PARM_ACT pact) @@ -1671,7 +1671,7 @@ void cls_config::edit_on_motion_detected(std::string &parm, enum PARM_ACT pact) parm = on_motion_detected; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_motion_detected",_("on_motion_detected")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_motion_detected",_("on_motion_detected")); } void cls_config::edit_on_movie_start(std::string &parm, enum PARM_ACT pact) @@ -1684,7 +1684,7 @@ void cls_config::edit_on_movie_start(std::string &parm, enum PARM_ACT pact) parm = on_movie_start; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_movie_start",_("on_movie_start")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_movie_start",_("on_movie_start")); } void cls_config::edit_on_movie_end(std::string &parm, enum PARM_ACT pact) @@ -1697,7 +1697,7 @@ void cls_config::edit_on_movie_end(std::string &parm, enum PARM_ACT pact) parm = on_movie_end; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_movie_end",_("on_movie_end")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_movie_end",_("on_movie_end")); } void cls_config::edit_on_camera_lost(std::string &parm, enum PARM_ACT pact) @@ -1710,7 +1710,7 @@ void cls_config::edit_on_camera_lost(std::string &parm, enum PARM_ACT pact) parm = on_camera_lost; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_camera_lost",_("on_camera_lost")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_camera_lost",_("on_camera_lost")); } void cls_config::edit_on_camera_found(std::string &parm, enum PARM_ACT pact) @@ -1723,7 +1723,7 @@ void cls_config::edit_on_camera_found(std::string &parm, enum PARM_ACT pact) parm = on_camera_found; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_camera_found",_("on_camera_found")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_camera_found",_("on_camera_found")); } void cls_config::edit_on_secondary_detect(std::string &parm, enum PARM_ACT pact) @@ -1736,7 +1736,7 @@ void cls_config::edit_on_secondary_detect(std::string &parm, enum PARM_ACT pact) parm = on_secondary_detect; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_secondary_detect",_("on_secondary_detect")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_secondary_detect",_("on_secondary_detect")); } void cls_config::edit_on_action_user(std::string &parm, enum PARM_ACT pact) @@ -1749,7 +1749,7 @@ void cls_config::edit_on_action_user(std::string &parm, enum PARM_ACT pact) parm = on_action_user; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_action_user",_("on_action_user")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_action_user",_("on_action_user")); } void cls_config::edit_on_sound_alert(std::string &parm, enum PARM_ACT pact) @@ -1762,7 +1762,7 @@ void cls_config::edit_on_sound_alert(std::string &parm, enum PARM_ACT pact) parm = on_sound_alert; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_sound_alert",_("on_sound_alert")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","on_sound_alert",_("on_sound_alert")); } void cls_config::edit_picture_output(std::string &parm, enum PARM_ACT pact) @@ -1776,7 +1776,7 @@ void cls_config::edit_picture_output(std::string &parm, enum PARM_ACT pact) } else if (parm == "") { picture_output = "off"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid picture_output %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid picture_output %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = picture_output; @@ -1786,7 +1786,7 @@ void cls_config::edit_picture_output(std::string &parm, enum PARM_ACT pact) parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","picture_output",_("picture_output")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","picture_output",_("picture_output")); } void cls_config::edit_picture_output_motion(std::string &parm, enum PARM_ACT pact) @@ -1799,7 +1799,7 @@ void cls_config::edit_picture_output_motion(std::string &parm, enum PARM_ACT pac } else if (parm == "") { picture_output_motion = "off"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid picture_output_motion %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid picture_output_motion %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = picture_output_motion; @@ -1809,7 +1809,7 @@ void cls_config::edit_picture_output_motion(std::string &parm, enum PARM_ACT pac parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","picture_output_motion",_("picture_output_motion")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","picture_output_motion",_("picture_output_motion")); } void cls_config::edit_picture_type(std::string &parm, enum PARM_ACT pact) @@ -1822,7 +1822,7 @@ void cls_config::edit_picture_type(std::string &parm, enum PARM_ACT pact) } else if ((parm == "") ||(parm == "jpeg")) { picture_type = "jpg"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid picture_type %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid picture_type %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = picture_type; @@ -1832,7 +1832,7 @@ void cls_config::edit_picture_type(std::string &parm, enum PARM_ACT pact) parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","picture_type",_("picture_type")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","picture_type",_("picture_type")); } void cls_config::edit_picture_quality(std::string &parm, enum PARM_ACT pact) @@ -1843,7 +1843,7 @@ void cls_config::edit_picture_quality(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 100)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid picture_quality %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid picture_quality %d"),parm_in); } else { picture_quality = parm_in; } @@ -1851,7 +1851,7 @@ void cls_config::edit_picture_quality(std::string &parm, enum PARM_ACT pact) parm = std::to_string(picture_quality); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","picture_quality",_("picture_quality")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","picture_quality",_("picture_quality")); } void cls_config::edit_picture_exif(std::string &parm, enum PARM_ACT pact) @@ -1864,7 +1864,7 @@ void cls_config::edit_picture_exif(std::string &parm, enum PARM_ACT pact) parm = picture_exif; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","picture_exif",_("picture_exif")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","picture_exif",_("picture_exif")); } void cls_config::edit_picture_filename(std::string &parm, enum PARM_ACT pact) @@ -1876,7 +1876,7 @@ void cls_config::edit_picture_filename(std::string &parm, enum PARM_ACT pact) picture_filename = ""; } else if (parm.substr(0,1) == "/") { picture_filename = parm.substr(1); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO,"Removing leading '/' from filename"); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,"Removing leading '/' from filename"); } else { picture_filename = parm; } @@ -1884,7 +1884,7 @@ void cls_config::edit_picture_filename(std::string &parm, enum PARM_ACT pact) parm = picture_filename; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","picture_filename",_("picture_filename")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","picture_filename",_("picture_filename")); } void cls_config::edit_snapshot_interval(std::string &parm, enum PARM_ACT pact) @@ -1895,7 +1895,7 @@ void cls_config::edit_snapshot_interval(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 2147483647)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid snapshot_interval %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid snapshot_interval %d"),parm_in); } else { snapshot_interval = parm_in; } @@ -1903,7 +1903,7 @@ void cls_config::edit_snapshot_interval(std::string &parm, enum PARM_ACT pact) parm = std::to_string(snapshot_interval); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snapshot_interval",_("snapshot_interval")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snapshot_interval",_("snapshot_interval")); } void cls_config::edit_snapshot_filename(std::string &parm, enum PARM_ACT pact) @@ -1915,7 +1915,7 @@ void cls_config::edit_snapshot_filename(std::string &parm, enum PARM_ACT pact) snapshot_filename = ""; } else if (parm.substr(0,1) == "/") { snapshot_filename = parm.substr(1); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO,"Removing leading '/' from filename"); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,"Removing leading '/' from filename"); } else { snapshot_filename = parm; } @@ -1923,7 +1923,7 @@ void cls_config::edit_snapshot_filename(std::string &parm, enum PARM_ACT pact) parm = snapshot_filename; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snapshot_filename",_("snapshot_filename")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snapshot_filename",_("snapshot_filename")); } void cls_config::edit_movie_output(std::string &parm, enum PARM_ACT pact) @@ -1936,7 +1936,7 @@ void cls_config::edit_movie_output(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, movie_output); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_output",_("movie_output")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_output",_("movie_output")); } void cls_config::edit_movie_output_motion(std::string &parm, enum PARM_ACT pact) @@ -1949,7 +1949,7 @@ void cls_config::edit_movie_output_motion(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, movie_output_motion); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_output_motion",_("movie_output_motion")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_output_motion",_("movie_output_motion")); } void cls_config::edit_movie_max_time(std::string &parm, enum PARM_ACT pact) @@ -1960,7 +1960,7 @@ void cls_config::edit_movie_max_time(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 2147483647)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid movie_max_time %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid movie_max_time %d"),parm_in); } else { movie_max_time = parm_in; } @@ -1968,7 +1968,7 @@ void cls_config::edit_movie_max_time(std::string &parm, enum PARM_ACT pact) parm = std::to_string(movie_max_time); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_max_time",_("movie_max_time")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_max_time",_("movie_max_time")); } void cls_config::edit_movie_bps(std::string &parm, enum PARM_ACT pact) @@ -1979,7 +1979,7 @@ void cls_config::edit_movie_bps(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 9999999)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid movie_bps %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid movie_bps %d"),parm_in); } else { movie_bps = parm_in; } @@ -1987,7 +1987,7 @@ void cls_config::edit_movie_bps(std::string &parm, enum PARM_ACT pact) parm = std::to_string(movie_bps); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_bps",_("movie_bps")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_bps",_("movie_bps")); } void cls_config::edit_movie_quality(std::string &parm, enum PARM_ACT pact) @@ -1998,7 +1998,7 @@ void cls_config::edit_movie_quality(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in <= 0) || (parm_in > 100)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid movie_quality %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid movie_quality %d"),parm_in); } else if (parm_in > 90) { /* Many movie players can not handle the 100% quality @@ -2006,11 +2006,11 @@ void cls_config::edit_movie_quality(std::string &parm, enum PARM_ACT pact) As a result, we limit it to an arbritrary number less than 100 (i.e. 90) */ - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Movie quality settings greater than 90 are not permitted.")); movie_quality = 90; } else if (parm_in < 5) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Movie quality settings less then 5 are not permitted.")); movie_quality = 5; } else { @@ -2020,7 +2020,7 @@ void cls_config::edit_movie_quality(std::string &parm, enum PARM_ACT pact) parm = std::to_string(movie_quality); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_quality",_("movie_quality")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_quality",_("movie_quality")); } void cls_config::edit_movie_container(std::string &parm, enum PARM_ACT pact) @@ -2033,7 +2033,7 @@ void cls_config::edit_movie_container(std::string &parm, enum PARM_ACT pact) parm = movie_container; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_container",_("movie_container")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_container",_("movie_container")); } void cls_config::edit_movie_passthrough(std::string &parm, enum PARM_ACT pact) @@ -2046,7 +2046,7 @@ void cls_config::edit_movie_passthrough(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, movie_passthrough); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_passthrough",_("movie_passthrough")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_passthrough",_("movie_passthrough")); } void cls_config::edit_movie_filename(std::string &parm, enum PARM_ACT pact) @@ -2058,7 +2058,7 @@ void cls_config::edit_movie_filename(std::string &parm, enum PARM_ACT pact) movie_filename = ""; } else if (parm.substr(0,1) == "/") { movie_filename = parm.substr(1); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO,"Removing leading '/' from filename"); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,"Removing leading '/' from filename"); } else { movie_filename = parm; } @@ -2066,7 +2066,7 @@ void cls_config::edit_movie_filename(std::string &parm, enum PARM_ACT pact) parm = movie_filename; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_filename",_("movie_filename")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_filename",_("movie_filename")); } void cls_config::edit_movie_retain(std::string &parm, enum PARM_ACT pact) @@ -2079,7 +2079,7 @@ void cls_config::edit_movie_retain(std::string &parm, enum PARM_ACT pact) } else if (parm == "") { movie_retain = "all"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid movie_retain %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid movie_retain %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = movie_retain; @@ -2089,7 +2089,7 @@ void cls_config::edit_movie_retain(std::string &parm, enum PARM_ACT pact) parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_retain",_("movie_retain")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_retain",_("movie_retain")); } void cls_config::edit_movie_extpipe_use(std::string &parm, enum PARM_ACT pact) @@ -2102,7 +2102,7 @@ void cls_config::edit_movie_extpipe_use(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, movie_extpipe_use); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_extpipe_use",_("movie_extpipe_use")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_extpipe_use",_("movie_extpipe_use")); } void cls_config::edit_movie_extpipe(std::string &parm, enum PARM_ACT pact) @@ -2115,7 +2115,7 @@ void cls_config::edit_movie_extpipe(std::string &parm, enum PARM_ACT pact) parm = movie_extpipe; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_extpipe",_("movie_extpipe")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","movie_extpipe",_("movie_extpipe")); } void cls_config::edit_timelapse_interval(std::string &parm, enum PARM_ACT pact) @@ -2126,7 +2126,7 @@ void cls_config::edit_timelapse_interval(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 2147483647)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid timelapse_interval %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid timelapse_interval %d"),parm_in); } else { timelapse_interval = parm_in; } @@ -2134,7 +2134,7 @@ void cls_config::edit_timelapse_interval(std::string &parm, enum PARM_ACT pact) parm = std::to_string(timelapse_interval); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","timelapse_interval",_("timelapse_interval")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","timelapse_interval",_("timelapse_interval")); } void cls_config::edit_timelapse_mode(std::string &parm, enum PARM_ACT pact) @@ -2149,7 +2149,7 @@ void cls_config::edit_timelapse_mode(std::string &parm, enum PARM_ACT pact) } else if (parm == "") { timelapse_mode = "daily"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid timelapse_mode %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid timelapse_mode %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = timelapse_mode; @@ -2160,7 +2160,7 @@ void cls_config::edit_timelapse_mode(std::string &parm, enum PARM_ACT pact) parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","timelapse_mode",_("timelapse_mode")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","timelapse_mode",_("timelapse_mode")); } void cls_config::edit_timelapse_fps(std::string &parm, enum PARM_ACT pact) @@ -2171,7 +2171,7 @@ void cls_config::edit_timelapse_fps(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 2) || (parm_in > 100)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid timelapse_fps %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid timelapse_fps %d"),parm_in); } else { timelapse_fps = parm_in; } @@ -2179,7 +2179,7 @@ void cls_config::edit_timelapse_fps(std::string &parm, enum PARM_ACT pact) parm = std::to_string(timelapse_fps); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","timelapse_fps",_("timelapse_fps")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","timelapse_fps",_("timelapse_fps")); } void cls_config::edit_timelapse_container(std::string &parm, enum PARM_ACT pact) @@ -2192,7 +2192,7 @@ void cls_config::edit_timelapse_container(std::string &parm, enum PARM_ACT pact) } else if (parm == "") { timelapse_container = "mpg"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid timelapse_container %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid timelapse_container %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = timelapse_container; @@ -2202,7 +2202,7 @@ void cls_config::edit_timelapse_container(std::string &parm, enum PARM_ACT pact) parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","timelapse_container",_("timelapse_container")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","timelapse_container",_("timelapse_container")); } void cls_config::edit_timelapse_filename(std::string &parm, enum PARM_ACT pact) @@ -2214,7 +2214,7 @@ void cls_config::edit_timelapse_filename(std::string &parm, enum PARM_ACT pact) timelapse_filename = ""; } else if (parm.substr(0,1) == "/") { timelapse_filename = parm.substr(1); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO,"Removing leading '/' from filename"); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,"Removing leading '/' from filename"); } else { timelapse_filename = parm; } @@ -2222,7 +2222,7 @@ void cls_config::edit_timelapse_filename(std::string &parm, enum PARM_ACT pact) parm = timelapse_filename; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","timelapse_filename",_("timelapse_filename")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","timelapse_filename",_("timelapse_filename")); } void cls_config::edit_video_pipe(std::string &parm, enum PARM_ACT pact) @@ -2235,7 +2235,7 @@ void cls_config::edit_video_pipe(std::string &parm, enum PARM_ACT pact) parm = video_pipe; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","video_pipe",_("video_pipe")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","video_pipe",_("video_pipe")); } void cls_config::edit_video_pipe_motion(std::string &parm, enum PARM_ACT pact) @@ -2248,7 +2248,7 @@ void cls_config::edit_video_pipe_motion(std::string &parm, enum PARM_ACT pact) parm = video_pipe_motion; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","video_pipe_motion",_("video_pipe_motion")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","video_pipe_motion",_("video_pipe_motion")); } void cls_config::edit_webcontrol_port(std::string &parm, enum PARM_ACT pact) @@ -2259,7 +2259,7 @@ void cls_config::edit_webcontrol_port(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 65535)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_port %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_port %d"),parm_in); } else { webcontrol_port = parm_in; } @@ -2267,7 +2267,7 @@ void cls_config::edit_webcontrol_port(std::string &parm, enum PARM_ACT pact) parm = std::to_string(webcontrol_port); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_port",_("webcontrol_port")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_port",_("webcontrol_port")); } void cls_config::edit_webcontrol_port2(std::string &parm, enum PARM_ACT pact) @@ -2278,7 +2278,7 @@ void cls_config::edit_webcontrol_port2(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 65535)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_port2 %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_port2 %d"),parm_in); } else { webcontrol_port2 = parm_in; } @@ -2286,7 +2286,7 @@ void cls_config::edit_webcontrol_port2(std::string &parm, enum PARM_ACT pact) parm = std::to_string(webcontrol_port2); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_port2",_("webcontrol_port2")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_port2",_("webcontrol_port2")); } void cls_config::edit_webcontrol_base_path(std::string &parm, enum PARM_ACT pact) @@ -2295,12 +2295,12 @@ void cls_config::edit_webcontrol_base_path(std::string &parm, enum PARM_ACT pact webcontrol_base_path = ""; } else if (pact == PARM_ACT_SET) { if (parm == "/") { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Invalid webcontrol_base_path: Use blank instead of single / ")); webcontrol_base_path = ""; } else if (parm.length() >= 1) { if (parm.substr(0, 1) != "/") { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Invalid webcontrol_base_path: Must start with a / ")); webcontrol_base_path = "/" + parm; } else { @@ -2313,7 +2313,7 @@ void cls_config::edit_webcontrol_base_path(std::string &parm, enum PARM_ACT pact parm = webcontrol_base_path; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_base_path",_("webcontrol_base_path")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_base_path",_("webcontrol_base_path")); } void cls_config::edit_webcontrol_ipv6(std::string &parm, enum PARM_ACT pact) @@ -2326,7 +2326,7 @@ void cls_config::edit_webcontrol_ipv6(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, webcontrol_ipv6); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_ipv6",_("webcontrol_ipv6")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_ipv6",_("webcontrol_ipv6")); } void cls_config::edit_webcontrol_localhost(std::string &parm, enum PARM_ACT pact) @@ -2339,7 +2339,7 @@ void cls_config::edit_webcontrol_localhost(std::string &parm, enum PARM_ACT pact edit_get_bool(parm, webcontrol_localhost); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_localhost",_("webcontrol_localhost")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_localhost",_("webcontrol_localhost")); } void cls_config::edit_webcontrol_parms(std::string &parm, enum PARM_ACT pact) @@ -2350,7 +2350,7 @@ void cls_config::edit_webcontrol_parms(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 3)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_parms %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_parms %d"),parm_in); } else { webcontrol_parms = parm_in; } @@ -2362,7 +2362,7 @@ void cls_config::edit_webcontrol_parms(std::string &parm, enum PARM_ACT pact) parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_parms",_("webcontrol_parms")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_parms",_("webcontrol_parms")); } void cls_config::edit_webcontrol_interface(std::string &parm, enum PARM_ACT pact) @@ -2375,7 +2375,7 @@ void cls_config::edit_webcontrol_interface(std::string &parm, enum PARM_ACT pact } else if (parm == "") { webcontrol_interface = "default"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_interface %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_interface %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = webcontrol_interface; @@ -2385,7 +2385,7 @@ void cls_config::edit_webcontrol_interface(std::string &parm, enum PARM_ACT pact parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_interface",_("webcontrol_interface")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_interface",_("webcontrol_interface")); } void cls_config::edit_webcontrol_auth_method(std::string &parm, enum PARM_ACT pact) @@ -2398,7 +2398,7 @@ void cls_config::edit_webcontrol_auth_method(std::string &parm, enum PARM_ACT pa } else if (parm == "") { webcontrol_auth_method = "none"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_auth_method %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_auth_method %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = webcontrol_auth_method; @@ -2408,7 +2408,7 @@ void cls_config::edit_webcontrol_auth_method(std::string &parm, enum PARM_ACT pa parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_auth_method",_("webcontrol_auth_method")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_auth_method",_("webcontrol_auth_method")); } void cls_config::edit_webcontrol_authentication(std::string &parm, enum PARM_ACT pact) @@ -2421,7 +2421,7 @@ void cls_config::edit_webcontrol_authentication(std::string &parm, enum PARM_ACT parm = webcontrol_authentication; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_authentication",_("webcontrol_authentication")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_authentication",_("webcontrol_authentication")); } void cls_config::edit_webcontrol_tls(std::string &parm, enum PARM_ACT pact) @@ -2434,7 +2434,7 @@ void cls_config::edit_webcontrol_tls(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, webcontrol_tls); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_tls",_("webcontrol_tls")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_tls",_("webcontrol_tls")); } void cls_config::edit_webcontrol_cert(std::string &parm, enum PARM_ACT pact) @@ -2447,7 +2447,7 @@ void cls_config::edit_webcontrol_cert(std::string &parm, enum PARM_ACT pact) parm = webcontrol_cert; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_cert",_("webcontrol_cert")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_cert",_("webcontrol_cert")); } void cls_config::edit_webcontrol_key(std::string &parm, enum PARM_ACT pact) @@ -2460,7 +2460,7 @@ void cls_config::edit_webcontrol_key(std::string &parm, enum PARM_ACT pact) parm = webcontrol_key; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_key",_("webcontrol_key")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_key",_("webcontrol_key")); } void cls_config::edit_webcontrol_headers(std::string &parm, enum PARM_ACT pact) @@ -2473,7 +2473,7 @@ void cls_config::edit_webcontrol_headers(std::string &parm, enum PARM_ACT pact) parm = webcontrol_headers; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_headers",_("webcontrol_headers")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_headers",_("webcontrol_headers")); } void cls_config::edit_webcontrol_html(std::string &parm, enum PARM_ACT pact) @@ -2486,7 +2486,7 @@ void cls_config::edit_webcontrol_html(std::string &parm, enum PARM_ACT pact) parm = webcontrol_html; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_html",_("webcontrol_html")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_html",_("webcontrol_html")); } void cls_config::edit_webcontrol_actions(std::string &parm, enum PARM_ACT pact) @@ -2499,7 +2499,7 @@ void cls_config::edit_webcontrol_actions(std::string &parm, enum PARM_ACT pact) parm = webcontrol_actions; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_actions",_("webcontrol_actions")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_actions",_("webcontrol_actions")); } void cls_config::edit_webcontrol_lock_minutes(std::string &parm, enum PARM_ACT pact) @@ -2510,7 +2510,7 @@ void cls_config::edit_webcontrol_lock_minutes(std::string &parm, enum PARM_ACT p } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if (parm_in < 0) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_lock_minutes %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_lock_minutes %d"),parm_in); } else { webcontrol_lock_minutes = parm_in; } @@ -2518,7 +2518,7 @@ void cls_config::edit_webcontrol_lock_minutes(std::string &parm, enum PARM_ACT p parm = std::to_string(webcontrol_lock_minutes); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_lock_minutes",_("webcontrol_lock_minutes")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_lock_minutes",_("webcontrol_lock_minutes")); } void cls_config::edit_webcontrol_lock_attempts(std::string &parm, enum PARM_ACT pact) @@ -2529,7 +2529,7 @@ void cls_config::edit_webcontrol_lock_attempts(std::string &parm, enum PARM_ACT } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if (parm_in < 0) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_lock_attempts %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid webcontrol_lock_attempts %d"),parm_in); } else { webcontrol_lock_attempts = parm_in; } @@ -2537,7 +2537,7 @@ void cls_config::edit_webcontrol_lock_attempts(std::string &parm, enum PARM_ACT parm = std::to_string(webcontrol_lock_attempts); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_lock_attempts",_("webcontrol_lock_attempts")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_lock_attempts",_("webcontrol_lock_attempts")); } void cls_config::edit_webcontrol_lock_script(std::string &parm, enum PARM_ACT pact) @@ -2550,7 +2550,7 @@ void cls_config::edit_webcontrol_lock_script(std::string &parm, enum PARM_ACT pa parm = webcontrol_lock_script; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_lock_script",_("webcontrol_lock_script")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","webcontrol_lock_script",_("webcontrol_lock_script")); } void cls_config::edit_stream_preview_scale(std::string &parm, enum PARM_ACT pact) @@ -2561,7 +2561,7 @@ void cls_config::edit_stream_preview_scale(std::string &parm, enum PARM_ACT pact } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 1000)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid stream_preview_scale %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid stream_preview_scale %d"),parm_in); } else { stream_preview_scale = parm_in; } @@ -2569,7 +2569,7 @@ void cls_config::edit_stream_preview_scale(std::string &parm, enum PARM_ACT pact parm = std::to_string(stream_preview_scale); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_preview_scale",_("stream_preview_scale")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_preview_scale",_("stream_preview_scale")); } void cls_config::edit_stream_preview_newline(std::string &parm, enum PARM_ACT pact) @@ -2582,7 +2582,7 @@ void cls_config::edit_stream_preview_newline(std::string &parm, enum PARM_ACT pa edit_get_bool(parm, stream_preview_newline); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_preview_newline",_("stream_preview_newline")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_preview_newline",_("stream_preview_newline")); } void cls_config::edit_stream_preview_params(std::string &parm, enum PARM_ACT pact) @@ -2595,7 +2595,7 @@ void cls_config::edit_stream_preview_params(std::string &parm, enum PARM_ACT pac parm = stream_preview_params; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_preview_params",_("stream_preview_params")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_preview_params",_("stream_preview_params")); } void cls_config::edit_stream_preview_method(std::string &parm, enum PARM_ACT pact) @@ -2608,7 +2608,7 @@ void cls_config::edit_stream_preview_method(std::string &parm, enum PARM_ACT pac } else if (parm == "") { stream_preview_method = "combined"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid stream_preview_method %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid stream_preview_method %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = stream_preview_method; @@ -2618,7 +2618,7 @@ void cls_config::edit_stream_preview_method(std::string &parm, enum PARM_ACT pac parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_preview_method",_("stream_preview_method")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_preview_method",_("stream_preview_method")); } void cls_config::edit_stream_preview_ptz(std::string &parm, enum PARM_ACT pact) @@ -2631,7 +2631,7 @@ void cls_config::edit_stream_preview_ptz(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, stream_preview_ptz); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_preview_ptz",_("stream_preview_ptz")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_preview_ptz",_("stream_preview_ptz")); } void cls_config::edit_stream_quality(std::string &parm, enum PARM_ACT pact) @@ -2642,7 +2642,7 @@ void cls_config::edit_stream_quality(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 100)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid stream_quality %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid stream_quality %d"),parm_in); } else { stream_quality = parm_in; } @@ -2650,7 +2650,7 @@ void cls_config::edit_stream_quality(std::string &parm, enum PARM_ACT pact) parm = std::to_string(stream_quality); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_quality",_("stream_quality")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_quality",_("stream_quality")); } void cls_config::edit_stream_grey(std::string &parm, enum PARM_ACT pact) @@ -2663,7 +2663,7 @@ void cls_config::edit_stream_grey(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, stream_grey); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_grey",_("stream_grey")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_grey",_("stream_grey")); } void cls_config::edit_stream_motion(std::string &parm, enum PARM_ACT pact) @@ -2676,7 +2676,7 @@ void cls_config::edit_stream_motion(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, stream_motion); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_motion",_("stream_motion")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_motion",_("stream_motion")); } void cls_config::edit_stream_maxrate(std::string &parm, enum PARM_ACT pact) @@ -2687,7 +2687,7 @@ void cls_config::edit_stream_maxrate(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 100)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid stream_maxrate %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid stream_maxrate %d"),parm_in); } else { stream_maxrate = parm_in; } @@ -2695,7 +2695,7 @@ void cls_config::edit_stream_maxrate(std::string &parm, enum PARM_ACT pact) parm = std::to_string(stream_maxrate); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_maxrate",_("stream_maxrate")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_maxrate",_("stream_maxrate")); } void cls_config::edit_stream_scan_time(std::string &parm, enum PARM_ACT pact) @@ -2706,7 +2706,7 @@ void cls_config::edit_stream_scan_time(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 600)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid stream_scan_time %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid stream_scan_time %d"),parm_in); } else { stream_scan_time = parm_in; } @@ -2714,7 +2714,7 @@ void cls_config::edit_stream_scan_time(std::string &parm, enum PARM_ACT pact) parm = std::to_string(stream_scan_time); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_scan_time",_("stream_scan_time")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_scan_time",_("stream_scan_time")); } void cls_config::edit_stream_scan_scale(std::string &parm, enum PARM_ACT pact) @@ -2725,7 +2725,7 @@ void cls_config::edit_stream_scan_scale(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 1) || (parm_in > 1000)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid stream_scan_scale %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid stream_scan_scale %d"),parm_in); } else { stream_scan_scale = parm_in; } @@ -2733,7 +2733,7 @@ void cls_config::edit_stream_scan_scale(std::string &parm, enum PARM_ACT pact) parm = std::to_string(stream_scan_scale); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_scan_scale",_("stream_scan_scale")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","stream_scan_scale",_("stream_scan_scale")); } void cls_config::edit_database_type(std::string &parm, enum PARM_ACT pact) @@ -2745,7 +2745,7 @@ void cls_config::edit_database_type(std::string &parm, enum PARM_ACT pact) (parm == "postgresql") || (parm == "sqlite3")) { database_type = parm; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid database_type %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid database_type %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = database_type; @@ -2755,7 +2755,7 @@ void cls_config::edit_database_type(std::string &parm, enum PARM_ACT pact) parm = parm + "]"; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_type",_("database_type")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_type",_("database_type")); } void cls_config::edit_database_dbname(std::string &parm, enum PARM_ACT pact) @@ -2768,7 +2768,7 @@ void cls_config::edit_database_dbname(std::string &parm, enum PARM_ACT pact) parm = database_dbname; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_dbname",_("database_dbname")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_dbname",_("database_dbname")); } void cls_config::edit_database_host(std::string &parm, enum PARM_ACT pact) @@ -2781,7 +2781,7 @@ void cls_config::edit_database_host(std::string &parm, enum PARM_ACT pact) parm = database_host; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_host",_("database_host")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_host",_("database_host")); } void cls_config::edit_database_port(std::string &parm, enum PARM_ACT pact) @@ -2792,7 +2792,7 @@ void cls_config::edit_database_port(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 65535)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid database_port %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid database_port %d"),parm_in); } else { database_port = parm_in; } @@ -2800,7 +2800,7 @@ void cls_config::edit_database_port(std::string &parm, enum PARM_ACT pact) parm = std::to_string(database_port); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_port",_("database_port")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_port",_("database_port")); } void cls_config::edit_database_user(std::string &parm, enum PARM_ACT pact) @@ -2813,7 +2813,7 @@ void cls_config::edit_database_user(std::string &parm, enum PARM_ACT pact) parm = database_user; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_user",_("database_user")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_user",_("database_user")); } void cls_config::edit_database_password(std::string &parm, enum PARM_ACT pact) @@ -2826,7 +2826,7 @@ void cls_config::edit_database_password(std::string &parm, enum PARM_ACT pact) parm = database_password; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_password",_("database_password")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_password",_("database_password")); } void cls_config::edit_database_busy_timeout(std::string &parm, enum PARM_ACT pact) @@ -2837,7 +2837,7 @@ void cls_config::edit_database_busy_timeout(std::string &parm, enum PARM_ACT pac } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 10000)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid database_busy_timeout %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid database_busy_timeout %d"),parm_in); } else { database_busy_timeout = parm_in; } @@ -2845,7 +2845,7 @@ void cls_config::edit_database_busy_timeout(std::string &parm, enum PARM_ACT pac parm = std::to_string(database_busy_timeout); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_busy_timeout",_("database_busy_timeout")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","database_busy_timeout",_("database_busy_timeout")); } void cls_config::edit_sql_event_start(std::string &parm, enum PARM_ACT pact) @@ -2858,7 +2858,7 @@ void cls_config::edit_sql_event_start(std::string &parm, enum PARM_ACT pact) parm = sql_event_start; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","sql_event_start",_("sql_event_start")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","sql_event_start",_("sql_event_start")); } void cls_config::edit_sql_event_end(std::string &parm, enum PARM_ACT pact) @@ -2871,7 +2871,7 @@ void cls_config::edit_sql_event_end(std::string &parm, enum PARM_ACT pact) parm = sql_event_end; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","sql_event_end",_("sql_event_end")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","sql_event_end",_("sql_event_end")); } void cls_config::edit_sql_movie_start(std::string &parm, enum PARM_ACT pact) @@ -2884,7 +2884,7 @@ void cls_config::edit_sql_movie_start(std::string &parm, enum PARM_ACT pact) parm = sql_movie_start; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","sql_movie_start",_("sql_movie_start")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","sql_movie_start",_("sql_movie_start")); } void cls_config::edit_sql_movie_end(std::string &parm, enum PARM_ACT pact) @@ -2897,7 +2897,7 @@ void cls_config::edit_sql_movie_end(std::string &parm, enum PARM_ACT pact) parm = sql_movie_end; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","sql_movie_end",_("sql_movie_end")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","sql_movie_end",_("sql_movie_end")); } void cls_config::edit_sql_pic_save(std::string &parm, enum PARM_ACT pact) @@ -2910,7 +2910,7 @@ void cls_config::edit_sql_pic_save(std::string &parm, enum PARM_ACT pact) parm = sql_pic_save; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","sql_pic_save",_("sql_pic_save")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","sql_pic_save",_("sql_pic_save")); } void cls_config::edit_ptz_auto_track(std::string &parm, enum PARM_ACT pact) @@ -2923,7 +2923,7 @@ void cls_config::edit_ptz_auto_track(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, ptz_auto_track); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_auto_track",_("ptz_auto_track")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_auto_track",_("ptz_auto_track")); } void cls_config::edit_ptz_wait(std::string &parm, enum PARM_ACT pact) @@ -2934,7 +2934,7 @@ void cls_config::edit_ptz_wait(std::string &parm, enum PARM_ACT pact) } else if (pact == PARM_ACT_SET) { parm_in = atoi(parm.c_str()); if ((parm_in < 0) || (parm_in > 2147483647)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid ptz_wait %d"),parm_in); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid ptz_wait %d"),parm_in); } else { ptz_wait = parm_in; } @@ -2942,7 +2942,7 @@ void cls_config::edit_ptz_wait(std::string &parm, enum PARM_ACT pact) parm = std::to_string(ptz_wait); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_wait",_("ptz_wait")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_wait",_("ptz_wait")); } void cls_config::edit_ptz_move_track(std::string &parm, enum PARM_ACT pact) @@ -2955,7 +2955,7 @@ void cls_config::edit_ptz_move_track(std::string &parm, enum PARM_ACT pact) parm = ptz_move_track; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_move_track",_("ptz_move_track")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_move_track",_("ptz_move_track")); } void cls_config::edit_ptz_pan_left(std::string &parm, enum PARM_ACT pact) @@ -2968,7 +2968,7 @@ void cls_config::edit_ptz_pan_left(std::string &parm, enum PARM_ACT pact) parm = ptz_pan_left; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_pan_left",_("ptz_pan_left")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_pan_left",_("ptz_pan_left")); } void cls_config::edit_ptz_pan_right(std::string &parm, enum PARM_ACT pact) @@ -2981,7 +2981,7 @@ void cls_config::edit_ptz_pan_right(std::string &parm, enum PARM_ACT pact) parm = ptz_pan_right; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_pan_right",_("ptz_pan_right")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_pan_right",_("ptz_pan_right")); } void cls_config::edit_ptz_tilt_up(std::string &parm, enum PARM_ACT pact) @@ -2994,7 +2994,7 @@ void cls_config::edit_ptz_tilt_up(std::string &parm, enum PARM_ACT pact) parm = ptz_tilt_up; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_tilt_up",_("ptz_tilt_up")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_tilt_up",_("ptz_tilt_up")); } void cls_config::edit_ptz_tilt_down(std::string &parm, enum PARM_ACT pact) @@ -3007,7 +3007,7 @@ void cls_config::edit_ptz_tilt_down(std::string &parm, enum PARM_ACT pact) parm = ptz_tilt_down; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_tilt_down",_("ptz_tilt_down")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_tilt_down",_("ptz_tilt_down")); } void cls_config::edit_ptz_zoom_in(std::string &parm, enum PARM_ACT pact) @@ -3020,7 +3020,7 @@ void cls_config::edit_ptz_zoom_in(std::string &parm, enum PARM_ACT pact) parm = ptz_zoom_in; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_zoom_in",_("ptz_zoom_in")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_zoom_in",_("ptz_zoom_in")); } void cls_config::edit_ptz_zoom_out(std::string &parm, enum PARM_ACT pact) @@ -3033,7 +3033,7 @@ void cls_config::edit_ptz_zoom_out(std::string &parm, enum PARM_ACT pact) parm = ptz_zoom_out; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_zoom_out",_("ptz_zoom_out")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","ptz_zoom_out",_("ptz_zoom_out")); } void cls_config::edit_snd_device(std::string &parm, enum PARM_ACT pact) @@ -3046,7 +3046,7 @@ void cls_config::edit_snd_device(std::string &parm, enum PARM_ACT pact) parm = snd_device; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snd_device",_("snd_device")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snd_device",_("snd_device")); } void cls_config::edit_snd_params(std::string &parm, enum PARM_ACT pact) @@ -3059,7 +3059,7 @@ void cls_config::edit_snd_params(std::string &parm, enum PARM_ACT pact) parm = snd_params; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snd_params",_("snd_params")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snd_params",_("snd_params")); } void cls_config::edit_snd_alerts(std::string &parm, enum PARM_ACT pact) @@ -3085,7 +3085,7 @@ void cls_config::edit_snd_alerts(std::string &parm, enum PARM_ACT pact) } } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snd_alerts",_("snd_alerts")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snd_alerts",_("snd_alerts")); } void cls_config::edit_snd_alerts(std::list &parm, enum PARM_ACT pact) @@ -3099,7 +3099,7 @@ void cls_config::edit_snd_alerts(std::list &parm, enum PARM_ACT pac parm = snd_alerts; } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snd_alerts",_("snd_alerts")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snd_alerts",_("snd_alerts")); } void cls_config::edit_snd_window(std::string &parm, enum PARM_ACT pact) @@ -3112,7 +3112,7 @@ void cls_config::edit_snd_window(std::string &parm, enum PARM_ACT pact) } else if (parm == "") { snd_window = "hamming"; } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid snd_window %s"), parm.c_str()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Invalid snd_window %s"), parm.c_str()); } } else if (pact == PARM_ACT_GET) { parm = snd_window; @@ -3121,7 +3121,7 @@ void cls_config::edit_snd_window(std::string &parm, enum PARM_ACT pact) } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snd_window",_("snd_window")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snd_window",_("snd_window")); } void cls_config::edit_snd_show(std::string &parm, enum PARM_ACT pact) @@ -3134,7 +3134,7 @@ void cls_config::edit_snd_show(std::string &parm, enum PARM_ACT pact) edit_get_bool(parm, snd_show); } return; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snd_show",_("snd_show")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:%s","snd_show",_("snd_show")); } void cls_config::edit_cat00(std::string cmd, std::string &parm_val, enum PARM_ACT pact) @@ -3531,7 +3531,7 @@ int cls_config::edit_set_depr(std::string &parm_nm, std::string &parm_val) indx = 0; while (config_parms_depr[indx].parm_name != "") { if (parm_nm == config_parms_depr[indx].parm_name) { - MOTPLS_LOG(ALR, TYPE_ALL, NO_ERRNO, "%s after version %s" + MOTION_LOG(ALR, TYPE_ALL, NO_ERRNO, "%s after version %s" , config_parms_depr[indx].info.c_str() , config_parms_depr[indx].last_version.c_str()); @@ -3578,7 +3578,7 @@ void cls_config::edit_set(std::string parm_nm, std::string parm_val) return; } - MOTPLS_LOG(ALR, TYPE_ALL, NO_ERRNO, _("Unknown config option \"%s\""), parm_nm.c_str()); + MOTION_LOG(ALR, TYPE_ALL, NO_ERRNO, _("Unknown config option \"%s\""), parm_nm.c_str()); } void cls_config::edit_list(std::string parm_nm, std::string &parm_val, enum PARM_CAT parm_cat) @@ -3790,7 +3790,7 @@ void cls_config::camera_add(std::string fname, bool srcdir) if (fname == "") { cam_cls->conf_src->camera_filenm(); } else if (stat(fname.c_str(), &statbuf) != 0) { - MOTPLS_LOG(ALR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ALR, TYPE_ALL, SHOW_ERRNO ,_("Camera config file %s not found"), fname.c_str()); } else { cam_cls->conf_src->process(); @@ -3866,7 +3866,7 @@ void cls_config::sound_add(std::string fname, bool srcdir) if (fname == "") { snd_cls->conf_src->sound_filenm(); } else if (stat(fname.c_str(), &statbuf) != 0) { - MOTPLS_LOG(ALR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ALR, TYPE_ALL, SHOW_ERRNO ,_("Sound config file %s not found"), fname.c_str()); } else { snd_cls->conf_src->process(); @@ -3893,13 +3893,13 @@ void cls_config::config_dir_parm(std::string confdir) if (file.substr(file.length()-5,5) == ".conf") { if (file.find("sound") == std::string::npos) { file = confdir + "/" + file; - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Processing as camera config file %s") , file.c_str() ); camera_add(file, true); } else { file = confdir + "/" + file; - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Processing as sound config file %s") , file.c_str() ); sound_add(file, true); @@ -3922,13 +3922,13 @@ void cls_config::process() ifs.open(conf_filename); if (ifs.is_open() == false) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("params_file not found: %s") , conf_filename.c_str()); return; } - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Processing config file %s") , conf_filename.c_str()); @@ -3968,7 +3968,7 @@ void cls_config::process() } else if ((line != "") && (line.substr(0, 1) != ";") && (line.substr(0, 1) != "#") ) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Unable to parse line: %s"), line.c_str()); } } @@ -3987,15 +3987,15 @@ void cls_config::parms_log_parm(std::string parm_nm, std::string parm_vl) (parm_nm == "database_user") || (parm_nm == "database_password")) { - MOTPLS_SHT(INF, TYPE_ALL, NO_ERRNO + MOTION_SHT(INF, TYPE_ALL, NO_ERRNO ,_("%-25s "), parm_nm.c_str()); } else { if ((parm_nm.compare(0,4,"text") == 0) || (parm_vl.compare(0,1, " ") != 0)) { - MOTPLS_SHT(INF, TYPE_ALL, NO_ERRNO + MOTION_SHT(INF, TYPE_ALL, NO_ERRNO , "%-25s %s", parm_nm.c_str(), parm_vl.c_str()); } else { - MOTPLS_SHT(INF, TYPE_ALL, NO_ERRNO + MOTION_SHT(INF, TYPE_ALL, NO_ERRNO , "%-25s \"%s\"", parm_nm.c_str(), parm_vl.c_str()); } } @@ -4011,10 +4011,10 @@ void cls_config::parms_log() enum PARM_CAT parm_ct; enum PARM_TYP parm_typ; - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO ,_("Logging configuration parameters from all files")); - MOTPLS_SHT(INF, TYPE_ALL, NO_ERRNO + MOTION_SHT(INF, TYPE_ALL, NO_ERRNO , _("Config file: %s"), app->conf_src->conf_filename.c_str()); i = 0; @@ -4039,7 +4039,7 @@ void cls_config::parms_log() } for (indx=0; indxcam_cnt; indx++) { - MOTPLS_SHT(INF, TYPE_ALL, NO_ERRNO + MOTION_SHT(INF, TYPE_ALL, NO_ERRNO , _("Camera config file: %s") , app->cam_list[indx]->conf_src->conf_filename.c_str()); i = 0; @@ -4066,7 +4066,7 @@ void cls_config::parms_log() } for (indx=0; indxsnd_cnt; indx++) { - MOTPLS_SHT(INF, TYPE_ALL, NO_ERRNO + MOTION_SHT(INF, TYPE_ALL, NO_ERRNO , _("Sound config file: %s") , app->snd_list[indx]->conf_src->conf_filename.c_str()); i = 0; @@ -4133,7 +4133,7 @@ void cls_config::parms_write_app() conffile = myfopen(app->conf_src->conf_filename.c_str(), "we"); if (conffile == NULL) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Failed to write configuration to %s") , app->conf_src->conf_filename.c_str()); return; @@ -4190,7 +4190,7 @@ void cls_config::parms_write_app() fprintf(conffile, "\n"); myfclose(conffile); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Configuration written to %s") , app->conf_src->conf_filename.c_str()); @@ -4213,7 +4213,7 @@ void cls_config::parms_write_cam() for (indx=0; indxcam_cnt; indx++) { conffile = myfopen(app->cam_list[indx]->conf_src->conf_filename.c_str(), "we"); if (conffile == NULL) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Failed to write configuration to %s") , app->cam_list[indx]->conf_src->conf_filename.c_str()); return; @@ -4249,7 +4249,7 @@ void cls_config::parms_write_cam() fprintf(conffile, "\n"); myfclose(conffile); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Configuration written to %s") , app->cam_list[indx]->conf_src->conf_filename.c_str()); } @@ -4273,7 +4273,7 @@ void cls_config::parms_write_snd() for (indx=0; indxsnd_cnt; indx++) { conffile = myfopen(app->snd_list[indx]->conf_src->conf_filename.c_str(), "we"); if (conffile == NULL) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Failed to write configuration to %s") , app->snd_list[indx]->conf_src->conf_filename.c_str()); return; @@ -4309,7 +4309,7 @@ void cls_config::parms_write_snd() fprintf(conffile, "\n"); myfclose(conffile); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Configuration written to %s") , app->snd_list[indx]->conf_src->conf_filename.c_str()); } @@ -4375,7 +4375,7 @@ void cls_config::init() if (filename == "") { if (getcwd(path, sizeof(path)) == NULL) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO, _("Error getcwd")); + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, _("Error getcwd")); exit(-1); } filename = path + std::string("/motion.conf"); @@ -4404,17 +4404,17 @@ void cls_config::init() filename = ""; } if (filename != "") { - MOTPLS_LOG(WRN, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(WRN, TYPE_ALL, SHOW_ERRNO ,_("The configuration file location '%s' is deprecated.") , sysconfdir ); - MOTPLS_LOG(WRN, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(WRN, TYPE_ALL, SHOW_ERRNO ,_("The new default configuration file location is '%s'") , configdir ); } } if (filename == "") { - MOTPLS_LOG(ALR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ALR, TYPE_ALL, SHOW_ERRNO ,_("Could not open configuration file")); exit(-1); } diff --git a/src/dbse.cpp b/src/dbse.cpp index 8f1e6ece..617a7e9f 100644 --- a/src/dbse.cpp +++ b/src/dbse.cpp @@ -117,7 +117,7 @@ void cls_dbse::item_assign(std::string col_nm, std::string col_val) } } -void cls_dbse::sql_motpls(std::string &sql) +void cls_dbse::sql_motion(std::string &sql) { std::string delimit; @@ -161,7 +161,7 @@ void cls_dbse::sql_motpls(std::string &sql) } -void cls_dbse::sql_motpls(std::string &sql, std::string col_p1, std::string col_p2) +void cls_dbse::sql_motion(std::string &sql, std::string col_p1, std::string col_p2) { if ((is_open == false) || (finish == true)) { return; @@ -200,15 +200,15 @@ void cls_dbse::sqlite3db_exec(std::string sql) return; } - MOTPLS_LOG(DBG, TYPE_DB, NO_ERRNO, "Executing query"); + MOTION_LOG(DBG, TYPE_DB, NO_ERRNO, "Executing query"); retcd = sqlite3_exec(database_sqlite3db , sql.c_str(), nullptr, 0, &errmsg); if (retcd != SQLITE_OK ) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("SQLite error was %s"), errmsg); sqlite3_free(errmsg); } - MOTPLS_LOG(DBG, TYPE_DB, NO_ERRNO, "Finished query"); + MOTION_LOG(DBG, TYPE_DB, NO_ERRNO, "Finished query"); } void cls_dbse::sqlite3db_cb (int arg_nb, char **arg_val, char **col_nm) @@ -263,11 +263,11 @@ void cls_dbse::sqlite3db_cols_verify() cols_vec_create(); dbse_action = DBSE_COLS_LIST; - sql_motpls(sql); + sql_motion(sql); retcd = sqlite3_exec(database_sqlite3db , sql.c_str(), dbse_sqlite3db_cb, this, &errmsg); if (retcd != SQLITE_OK ) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Error retrieving table columns: %s"), errmsg); sqlite3_free(errmsg); return; @@ -276,7 +276,7 @@ void cls_dbse::sqlite3db_cols_verify() for (indx=0;indxcfg->database_dbname.c_str()); retcd = sqlite3_open( @@ -337,12 +337,12 @@ void cls_dbse::sqlite3db_init() , &database_sqlite3db); if (retcd != SQLITE_OK) { err_open =sqlite3_errmsg(database_sqlite3db); - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Can't open database %s : %s") , app->cfg->database_dbname.c_str() , err_open); sqlite3_close(database_sqlite3db); - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Could not initialize database %s") , app->cfg->database_dbname.c_str()); is_open = false; @@ -351,23 +351,23 @@ void cls_dbse::sqlite3db_init() } is_open = true; - MOTPLS_LOG(NTC, TYPE_DB, NO_ERRNO + MOTION_LOG(NTC, TYPE_DB, NO_ERRNO , _("database_busy_timeout %d msec") , app->cfg->database_busy_timeout); retcd = sqlite3_busy_timeout(database_sqlite3db, app->cfg->database_busy_timeout); if (retcd != SQLITE_OK) { err_open = sqlite3_errmsg(database_sqlite3db); - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("database_busy_timeout failed %s"), err_open); } table_ok = false; dbse_action = DBSE_TBL_CHECK; - sql_motpls(sql); + sql_motion(sql); retcd = sqlite3_exec(database_sqlite3db , sql.c_str(), dbse_sqlite3db_cb, this, &err_qry); if (retcd != SQLITE_OK ) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Error checking table: %s"), err_qry); sqlite3_free(err_qry); return; @@ -375,10 +375,10 @@ void cls_dbse::sqlite3db_init() if (table_ok == false) { dbse_action = DBSE_TBL_CREATE; - sql_motpls(sql); + sql_motion(sql); retcd = sqlite3_exec(database_sqlite3db, sql.c_str(), 0, 0, &err_qry); if (retcd != SQLITE_OK ) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Error creating table: %s"), err_qry); sqlite3_free(err_qry); return; @@ -403,7 +403,7 @@ void cls_dbse::sqlite3db_filelist(std::string sql) retcd = sqlite3_exec(database_sqlite3db, sql.c_str() , dbse_sqlite3db_cb, this, &errmsg); if (retcd != SQLITE_OK ) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Error retrieving table: %s"), errmsg); sqlite3_free(errmsg); return; @@ -433,11 +433,11 @@ void cls_dbse::mariadb_exec (std::string sql) return; } - MOTPLS_LOG(DBG, TYPE_DB, NO_ERRNO, "Executing MariaDB query"); + MOTION_LOG(DBG, TYPE_DB, NO_ERRNO, "Executing MariaDB query"); retcd = mysql_query(database_mariadb, sql.c_str()); if (retcd != 0) { retcd = (int)mysql_errno(database_mariadb); - MOTPLS_LOG(ERR, TYPE_DB, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_DB, SHOW_ERRNO , _("MariaDB query '%s' failed. %s error code %d") , sql.c_str() , mysql_error(database_mariadb) @@ -450,7 +450,7 @@ void cls_dbse::mariadb_exec (std::string sql) retcd = mysql_query(database_mariadb, "commit;"); if (retcd != 0) { retcd = (int)mysql_errno(database_mariadb); - MOTPLS_LOG(ERR, TYPE_DB, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_DB, SHOW_ERRNO , _("MariaDB query commit failed. %s error code %d") , mysql_error(database_mariadb), retcd); if (retcd >= 2000) { @@ -477,7 +477,7 @@ void cls_dbse::mariadb_recs(std::string sql) retcd = mysql_query(database_mariadb, sql.c_str()); if (retcd != 0){ - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Query error: %s"),sql.c_str()); shutdown(); return; @@ -485,7 +485,7 @@ void cls_dbse::mariadb_recs(std::string sql) qry_result = mysql_store_result(database_mariadb); if (qry_result == nullptr) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Query store error: %s"),sql.c_str()); shutdown(); return; @@ -561,13 +561,13 @@ void cls_dbse::mariadb_cols_verify() cols_vec_create(); dbse_action = DBSE_COLS_LIST; - sql_motpls(sql); + sql_motion(sql); mariadb_recs(sql.c_str()); for (indx=0;indxcfg->database_type.c_str()); is_open = false; @@ -654,12 +654,12 @@ void cls_dbse::mariadb_init() , app->cfg->database_dbname.c_str() , (uint)app->cfg->database_port, nullptr, 0) == nullptr) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Cannot connect to MariaDB database %s on host %s with user %s") , app->cfg->database_dbname.c_str() , app->cfg->database_host.c_str() , app->cfg->database_user.c_str()); - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("MariaDB error was %s") , mysql_error(database_mariadb)); shutdown(); @@ -671,7 +671,7 @@ void cls_dbse::mariadb_init() mariadb_setup(); - MOTPLS_LOG(INF, TYPE_DB, NO_ERRNO + MOTION_LOG(INF, TYPE_DB, NO_ERRNO , _("%s database opened") , app->cfg->database_dbname.c_str() ); } @@ -707,16 +707,16 @@ void cls_dbse::pgsqldb_exec(std::string sql) return; } - MOTPLS_LOG(DBG, TYPE_DB, NO_ERRNO, "Executing postgresql query"); + MOTION_LOG(DBG, TYPE_DB, NO_ERRNO, "Executing postgresql query"); res = PQexec(database_pgsqldb, sql.c_str()); if (PQstatus(database_pgsqldb) == CONNECTION_BAD) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Connection to PostgreSQL database '%s' failed: %s") , app->cfg->database_dbname.c_str() , PQerrorMessage(database_pgsqldb)); PQreset(database_pgsqldb); if (PQstatus(database_pgsqldb) == CONNECTION_BAD) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Re-Connection to PostgreSQL database '%s' failed: %s") , app->cfg->database_dbname.c_str() , PQerrorMessage(database_pgsqldb)); @@ -724,12 +724,12 @@ void cls_dbse::pgsqldb_exec(std::string sql) shutdown(); return; } else { - MOTPLS_LOG(INF, TYPE_DB, NO_ERRNO + MOTION_LOG(INF, TYPE_DB, NO_ERRNO , _("Re-Connection to PostgreSQL database '%s' Succeed") , app->cfg->database_dbname.c_str()); } } else if (!(PQresultStatus(res) == PGRES_COMMAND_OK || PQresultStatus(res) == PGRES_TUPLES_OK)) { - MOTPLS_LOG(ERR, TYPE_DB, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_DB, SHOW_ERRNO , "PGSQL query failed: [%s] %s %s" , sql.c_str() , PQresStatus(PQresultStatus(res)) @@ -837,13 +837,13 @@ void cls_dbse::pgsqldb_cols_verify() cols_vec_create(); dbse_action = DBSE_COLS_LIST; - sql_motpls(sql); + sql_motion(sql); pgsqldb_recs(sql.c_str()); for (indx=0;indxcfg->database_port) + " "; database_pgsqldb = PQconnectdb(constr.c_str()); if (PQstatus(database_pgsqldb) == CONNECTION_BAD) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Connection to PostgreSQL database '%s' failed: %s") , app->cfg->database_dbname.c_str() , PQerrorMessage(database_pgsqldb)); @@ -929,7 +929,7 @@ void cls_dbse::pgsqldb_init() pgsqldb_setup(); - MOTPLS_LOG(INF, TYPE_DB, NO_ERRNO + MOTION_LOG(INF, TYPE_DB, NO_ERRNO , _("%s database opened") , app->cfg->database_dbname.c_str() ); } @@ -953,7 +953,7 @@ bool cls_dbse::dbse_open() return false; } - MOTPLS_LOG(DBG, TYPE_DB, NO_ERRNO,_("Opening database")); + MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("Opening database")); #ifdef HAVE_MARIADB if (app->cfg->database_type == "mariadb") { @@ -1078,7 +1078,7 @@ void cls_dbse::exec(cls_camera *cam, std::string fname, std::string cmd) if (sql == "") { return; } - MOTPLS_LOG(DBG, TYPE_DB, NO_ERRNO, "%s query: %s" + MOTION_LOG(DBG, TYPE_DB, NO_ERRNO, "%s query: %s" , cmd.c_str(), sql.c_str()); exec_sql(sql); @@ -1155,7 +1155,7 @@ void cls_dbse::dbse_edits() if ((app->cfg->database_type != "") && (app->cfg->database_dbname == "")) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO , _("Invalid database name")); retcd = -1; } @@ -1164,7 +1164,7 @@ void cls_dbse::dbse_edits() (app->cfg->database_type != "postgresql") && (app->cfg->database_type != "sqlite3") && (app->cfg->database_type != "")) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO ,_("Invalid database_type %s") , app->cfg->database_type.c_str()); retcd = -1; @@ -1173,20 +1173,20 @@ void cls_dbse::dbse_edits() if (((app->cfg->database_type == "mariadb") || (app->cfg->database_type == "postgresql")) && (app->cfg->database_port == 0)) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO ,_("Must specify database port for mariadb/pgsql")); retcd = -1; } if ((app->cfg->database_type == "sqlite3") && (app->cfg->database_dbname == "")) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO ,_("Must specify database name for sqlite3")); retcd = -1; } if ((app->cfg->database_type != "") && (retcd == -1)) { - MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO + MOTION_LOG(ERR, TYPE_DB, NO_ERRNO ,_("Database functionality disabled.")); app->cfg->database_type = ""; } @@ -1297,7 +1297,7 @@ void cls_dbse::handler() timing(); } - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Database handler closed")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Database handler closed")); handler_running = false; pthread_exit(NULL); @@ -1316,7 +1316,7 @@ void cls_dbse::handler_startup() pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); retcd = pthread_create(&handler_thread, &thread_attr, &dbse_handler, this); if (retcd != 0) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start database handler thread.")); + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start database handler thread.")); handler_running = false; handler_stop = true; } @@ -1336,10 +1336,10 @@ void cls_dbse::handler_shutdown() waitcnt++; } if (waitcnt == app->cfg->watchdog_tmo) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Normal shutdown of database handler failed")); if (app->cfg->watchdog_kill > 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Waiting additional %d seconds (watchdog_kill).") ,app->cfg->watchdog_kill); waitcnt = 0; @@ -1348,14 +1348,14 @@ void cls_dbse::handler_shutdown() waitcnt++; } if (waitcnt == app->cfg->watchdog_kill) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("No response to shutdown. Killing it.")); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Memory leaks will occur.")); pthread_kill(handler_thread, SIGVTALRM); } } else { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("watchdog_kill set to terminate application.")); exit(1); } diff --git a/src/dbse.hpp b/src/dbse.hpp index 3bf557ee..7b9bb2f0 100644 --- a/src/dbse.hpp +++ b/src/dbse.hpp @@ -155,8 +155,8 @@ class cls_dbse { void item_default(); void item_assign(std::string col_nm, std::string col_val); - void sql_motpls(std::string &sql); - void sql_motpls(std::string &sql, std::string col_p1, std::string col_p2); + void sql_motion(std::string &sql); + void sql_motion(std::string &sql, std::string col_p1, std::string col_p2); }; #endif /* _INCLUDE_DBSE_HPP_ */ diff --git a/src/draw.cpp b/src/draw.cpp index 9409fee0..048ab1db 100644 --- a/src/draw.cpp +++ b/src/draw.cpp @@ -1225,7 +1225,7 @@ void cls_draw::init_scale() if (cam->text_scale <= 0) { cam->text_scale = 1; } - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO ,_("Invalid text scale. Adjusted to %d"), cam->text_scale); } @@ -1234,7 +1234,7 @@ void cls_draw::init_scale() if (cam->text_scale <= 0) { cam->text_scale = 1; } - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO ,_("Invalid text scale. Adjusted to %d"), cam->text_scale); } diff --git a/src/jpegutils.cpp b/src/jpegutils.cpp index 3eeb062a..cb8e71e8 100644 --- a/src/jpegutils.cpp +++ b/src/jpegutils.cpp @@ -411,7 +411,7 @@ static void add_huff_table(j_decompress_ptr dinfo, JHUFF_TBL **htblptr, const UI nsymbols += bits[len]; if (nsymbols < 1 || nsymbols > 256) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("%s: Given jpeg buffer was too small")); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("%s: Given jpeg buffer was too small")); } memcpy((*htblptr)->huffval, val, (uint)nsymbols * sizeof(UINT8)); @@ -613,7 +613,7 @@ static void jpgutl_error_exit(j_common_ptr cinfo) */ (*cinfo->err->format_message) (cinfo, buffer); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, "%s", buffer); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, "%s", buffer); /* Return control to the setjmp point. */ longjmp (myerr->setjmp_buffer, 1); @@ -642,7 +642,7 @@ static void jpgutl_emit_message(j_common_ptr cinfo, int msg_level) if ((cinfo->err->msg_code != JWRN_EXTRANEOUS_DATA) && (msg_level < 0) ) { myerr->warning_seen++ ; (*cinfo->err->format_message) (cinfo, buffer); - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "msg_level: %d, %s", msg_level, buffer); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "msg_level: %d, %s", msg_level, buffer); } } @@ -785,13 +785,13 @@ int jpgutl_decode_jpeg (u_char *jpeg_data_in, int jpeg_data_len, jpeg_start_decompress (&dinfo); if ((dinfo.output_width == 0) || (dinfo.output_height == 0)) { - MOTPLS_LOG(WRN, TYPE_VIDEO, NO_ERRNO,_("Invalid JPEG image dimensions")); + MOTION_LOG(WRN, TYPE_VIDEO, NO_ERRNO,_("Invalid JPEG image dimensions")); jpeg_destroy_decompress(&dinfo); return -1; } if ((dinfo.output_width != width) || (dinfo.output_height != height)) { - MOTPLS_LOG(WRN, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(WRN, TYPE_VIDEO, NO_ERRNO ,_("JPEG image size %dx%d, JPEG was %dx%d") ,width, height, dinfo.output_width, dinfo.output_height); jpeg_destroy_decompress(&dinfo); diff --git a/src/libcam.cpp b/src/libcam.cpp index 0c3e0b95..93b4cce4 100644 --- a/src/libcam.cpp +++ b/src/libcam.cpp @@ -32,180 +32,180 @@ using namespace libcamera; void cls_libcam::log_orientation() { #if (LIBCAMVER >= 2000) - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, "Libcamera Orientation Options:"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate0Mirror"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate180"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate180Mirror"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate90"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate90Mirror"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate270"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate270Mirror"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, "Libcamera Orientation Options:"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate0Mirror"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate180"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate180Mirror"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate90"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate90Mirror"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate270"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Rotate270Mirror"); #else - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Orientation Not available"); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Orientation Not available"); #endif } void cls_libcam::log_controls() { - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, "Libcamera Controls:"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, "Libcamera Controls:"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeEnable(bool)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeLocked(bool)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeEnable(bool)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeLocked(bool)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeMeteringMode(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " MeteringCentreWeighted = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " MeteringSpot = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " MeteringMatrix = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " MeteringCustom = 3"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeMeteringMode(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " MeteringCentreWeighted = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " MeteringSpot = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " MeteringMatrix = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " MeteringCustom = 3"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeConstraintMode(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ConstraintNormal = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ConstraintHighlight = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ConstraintShadows = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ConstraintCustom = 3"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeConstraintMode(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ConstraintNormal = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ConstraintHighlight = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ConstraintShadows = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ConstraintCustom = 3"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeExposureMode(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ExposureNormal = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ExposureShort = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ExposureLong = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ExposureCustom = 3"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeExposureMode(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ExposureNormal = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ExposureShort = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ExposureLong = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ExposureCustom = 3"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ExposureValue(float)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ExposureTime(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AnalogueGain(float)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Brightness(float)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Contrast(float)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Lux(float)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbEnable(bool)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ExposureValue(float)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ExposureTime(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AnalogueGain(float)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Brightness(float)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Contrast(float)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Lux(float)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbEnable(bool)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbMode(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbAuto = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbIncandescent = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbTungsten = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbFluorescent = 3"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbIndoor = 4"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbDaylight = 5"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbCloudy = 6"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbCustom = 7"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbMode(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbAuto = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbIncandescent = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbTungsten = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbFluorescent = 3"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbIndoor = 4"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbDaylight = 5"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbCloudy = 6"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbCustom = 7"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbLocked(bool)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColourGains(Pipe delimited)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Red | Blue"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColourTemperature(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Saturation(float)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " SensorBlackLevels(Pipe delimited)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " var1|var2|var3|var4"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Sharpness(float)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " FocusFoM(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColourCorrectionMatrix(Pipe delimited)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " var1|var2|...|var8|var9"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ScalerCrop(Pipe delimited)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " x | y | h | w"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " DigitalGain(float)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " FrameDuration(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " FrameDurationLimits(Pipe delimited)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " min | max"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " SensorTemperature(float)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " SensorTimestamp(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbLocked(bool)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColourGains(Pipe delimited)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Red | Blue"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColourTemperature(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Saturation(float)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " SensorBlackLevels(Pipe delimited)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " var1|var2|var3|var4"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " Sharpness(float)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " FocusFoM(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColourCorrectionMatrix(Pipe delimited)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " var1|var2|...|var8|var9"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ScalerCrop(Pipe delimited)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " x | y | h | w"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " DigitalGain(float)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " FrameDuration(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " FrameDurationLimits(Pipe delimited)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " min | max"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " SensorTemperature(float)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " SensorTimestamp(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfMode(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfModeManual = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfModeAuto = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfModeContinuous = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfMode(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfModeManual = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfModeAuto = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfModeContinuous = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfRange(0-2)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfRangeNormal = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfRangeMacro = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfRangeFull = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfRange(0-2)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfRangeNormal = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfRangeMacro = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfRangeFull = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfSpeed(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfSpeedNormal = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfSpeedFast = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfSpeed(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfSpeedNormal = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfSpeedFast = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfMetering(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfMeteringAuto = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfMeteringWindows = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfMetering(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfMeteringAuto = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfMeteringWindows = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfWindows(Pipe delimited)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " x | y | h | w"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfWindows(Pipe delimited)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " x | y | h | w"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfTrigger(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfTriggerStart = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfTriggerCancel = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfTrigger(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfTriggerStart = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfTriggerCancel = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPause(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseImmediate = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseDeferred = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseResume = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPause(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseImmediate = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseDeferred = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseResume = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " LensPosition(float)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " LensPosition(float)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfState(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfStateIdle = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfStateScanning = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfStateFocused = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfStateFailed = 3"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfState(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfStateIdle = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfStateScanning = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfStateFocused = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfStateFailed = 3"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseState(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseStateRunning = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseStatePausing = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseStatePaused = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseState(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseStateRunning = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseStatePausing = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AfPauseStatePaused = 2"); } void cls_libcam:: log_draft() { - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, "Libcamera Controls Draft:"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, "Libcamera Controls Draft:"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AePrecaptureTrigger(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AePrecaptureTriggerIdle = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AePrecaptureTriggerStart = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AePrecaptureTriggerCancel = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AePrecaptureTrigger(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AePrecaptureTriggerIdle = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AePrecaptureTriggerStart = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AePrecaptureTriggerCancel = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " NoiseReductionMode(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " NoiseReductionModeOff = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " NoiseReductionModeFast = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " NoiseReductionModeHighQuality = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " NoiseReductionModeMinimal = 3"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " NoiseReductionModeZSL = 4"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " NoiseReductionMode(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " NoiseReductionModeOff = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " NoiseReductionModeFast = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " NoiseReductionModeHighQuality = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " NoiseReductionModeMinimal = 3"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " NoiseReductionModeZSL = 4"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColorCorrectionAberrationMode(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColorCorrectionAberrationOff = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColorCorrectionAberrationFast = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColorCorrectionAberrationHighQuality = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColorCorrectionAberrationMode(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColorCorrectionAberrationOff = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColorCorrectionAberrationFast = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " ColorCorrectionAberrationHighQuality = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeState(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeStateSearching = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeStateConverged = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeStateLocked = 3"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeStateFlashRequired = 4"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeStatePrecapture = 5"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeState(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeStateSearching = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeStateConverged = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeStateLocked = 3"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeStateFlashRequired = 4"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AeStatePrecapture = 5"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbState(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbStateInactive = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbStateSearching = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbConverged = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbLocked = 3"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbState(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbStateInactive = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbStateSearching = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbConverged = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " AwbLocked = 3"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " SensorRollingShutterSkew(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " SensorRollingShutterSkew(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " LensShadingMapMode(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " LensShadingMapModeOff = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " LensShadingMapModeOn = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " LensShadingMapMode(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " LensShadingMapModeOff = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " LensShadingMapModeOn = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " PipelineDepth(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " PipelineDepth(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " MaxLatency(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " MaxLatency(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternMode(int)"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternModeOff = 0"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternModeSolidColor = 1"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternModeColorBars = 2"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternModeColorBarsFadeToGray = 3"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternModePn9 = 4"); - MOTPLS_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternModeCustom1 = 256"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternMode(int)"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternModeOff = 0"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternModeSolidColor = 1"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternModeColorBars = 2"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternModeColorBarsFadeToGray = 3"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternModePn9 = 4"); + MOTION_SHT(DBG, TYPE_VIDEO, NO_ERRNO, " TestPatternModeCustom1 = 256"); } @@ -219,7 +219,7 @@ void cls_libcam::start_params() for (indx=0;indxparams_cnt;indx++) { itm = ¶ms->params_array[indx]; - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "%s : %s" + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "%s : %s" ,itm->param_name.c_str(), itm->param_value.c_str()); } } @@ -229,28 +229,28 @@ int cls_libcam::start_mgr() int retcd; std::string camid; - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Starting."); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Starting."); cam_mgr = std::make_unique(); retcd = cam_mgr->start(); if (retcd != 0) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "Error starting camera manager. Return code: %d",retcd); return retcd; } started_mgr = true; - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "cam_mgr started."); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "cam_mgr started."); if (cam->cfg->libcam_device == "camera0"){ if (cam_mgr->cameras().size() == 0) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "No camera devices found"); return -1; } camid = cam_mgr->cameras()[0]->id(); } else { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "Invalid libcam_device '%s'. The only name supported is 'camera0' " ,cam->cfg->libcam_device.c_str()); return -1; @@ -259,7 +259,7 @@ int cls_libcam::start_mgr() camera->acquire(); started_aqr = true; - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Finished."); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Finished."); return 0; } @@ -455,13 +455,13 @@ void cls_libcam::config_controls() retcd = config->validate(); if (retcd == CameraConfiguration::Adjusted) { - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO , "Configuration controls adjusted."); } else if (retcd == CameraConfiguration::Valid) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO , "Configuration controls valid"); } else if (retcd == CameraConfiguration::Invalid) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "Configuration controls error"); } @@ -494,7 +494,7 @@ void cls_libcam:: config_orientation() } else if (itm->param_value == "Rotate270Mirror") { config->orientation = Orientation::Rotate270Mirror; } else { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "Invalid Orientation option: %s." , itm->param_value.c_str()); } @@ -522,18 +522,18 @@ void cls_libcam:: config_orientation() } else { adjdesc = "unknown"; } - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO , "Configuration orientation adjusted to %s." , adjdesc.c_str()); } else if (retcd == CameraConfiguration::Valid) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO , "Configuration orientation valid"); } else if (retcd == CameraConfiguration::Invalid) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "Configuration orientation error"); } #else - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Orientation Not available"); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Orientation Not available"); #endif } @@ -542,7 +542,7 @@ int cls_libcam::start_config() { int retcd; - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Starting."); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Starting."); config = camera->generateConfiguration({ StreamRole::Viewfinder }); @@ -556,26 +556,26 @@ int cls_libcam::start_config() retcd = config->validate(); if (retcd == CameraConfiguration::Adjusted) { if (config->at(0).pixelFormat != PixelFormat::fromString("YUV420")) { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO , "Pixel format was adjusted to %s." , config->at(0).pixelFormat.toString().c_str()); return -1; } else { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO , "Configuration adjusted."); } } else if (retcd == CameraConfiguration::Valid) { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO , "Configuration is valid"); } else if (retcd == CameraConfiguration::Invalid) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "Error setting configuration"); return -1; } if ((config->at(0).size.width != (uint)cam->cfg->width) || (config->at(0).size.height != (uint)cam->cfg->height)) { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO , "Image size adjusted from %d x %d to %d x %d" , cam->cfg->width, cam->cfg->height , config->at(0).size.width, config->at(0).size.height); @@ -595,7 +595,7 @@ int cls_libcam::start_config() camera->configure(config.get()); - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Finished."); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Finished."); return 0; } @@ -611,21 +611,21 @@ int cls_libcam::start_req() { int retcd, bytes, indx, width; - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Starting."); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Starting."); camera->requestCompleted.connect(this, &cls_libcam::req_complete); frmbuf = std::make_unique(camera); retcd = frmbuf->allocate(config->at(0).stream()); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "Buffer allocation error."); return -1; } std::unique_ptr request = camera->createRequest(); if (!request) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "Create request error."); return -1; } @@ -637,7 +637,7 @@ int cls_libcam::start_req() retcd = request->addBuffer(stream, buffer.get()); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "Add buffer for request error."); return -1; } @@ -649,7 +649,7 @@ int cls_libcam::start_req() bytes = 0; for (indx=0; indx<(int)buffer->planes().size(); indx++){ bytes += buffer->planes()[(uint)indx].length; - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "Plane %d of %d length %d" + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "Plane %d of %d length %d" , indx, buffer->planes().size() , buffer->planes()[(uint)indx].length); } @@ -658,11 +658,11 @@ int cls_libcam::start_req() width = ((int)buffer->planes()[0].length / cam->imgs.height); if (((int)buffer->planes()[0].length != (width * cam->imgs.height)) || (bytes > ((width * cam->imgs.height * 3)/2))) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "Error setting image size. Plane 0 length %d, total bytes %d" , buffer->planes()[0].length, bytes); } - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO , "Image size adjusted from %d x %d to %d x %d" , cam->imgs.width,cam->imgs.height , width,cam->imgs.height); @@ -677,7 +677,7 @@ int cls_libcam::start_req() requests.push_back(std::move(request)); - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Finished."); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Finished."); return 0; } @@ -686,11 +686,11 @@ int cls_libcam::start_capture() { int retcd; - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Starting."); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Starting."); retcd = camera->start(&this->controls); if (retcd) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "Failed to start capture."); return -1; } @@ -699,7 +699,7 @@ int cls_libcam::start_capture() for (std::unique_ptr &request : requests) { retcd = req_add(request.get()); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , "Failed to queue request."); if (started_cam) { camera->stop(); @@ -707,7 +707,7 @@ int cls_libcam::start_capture() return -1; } } - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Finished."); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Finished."); return 0; } @@ -747,7 +747,7 @@ int cls_libcam::libcam_start() started_cam = true; - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Camera started"); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Camera started"); return 0; } @@ -782,7 +782,7 @@ void cls_libcam::libcam_stop() cam_mgr.reset(); } cam->device_status = STATUS_CLOSED; - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Camera stopped."); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, "Camera stopped."); } #endif @@ -796,17 +796,17 @@ void cls_libcam::noimage() reconnect_count++; } else { if (reconnect_count >= 500) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 2 hours.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 2 hours.")); slp_dur = 7200; } else if (reconnect_count >= 200) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 10 minutes.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 10 minutes.")); reconnect_count++; slp_dur = 600; } else { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 30 seconds.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 30 seconds.")); reconnect_count++; slp_dur = 30; } @@ -814,7 +814,7 @@ void cls_libcam::noimage() SLEEP(slp_dur,0); libcam_stop(); if (libcam_start() < 0) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO,_("libcam failed to open")); + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO,_("libcam failed to open")); libcam_stop(); } else { cam->device_status = STATUS_OPENED; @@ -868,18 +868,18 @@ cls_libcam::cls_libcam(cls_camera *p_cam) { cam = p_cam; #ifdef HAVE_LIBCAM - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("Opening libcam")); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("Opening libcam")); params = nullptr; reconnect_count = 0; cam->watchdog = cam->cfg->watchdog_tmo * 3; /* 3 is arbitrary multiplier to give startup more time*/ if (libcam_start() < 0) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO,_("libcam failed to open")); + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO,_("libcam failed to open")); libcam_stop(); } else { cam->device_status = STATUS_OPENED; } #else - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("libcam not available")); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("libcam not available")); cam->device_status = STATUS_CLOSED; #endif } diff --git a/src/logger.cpp b/src/logger.cpp index 376354f8..3a4d1166 100644 --- a/src/logger.cpp +++ b/src/logger.cpp @@ -54,7 +54,7 @@ void ff_log(void *var1, int errnbr, const char *fmt, va_list vlist) fflvl = ((motlog->log_fflevel -2) * 8); if (errnbr <= fflvl ) { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO,"%s",buff ); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO,"%s",buff ); } } @@ -186,7 +186,7 @@ void cls_log::set_log_file(std::string pname) if (log_file_name == "") { set_mode(LOGMODE_SYSLOG); log_file_name = "syslog"; - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, "Logging to syslog"); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "Logging to syslog"); } } else if ((pname != log_file_name) || (log_file_ptr == nullptr)) { @@ -198,13 +198,13 @@ void cls_log::set_log_file(std::string pname) if (log_file_ptr != nullptr) { log_file_name = pname; set_mode(LOGMODE_SYSLOG); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, "Logging to file (%s)" + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "Logging to file (%s)" ,pname.c_str()); set_mode(LOGMODE_FILE); } else { log_file_name = "syslog"; set_mode(LOGMODE_SYSLOG); - MOTPLS_LOG(EMG, TYPE_ALL, SHOW_ERRNO, "Cannot create log file %s" + MOTION_LOG(EMG, TYPE_ALL, SHOW_ERRNO, "Cannot create log file %s" , pname.c_str()); } } diff --git a/src/logger.hpp b/src/logger.hpp index ae287327..e890c21b 100644 --- a/src/logger.hpp +++ b/src/logger.hpp @@ -51,8 +51,8 @@ #define TYPE_DEFAULT TYPE_ALL /* Default type */ #define TYPE_DEFAULT_STR "ALL" /* Default name logs */ - #define MOTPLS_LOG(x, y, z, ...) motlog->write_msg(x, y, z, 1, __FUNCTION__, __VA_ARGS__) - #define MOTPLS_SHT(x, y, z, ...) motlog->write_msg(x, y, z, 0, __VA_ARGS__) + #define MOTION_LOG(x, y, z, ...) motlog->write_msg(x, y, z, 1, __FUNCTION__, __VA_ARGS__) + #define MOTION_SHT(x, y, z, ...) motlog->write_msg(x, y, z, 0, __VA_ARGS__) struct ctx_log_item { uint64_t log_nbr; diff --git a/src/motion.cpp b/src/motion.cpp index 540b3248..ace40bdf 100644 --- a/src/motion.cpp +++ b/src/motion.cpp @@ -30,7 +30,7 @@ #include "movie.hpp" #include "netcam.hpp" -volatile enum MOTPLS_SIGNAL motsignal; +volatile enum MOTION_SIGNAL motsignal; /** Handle signals sent */ static void sig_handler(int signo) @@ -38,20 +38,20 @@ static void sig_handler(int signo) /*The FALLTHROUGH is a special comment required by compiler. Do not edit it*/ switch(signo) { case SIGALRM: - motsignal = MOTPLS_SIGNAL_ALARM; + motsignal = MOTION_SIGNAL_ALARM; break; case SIGUSR1: - motsignal = MOTPLS_SIGNAL_USR1; + motsignal = MOTION_SIGNAL_USR1; break; case SIGHUP: - motsignal = MOTPLS_SIGNAL_SIGHUP; + motsignal = MOTION_SIGNAL_SIGHUP; break; case SIGINT: /*FALLTHROUGH*/ case SIGQUIT: /*FALLTHROUGH*/ case SIGTERM: - motsignal = MOTPLS_SIGNAL_SIGTERM; + motsignal = MOTION_SIGNAL_SIGTERM; break; case SIGSEGV: exit(0); @@ -114,17 +114,17 @@ void cls_motapp::signal_process() int indx; switch(motsignal){ - case MOTPLS_SIGNAL_ALARM: /* Trigger snapshot */ + case MOTION_SIGNAL_ALARM: /* Trigger snapshot */ for (indx=0; indxaction_snapshot = true; } break; - case MOTPLS_SIGNAL_USR1: /* Trigger the end of a event */ + case MOTION_SIGNAL_USR1: /* Trigger the end of a event */ for (indx=0; indxevent_stop = true; } break; - case MOTPLS_SIGNAL_SIGHUP: /* Reload the parameters and restart*/ + case MOTION_SIGNAL_SIGHUP: /* Reload the parameters and restart*/ reload_all = true; webu->finish = true; for (indx=0; indxhandler_shutdown(); } break; - case MOTPLS_SIGNAL_SIGTERM: /* Quit application */ + case MOTION_SIGNAL_SIGTERM: /* Quit application */ webu->finish = true; webu->restart = false; @@ -179,7 +179,7 @@ void cls_motapp::signal_process() default: break; } - motsignal = MOTPLS_SIGNAL_NONE; + motsignal = MOTION_SIGNAL_NONE; } void cls_motapp::pid_write() @@ -191,17 +191,17 @@ void cls_motapp::pid_write() if (pidf) { (void)fprintf(pidf, "%d\n", getpid()); myfclose(pidf); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Created process id file %s. Process ID is %d") ,cfg->pid_file.c_str(), getpid()); } else { - MOTPLS_LOG(EMG, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(EMG, TYPE_ALL, SHOW_ERRNO , _("Cannot create process id file (pid file) %s") , cfg->pid_file.c_str()); } } - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Motion pid: %d"), getpid()); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Motion pid: %d"), getpid()); } @@ -211,9 +211,9 @@ void cls_motapp::pid_remove() if ((cfg->pid_file != "") && (reload_all == false)) { if (!unlink(cfg->pid_file.c_str())) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Removed process id file (pid file).")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Removed process id file (pid file).")); } else{ - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO, _("Error removing pid file")); + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, _("Error removing pid file")); } } } @@ -233,7 +233,7 @@ void cls_motapp::daemon() sigemptyset(&sig_ign_action.sa_mask); if (fork()) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Motion going to daemon mode")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Motion going to daemon mode")); exit(0); } @@ -242,7 +242,7 @@ void cls_motapp::daemon() * without having to stop Motion */ if (chdir("/")) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO, _("Could not change directory")); + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, _("Could not change directory")); } #if (defined(BSD) && !defined(__APPLE__)) @@ -278,9 +278,9 @@ void cls_motapp::daemon() void cls_motapp::av_init() { - MOTPLS_LOG(NTC, TYPE_ENCODER, NO_ERRNO, _("libavcodec version %d.%d.%d") + MOTION_LOG(NTC, TYPE_ENCODER, NO_ERRNO, _("libavcodec version %d.%d.%d") , LIBAVCODEC_VERSION_MAJOR, LIBAVCODEC_VERSION_MINOR, LIBAVCODEC_VERSION_MICRO); - MOTPLS_LOG(NTC, TYPE_ENCODER, NO_ERRNO, _("libavformat version %d.%d.%d") + MOTION_LOG(NTC, TYPE_ENCODER, NO_ERRNO, _("libavformat version %d.%d.%d") , LIBAVFORMAT_VERSION_MAJOR, LIBAVFORMAT_VERSION_MINOR, LIBAVFORMAT_VERSION_MICRO); #if (MYFFVER < 58000) @@ -300,63 +300,63 @@ void cls_motapp::av_deinit() void cls_motapp::ntc() { #ifdef HAVE_V4L2 - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("v4l2 : available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("v4l2 : available")); #else - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("v4l2 : not available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("v4l2 : not available")); #endif #ifdef HAVE_WEBP - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("webp : available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("webp : available")); #else - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("webp : not available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("webp : not available")); #endif #ifdef HAVE_LIBCAM - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("libcam : available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("libcam : available")); #else - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("libcam : not available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("libcam : not available")); #endif #ifdef HAVE_MYSQL - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("mysql : available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("mysql : available")); #else - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("mysql : not available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("mysql : not available")); #endif #ifdef HAVE_MARIADB - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("MariaDB: available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("MariaDB: available")); #else - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("MariaDB: not available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("MariaDB: not available")); #endif #ifdef HAVE_SQLITE3 - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("sqlite3: available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("sqlite3: available")); #else - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("sqlite3: not available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("sqlite3: not available")); #endif #ifdef HAVE_PGSQL - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("pgsql : available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("pgsql : available")); #else - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("pgsql : not available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("pgsql : not available")); #endif #ifdef ENABLE_NLS - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("nls : available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("nls : available")); #else - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("nls : not available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("nls : not available")); #endif #ifdef HAVE_ALSA - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("alsa : available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("alsa : available")); #else - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("alsa : not available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("alsa : not available")); #endif #ifdef HAVE_FFTW3 - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("fftw3 : available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("fftw3 : available")); #else - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("fftw3 : not available")); + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("fftw3 : not available")); #endif } @@ -375,7 +375,7 @@ void cls_motapp::watchdog(uint camindx) return; } - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Camera %d - Watchdog timeout.") , cam_list[camindx]->cfg->device_id); @@ -403,7 +403,7 @@ void cls_motapp::watchdog(uint camindx) } cam_list[indx]->handler_shutdown(); - if (motsignal != MOTPLS_SIGNAL_SIGTERM) { + if (motsignal != MOTION_SIGNAL_SIGTERM) { cam_list[indx]->handler_stop = false; /*Trigger a restart*/ } } @@ -415,7 +415,7 @@ void cls_motapp::check_restart() std::string parm_pid_org, parm_pid_new; if (motlog->restart == true) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Restarting log")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Restarting log")); cfg->edit_get("pid_file",parm_pid_org, PARM_CAT_00); conf_src->edit_get("pid_file",parm_pid_new, PARM_CAT_00); @@ -432,27 +432,27 @@ void cls_motapp::check_restart() pid_write(); } motlog->restart = false; - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Restarted log")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Restarted log")); } if (dbse->restart == true) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Restarting database")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Restarting database")); pthread_mutex_lock(&dbse->mutex_dbse); dbse->shutdown(); cfg->parms_copy(conf_src, PARM_CAT_15); dbse->startup(); pthread_mutex_lock(&dbse->mutex_dbse); dbse->restart = false; - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Restarted database")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Restarted database")); } if (webu->restart == true) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Restarting webcontrol")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Restarting webcontrol")); webu->shutdown(); cfg->parms_copy(conf_src, PARM_CAT_13); webu->startup(); webu->restart = false; - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Restarted webcontrol")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Restarted webcontrol")); } } @@ -534,7 +534,7 @@ void cls_motapp::init(int p_argc, char *p_argv[]) if (cfg->daemon) { daemon(); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Motion running as daemon process")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Motion running as daemon process")); } cfg->parms_log(); @@ -558,9 +558,9 @@ void cls_motapp::init(int p_argc, char *p_argv[]) snd_list[indx]->handler_startup(); } } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("No camera or sound configuration files specified.")); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Waiting for camera or sound configuration to be added via web control.")); } @@ -617,7 +617,7 @@ void cls_motapp::camera_delete() } if ((cam_delete >= cam_cnt) || (cam_cnt == 0)) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Invalid camera specified for deletion. %d"), cam_delete); cam_delete = -1; return; @@ -625,18 +625,18 @@ void cls_motapp::camera_delete() cam = cam_list[cam_delete]; - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO, _("Stopping %s device_id %d") + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO, _("Stopping %s device_id %d") , cam->cfg->device_name.c_str(), cam->cfg->device_id); cam->finish = true; cam->handler_shutdown(); if (cam->handler_running == true) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, "Error stopping camera. Timed out shutting down"); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, "Error stopping camera. Timed out shutting down"); cam_delete = -1; return; } - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, "Camera stopped"); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "Camera stopped"); pthread_mutex_lock(&mutex_camlst); mydelete(cam_list[cam_delete]); @@ -665,14 +665,14 @@ int main (int p_argc, char **p_argv) app->init(p_argc, p_argv); while (app->check_devices()) { SLEEP(1, 0); - if (motsignal != MOTPLS_SIGNAL_NONE) { + if (motsignal != MOTION_SIGNAL_NONE) { app->signal_process(); } app->camera_add(); app->camera_delete(); app->check_restart(); } - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Motion devices finished")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Motion devices finished")); if (app->reload_all) { app->deinit(); app->reload_all = false; @@ -683,7 +683,7 @@ int main (int p_argc, char **p_argv) app->deinit(); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Motion terminating")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Motion terminating")); mydelete(motlog); mydelete(app); diff --git a/src/motion.hpp b/src/motion.hpp index 6bf20943..25dc6086 100644 --- a/src/motion.hpp +++ b/src/motion.hpp @@ -17,8 +17,8 @@ * */ -#ifndef _INCLUDE_MOTIONPLUS_HPP_ -#define _INCLUDE_MOTIONPLUS_HPP_ +#ifndef _INCLUDE_MOTION_HPP_ +#define _INCLUDE_MOTION_HPP_ #include "config.hpp" @@ -116,12 +116,12 @@ class cls_webu_post; class cls_webu_common; class cls_webu_stream; -enum MOTPLS_SIGNAL { - MOTPLS_SIGNAL_NONE, - MOTPLS_SIGNAL_ALARM, - MOTPLS_SIGNAL_USR1, - MOTPLS_SIGNAL_SIGHUP, - MOTPLS_SIGNAL_SIGTERM +enum MOTION_SIGNAL { + MOTION_SIGNAL_NONE, + MOTION_SIGNAL_ALARM, + MOTION_SIGNAL_USR1, + MOTION_SIGNAL_SIGHUP, + MOTION_SIGNAL_SIGTERM }; enum DEVICE_STATUS { @@ -219,4 +219,4 @@ class cls_motapp { void watchdog(uint camindx); }; -#endif /* _INCLUDE_MOTIONPLUS_HPP_ */ +#endif /* _INCLUDE_MOTION_HPP_ */ diff --git a/src/movie.cpp b/src/movie.cpp index 978ec377..5af7b020 100644 --- a/src/movie.cpp +++ b/src/movie.cpp @@ -32,7 +32,7 @@ int movie_interrupt(void *ctx) clock_gettime(CLOCK_MONOTONIC, &movie->cb_cr_ts); if ((movie->cb_cr_ts.tv_sec - movie->cb_st_ts.tv_sec ) > movie->cb_dur) { - MOTPLS_LOG(INF, TYPE_ENCODER, NO_ERRNO,_("Movie timed out")); + MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO,_("Movie timed out")); return 1; } return 0; @@ -127,7 +127,7 @@ int cls_movie::get_oformat() full_nm += ".mpg"; file_nm += ".mpg"; if (oc->oformat == nullptr) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO ,_("Error setting timelapse append for container %s") , container.c_str()); free_context(); @@ -187,7 +187,7 @@ int cls_movie::get_oformat() } if (oc->oformat == nullptr) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO ,_("container option value %s is not supported") , container.c_str()); free_context(); @@ -195,7 +195,7 @@ int cls_movie::get_oformat() } if (oc->oformat->video_codec == AV_CODEC_ID_NONE) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not get the container")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not get the container")); free_context(); return -1; } @@ -211,7 +211,7 @@ int cls_movie::encode_video() retcd = avcodec_send_frame(ctx_codec, picture); if (retcd < 0 ) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO ,_("Error sending frame for encoding:%s"),errstr); return -1; } @@ -223,7 +223,7 @@ int cls_movie::encode_video() } if (retcd < 0 ) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO ,_("Error receiving encoded packet video:%s"),errstr); //Packet is freed upon failure of encoding return -1; @@ -260,7 +260,7 @@ int cls_movie::set_pts(const struct timespec *ts1) , strm_video->time_base); } if (test_mode == true) { - MOTPLS_LOG(INF, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO ,_("PTS %" PRId64 " Base PTS %" PRId64 " ms interval %" PRId64 " timebase %d-%d") ,picture->pts,base_pts,pts_interval ,strm_video->time_base.num,strm_video->time_base.den); @@ -269,7 +269,7 @@ int cls_movie::set_pts(const struct timespec *ts1) if (picture->pts <= last_pts) { //We have a problem with our motion loop timing and sending frames or the rounding into the PTS. if (test_mode == true) { - MOTPLS_LOG(INF, TYPE_ENCODER, NO_ERRNO, _("BAD TIMING!! Frame skipped.")); + MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO, _("BAD TIMING!! Frame skipped.")); } return -1; } @@ -332,7 +332,7 @@ int cls_movie::set_quality() ctx_codec->global_quality=quality; } } - MOTPLS_LOG(INF, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO ,_("%s codec vbr/crf/bit_rate: %d"), codec->name, quality); return 0; @@ -344,19 +344,19 @@ int cls_movie::set_codec_preferred() if (preferred_codec != "") { codec = avcodec_find_encoder_by_name(preferred_codec.c_str()); if (codec == nullptr) { - MOTPLS_LOG(NTC, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(NTC, TYPE_ENCODER, NO_ERRNO ,_("Failed to find user requested codec %s") , preferred_codec.c_str()); codec = avcodec_find_encoder(oc->video_codec_id); } else { - MOTPLS_LOG(NTC, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(NTC, TYPE_ENCODER, NO_ERRNO ,_("Using codec %s"), preferred_codec.c_str()); } } else { codec = avcodec_find_encoder(oc->video_codec_id); } if (codec == nullptr) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO ,_("codec for container %s not found"), container.c_str()); free_context(); return -1; @@ -377,13 +377,13 @@ int cls_movie::set_codec() strm_video = avformat_new_stream(oc, codec); if (!strm_video) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not alloc stream")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not alloc stream")); free_context(); return -1; } ctx_codec = avcodec_alloc_context3(codec); if (ctx_codec == nullptr) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Failed to allocate codec context!")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Failed to allocate codec context!")); free_context(); return -1; } @@ -409,7 +409,7 @@ int cls_movie::set_codec() if ((container == "flv") || (container == "mp4") || (container == "hevc")) { - MOTPLS_LOG(NTC, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(NTC, TYPE_ENCODER, NO_ERRNO , "Low fps. Encoding %d frames into a %d frames container." , fps, 10); fps = 10; @@ -428,7 +428,7 @@ int cls_movie::set_codec() ctx_codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; if (set_quality() < 0) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Unable to set quality")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Unable to set quality")); return -1; } @@ -437,7 +437,7 @@ int cls_movie::set_codec() if (codec->supported_framerates) { const AVRational *p_fps = codec->supported_framerates; while (p_fps->num) { - MOTPLS_LOG(INF, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO ,_("Reported FPS Supported %d/%d"), p_fps->num, p_fps->den); p_fps++; } @@ -450,7 +450,7 @@ int cls_movie::set_codec() } if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not open codec %s"),errstr); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not open codec %s"),errstr); av_dict_free(&opts); free_context(); return -1; @@ -470,7 +470,7 @@ int cls_movie::set_stream() retcd = avcodec_parameters_from_context(strm_video->codecpar,ctx_codec); if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO ,_("Failed to copy decoder parameters!: %s"), errstr); free_context(); return -1; @@ -557,7 +557,7 @@ int cls_movie::set_picture() picture = av_frame_alloc(); if (!picture) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("could not alloc frame")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("could not alloc frame")); free_context(); return -1; } @@ -579,7 +579,7 @@ int cls_movie::set_picture() retcd = alloc_video_buffer(picture, 32); if (retcd) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("could not alloc buffers %s"), errstr); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("could not alloc buffers %s"), errstr); free_context(); return -1; } @@ -609,7 +609,7 @@ int cls_movie::set_outputfile() retcd = avio_open(&oc->pb, full_nm.c_str(), AVIO_FLAG_WRITE| AVIO_FLAG_NONBLOCK); if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_ENCODER, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, SHOW_ERRNO ,_("error %s opening file %s") , errstr, full_nm.c_str()); remove(full_nm.c_str()); @@ -618,7 +618,7 @@ int cls_movie::set_outputfile() } } else { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_ENCODER, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, SHOW_ERRNO ,_("avio_open: %s File %s") , errstr, full_nm.c_str()); remove(full_nm.c_str()); @@ -631,10 +631,10 @@ int cls_movie::set_outputfile() retcd = avformat_write_header(oc, nullptr); if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO ,_("Could not write movie header %s"),errstr); if ((container == "mp4") && (strm_audio != nullptr)) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO , _("Ensure audio codec is permitted with a MP4 container.")); } remove(full_nm.c_str()); @@ -668,7 +668,7 @@ int cls_movie::flush_codec() retcd = avcodec_send_frame(ctx_codec, nullptr); if (retcd < 0 ) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO ,_("Error entering draining mode:%s"),errstr); return -1; } @@ -678,7 +678,7 @@ int cls_movie::flush_codec() if (recv_cd != AVERROR_EOF) { if (recv_cd < 0) { av_strerror(recv_cd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO ,_("Error draining codec:%s"),errstr); free_pkt(); return -1; @@ -691,7 +691,7 @@ int cls_movie::flush_codec() } retcd = av_write_frame(oc, pkt); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO ,_("Error writing draining video frame")); return -1; } @@ -718,7 +718,7 @@ int cls_movie::put_frame(const struct timespec *ts1) retcd = encode_video(); if (retcd != 0) { if (retcd != -2) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Error while encoding picture")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Error while encoding picture")); } free_pkt(); return retcd; @@ -732,7 +732,7 @@ int cls_movie::put_frame(const struct timespec *ts1) free_pkt(); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Error while writing video frame")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Error while writing video frame")); return -1; } return retcd; @@ -770,7 +770,7 @@ int cls_movie::passthru_pktpts() if (pkt->pts != AV_NOPTS_VALUE) { if (pkt->pts < base_pdts) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "Invalid pkt->pts"); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "Invalid pkt->pts"); return -1; } else { ts_interval = pkt->pts - base_pdts; @@ -778,13 +778,13 @@ int cls_movie::passthru_pktpts() pkt->pts = av_rescale_q(ts_interval , netcam_data->transfer_format->streams[indx]->time_base, tmpbase); } else { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "pkt->pts is AV_NOPTS_VALUE"); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "pkt->pts is AV_NOPTS_VALUE"); return -1; } if (pkt->dts != AV_NOPTS_VALUE) { if (pkt->dts < base_pdts) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "pkt->dts is invalid"); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "pkt->dts is invalid"); return -1; } else { ts_interval = pkt->dts - base_pdts; @@ -792,7 +792,7 @@ int cls_movie::passthru_pktpts() pkt->dts = av_rescale_q(ts_interval , netcam_data->transfer_format->streams[indx]->time_base, tmpbase); } else { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "pkt->dts is AV_NOPTS_VALUE"); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "pkt->dts is AV_NOPTS_VALUE"); return -1; } @@ -801,12 +801,12 @@ int cls_movie::passthru_pktpts() , netcam_data->transfer_format->streams[indx]->time_base, tmpbase); if ((pkt->pts == AV_NOPTS_VALUE) || (pkt->dts == AV_NOPTS_VALUE)) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "pkt->dts or pkt->pts is AV_NOPTS_VALUE"); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, "pkt->dts or pkt->pts is AV_NOPTS_VALUE"); return -1; } /* - MOTPLS_LOG(INF, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO ,_("base PTS %" PRId64 " new PTS %" PRId64 " srcbase %d-%d newbase %d-%d") ,ts_interval, pkt->duration ,netcam_data->transfer_format->streams[indx]->time_base.num @@ -829,7 +829,7 @@ void cls_movie::passthru_write(int indx) retcd = av_packet_ref(pkt, netcam_data->pktarray[indx].packet); if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(INF, TYPE_ENCODER, NO_ERRNO, "av_copy_packet: %s",errstr); + MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO, "av_copy_packet: %s",errstr); free_pkt(); return; } @@ -844,7 +844,7 @@ void cls_movie::passthru_write(int indx) free_pkt(); if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(DBG, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(DBG, TYPE_ENCODER, NO_ERRNO ,_("Error while writing video frame: %s"),errstr); return; } @@ -992,13 +992,13 @@ int cls_movie::passthru_streams_video(AVStream *stream_in) strm_video = avformat_new_stream(oc, nullptr); if (strm_video == nullptr) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not alloc video stream")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not alloc video stream")); return -1; } retcd = avcodec_parameters_copy(strm_video->codecpar, stream_in->codecpar); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Unable to copy video codec parameters")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Unable to copy video codec parameters")); return -1; } @@ -1006,7 +1006,7 @@ int cls_movie::passthru_streams_video(AVStream *stream_in) strm_video->time_base = stream_in->time_base; strm_video->avg_frame_rate = stream_in->avg_frame_rate; - MOTPLS_LOG(DBG, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(DBG, TYPE_ENCODER, NO_ERRNO , _("video timebase %d/%d fps %d/%d") , strm_video->time_base.num , strm_video->time_base.den @@ -1022,13 +1022,13 @@ int cls_movie::passthru_streams_audio( AVStream *stream_in) strm_audio = avformat_new_stream(oc, nullptr); if (!strm_audio) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not alloc audio stream")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not alloc audio stream")); return -1; } retcd = avcodec_parameters_copy(strm_audio->codecpar, stream_in->codecpar); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Unable to copy audio codec parameters")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Unable to copy audio codec parameters")); return -1; } @@ -1040,7 +1040,7 @@ int cls_movie::passthru_streams_audio( AVStream *stream_in) strm_audio->codecpar->sample_rate = stream_in->codecpar->sample_rate; strm_audio->avg_frame_rate = stream_in->avg_frame_rate; - MOTPLS_LOG(DBG, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(DBG, TYPE_ENCODER, NO_ERRNO , _("audio timebase %d/%d") , strm_audio->time_base.num , strm_audio->time_base.den); @@ -1078,13 +1078,13 @@ int cls_movie::passthru_check() { if ((netcam_data->status == NETCAM_NOTCONNECTED ) || (netcam_data->status == NETCAM_RECONNECTING )) { - MOTPLS_LOG(NTC, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(NTC, TYPE_ENCODER, NO_ERRNO ,_("rtsp camera not ready for pass-through.")); return -1; } if (netcam_data == nullptr) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("RTSP context not available.")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("RTSP context not available.")); return -1; } @@ -1104,7 +1104,7 @@ int cls_movie::passthru_open() oc = avformat_alloc_context(); if (!oc) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not allocate output context")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not allocate output context")); free_context(); return -1; } @@ -1115,7 +1115,7 @@ int cls_movie::passthru_open() if ((container != "mp4") && (container != "mov") && (container != "mkv")) { - MOTPLS_LOG(NTC, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(NTC, TYPE_ENCODER, NO_ERRNO ,_("Changing to MP4 container for pass-through.")); container = "mp4"; } @@ -1124,24 +1124,24 @@ int cls_movie::passthru_open() retcd = get_oformat(); if (retcd < 0 ) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not get output format!")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not get output format!")); return -1; } retcd = passthru_streams(); if (retcd < 0 ) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not get streams!")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not get streams!")); return -1; } retcd = set_outputfile(); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not create output file")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not create output file")); return -1; } if (strm_audio != nullptr) { - MOTPLS_LOG(DBG, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(DBG, TYPE_ENCODER, NO_ERRNO , _("Timebase after open audio: %d/%d video: %d/%d") , strm_audio->time_base.num , strm_audio->time_base.den @@ -1149,7 +1149,7 @@ int cls_movie::passthru_open() , strm_video->time_base.den); } - MOTPLS_LOG(INF, TYPE_ENCODER, NO_ERRNO, "Pass-through stream opened"); + MOTION_LOG(INF, TYPE_ENCODER, NO_ERRNO, "Pass-through stream opened"); return 0; } @@ -1172,7 +1172,7 @@ void cls_movie::put_pix_yuv420(ctx_image_data *img_data) void cls_movie::on_movie_start() { - MOTPLS_LOG(DBG, TYPE_EVENTS, NO_ERRNO, _("Creating movie: %s"),full_nm.c_str()); + MOTION_LOG(DBG, TYPE_EVENTS, NO_ERRNO, _("Creating movie: %s"),full_nm.c_str()); if (cam->cfg->on_movie_start != "") { util_exec_command(cam, cam->cfg->on_movie_start.c_str(), full_nm.c_str()); } @@ -1180,7 +1180,7 @@ void cls_movie::on_movie_start() void cls_movie::on_movie_end() { - MOTPLS_LOG(DBG, TYPE_EVENTS, NO_ERRNO, _("Finished movie: %s"),full_nm.c_str()); + MOTION_LOG(DBG, TYPE_EVENTS, NO_ERRNO, _("Finished movie: %s"),full_nm.c_str()); if (cam->cfg->on_movie_end != "") { util_exec_command(cam, cam->cfg->on_movie_end.c_str(), full_nm.c_str()); } @@ -1190,7 +1190,7 @@ int cls_movie::movie_open() { if (passthrough) { if (passthru_open() < 0 ) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not setup passthrough!")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not setup passthrough!")); free_context(); return -1; } @@ -1199,7 +1199,7 @@ int cls_movie::movie_open() oc = avformat_alloc_context(); if (oc == nullptr) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not allocate output context")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not allocate output context")); free_context(); return -1; } @@ -1209,28 +1209,28 @@ int cls_movie::movie_open() oc->interrupt_callback.opaque = this; if (get_oformat() < 0 ) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not get codec!")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not get codec!")); free_context(); return -1; } if (set_codec() < 0 ) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Failed to allocate codec!")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Failed to allocate codec!")); return -1; } if (set_stream() < 0) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not set the stream")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not set the stream")); return -1; } if (set_picture() < 0) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not set the picture")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not set the picture")); return -1; } if (set_outputfile() < 0) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not open output file")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Could not open output file")); return -1; } @@ -1255,7 +1255,7 @@ void cls_movie::stop() } } else { if (flush_codec() < 0) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Error flushing codec")); + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO, _("Error flushing codec")); } if (oc != nullptr) { if (oc->pb != nullptr) { @@ -1286,7 +1286,7 @@ void cls_movie::stop() (cam->algsec->detected == false) && (cam->algsec->method != "none")) { if (remove(full_nm.c_str()) != 0) { - MOTPLS_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO , _("Unable to remove file %s"), full_nm.c_str()); } else { cam->app->dbse->filelist_add(cam, ts, "movie" @@ -1300,7 +1300,7 @@ void cls_movie::stop() on_movie_end(); cam->app->dbse->exec(cam, full_nm, "movie_end"); } else { - MOTPLS_LOG(ERR, TYPE_EVENTS, NO_ERRNO,_("Invalid movie type")); + MOTION_LOG(ERR, TYPE_EVENTS, NO_ERRNO,_("Invalid movie type")); } is_running = false; @@ -1316,7 +1316,7 @@ int cls_movie::extpipe_put() if ((cam->imgs.size_high > 0) && (cam->movie_passthrough == false)) { if (!fwrite(cam->current_image->image_high , (uint)cam->imgs.size_high, 1, extpipe_stream)) { - MOTPLS_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO , _("Error writing in pipe , state error %d") , ferror(extpipe_stream)); retcd = -1; @@ -1324,7 +1324,7 @@ int cls_movie::extpipe_put() } else { if (!fwrite(cam->current_image->image_norm , (uint)cam->imgs.size_norm, 1, extpipe_stream)) { - MOTPLS_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO ,_("Error writing in pipe , state error %d") , ferror(extpipe_stream)); retcd = -1; @@ -1378,7 +1378,7 @@ int cls_movie::put_image(ctx_image_data *img_data, const struct timespec *ts1) retcd = put_frame(ts1); cnt++; if (cnt > 50) { - MOTPLS_LOG(ERR, TYPE_ENCODER, NO_ERRNO + MOTION_LOG(ERR, TYPE_ENCODER, NO_ERRNO ,_("Excessive attempts to clear buffered packet")); retcd = -1; } @@ -1386,7 +1386,7 @@ int cls_movie::put_image(ctx_image_data *img_data, const struct timespec *ts1) //non timelapse buffered is ok if (retcd == -2) { retcd = 0; - MOTPLS_LOG(DBG, TYPE_ENCODER, NO_ERRNO, _("Buffered packet")); + MOTION_LOG(DBG, TYPE_ENCODER, NO_ERRNO, _("Buffered packet")); } } @@ -1412,7 +1412,7 @@ void cls_movie::init_container() size_t col_pos; if (cam->cfg->movie_container == "test") { - MOTPLS_LOG(NTC, TYPE_ENCODER, NO_ERRNO, "Running test of the various output formats."); + MOTION_LOG(NTC, TYPE_ENCODER, NO_ERRNO, "Running test of the various output formats."); codenbr = cam->event_curr_nbr % 10; if (codenbr == 1) { container = "flv"; @@ -1500,7 +1500,7 @@ void cls_movie::start_norm() passthrough = cam->movie_passthrough; if (movie_open() < 0) { - MOTPLS_LOG(ERR, TYPE_EVENTS, NO_ERRNO + MOTION_LOG(ERR, TYPE_EVENTS, NO_ERRNO ,_("Error initializing movie.")); return; } @@ -1561,7 +1561,7 @@ void cls_movie::start_motion() high_resolution = false; if (movie_open() < 0) { - MOTPLS_LOG(ERR, TYPE_EVENTS, NO_ERRNO + MOTION_LOG(ERR, TYPE_EVENTS, NO_ERRNO ,_("Error initializing movie.")); return; } @@ -1605,19 +1605,19 @@ void cls_movie::start_timelapse() netcam_data = nullptr; if (cam->cfg->timelapse_container == "mpg") { - MOTPLS_LOG(NTC, TYPE_EVENTS, NO_ERRNO, _("Timelapse using mpg container.")); - MOTPLS_LOG(NTC, TYPE_EVENTS, NO_ERRNO, _("Events will be appended to file")); + MOTION_LOG(NTC, TYPE_EVENTS, NO_ERRNO, _("Timelapse using mpg container.")); + MOTION_LOG(NTC, TYPE_EVENTS, NO_ERRNO, _("Events will be appended to file")); tlapse = TIMELAPSE_APPEND; container = "mpg"; } else { - MOTPLS_LOG(NTC, TYPE_EVENTS, NO_ERRNO, _("Timelapse using mkv container.")); - MOTPLS_LOG(NTC, TYPE_EVENTS, NO_ERRNO, _("Events will be trigger new files")); + MOTION_LOG(NTC, TYPE_EVENTS, NO_ERRNO, _("Timelapse using mkv container.")); + MOTION_LOG(NTC, TYPE_EVENTS, NO_ERRNO, _("Events will be trigger new files")); tlapse = TIMELAPSE_NEW; container = "mkv"; } if (movie_open() < 0) { - MOTPLS_LOG(ERR, TYPE_EVENTS, NO_ERRNO + MOTION_LOG(ERR, TYPE_EVENTS, NO_ERRNO ,_("Error initializing movie.")); return; } @@ -1641,9 +1641,9 @@ void cls_movie::start_extpipe() file_nm = tmp; if (cam->cfg->movie_output) { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Requested extpipe in addition to movie_output.")); - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Adjusting file name of extpipe output.")); full_nm = cam->cfg->target_dir + "/" + file_nm + "p"; } else { @@ -1653,7 +1653,7 @@ void cls_movie::start_extpipe() file_nm = full_nm.substr(file_dir.length()+1); if (mycreate_path(full_nm.c_str()) == -1) { - MOTPLS_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO, _("create path failed")); + MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO, _("create path failed")); return; } @@ -1661,11 +1661,11 @@ void cls_movie::start_extpipe() mystrftime(cam, tmp, sizeof(tmp) , cam->cfg->movie_extpipe.c_str(), full_nm.c_str()); - MOTPLS_LOG(NTC, TYPE_EVENTS, NO_ERRNO, _("extpipe cmd: %s"), tmp); + MOTION_LOG(NTC, TYPE_EVENTS, NO_ERRNO, _("extpipe cmd: %s"), tmp); extpipe_stream = popen(tmp, "we"); if (extpipe_stream == nullptr) { - MOTPLS_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO, _("popen failed")); + MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO, _("popen failed")); return; } @@ -1692,7 +1692,7 @@ void cls_movie::start() } else if (movie_type == "extpipe") { start_extpipe(); } else { - MOTPLS_LOG(ERR, TYPE_EVENTS, NO_ERRNO,_("Invalid movie type")); + MOTION_LOG(ERR, TYPE_EVENTS, NO_ERRNO,_("Invalid movie type")); } } diff --git a/src/netcam.cpp b/src/netcam.cpp index c1ec8218..7067f1c2 100644 --- a/src/netcam.cpp +++ b/src/netcam.cpp @@ -43,7 +43,7 @@ enum AVPixelFormat netcam_getfmt_vaapi(AVCodecContext *avctx, const enum AVPixel } } - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("Failed to get vaapi pix format")); + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("Failed to get vaapi pix format")); return AV_PIX_FMT_NONE; } @@ -56,7 +56,7 @@ enum AVPixelFormat netcam_getfmt_cuda(AVCodecContext *avctx, const enum AVPixelF if (*p == AV_PIX_FMT_CUDA) return *p; } - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("Failed to get cuda pix format")); + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("Failed to get cuda pix format")); return AV_PIX_FMT_NONE; } @@ -69,7 +69,7 @@ enum AVPixelFormat netcam_getfmt_drm(AVCodecContext *avctx, const enum AVPixelFo if (*p == AV_PIX_FMT_DRM_PRIME) return *p; } - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("Failed to get drm pix format")); + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("Failed to get drm pix format")); return AV_PIX_FMT_NONE; } @@ -89,7 +89,7 @@ int netcam_interrupt(void *ctx) if ((netcam->icur_tm.tv_sec - netcam->ist_tm.tv_sec ) > netcam->idur){ if (netcam->cam->finish == false) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Camera reading (%s) timed out") , netcam->cameratype.c_str(), netcam->camera_name.c_str()); } @@ -107,7 +107,7 @@ int netcam_interrupt(void *ctx) clock_gettime(CLOCK_MONOTONIC, &netcam->icur_tm); if ((netcam->icur_tm.tv_sec - netcam->ist_tm.tv_sec ) > netcam->idur){ if (netcam->cam->finish == false) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Camera (%s) timed out") , netcam->cameratype.c_str(), netcam->camera_name.c_str()); } @@ -142,7 +142,7 @@ void cls_netcam::filelist_load() filelist.clear(); retcd = stat(filedir.c_str(), &sbuf); if ((sbuf.st_mode & S_IFREG ) && (retcd == 0)) { - MOTPLS_LOG(DBG, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_NETCAM, NO_ERRNO , _("File specified: %s"),filedir.c_str()); fileitm.fullnm = filedir; chkloc = fileitm.fullnm.find_last_of("/"); @@ -159,7 +159,7 @@ void cls_netcam::filelist_load() } filelist.push_back(fileitm); } else if ((sbuf.st_mode & S_IFDIR ) && (retcd == 0)) { - MOTPLS_LOG(DBG, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_NETCAM, NO_ERRNO , _("Directory specified: %s"),filedir.c_str()); d = opendir(filedir.c_str()); if (d != NULL) { @@ -179,7 +179,7 @@ void cls_netcam::filelist_load() } } } else { - MOTPLS_LOG(DBG, TYPE_NETCAM, SHOW_ERRNO + MOTION_LOG(DBG, TYPE_NETCAM, SHOW_ERRNO , _("Directory did not open: %s"),filedir.c_str()); } closedir(d); @@ -190,12 +190,12 @@ void cls_netcam::filelist_load() filenbr = 0; } if (filelist.size() == 0) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO , _("Directory/file not found: %s"), filedir.c_str()); } else { path = filelist[(uint)filenbr].fullnm; } - MOTPLS_LOG(DBG, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_NETCAM, NO_ERRNO , _("Netcam Path: %s"),path.c_str()); } @@ -243,7 +243,7 @@ char *cls_netcam::url_match(regmatch_t m, const char *input) void cls_netcam::url_invalid(ctx_url *parse_url) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("Invalid URL. Can not parse values.")); + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("Invalid URL. Can not parse values.")); parse_url->port = 0; parse_url->host = "????"; @@ -292,7 +292,7 @@ void cls_netcam::url_parse(ctx_url *parse_url, std::string text_url) for (i = 0; i < 10; i++) { if ((s = url_match(matches[i], text_url.c_str())) != NULL) { - //MOTPLS_LOG(DBG, TYPE_NETCAM, NO_ERRNO, "Parse case %d data %s", i, s); + //MOTION_LOG(DBG, TYPE_NETCAM, NO_ERRNO, "Parse case %d data %s", i, s); switch (i) { case 1: parse_url->service = s; @@ -330,7 +330,7 @@ void cls_netcam::url_parse(ctx_url *parse_url, std::string text_url) } else if (parse_url->service == "rtsp") { parse_url->port = 554; } - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO , _("Using port number %d"), parse_url->port); } @@ -457,7 +457,7 @@ void cls_netcam::pktarray_resize() pktarray = tmp; pktarray_size = newsize; - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO , _("%s:Resized packet array to %d") , cameratype.c_str(), newsize); } @@ -493,7 +493,7 @@ void cls_netcam::pktarray_add() retcd = av_packet_ref(pktarray[indx_next].packet, packet_recv); if ((interrupted) || (retcd < 0)) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:av_copy_packet:%s ,Interrupt:%s") ,cameratype.c_str() ,errstr, interrupted ? _("true"):_("false")); @@ -522,13 +522,13 @@ int cls_netcam::decode_sw() if (retcd == AVERROR(EAGAIN)) { retcd = 0; } else if (retcd == AVERROR_INVALIDDATA) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Ignoring packet with invalid data") ,cameratype.c_str()); retcd = 0; } else if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Rec frame error:%s") ,cameratype.c_str(), errstr); retcd = -1; @@ -551,7 +551,7 @@ int cls_netcam::decode_vaapi() retcd = av_hwframe_get_buffer(codec_context->hw_frames_ctx, hw_frame, 0); if (retcd < 0) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO , _("%s:Error getting hw frame buffer") , cameratype.c_str()); av_frame_free(&hw_frame); @@ -563,13 +563,13 @@ int cls_netcam::decode_vaapi() if (retcd == AVERROR(EAGAIN)) { retcd = 0; } else if (retcd == AVERROR_INVALIDDATA) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Ignoring packet with invalid data") ,cameratype.c_str()); retcd = 0; } else if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Rec frame error:%s") ,cameratype.c_str(), errstr); retcd = -1; @@ -582,7 +582,7 @@ int cls_netcam::decode_vaapi() retcd = av_hwframe_transfer_data(frame, hw_frame, 0); if (retcd < 0) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Error transferring HW decoded to system memory") ,cameratype.c_str()); av_frame_free(&hw_frame); @@ -606,13 +606,13 @@ int cls_netcam::decode_cuda() if (retcd == AVERROR(EAGAIN)){ retcd = 0; } else if (retcd == AVERROR_INVALIDDATA) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Ignoring packet with invalid data") ,cameratype.c_str()); retcd = 0; } else if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Rec frame error:%s") ,cameratype.c_str(), errstr); retcd = -1; @@ -626,7 +626,7 @@ int cls_netcam::decode_cuda() retcd = av_hwframe_transfer_data(frame, hw_frame, 0); if (retcd < 0) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Error transferring HW decoded to system memory") ,cameratype.c_str()); av_frame_free(&hw_frame); @@ -651,13 +651,13 @@ int cls_netcam::decode_drm() if (retcd == AVERROR(EAGAIN)){ retcd = 0; } else if (retcd == AVERROR_INVALIDDATA) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Ignoring packet with invalid data") ,cameratype.c_str()); retcd = 0; } else if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Rec frame error:%s") ,cameratype.c_str(), errstr); retcd = -1; @@ -671,7 +671,7 @@ int cls_netcam::decode_drm() retcd = av_hwframe_transfer_data(frame, hw_frame, 0); if (retcd < 0) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Error transferring HW decoded to system memory") ,cameratype.c_str()); av_frame_free(&hw_frame); @@ -699,20 +699,20 @@ int cls_netcam::decode_video() retcd = avcodec_send_packet(codec_context, packet_recv); if ((interrupted) || (handler_stop)) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Interrupted or handler_stop on send") ,cameratype.c_str()); return -1; } if (retcd == AVERROR_INVALIDDATA) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Send ignoring packet with invalid data") ,cameratype.c_str()); return 0; } if (retcd < 0 && retcd != AVERROR_EOF) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Error sending packet to codec:%s") ,cameratype.c_str(), errstr); if (service == "file") { @@ -745,7 +745,7 @@ int cls_netcam::decode_packet() } if (packet_recv->stream_index == audio_stream_index) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Error decoding video packet...it is audio") ,cameratype.c_str()); } @@ -769,7 +769,7 @@ int cls_netcam::decode_packet() , (enum AVPixelFormat)frame->format , frame->width, frame->height, 1); if ((retcd < 0) || (interrupted)) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Error decoding video packet:Copying to buffer") ,cameratype.c_str()); return -1; @@ -787,19 +787,19 @@ void cls_netcam::hwdecoders() return; } if ((hw_type == AV_HWDEVICE_TYPE_NONE) && (first_image)) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:HW Devices:") , cameratype.c_str()); while((hw_type = av_hwdevice_iterate_types(hw_type)) != AV_HWDEVICE_TYPE_NONE){ if ((hw_type == AV_HWDEVICE_TYPE_VAAPI) || (hw_type == AV_HWDEVICE_TYPE_CUDA) || (hw_type == AV_HWDEVICE_TYPE_DRM)) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s: %s(available)") , cameratype.c_str() , av_hwdevice_get_type_name(hw_type)); } else { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s: %s(not implemented)") , cameratype.c_str() , av_hwdevice_get_type_name(hw_type)); @@ -815,26 +815,26 @@ void cls_netcam::decoder_error(int retcd, const char* fnc_nm) int indx; if (interrupted) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Interrupted"),cameratype.c_str()); } else { if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:%s:%s"),cameratype.c_str() ,fnc_nm, errstr); } else { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:%s:Failed"), cameratype.c_str() ,fnc_nm); } } if (decoder_nm != "NULL") { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Decoder %s did not work.") ,cameratype.c_str(), decoder_nm.c_str()); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Ignoring and removing the user requested decoder %s") ,cameratype.c_str(), decoder_nm.c_str()); @@ -856,13 +856,13 @@ int cls_netcam::init_vaapi() int retcd, indx; AVPixelFormat *pixelformats = nullptr; - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Initializing vaapi decoder") ,cameratype.c_str()); hw_type = av_hwdevice_find_type_by_name("vaapi"); if (hw_type == AV_HWDEVICE_TYPE_NONE) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("%s:Unable to find vaapi hw device") + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("%s:Unable to find vaapi hw device") , cameratype.c_str()); decoder_error(0, "av_hwdevice"); return -1; @@ -933,7 +933,7 @@ int cls_netcam::init_vaapi() , &pixelformats , 0); if (retcd < 0) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Error enumerating HW pixel types") ,cameratype.c_str()); decoder_error(retcd, "initvaapi 3"); @@ -946,7 +946,7 @@ int cls_netcam::init_vaapi() const AVPixFmtDescriptor *descr; for (indx=0; pixelformats[indx] != AV_PIX_FMT_NONE; indx++) { descr = av_pix_fmt_desc_get(pixelformats[indx]); - MOTPLS_LOG(DBG, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_NETCAM, NO_ERRNO , _("%s:Available HW pixel type:%s") , cameratype.c_str() ,descr->name); @@ -960,12 +960,12 @@ int cls_netcam::init_cuda() { int retcd; - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Initializing cuda decoder"),cameratype.c_str()); hw_type = av_hwdevice_find_type_by_name("cuda"); if (hw_type == AV_HWDEVICE_TYPE_NONE){ - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("%s:Unable to find cuda hw device") + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("%s:Unable to find cuda hw device") , cameratype.c_str()); decoder_error(0, "av_hwdevice"); return -1; @@ -1005,13 +1005,13 @@ int cls_netcam::init_drm() { int retcd; - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Initializing drm decoder") ,cameratype.c_str()); hw_type = av_hwdevice_find_type_by_name("drm"); if (hw_type == AV_HWDEVICE_TYPE_NONE){ - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("%s:Unable to find drm hw device") + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO,_("%s:Unable to find drm hw device") , cameratype.c_str()); decoder_error(0, "av_hwdevice"); return -1; @@ -1051,7 +1051,7 @@ int cls_netcam::init_swdecoder() { int retcd; - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Initializing decoder"),cameratype.c_str()); if (decoder_nm != "NULL") { @@ -1061,7 +1061,7 @@ int cls_netcam::init_swdecoder() decoder_error(0 , "avcodec_find_decoder_by_name"); } else { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Using decoder %s") , cameratype.c_str() , decoder_nm.c_str()); @@ -1146,7 +1146,7 @@ int cls_netcam::open_codec() return -1; } - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Decoder opened"),cameratype.c_str()); return 0; @@ -1161,7 +1161,7 @@ int cls_netcam::open_sws() swsframe_in = av_frame_alloc(); if (swsframe_in == nullptr) { if (status == NETCAM_NOTCONNECTED) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO , _("%s:Unable to allocate swsframe_in.") , cameratype.c_str()); } @@ -1172,7 +1172,7 @@ int cls_netcam::open_sws() swsframe_out = av_frame_alloc(); if (swsframe_out == nullptr) { if (status == NETCAM_NOTCONNECTED) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO , _("%s:Unable to allocate swsframe_out.") , cameratype.c_str()); } @@ -1187,7 +1187,7 @@ int cls_netcam::open_sws() if (check_pixfmt() != 0) { const AVPixFmtDescriptor *descr; descr = av_pix_fmt_desc_get((AVPixelFormat)frame->format); - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO , _("%s:Pixel format %s will be converted.") , cameratype.c_str(), descr->name); } @@ -1202,7 +1202,7 @@ int cls_netcam::open_sws() ,SWS_BICUBIC,nullptr,nullptr,nullptr); if (swsctx == nullptr) { if (status == NETCAM_NOTCONNECTED) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO , _("%s:Unable to allocate scaling context.") , cameratype.c_str()); } @@ -1214,7 +1214,7 @@ int cls_netcam::open_sws() AV_PIX_FMT_YUV420P, imgsize.width, imgsize.height, 1); if (swsframe_size <= 0) { if (status == NETCAM_NOTCONNECTED) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO , _("%s:Error determining size of frame out") , cameratype.c_str()); } @@ -1253,7 +1253,7 @@ int cls_netcam::resize() if (retcd < 0) { if (status == NETCAM_NOTCONNECTED) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Error allocating picture in:%s") , cameratype.c_str(), errstr); } @@ -1271,7 +1271,7 @@ int cls_netcam::resize() if (retcd < 0) { if (status == NETCAM_NOTCONNECTED) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Error allocating picture out:%s") , cameratype.c_str(), errstr); } @@ -1290,7 +1290,7 @@ int cls_netcam::resize() if (retcd < 0) { if (status == NETCAM_NOTCONNECTED) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Error resizing/reformatting:%s") , cameratype.c_str(), errstr); } @@ -1308,7 +1308,7 @@ int cls_netcam::resize() if (retcd < 0) { if (status == NETCAM_NOTCONNECTED) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Error putting frame into output buffer:%s") , cameratype.c_str(), errstr); } @@ -1347,7 +1347,7 @@ void cls_netcam::pkt_ts() usec_ltncy = (((tmp_tm.tv_sec - connection_tm.tv_sec) * 1000000) + ((tmp_tm.tv_nsec - connection_tm.tv_nsec) / 1000)); if (usec_ltncy < 0) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Latency calculation error ") , cameratype.c_str()); usec_ltncy = 0; @@ -1397,12 +1397,12 @@ int cls_netcam::read_image() } if ((interrupted) || (errcnt > 1)) { if (interrupted) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Interrupted") ,cameratype.c_str()); } else { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:av_read_frame:%s" ) ,cameratype.c_str(),errstr); } @@ -1493,7 +1493,7 @@ int cls_netcam::read_image() if (capture_rate < 1) { capture_rate = src_fps + 1; if (pts_adj == false) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:capture_rate not specified in params. Using %d") ,cameratype.c_str(),capture_rate); } @@ -1502,10 +1502,10 @@ int cls_netcam::read_image() if (capture_rate < 1) { capture_rate = cfg_framerate; if (pts_adj == false) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:capture_rate not specified.") ,cameratype.c_str()); - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Using framerate %d") ,cameratype.c_str(), capture_rate); } @@ -1533,16 +1533,16 @@ int cls_netcam::ntc() if ((imgsize.width != frame->width) || (imgsize.height != frame->height)) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO, ""); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO, "******************************************************"); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO, _("The network camera is sending pictures at %dx%d") + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, ""); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, "******************************************************"); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, _("The network camera is sending pictures at %dx%d") , frame->width,frame->height); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO, _("resolution but config is %dx%d. If possible change") + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, _("resolution but config is %dx%d. If possible change") , imgsize.width,imgsize.height); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO, _("the netcam or config so that the image height and")); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO, _("width are the same to lower the CPU usage.")); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO, "******************************************************"); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO, ""); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, _("the netcam or config so that the image height and")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, _("width are the same to lower the CPU usage.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, "******************************************************"); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO, ""); } return 0; @@ -1595,7 +1595,7 @@ void cls_netcam::set_options() av_dict_set(&opts , itm->param_name.c_str(), itm->param_value.c_str(), 0); if (status == NETCAM_NOTCONNECTED) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO,_("%s:%s = %s") + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO,_("%s:%s = %s") ,cameratype.c_str() ,itm->param_name.c_str(),itm->param_value.c_str()); } @@ -1603,7 +1603,7 @@ void cls_netcam::set_options() (itm->param_value != "")) { format_context->iformat = av_find_input_format(itm->param_value.c_str()); if (status == NETCAM_NOTCONNECTED) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO,_("%s:%s = %s") + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO,_("%s:%s = %s") ,cameratype.c_str() ,itm->param_name.c_str(),itm->param_value.c_str()); } @@ -1630,15 +1630,15 @@ void cls_netcam::set_path () if (url.service == "v4l2") { path = url.path; - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("Setting up v4l2")); } else if (url.service == "file") { filedir = url.path; filelist_load(); - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("Setting up file")); } else { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("Setting up %s "),url.service.c_str()); if (url.userpass.length() > 0) { path = url.service + "://" + @@ -1689,7 +1689,7 @@ void cls_netcam::set_parms () } camera_name = cam->cfg->device_name; - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO , _("%s:Setting up camera(%s).") , cameratype.c_str(), camera_name.c_str()); @@ -1779,7 +1779,7 @@ int cls_netcam::copy_stream() stream_in = format_context->streams[indx]; retcd = avcodec_parameters_copy(transfer_stream->codecpar, stream_in->codecpar); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Unable to copy codec parameters") , cameratype.c_str()); pthread_mutex_unlock(&mutex_transfer); @@ -1791,7 +1791,7 @@ int cls_netcam::copy_stream() } pthread_mutex_unlock(&mutex_transfer); - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO, _("Stream copied for pass-through")); + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO, _("Stream copied for pass-through")); return 0; } @@ -1806,7 +1806,7 @@ int cls_netcam::open_context() if (path == "") { if (status == NETCAM_NOTCONNECTED) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO, _("No path passed to connect")); + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO, _("No path passed to connect")); } return -1; } @@ -1823,19 +1823,19 @@ int cls_netcam::open_context() set_options(); - MOTPLS_LOG(DBG, TYPE_NETCAM, NO_ERRNO, _("Opening camera")); + MOTION_LOG(DBG, TYPE_NETCAM, NO_ERRNO, _("Opening camera")); retcd = avformat_open_input(&format_context , path.c_str(), nullptr, &opts); if ((retcd < 0) || (interrupted) || (handler_stop) ) { if (status == NETCAM_NOTCONNECTED) { if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Unable to open camera(%s):%s") , cameratype.c_str() , camera_name.c_str(), errstr); } else if (interrupted) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Unable to open camera(%s):timeout") , cameratype.c_str() , camera_name.c_str()); @@ -1847,7 +1847,7 @@ int cls_netcam::open_context() } clock_gettime(CLOCK_MONOTONIC, &ist_tm); av_dict_free(&opts); - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Opened camera(%s)"), cameratype.c_str() , camera_name.c_str()); @@ -1858,11 +1858,11 @@ int cls_netcam::open_context() if (status == NETCAM_NOTCONNECTED) { if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Unable to find stream info:%s") ,cameratype.c_str(), errstr); } else if (interrupted) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Unable to find stream info:%s") ,cameratype.c_str()); } @@ -1883,11 +1883,11 @@ int cls_netcam::open_context() if ((retcd < 0) || (interrupted) || (handler_stop) ) { av_strerror(retcd, errstr, sizeof(errstr)); if (status == NETCAM_NOTCONNECTED) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Unable to open codec context:%s") ,cameratype.c_str(), errstr); } else { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Connected and unable to open codec context:%s") ,cameratype.c_str(), errstr); } @@ -1897,7 +1897,7 @@ int cls_netcam::open_context() if (codec_context->width <= 0 || codec_context->height <= 0) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Camera image size is invalid") ,cameratype.c_str()); context_close(); @@ -1913,7 +1913,7 @@ int cls_netcam::open_context() frame = av_frame_alloc(); if (frame == nullptr) { if (status == NETCAM_NOTCONNECTED) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Unable to allocate frame.") ,cameratype.c_str()); } @@ -1925,7 +1925,7 @@ int cls_netcam::open_context() retcd = copy_stream(); if ((retcd < 0) || (interrupted)) { if (status == NETCAM_NOTCONNECTED) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Failed to copy stream for pass-through.") ,cameratype.c_str()); } @@ -1938,7 +1938,7 @@ int cls_netcam::open_context() retcd = read_image(); if ((retcd < 0) || (interrupted)) { if (status == NETCAM_NOTCONNECTED) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("%s:Failed to read first image") ,cameratype.c_str()); } @@ -1973,29 +1973,29 @@ int cls_netcam::connect() if (!first_image) { status = NETCAM_CONNECTED; - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Camera (%s) connected") , cameratype.c_str(),camera_name.c_str()); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO , _("%s:Netcam capture FPS is %d.") , cameratype.c_str(), capture_rate); if (src_fps > 0) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO , _("%s:Camera source is %d FPS") , cameratype.c_str(), src_fps); } else { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO , _("%s:Unable to determine the camera source FPS.") , cameratype.c_str()); } if (capture_rate < src_fps) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO , _("%s:Capture FPS less than camera FPS. Decoding errors will occur.") , cameratype.c_str()); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO , _("%s:Capture FPS should be greater than camera FPS.") , cameratype.c_str()); } @@ -2006,7 +2006,7 @@ int cls_netcam::connect() * for the audio stream. The technically correct process is that our wait timer in * the handler is only triggered when the last packet is a video stream */ - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:An audio stream was detected. Capture_rate increased to compensate.") ,cameratype.c_str()); } @@ -2057,12 +2057,12 @@ void cls_netcam::handler_reconnect() if (service == "file") { filelist_load(); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Processing file: %s") ,cameratype.c_str(), path.c_str()); } else if ((status == NETCAM_CONNECTED) || (status == NETCAM_READINGIMAGE)) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Reconnecting with camera....") ,cameratype.c_str()); } @@ -2078,27 +2078,27 @@ void cls_netcam::handler_reconnect() reconnect_count++; } else { if (reconnect_count >= 500) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Camera did not reconnect.") , cameratype.c_str()); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Checking for camera every 2 hours.") ,cameratype.c_str()); slp_dur = 7200; } else if (reconnect_count >= 200) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Camera did not reconnect.") , cameratype.c_str()); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Checking for camera every 10 minutes.") ,cameratype.c_str()); reconnect_count++; slp_dur = 600; } else { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Camera did not reconnect.") , cameratype.c_str()); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Checking for camera every 10 seconds.") ,cameratype.c_str()); reconnect_count++; @@ -2125,7 +2125,7 @@ void cls_netcam::handler() mythreadname_set("nc", threadnbr, camera_name.c_str()); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Camera handler started") ,cameratype.c_str()); @@ -2151,7 +2151,7 @@ void cls_netcam::handler() } } - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Camera handler stopped"),cameratype.c_str()); handler_running = false; pthread_exit(nullptr); @@ -2170,7 +2170,7 @@ void cls_netcam::handler_startup() pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); retcd = pthread_create(&handler_thread, &thread_attr, &netcam_handler, this); if (retcd != 0) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start camera thread.")); + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start camera thread.")); handler_running = false; handler_stop = true; return; @@ -2190,7 +2190,7 @@ void cls_netcam::handler_startup() } pthread_mutex_unlock(&mutex); if (wait_counter > 0 ) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Waiting for first image from the handler.") ,cameratype.c_str()); SLEEP(0,5000000); @@ -2208,7 +2208,7 @@ void cls_netcam::handler_shutdown() handler_stop = true; if (handler_running == true) { - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO ,_("%s:Shutting down network camera.") ,cameratype.c_str()); waitcnt = 0; @@ -2217,10 +2217,10 @@ void cls_netcam::handler_shutdown() waitcnt++; } if (waitcnt == cam->cfg->watchdog_tmo) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Normal shutdown of camera failed")); if (cam->cfg->watchdog_kill > 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Waiting additional %d seconds (watchdog_kill).") ,cam->cfg->watchdog_kill); waitcnt = 0; @@ -2229,14 +2229,14 @@ void cls_netcam::handler_shutdown() waitcnt++; } if (waitcnt == cam->cfg->watchdog_kill) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("No response to shutdown. Killing it.")); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Memory leaks will occur.")); pthread_kill(handler_thread, SIGVTALRM); } } else { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("watchdog_kill set to terminate application.")); exit(1); } @@ -2262,7 +2262,7 @@ void cls_netcam::handler_shutdown() cam->device_status = STATUS_CLOSED; status = NETCAM_NOTCONNECTED; - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("%s:Shut down complete.") ,cameratype.c_str()); @@ -2280,9 +2280,9 @@ void cls_netcam::netcam_start() handler_stop = false; if (high_resolution == false) { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("Norm: Opening Netcam")); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("Norm: Opening Netcam")); } else { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("High: Opening Netcam")); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("High: Opening Netcam")); } cam->watchdog = cam->cfg->watchdog_tmo * 3; /* 3 is arbitrary multiplier to give startup more time*/ set_parms(); @@ -2305,7 +2305,7 @@ void cls_netcam::netcam_start() } cam->watchdog = cam->cfg->watchdog_tmo * 3; /* 3 is arbitrary multiplier to give startup more time*/ if (read_image() != 0) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO ,_("Failed trying to read first image")); handler_shutdown(); return; @@ -2338,17 +2338,17 @@ void cls_netcam::noimage() if (handler_running == false ) { if (reconnect_count >= 500) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 2 hours.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 2 hours.")); slp_dur = 7200; } else if (reconnect_count >= 200) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 10 minutes.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 10 minutes.")); reconnect_count++; slp_dur = 600; } else { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 30 seconds.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 30 seconds.")); reconnect_count++; slp_dur = 30; } diff --git a/src/picture.cpp b/src/picture.cpp index a0a8ea11..086a1823 100644 --- a/src/picture.cpp +++ b/src/picture.cpp @@ -38,7 +38,7 @@ void cls_picture::picname(char* fullname, std::string fmtstr retcd = snprintf(fullname, PATH_MAX, fmtstr.c_str() , cam->cfg->target_dir.c_str(), filename, extname.c_str()); if ((retcd < 0) || (retcd >= PATH_MAX)) { - MOTPLS_LOG(ERR, TYPE_EVENTS, NO_ERRNO + MOTION_LOG(ERR, TYPE_EVENTS, NO_ERRNO ,_("Error creating picture file name")); return; } @@ -50,7 +50,7 @@ void cls_picture::picname(char* fullname, std::string fmtstr void cls_picture::on_picture_save_command(char *fname) { - MOTPLS_LOG(NTC, TYPE_EVENTS, NO_ERRNO, _("File saved to: %s"), fname); + MOTION_LOG(NTC, TYPE_EVENTS, NO_ERRNO, _("File saved to: %s"), fname); if (cam->cfg->on_picture_save != "") { util_exec_command(cam, cam->cfg->on_picture_save.c_str(), fname); @@ -131,7 +131,7 @@ void cls_picture::process_snapshot() , "lastsnap", cam->cfg->picture_type); remove(linkpath); if (symlink(filename, linkpath)) { - MOTPLS_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO ,_("Could not create symbolic link [%s]"), filename); return; } @@ -202,7 +202,7 @@ void cls_picture::webp_exif(WebPMux* webp_mux WebPMuxError err = WebPMuxSetChunk(webp_mux, "EXIF", &webp_exif, 1); if (err != WEBP_MUX_OK) { - MOTPLS_LOG(ERR, TYPE_CORE, NO_ERRNO + MOTION_LOG(ERR, TYPE_CORE, NO_ERRNO , _("Unable to set set EXIF to webp chunk")); } free(exif); @@ -219,14 +219,14 @@ void cls_picture::save_webp(FILE *fp, u_char *image, int width, int height WebPConfig webp_config; if (!WebPConfigPreset(&webp_config, WEBP_PRESET_DEFAULT , (float) cam->cfg->picture_quality)) { - MOTPLS_LOG(ERR, TYPE_CORE, NO_ERRNO, _("libwebp version error")); + MOTION_LOG(ERR, TYPE_CORE, NO_ERRNO, _("libwebp version error")); return; } /* Create the input data structure and check for compatible library version */ WebPPicture webp_image; if (!WebPPictureInit(&webp_image)) { - MOTPLS_LOG(ERR, TYPE_CORE, NO_ERRNO,_("libwebp version error")); + MOTION_LOG(ERR, TYPE_CORE, NO_ERRNO,_("libwebp version error")); return; } @@ -234,7 +234,7 @@ void cls_picture::save_webp(FILE *fp, u_char *image, int width, int height webp_image.width = width; webp_image.height = height; if (!WebPPictureAlloc(&webp_image)) { - MOTPLS_LOG(ERR, TYPE_CORE, NO_ERRNO,_("libwebp image buffer allocation error")); + MOTION_LOG(ERR, TYPE_CORE, NO_ERRNO,_("libwebp image buffer allocation error")); return; } @@ -251,7 +251,7 @@ void cls_picture::save_webp(FILE *fp, u_char *image, int width, int height /* Encode the YUV image as webp */ if (!WebPEncode(&webp_config, &webp_image)) { - MOTPLS_LOG(WRN, TYPE_CORE, NO_ERRNO,_("libwebp image compression error")); + MOTION_LOG(WRN, TYPE_CORE, NO_ERRNO,_("libwebp image compression error")); } /* A bitstream object is needed for the muxing proces */ WebPData webp_bitstream; @@ -266,12 +266,12 @@ void cls_picture::save_webp(FILE *fp, u_char *image, int width, int height WebPData webp_output; WebPMuxError err = WebPMuxAssemble(webp_mux, &webp_output); if (err != WEBP_MUX_OK) { - MOTPLS_LOG(ERR, TYPE_CORE, NO_ERRNO,_("unable to assemble webp image")); + MOTION_LOG(ERR, TYPE_CORE, NO_ERRNO,_("unable to assemble webp image")); } /* Write the webp final bitstream to the file */ if (fwrite(webp_output.bytes, sizeof(uint8_t), webp_output.size, fp) != webp_output.size) { - MOTPLS_LOG(ERR, TYPE_CORE, NO_ERRNO,_("unable to save webp image to file")); + MOTION_LOG(ERR, TYPE_CORE, NO_ERRNO,_("unable to save webp image to file")); } #if WEBP_ENCODER_ABI_VERSION > 0x0202 @@ -451,7 +451,7 @@ void cls_picture::save_norm(char *file, u_char *image) picture = myfopen(file, "wbe"); if (!picture) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO ,_("Can't write picture to file %s"), file); return; } @@ -477,7 +477,7 @@ void cls_picture::save_roi(char *file, u_char *image) picture = myfopen(file, "wbe"); if (!picture) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO ,_("Can't write picture to file %s"), file); return; } @@ -516,12 +516,12 @@ u_char *cls_picture::load_pgm(FILE *picture, int width, int height) line[255] = 0; if (!fgets(line, 255, picture)) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO,_("Could not read from pgm file")); + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO,_("Could not read from pgm file")); return NULL; } if (strncmp(line, "P5", 2)) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO ,_("This is not a pgm file, starts with '%s'"), line); return NULL; } @@ -535,7 +535,7 @@ u_char *cls_picture::load_pgm(FILE *picture, int width, int height) /* Read image size */ if (sscanf(line, "%d %d", &mask_width, &mask_height) != 2) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO ,_("Failed reading size in pgm file")); return NULL; } @@ -548,7 +548,7 @@ u_char *cls_picture::load_pgm(FILE *picture, int width, int height) } if (sscanf(line, "%d", &maxval) != 1) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO ,_("Failed reading maximum value in pgm file")); return NULL; } @@ -562,7 +562,7 @@ u_char *cls_picture::load_pgm(FILE *picture, int width, int height) for (y = 0; y < mask_height; y++) { if ((int)fread(&image[y * mask_width], 1, (uint)mask_width, picture) != mask_width) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO, "Failed reading image data from pgm file"); + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, "Failed reading image data from pgm file"); } for (x = 0; x < mask_width; x++) { @@ -573,9 +573,9 @@ u_char *cls_picture::load_pgm(FILE *picture, int width, int height) /* Resize mask if required */ if (mask_width != width || mask_height != height) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO ,_("The mask file specified is not the same size as image from camera.")); - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO ,_("Attempting to resize mask image from %dx%d to %dx%d") ,mask_width, mask_height, width, height); @@ -604,12 +604,12 @@ void cls_picture::write_mask(const char *file) if (!picture) { /* Report to syslog - suggest solution if the problem is access rights to target dir. */ if (errno == EACCES) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO ,_("can't write mask file %s - check access rights to target directory") ,file); } else { /* If target dir is temporarily unavailable we may survive. */ - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO ,_("can't write mask file %s"), file); } return; @@ -623,14 +623,14 @@ void cls_picture::write_mask(const char *file) /* Write pgm image data at once. */ if ((int)fwrite(cam->imgs.image_motion.image_norm, (uint)cam->cfg->width, (uint)cam->cfg->height, picture) != cam->cfg->height) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO ,_("Failed writing default mask as pgm file")); return; } myfclose(picture); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Creating empty mask %s\nPlease edit this file and " "re-run motion to enable mask feature"), cam->cfg->mask_file.c_str()); } @@ -708,7 +708,7 @@ void cls_picture::init_privacy() if (cam->cfg->mask_privacy != "") { if ((picture = myfopen(cam->cfg->mask_privacy.c_str(), "rbe"))) { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, _("Opening privacy mask file")); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, _("Opening privacy mask file")); /* * NOTE: The mask is expected to have the output dimensions. I.e., the mask * applies to the already rotated image, not the capture image. Thus, use @@ -720,7 +720,7 @@ void cls_picture::init_privacy() cam->imgs.mask_privacy_uv =(u_char*) mymalloc((uint) ((cam->imgs.height * cam->imgs.width) / 2)); if (cam->imgs.size_high > 0) { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO ,_("Opening high resolution privacy mask file")); rewind(picture); cam->imgs.mask_privacy_high = load_pgm(picture, cam->imgs.width_high, cam->imgs.height_high); @@ -730,17 +730,17 @@ void cls_picture::init_privacy() myfclose(picture); } else { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO ,_("Error opening mask file %s"), cam->cfg->mask_privacy.c_str()); /* Try to write an empty mask file to make it easier for the user to edit it */ write_mask(cam->cfg->mask_privacy.c_str() ); } if (!cam->imgs.mask_privacy) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Failed to read mask privacy image. Mask privacy feature disabled.")); } else { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO ,_("Mask privacy file \"%s\" loaded."), cam->cfg->mask_privacy.c_str()); indx_img = 1; @@ -814,7 +814,7 @@ void cls_picture::init_mask() cam->imgs.mask = load_pgm(picture, cam->imgs.width, cam->imgs.height); myfclose(picture); } else { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO ,_("Error opening mask file %s") ,cam->cfg->mask_file.c_str()); /* @@ -825,10 +825,10 @@ void cls_picture::init_mask() } if (!cam->imgs.mask) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Failed to read mask image. Mask feature disabled.")); } else { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO ,_("Maskfile \"%s\" loaded.") ,cam->cfg->mask_file.c_str()); } diff --git a/src/rotate.cpp b/src/rotate.cpp index 5e1f9220..452765af 100644 --- a/src/rotate.cpp +++ b/src/rotate.cpp @@ -223,7 +223,7 @@ cls_rotate::cls_rotate(cls_camera *p_cam) buffer_high = nullptr; if ((cam->cfg->rotate % 90) > 0) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO ,_("Config option \"rotate\" not a multiple of 90: %d") ,cam->cfg->rotate); cam->cfg->rotate = 0; /* Disable rotation. */ diff --git a/src/schedule.cpp b/src/schedule.cpp index cc30a185..d7735e7b 100644 --- a/src/schedule.cpp +++ b/src/schedule.cpp @@ -111,7 +111,7 @@ void cls_schedule::cleandir_remove_dir(std::string dirnm) ep = readdir(dp); } closedir(dp); - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO , _("Removing empty directory %s"),dirnm.c_str()); rmdir(dirnm.c_str()); } @@ -127,7 +127,7 @@ void cls_schedule::cleandir_remove(std::string sql, bool removedir) for (indx=0;indxcleandir->dur_unit == "w") { cdur = p_cam->cleandir->dur_val * (60 * 60 * 24 * 7); } else { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Invalid clean directory duration units %s") ,p_cam->cleandir->dur_unit.c_str()); return; } if (cdur <= 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Invalid clean directory duration %d%s") , p_cam->cleandir->dur_val , p_cam->cleandir->dur_unit.c_str()); @@ -242,7 +242,7 @@ void cls_schedule::cleandir_cam(cls_camera *p_cam) } localtime_r(&p_cam->cleandir->next_ts.tv_sec, &c_tm); if (p_cam->cleandir->action == "delete") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO , _("Cleandir next run:%04d-%02d-%02d %02d:%02d Criteria:%d%s RemoveDir:%s") ,c_tm.tm_year+1900,c_tm.tm_mon+1,c_tm.tm_mday ,c_tm.tm_hour,c_tm.tm_min @@ -250,7 +250,7 @@ void cls_schedule::cleandir_cam(cls_camera *p_cam) ,p_cam->cleandir->dur_unit.c_str() ,p_cam->cleandir->removedir ? "Y":"N"); } else { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO , _("Clean directory set to run script at %04d-%02d-%02d %02d:%02d") ,c_tm.tm_year+1900,c_tm.tm_mon+1,c_tm.tm_mday ,c_tm.tm_hour,c_tm.tm_min); @@ -285,7 +285,7 @@ void cls_schedule::handler() timing(); } - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Schedule process closed")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Schedule process closed")); handler_running = false; pthread_exit(NULL); } @@ -303,7 +303,7 @@ void cls_schedule::handler_startup() pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); retcd = pthread_create(&handler_thread, &thread_attr, &schedule_handler, this); if (retcd != 0) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start schedule thread.")); + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start schedule thread.")); handler_running = false; handler_stop = true; } @@ -323,10 +323,10 @@ void cls_schedule::handler_shutdown() waitcnt++; } if (waitcnt == app->cfg->watchdog_tmo) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Normal shutdown of schedule thread failed")); if (app->cfg->watchdog_kill > 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Waiting additional %d seconds (watchdog_kill).") ,app->cfg->watchdog_kill); waitcnt = 0; @@ -335,14 +335,14 @@ void cls_schedule::handler_shutdown() waitcnt++; } if (waitcnt == app->cfg->watchdog_kill) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("No response to shutdown. Killing it.")); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Memory leaks will occur.")); pthread_kill(handler_thread, SIGVTALRM); } } else { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("watchdog_kill set to terminate application.")); exit(1); } diff --git a/src/sound.cpp b/src/sound.cpp index 8fd9c57d..8d23dbba 100644 --- a/src/sound.cpp +++ b/src/sound.cpp @@ -87,8 +87,8 @@ void cls_sound::edit_alerts() } if (validids == false) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, "Sound alert ids must be unique."); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, "Creating new sound alert ids."); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "Sound alert ids must be unique."); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "Creating new sound alert ids."); indx = 0; for (it_a0=snd_info->alerts.begin(); it_a0!=snd_info->alerts.end(); it_a0++) { it_a0->alert_id = indx; @@ -103,15 +103,15 @@ void cls_sound::edit_alerts() if (it_a0->volume_level < snd_info->vol_min) { snd_info->vol_min = it_a0->volume_level; } - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Sound Alert Parameters:"); - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, " alert_id: %d",it_a0->alert_id); - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, " alert_nm %s",it_a0->alert_nm.c_str()); - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, " freq_low: %.4f",it_a0->freq_low); - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, " freq_high: %.4f",it_a0->freq_high); - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, " volume_count: %d",it_a0->volume_count); - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, " volume_level: %d",it_a0->volume_level); - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, " trigger_threshold: %d",it_a0->trigger_threshold); - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, " trigger_duration: %d",it_a0->trigger_duration); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Sound Alert Parameters:"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, " alert_id: %d",it_a0->alert_id); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, " alert_nm %s",it_a0->alert_nm.c_str()); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, " freq_low: %.4f",it_a0->freq_low); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, " freq_high: %.4f",it_a0->freq_high); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, " volume_count: %d",it_a0->volume_count); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, " volume_level: %d",it_a0->volume_level); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, " trigger_threshold: %d",it_a0->trigger_threshold); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, " trigger_duration: %d",it_a0->trigger_duration); } } @@ -180,7 +180,7 @@ void cls_sound::load_params() for (indx=0;indxparams->params_cnt;indx++) { itm = &snd_info->params->params_array[indx]; - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s : %s" + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s : %s" ,itm->param_name.c_str(),itm->param_value.c_str()); } @@ -211,29 +211,29 @@ void cls_sound::alsa_list_subdev() ctx_snd_alsa *alsa = snd_info->snd_alsa; int indx, retcd, cnt; - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Card %i(%s): %s [%s]") + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Card %i(%s): %s [%s]") , alsa->card_id, alsa->device_nm.c_str() , snd_ctl_card_info_get_id(alsa->card_info) , snd_ctl_card_info_get_name(alsa->card_info)); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _(" Device %i (%s,%d): %s [%s]") + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _(" Device %i (%s,%d): %s [%s]") , alsa->device_id, alsa->device_nm.c_str() , alsa->device_id , snd_pcm_info_get_id(alsa->pcm_info) , snd_pcm_info_get_name(alsa->pcm_info)); cnt = (int)snd_pcm_info_get_subdevices_count(alsa->pcm_info); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _(" Subdevices: %i/%i") + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _(" Subdevices: %i/%i") , snd_pcm_info_get_subdevices_avail(alsa->pcm_info),cnt); for (indx=0; indxpcm_info, (uint)indx); retcd = snd_ctl_pcm_info(alsa->ctl_hdl, alsa->pcm_info); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("control digital audio playback info (%i): %s") , alsa->card_id, snd_strerror(retcd)); } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _(" Subdevice #%i: %s"), indx , snd_pcm_info_get_subdevice_name(alsa->pcm_info)); } @@ -249,7 +249,7 @@ void cls_sound::alsa_list_card() retcd = snd_ctl_card_info(alsa->ctl_hdl, alsa->card_info); if (retcd < 0) { snd_ctl_close(alsa->ctl_hdl); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("control hardware info (%i): %s") , alsa->card_id, snd_strerror(retcd)); return; @@ -258,7 +258,7 @@ void cls_sound::alsa_list_card() alsa->device_id = -1; retcd = snd_ctl_pcm_next_device(alsa->ctl_hdl, &alsa->device_id); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("snd_ctl_pcm_next_device")); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("snd_ctl_pcm_next_device")); return; } @@ -270,13 +270,13 @@ void cls_sound::alsa_list_card() if (retcd == 0) { alsa_list_subdev(); } else if (retcd != -ENOENT){ - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("control digital audio info (%i): %s") , alsa->card_id, snd_strerror(retcd)); } retcd = snd_ctl_pcm_next_device(alsa->ctl_hdl, &alsa->device_id); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("snd_ctl_pcm_next_device")); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("snd_ctl_pcm_next_device")); } } @@ -297,13 +297,13 @@ void cls_sound::alsa_list() alsa->card_id = -1; retcd = snd_card_next(&alsa->card_id); if ((retcd < 0) || (alsa->card_id == -1)) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("no soundcards found...")); device_status = STATUS_CLOSED; return; } - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Devices")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Devices")); while (alsa->card_id >= 0) { alsa->device_nm="hw:"+std::to_string(alsa->card_id); @@ -312,7 +312,7 @@ void cls_sound::alsa_list() alsa_list_card(); snd_ctl_close(alsa->ctl_hdl); } else { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, _("control open (%i): %s") + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, _("control open (%i): %s") , alsa->card_id, snd_strerror(retcd)); } snd_card_next(&alsa->card_id); @@ -335,7 +335,7 @@ void cls_sound::alsa_start() retcd = snd_pcm_open(&alsa->pcm_dev , cfg->snd_device.c_str(), SND_PCM_STREAM_CAPTURE, 0); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_open device %s (%s)") , cfg->snd_device.c_str(), snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -344,7 +344,7 @@ void cls_sound::alsa_start() retcd = snd_pcm_hw_params_malloc(&hw_params); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_hw_params_malloc(%s)") , snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -353,7 +353,7 @@ void cls_sound::alsa_start() retcd = snd_pcm_hw_params_any(alsa->pcm_dev, hw_params); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_hw_params_any(%s)") , snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -363,7 +363,7 @@ void cls_sound::alsa_start() retcd = snd_pcm_hw_params_set_access(alsa->pcm_dev , hw_params, SND_PCM_ACCESS_RW_INTERLEAVED); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_hw_params_set_access(%s)") , snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -373,7 +373,7 @@ void cls_sound::alsa_start() retcd = snd_pcm_hw_params_set_format(alsa->pcm_dev , hw_params, SND_PCM_FORMAT_S16_LE); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_hw_params_set_format(%s)") , snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -383,7 +383,7 @@ void cls_sound::alsa_start() retcd = snd_pcm_hw_params_set_rate_near(alsa->pcm_dev , hw_params, &smpl_rate, 0); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_hw_params_set_rate_near(%s)") , snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -393,7 +393,7 @@ void cls_sound::alsa_start() retcd = snd_pcm_hw_params_set_channels(alsa->pcm_dev , hw_params, (uint)snd_info->channels); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_hw_params_set_channels(%s)") , snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -403,7 +403,7 @@ void cls_sound::alsa_start() retcd = snd_pcm_hw_params_set_period_size_near(alsa->pcm_dev , hw_params, &frames_per, NULL); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_hw_params_set_period_size_near(%s)") , snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -412,7 +412,7 @@ void cls_sound::alsa_start() retcd = snd_pcm_hw_params(alsa->pcm_dev, hw_params); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_hw_params(%s)") , snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -421,7 +421,7 @@ void cls_sound::alsa_start() retcd = snd_pcm_prepare(alsa->pcm_dev); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_prepare(%s)") , snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -431,7 +431,7 @@ void cls_sound::alsa_start() /* get actual parms selected */ retcd = snd_pcm_hw_params_get_format(hw_params, &actl_sndfmt); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_hw_params_get_format(%s)") , snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -440,7 +440,7 @@ void cls_sound::alsa_start() retcd = snd_pcm_hw_params_get_rate(hw_params, &actl_rate, NULL); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_hw_params_get_rate(%s)") , snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -449,7 +449,7 @@ void cls_sound::alsa_start() retcd = snd_pcm_hw_params_get_period_size(hw_params, &frames_per, NULL); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: snd_pcm_hw_params_get_period_size(%s)") , snd_strerror (retcd)); device_status = STATUS_CLOSED; @@ -458,14 +458,14 @@ void cls_sound::alsa_start() snd_pcm_hw_params_free(hw_params); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Actual rate %hu"), actl_rate); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Actual frames per %lu"), frames_per); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Actual rate %hu"), actl_rate); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Actual frames per %lu"), frames_per); if (actl_sndfmt <= 5) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Sound format 16")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Sound format 16")); } else if (actl_sndfmt <= 9 ) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Sound format 24")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Sound format 24")); } else { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Sound format 32")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Sound format 32")); } /*************************************************************/ @@ -478,7 +478,7 @@ void cls_sound::alsa_start() memset(snd_info->buffer, 0x00 , (uint)snd_info->buffer_size * sizeof(int16_t)); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, "Started."); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "Started."); device_status =STATUS_OPENED; } @@ -518,7 +518,7 @@ void cls_sound::alsa_capture() retcd = snd_pcm_readi(alsa->pcm_dev , snd_info->buffer, (uint)snd_info->frames); if (retcd != snd_info->frames) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("error: read from audio interface failed (%s)") , snd_strerror((int)retcd)); device_status = STATUS_CLOSED; @@ -560,7 +560,7 @@ void cls_sound::pulse_init() , (cfg->snd_device=="" ? NULL : cfg->snd_device.c_str()) , "motion", &specs, NULL, NULL, &errcd); if (snd_info->snd_pulse->dev == NULL) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Error opening pulse (%s)") , pa_strerror(errcd)); device_status = STATUS_CLOSED; @@ -572,7 +572,7 @@ void cls_sound::pulse_init() memset(snd_info->buffer, 0x00 , (uint)snd_info->buffer_size * sizeof(int16_t)); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, "Started."); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "Started."); device_status =STATUS_OPENED; } @@ -589,7 +589,7 @@ void cls_sound::pulse_capture() retcd = pa_simple_read(pulse->dev, snd_info->buffer , (uint)snd_info->buffer_size, &errcd); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Error capturing PulseAudio (%s)") , pa_strerror(errcd)); device_status = STATUS_CLOSED; @@ -620,7 +620,7 @@ void cls_sound::fftw_open() return; } - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO , _("Opening FFTW plan")); fftw->ff_in = (double*) fftw_malloc( @@ -691,7 +691,7 @@ void cls_sound::check_alerts() freq_value = (snd_info->snd_fftw->bin_size * pMaxBinIndex * snd_info->channels); if (cfg->snd_show) { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO , _("Freq: %.4f threshold: %d count: %d maximum: %d") , freq_value, snd_info->vol_min , snd_info->vol_count, snd_info->vol_max); @@ -721,7 +721,7 @@ void cls_sound::check_alerts() clock_gettime(CLOCK_MONOTONIC, &it->trigger_time); if (it->trigger_count == it->trigger_threshold) { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO , _("Sound Alert %d-%s : level %d count %d max vol %d") , it->alert_id ,it->alert_nm.c_str() , it->volume_level, chkcnt @@ -779,7 +779,7 @@ void cls_sound::cleanup() device_status = STATUS_CLOSED; - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, "Stopped."); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "Stopped."); } @@ -798,7 +798,7 @@ void cls_sound::init() mythreadname_set("sl",cfg->device_id, cfg->device_name.c_str()); - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO,_("Initialize sound frequency")); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO,_("Initialize sound frequency")); snd_info = new ctx_snd_info; snd_info->params = new ctx_params; @@ -812,7 +812,7 @@ void cls_sound::init() if ((snd_info->source != "alsa") && (snd_info->source != "pulse")) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO,_("Invalid sound source.")); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO,_("Invalid sound source.")); device_status = STATUS_CLOSED; return; } @@ -827,7 +827,7 @@ void cls_sound::init() fftw_open(); #endif - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Detecting")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Detecting")); } @@ -871,7 +871,7 @@ void cls_sound::handler() cleanup(); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Sound exiting")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Sound exiting")); handler_running = false; pthread_exit(nullptr); @@ -883,7 +883,7 @@ void cls_sound::handler_startup() pthread_attr_t thread_attr; #if !defined(HAVE_FFTW3) || (!defined(HAVE_ALSA) && !defined(HAVE_PULSE)) - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Required packages not installed")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Required packages not installed")); device_status = STATUS_CLOSED; return; #endif @@ -895,7 +895,7 @@ void cls_sound::handler_startup() pthread_attr_setdetachstate(&thread_attr, PTHREAD_CREATE_DETACHED); retcd = pthread_create(&handler_thread, &thread_attr, &sound_handler, this); if (retcd != 0) { - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start sound frequency detection loop.")); + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Unable to start sound frequency detection loop.")); handler_running = false; handler_stop = true; } @@ -915,10 +915,10 @@ void cls_sound::handler_shutdown() waitcnt++; } if (waitcnt == cfg->watchdog_tmo) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Normal shutdown of sound frequency detection failed")); if (cfg->watchdog_kill > 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Waiting additional %d seconds (watchdog_kill).") ,cfg->watchdog_kill); waitcnt = 0; @@ -927,14 +927,14 @@ void cls_sound::handler_shutdown() waitcnt++; } if (waitcnt == cfg->watchdog_kill) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("No response to shutdown. Killing it.")); - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("Memory leaks will occur.")); pthread_kill(handler_thread, SIGVTALRM); } } else { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , _("watchdog_kill set to terminate application.")); exit(1); } diff --git a/src/util.cpp b/src/util.cpp index 1ba7cfb0..660ae187 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -127,7 +127,7 @@ void *mymalloc(size_t nbytes) void *dummy = calloc(nbytes, 1); if (!dummy) { - MOTPLS_LOG(EMG, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(EMG, TYPE_ALL, SHOW_ERRNO , _("Could not allocate %llu bytes of memory!") , (unsigned long long)nbytes); exit(1); @@ -143,12 +143,12 @@ void *myrealloc(void *ptr, size_t size, const char *desc) if (size == 0) { free(ptr); - MOTPLS_LOG(WRN, TYPE_ALL, NO_ERRNO + MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO ,_("Warning! Function %s tries to resize 0 bytes!"),desc); } else { dummy = realloc(ptr, size); if (!dummy) { - MOTPLS_LOG(EMG, TYPE_ALL, NO_ERRNO + MOTION_LOG(EMG, TYPE_ALL, NO_ERRNO ,_("Could not resize memory-block at offset %p to %llu bytes (function %s)!") ,ptr, (unsigned long long)size, desc); exit(1); @@ -182,11 +182,11 @@ int mycreate_path(const char *path) while (indx_pos != std::string::npos) { if (stat(tmp.substr(0, indx_pos + 1).c_str(), &statbuf) != 0) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Creating %s"), tmp.substr(0, indx_pos + 1).c_str()); retcd = mkdir(tmp.substr(0, indx_pos + 1).c_str(), mode); if (retcd == -1 && errno != EEXIST) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO ,_("Problem creating directory %s") , tmp.substr(0, indx_pos + 1).c_str()); return -1; @@ -220,7 +220,7 @@ FILE *myfopen(const char *path, const char *mode) fp = fopen(path, mode); } if (!fp) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO ,_("Error opening file %s with mode %s"), path, mode); return NULL; } @@ -234,7 +234,7 @@ int myfclose(FILE* fh) int rval = fclose(fh); if (rval != 0) { - MOTPLS_LOG(ERR, TYPE_ALL, SHOW_ERRNO, _("Error closing file")); + MOTION_LOG(ERR, TYPE_ALL, SHOW_ERRNO, _("Error closing file")); } return rval; @@ -473,7 +473,7 @@ void mythreadname_set(const char *abbr, int threadnbr, const char *threadname) #elif HAVE_PTHREAD_SETNAME_NP pthread_setname_np(pthread_self(), tname); #else - MOTPLS_LOG(INF, TYPE_NETCAM, NO_ERRNO, _("Unable to set thread name %s"), tname); + MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO, _("Unable to set thread name %s"), tname); #endif } @@ -514,7 +514,7 @@ static void mytranslate_locale_chg(const char *langcd) ++_nl_msg_cat_cntr; #else if (langcd != NULL) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO,"No native language support"); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,"No native language support"); } #endif } @@ -532,7 +532,7 @@ void mytranslate_init(void) bind_textdomain_codeset ("motion", "UTF-8"); textdomain ("motion"); - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Language: English")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Language: English")); #else /* Disable native language support */ @@ -549,14 +549,14 @@ char* mytranslate_text(const char *msgid, int setnls) if (setnls == 0) { if (nls_enabled) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Disabling native language support")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Disabling native language support")); } nls_enabled = false; return NULL; } else if (setnls == 1) { if (!nls_enabled) { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Enabling native language support")); + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Enabling native language support")); } nls_enabled = true; return NULL; @@ -631,7 +631,7 @@ void util_exec_command(cls_camera *cam, const char *command, const char *filenam execl("/bin/sh", "sh", "-c", stamp, " &",(char*)NULL); /* if above function succeeds the program never reach here */ - MOTPLS_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO + MOTION_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO ,_("Unable to start external command '%s'"), stamp); exit(1); @@ -640,11 +640,11 @@ void util_exec_command(cls_camera *cam, const char *command, const char *filenam if (pid > 0) { waitpid(pid, NULL, 0); } else { - MOTPLS_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO + MOTION_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO ,_("Unable to start external command '%s'"), stamp); } - MOTPLS_LOG(DBG, TYPE_EVENTS, NO_ERRNO + MOTION_LOG(DBG, TYPE_EVENTS, NO_ERRNO ,_("Executing external command '%s'"), stamp); } @@ -663,7 +663,7 @@ void util_exec_command(cls_camera *cam, std::string cmd) execl("/bin/sh", "sh", "-c", dst.c_str(), " &",(char*)NULL); /* if above function succeeds the program never reach here */ - MOTPLS_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO + MOTION_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO ,_("Unable to start external command '%s'"),dst.c_str()); exit(1); @@ -672,11 +672,11 @@ void util_exec_command(cls_camera *cam, std::string cmd) if (pid > 0) { waitpid(pid, NULL, 0); } else { - MOTPLS_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO + MOTION_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO ,_("Unable to start external command '%s'"), dst.c_str()); } - MOTPLS_LOG(DBG, TYPE_EVENTS, NO_ERRNO + MOTION_LOG(DBG, TYPE_EVENTS, NO_ERRNO ,_("Executing external command '%s'"), dst.c_str()); } @@ -695,7 +695,7 @@ void util_exec_command(cls_sound *snd, std::string cmd) execl("/bin/sh", "sh", "-c", dst.c_str(), " &",(char*)NULL); /* if above function succeeds the program never reach here */ - MOTPLS_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO + MOTION_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO ,_("Unable to start external command '%s'"),dst.c_str()); exit(1); @@ -704,11 +704,11 @@ void util_exec_command(cls_sound *snd, std::string cmd) if (pid > 0) { waitpid(pid, NULL, 0); } else { - MOTPLS_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO + MOTION_LOG(ALR, TYPE_EVENTS, SHOW_ERRNO ,_("Unable to start external command '%s'"), dst.c_str()); } - MOTPLS_LOG(DBG, TYPE_EVENTS, NO_ERRNO + MOTION_LOG(DBG, TYPE_EVENTS, NO_ERRNO ,_("Executing external command '%s'"), dst.c_str()); } @@ -720,7 +720,7 @@ static void util_parms_file(ctx_params *params, std::string params_file) std::string line, parm_nm, parm_vl; std::ifstream ifs; - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("parse file:%s"), params_file.c_str()); chk = 0; @@ -730,14 +730,14 @@ static void util_parms_file(ctx_params *params, std::string params_file) } } if (chk > 1){ - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Only one params_file specification is permitted.")); return; } ifs.open(params_file.c_str()); if (ifs.is_open() == false) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("params_file not found: %s"), params_file.c_str()); return; } @@ -760,7 +760,7 @@ static void util_parms_file(ctx_params *params, std::string params_file) } else if ((line != "") && (line.substr(0, 1) != ";") && (line.substr(0, 1) != "#")) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Unable to parse line:%s"), line.c_str()); } } @@ -786,7 +786,7 @@ void util_parms_add(ctx_params *params, std::string parm_nm, std::string parm_va parm_itm.param_value.assign(parm_val); params->params_array.push_back(parm_itm); - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:>%s< >%s<" + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"%s:>%s< >%s<" ,params->params_desc.c_str(), parm_nm.c_str(),parm_val.c_str()); if ((parm_nm == "params_file") && (parm_val != "")) { @@ -950,7 +950,7 @@ void util_parms_parse_qte(ctx_params *params, std::string &parmline) } } - //MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"Parsing: >%s< >%ld %ld %ld %ld<" + //MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"Parsing: >%s< >%ld %ld %ld %ld<" // ,parmline.c_str(), indxnm_st, indxnm_en, indxvl_st, indxvl_en); util_parms_extract(params, parmline, indxnm_st, indxnm_en, indxvl_st, indxvl_en); @@ -981,7 +981,7 @@ void util_parms_parse_comma(ctx_params *params, std::string &parmline) indxvl_en = parmline.find(",",indxvl_st) - 1; } - //MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,_("Parsing: >%s< >%ld %ld %ld %ld<") + //MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("Parsing: >%s< >%ld %ld %ld %ld<") // ,parmline.c_str(), indxnm_st, indxnm_en, indxvl_st, indxvl_en); util_parms_extract(params, parmline, indxnm_st, indxnm_en, indxvl_st, indxvl_en); @@ -1001,7 +1001,7 @@ void util_parms_parse_comma(ctx_params *params, std::string &parmline) } indxvl_en = parmline.length() - 1; - //MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO,"Parsing: >%s< >%ld %ld %ld %ld<" + //MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,"Parsing: >%s< >%ld %ld %ld %ld<" // ,parmline.c_str(), indxnm_st, indxnm_en, indxvl_st, indxvl_en); util_parms_extract(params, parmline, indxnm_st, indxnm_en, indxvl_st, indxvl_en); @@ -1099,7 +1099,7 @@ void util_parms_update(ctx_params *params, std::string &confline) confline = parmline; - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO ,_("New config:%s"), confline.c_str()); } @@ -1193,14 +1193,14 @@ void util_resize(uint8_t *src, int src_w, int src_h frm_in = av_frame_alloc(); if (frm_in == NULL) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO , _("Unable to allocate frm_in.")); return; } frm_out = av_frame_alloc(); if (frm_out == NULL) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO , _("Unable to allocate frm_out.")); av_frame_free(&frm_in); return; @@ -1212,7 +1212,7 @@ void util_resize(uint8_t *src, int src_w, int src_h , src_w, src_h, 1); if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO , "Error filling arrays: %s", errstr); av_frame_free(&frm_in); av_frame_free(&frm_out); @@ -1227,7 +1227,7 @@ void util_resize(uint8_t *src, int src_w, int src_h , dst_w, dst_h, 1); if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO , "Error Filling array 2: %s", errstr); free(buf); av_frame_free(&frm_in); @@ -1240,7 +1240,7 @@ void util_resize(uint8_t *src, int src_w, int src_h ,dst_w, dst_h, AV_PIX_FMT_YUV420P ,SWS_BICUBIC, NULL, NULL, NULL); if (swsctx == NULL) { - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO , _("Unable to allocate scaling context.")); free(buf); av_frame_free(&frm_in); @@ -1253,7 +1253,7 @@ void util_resize(uint8_t *src, int src_w, int src_h , 0, src_h, frm_out->data, frm_out->linesize); if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("Error resizing/reformatting: %s"), errstr); free(buf); av_frame_free(&frm_in); @@ -1270,7 +1270,7 @@ void util_resize(uint8_t *src, int src_w, int src_h if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO ,_("Error putting frame into output buffer: %s"), errstr); free(buf); av_frame_free(&frm_in); diff --git a/src/video_convert.cpp b/src/video_convert.cpp index 19617a8c..f218e520 100644 --- a/src/video_convert.cpp +++ b/src/video_convert.cpp @@ -452,7 +452,7 @@ int cls_convert::mjpegtoyuv420p(u_char *img_dst, u_char *img_src, int size) ptr_buffer =(u_char*) memmem(img_src, (uint)size, "\xff\xd8", 2); if (ptr_buffer == NULL) { - MOTPLS_LOG(CRT, TYPE_VIDEO, NO_ERRNO,_("Corrupt image ... continue")); + MOTION_LOG(CRT, TYPE_VIDEO, NO_ERRNO,_("Corrupt image ... continue")); return 1; } /** @@ -467,7 +467,7 @@ int cls_convert::mjpegtoyuv420p(u_char *img_dst, u_char *img_src, int size) } if (soi_pos != 0) { - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO,_("SOI position adjusted by %d bytes."), soi_pos); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO,_("SOI position adjusted by %d bytes."), soi_pos); } memmove(img_src, img_src + soi_pos, (uint)size - soi_pos); @@ -476,7 +476,7 @@ int cls_convert::mjpegtoyuv420p(u_char *img_dst, u_char *img_src, int size) ret = jpgutl_decode_jpeg(img_src,size, (uint)width, (uint)height, img_dst); if (ret == -1) { - MOTPLS_LOG(CRT, TYPE_VIDEO, NO_ERRNO,_("Corrupt image ... continue")); + MOTION_LOG(CRT, TYPE_VIDEO, NO_ERRNO,_("Corrupt image ... continue")); ret = 1; } return ret; diff --git a/src/video_loopback.cpp b/src/video_loopback.cpp index 5645588a..09e809cb 100644 --- a/src/video_loopback.cpp +++ b/src/video_loopback.cpp @@ -73,7 +73,7 @@ static int vlp_open_vidpipe(void) int retcd; if ((dir = opendir(prefix)) == NULL) { - MOTPLS_LOG(CRT, TYPE_VIDEO, SHOW_ERRNO,_("Failed to open '%s'"), prefix); + MOTION_LOG(CRT, TYPE_VIDEO, SHOW_ERRNO,_("Failed to open '%s'"), prefix); return -1; } @@ -82,11 +82,11 @@ static int vlp_open_vidpipe(void) retcd = snprintf(buffer, sizeof(buffer),"%s%s/name", prefix, dirp->d_name); if ((retcd<0) || (retcd >= (int)sizeof(buffer))) { - MOTPLS_LOG(NTC, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, SHOW_ERRNO ,_("Error specifying buffer: %s"),buffer); continue; } else { - MOTPLS_LOG(NTC, TYPE_VIDEO, SHOW_ERRNO,_("Opening buffer: %s"),buffer); + MOTION_LOG(NTC, TYPE_VIDEO, SHOW_ERRNO,_("Opening buffer: %s"),buffer); } if ((fd = open(buffer, O_RDONLY|O_CLOEXEC)) >= 0) { @@ -95,7 +95,7 @@ static int vlp_open_vidpipe(void) continue; } buffer[len]=0; - MOTPLS_LOG(NTC, TYPE_VIDEO, SHOW_ERRNO,_("Read buffer: %s"),buffer); + MOTION_LOG(NTC, TYPE_VIDEO, SHOW_ERRNO,_("Read buffer: %s"),buffer); if (strncmp(buffer, "Loopback video device",21)) { /* weird stuff after minor */ close(fd); continue; @@ -104,12 +104,12 @@ static int vlp_open_vidpipe(void) retcd = snprintf(buffer,sizeof(buffer),"/dev/%s",dirp->d_name); if ((retcd < 0) || (retcd >= (int)sizeof(buffer))) { - MOTPLS_LOG(NTC, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, SHOW_ERRNO ,_("Error specifying buffer: %s"),buffer); close(fd); continue; } else { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("found video device '%s' %d"), buffer,min); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("found video device '%s' %d"), buffer,min); } if ((tfd = open(buffer, O_RDWR|O_CLOEXEC)) >= 0) { @@ -128,7 +128,7 @@ static int vlp_open_vidpipe(void) closedir(dir); if (pipe_fd >= 0) { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("Opened %s as pipe output"), pipepath); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("Opened %s as pipe output"), pipepath); } return pipe_fd; @@ -140,31 +140,31 @@ static void vlp_show_vcap(struct v4l2_capability *cap) unsigned int c = cap->capabilities; int i; - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "Pipe Device"); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "cap.driver: %s",cap->driver); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "cap.card: %s",cap->card); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "cap.bus_info: %s",cap->bus_info); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "cap.card: %u.%u.%u",(vers >> 16) & 0xFF,(vers >> 8) & 0xFF,vers & 0xFF); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "Device capabilities"); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "Pipe Device"); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "cap.driver: %s",cap->driver); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "cap.card: %s",cap->card); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "cap.bus_info: %s",cap->bus_info); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "cap.card: %u.%u.%u",(vers >> 16) & 0xFF,(vers >> 8) & 0xFF,vers & 0xFF); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "Device capabilities"); for (i=0;cap_list[i].code;i++) { if (c & cap_list[i].code) { - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "%s",cap_list[i].cap); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "%s",cap_list[i].cap); } } - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "------------------------"); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "------------------------"); } static void vlp_show_vfmt(struct v4l2_format *v) { - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "type: type: %d",v->type); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.width: %d",v->fmt.pix.width); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.height: %d",v->fmt.pix.height); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.pixelformat: %d",v->fmt.pix.pixelformat); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.sizeimage: %d",v->fmt.pix.sizeimage); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.field: %d",v->fmt.pix.field); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.bytesperline: %d",v->fmt.pix.bytesperline); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.colorspace: %d",v->fmt.pix.colorspace); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "------------------------"); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "type: type: %d",v->type); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.width: %d",v->fmt.pix.width); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.height: %d",v->fmt.pix.height); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.pixelformat: %d",v->fmt.pix.pixelformat); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.sizeimage: %d",v->fmt.pix.sizeimage); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.field: %d",v->fmt.pix.field); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.bytesperline: %d",v->fmt.pix.bytesperline); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "fmt.pix.colorspace: %d",v->fmt.pix.colorspace); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "------------------------"); } int vlp_startpipe(const char *dev_name, int width, int height) @@ -177,17 +177,17 @@ int vlp_startpipe(const char *dev_name, int width, int height) dev = vlp_open_vidpipe(); } else { dev = open(dev_name, O_RDWR|O_CLOEXEC); - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("Opened %s as pipe output"), dev_name); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("Opened %s as pipe output"), dev_name); } if (dev < 0) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO,_("Opening %s as pipe output failed"), dev_name); + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO,_("Opening %s as pipe output failed"), dev_name); return -1; } if (ioctl(dev, VIDIOC_QUERYCAP, &vc) == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, "ioctl (VIDIOC_QUERYCAP)"); + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, "ioctl (VIDIOC_QUERYCAP)"); return -1; } @@ -198,10 +198,10 @@ int vlp_startpipe(const char *dev_name, int width, int height) v.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; if (ioctl(dev, VIDIOC_G_FMT, &v) == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, "ioctl (VIDIOC_G_FMT)"); + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, "ioctl (VIDIOC_G_FMT)"); return -1; } - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO,_("Original pipe specifications")); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO,_("Original pipe specifications")); vlp_show_vfmt(&v); v.type = V4L2_BUF_TYPE_VIDEO_OUTPUT; @@ -212,15 +212,15 @@ int vlp_startpipe(const char *dev_name, int width, int height) v.fmt.pix.bytesperline = (uint)width; v.fmt.pix.field = V4L2_FIELD_NONE; v.fmt.pix.colorspace = V4L2_COLORSPACE_SRGB; - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO,_("Proposed pipe specifications")); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO,_("Proposed pipe specifications")); vlp_show_vfmt(&v); if (ioctl(dev,VIDIOC_S_FMT, &v) == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, "ioctl (VIDIOC_S_FMT)"); + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, "ioctl (VIDIOC_S_FMT)"); return -1; } - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO,_("Final pipe specifications")); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO,_("Final pipe specifications")); vlp_show_vfmt(&v); return dev; @@ -238,7 +238,7 @@ void vlp_putpipe(cls_camera *cam) , cam->current_image->image_norm , (uint)cam->imgs.size_norm); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO ,_("Failed to put image into video pipe")); } } @@ -247,7 +247,7 @@ void vlp_putpipe(cls_camera *cam) , cam->imgs.image_motion.image_norm , (uint)cam->imgs.size_norm); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_EVENTS, SHOW_ERRNO ,_("Failed to put image into motion video pipe")); } } @@ -261,14 +261,14 @@ void vlp_init(cls_camera *cam) #if defined(HAVE_V4L2) && !defined(BSD) /* open video loopback devices if enabled */ if (cam->cfg->video_pipe != "") { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Opening video loopback device for normal pictures")); /* vid_startpipe should get the output dimensions */ cam->pipe = vlp_startpipe(cam->cfg->video_pipe.c_str(), cam->imgs.width, cam->imgs.height); if (cam->pipe < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Failed to open video loopback for normal pictures")); return; } @@ -277,14 +277,14 @@ void vlp_init(cls_camera *cam) } if (cam->cfg->video_pipe_motion != "") { - MOTPLS_LOG(NTC, TYPE_ALL, NO_ERRNO + MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO ,_("Opening video loopback device for motion pictures")); /* vid_startpipe should get the output dimensions */ cam->mpipe = vlp_startpipe(cam->cfg->video_pipe_motion.c_str(), cam->imgs.width, cam->imgs.height); if (cam->mpipe < 0) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO ,_("Failed to open video loopback for motion pictures")); return; } diff --git a/src/video_v4l2.cpp b/src/video_v4l2.cpp index bfe9c0a9..13f9fd3c 100644 --- a/src/video_v4l2.cpp +++ b/src/video_v4l2.cpp @@ -101,23 +101,23 @@ void cls_v4l2cam::ctrls_log() ctx_v4l2ctrl_item *itm; if (device_ctrls.size() >0) { - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, _("---------Controls---------")); - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, _(" V4L2 ID : Name : Range")); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, _("---------Controls---------")); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, _(" V4L2 ID : Name : Range")); for (indx=0;indxctrl_menuitem) { - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, " %s : %s" + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, " %s : %s" ,itm->ctrl_iddesc.c_str() ,itm->ctrl_name.c_str()); } else { - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "%s : %s : %d to %d" + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "%s : %s : %d to %d" ,itm->ctrl_iddesc.c_str() ,itm->ctrl_name.c_str() ,itm->ctrl_minimum ,itm->ctrl_maximum); } } - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, "--------------------------"); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, "--------------------------"); } } @@ -177,7 +177,7 @@ void cls_v4l2cam::ctrls_list() } if (device_ctrls.size() == 0) { - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO, _("No Controls found for device")); + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO, _("No Controls found for device")); return; } @@ -205,12 +205,12 @@ void cls_v4l2cam::ctrls_set() vid_ctrl.value = itm->ctrl_newval; retcd = xioctl(VIDIOC_S_CTRL, &vid_ctrl); if (retcd < 0) { - MOTPLS_LOG(WRN, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(WRN, TYPE_VIDEO, SHOW_ERRNO ,_("setting control %s \"%s\" to %d failed with return code %d") ,itm->ctrl_iddesc.c_str(), itm->ctrl_name.c_str() ,itm->ctrl_newval, retcd); } else { - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO ,_("Set control \"%s\" to value %d") ,itm->ctrl_name.c_str(), itm->ctrl_newval); itm->ctrl_currval = itm->ctrl_newval; @@ -242,13 +242,13 @@ void cls_v4l2cam::parms_set() /*FALLTHROUGH*/ case V4L2_CTRL_TYPE_INTEGER: if (mtoi(itm_p->param_value.c_str()) < itm_d->ctrl_minimum) { - MOTPLS_LOG(WRN, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(WRN, TYPE_VIDEO, NO_ERRNO ,_("%s control option value %s is below minimum. Skipping...") , itm_d->ctrl_name.c_str() , itm_p->param_value.c_str() , itm_d->ctrl_minimum); } else if (mtoi(itm_p->param_value.c_str()) > itm_d->ctrl_maximum) { - MOTPLS_LOG(WRN, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(WRN, TYPE_VIDEO, NO_ERRNO ,_("%s control option value %s is above maximum. Skipping...") , itm_d->ctrl_name.c_str() , itm_p->param_value.c_str() @@ -261,7 +261,7 @@ void cls_v4l2cam::parms_set() itm_d->ctrl_newval = mtob(itm_p->param_value.c_str()) ? 1 : 0; break; default: - MOTPLS_LOG(WRN, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(WRN, TYPE_VIDEO, NO_ERRNO ,_("control type not supported")); } } @@ -296,7 +296,7 @@ void cls_v4l2cam::set_input() } if (xioctl(VIDIOC_ENUMINPUT, &input) == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO ,_("Unable to query input %d." " VIDIOC_ENUMINPUT, if you use a WEBCAM change input value in conf by -1") ,input.index); @@ -304,21 +304,21 @@ void cls_v4l2cam::set_input() return; } - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO ,_("Name = \"%s\", type 0x%08X, status %08x") ,input.name, input.type, input.status); if (input.type & V4L2_INPUT_TYPE_TUNER) { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO ,_("Name = \"%s\",- TUNER"), input.name); } if (input.type & V4L2_INPUT_TYPE_CAMERA) { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("Name = \"%s\"- CAMERA"), input.name); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("Name = \"%s\"- CAMERA"), input.name); } if (xioctl(VIDIOC_S_INPUT, &input.index) == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO , _("Error selecting input %d VIDIOC_S_INPUT"), input.index); device_close(); return; @@ -350,7 +350,7 @@ void cls_v4l2cam::set_norm() } if (xioctl(VIDIOC_G_STD, &std_id) == -1) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO ,_("Device does not support specifying PAL/NTSC norm")); return; } @@ -361,7 +361,7 @@ void cls_v4l2cam::set_norm() while (xioctl(VIDIOC_ENUMSTD, &standard) == 0) { if (standard.id & std_id) { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO ,_("- video standard %s"), standard.name); } standard.index++; @@ -379,17 +379,17 @@ void cls_v4l2cam::set_norm() } if (xioctl(VIDIOC_S_STD, &std_id) == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO ,_("Error selecting standard method %d VIDIOC_S_STD") ,(int)std_id); } if (std_id == V4L2_STD_NTSC) { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, _("Video standard set to NTSC")); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, _("Video standard set to NTSC")); } else if (std_id == V4L2_STD_SECAM) { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, _("Video standard set to SECAM")); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, _("Video standard set to SECAM")); } else { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, _("Video standard set to PAL")); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, _("Video standard set to PAL")); } } @@ -422,12 +422,12 @@ void cls_v4l2cam::set_frequency() tuner.index = (uint)device_tuner; if (xioctl(VIDIOC_G_TUNER, &tuner) == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO ,_("tuner %d VIDIOC_G_TUNER"), tuner.index); return; } - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, _("Set tuner %d"), tuner.index); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, _("Set tuner %d"), tuner.index); /* Set the frequency. */ memset(&freq, 0, sizeof(struct v4l2_frequency)); @@ -436,12 +436,12 @@ void cls_v4l2cam::set_frequency() freq.frequency = (uint)((spec / 1000) * 16); if (xioctl(VIDIOC_S_FREQUENCY, &freq) == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO ,_("freq %ul VIDIOC_S_FREQUENCY"), freq.frequency); return; } - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, _("Set Frequency to %ul"), freq.frequency); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, _("Set Frequency to %ul"), freq.frequency); } return; @@ -461,7 +461,7 @@ int cls_v4l2cam::pixfmt_try(uint pixformat) retcd = xioctl(VIDIOC_TRY_FMT, &vidfmt); if ((retcd == -1) || (vidfmt.fmt.pix.pixelformat != pixformat)) { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO ,_("Unable to use palette %c%c%c%c (%dx%d)") ,pixformat >> 0, pixformat >> 8 ,pixformat >> 16, pixformat >> 24 @@ -469,7 +469,7 @@ int cls_v4l2cam::pixfmt_try(uint pixformat) return -1; } - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO ,_("Testing palette %c%c%c%c (%dx%d)") ,pixformat >> 0, pixformat >> 8 ,pixformat >> 16, pixformat >> 24 @@ -488,18 +488,18 @@ int cls_v4l2cam::pixfmt_stride() bpl = (int)vidfmt.fmt.pix.bytesperline; wd = cam->cfg->width; - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO , _("Checking image size %dx%d with stride %d") , cam->cfg->width, cam->cfg->height, bpl); if (bpl == 0) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO , _("No stride value provided from device.")); return 0; } if (wd > bpl) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , _("Width(%d) must be less than stride(%d)"), wd, bpl); return -1; } @@ -509,19 +509,19 @@ int cls_v4l2cam::pixfmt_stride() return 0; } - MOTPLS_LOG(WRN, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(WRN, TYPE_VIDEO, NO_ERRNO , _("The image width(%d) is not multiple of the stride(%d)") , wd, bpl); /* Width per stride */ wps = bpl / wd; if (wps < 1) { - MOTPLS_LOG(WRN, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(WRN, TYPE_VIDEO, NO_ERRNO , _("Impossible condition: Width(%d), Stride(%d), Per stride(%d)") , wd, bpl, wps); } - MOTPLS_LOG(WRN, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(WRN, TYPE_VIDEO, NO_ERRNO , _("Image width will be padded %d bytes"), ((bpl % wd)/wps)); cam->cfg->width = wd + ((bpl % wd)/wps); @@ -535,7 +535,7 @@ int cls_v4l2cam::pixfmt_adjust() if ((vidfmt.fmt.pix.width != (uint)cam->cfg->width) || (vidfmt.fmt.pix.height != (uint)cam->cfg->height)) { - MOTPLS_LOG(WRN, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(WRN, TYPE_VIDEO, NO_ERRNO ,_("Adjusting resolution from %ix%i to %ix%i.") ,cam->cfg->width, cam->cfg->height ,vidfmt.fmt.pix.width @@ -545,9 +545,9 @@ int cls_v4l2cam::pixfmt_adjust() cam->cfg->height = (int)vidfmt.fmt.pix.height; if ((cam->cfg->width % 8) || (cam->cfg->height % 8)) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO ,_("Adjusted resolution not modulo 8.")); - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO ,_("Specify different palette or width/height in config file.")); return -1; } @@ -575,14 +575,14 @@ int cls_v4l2cam::pixfmt_set(uint pixformat) } retcd = xioctl(VIDIOC_S_FMT, &vidfmt); if (retcd == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO ,_("Error setting pixel format.")); return -1; } pixfmt_src = (int)pixformat; - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO ,_("Using palette %c%c%c%c (%dx%d)") ,pixformat >> 0 , pixformat >> 8 ,pixformat >> 16, pixformat >> 24 @@ -596,18 +596,18 @@ void cls_v4l2cam::params_check() int spec, indx; if (cam->cfg->width % 8) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO ,_("config image width (%d) is not modulo 8"), cam->cfg->width); cam->cfg->width = cam->cfg->width - (cam->cfg->width % 8) + 8; - MOTPLS_LOG(WRN, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(WRN, TYPE_VIDEO, NO_ERRNO , _("Adjusting to width (%d)"), cam->cfg->width); } if (cam->cfg->height % 8) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO ,_("config image height (%d) is not modulo 8"), cam->cfg->height); cam->cfg->height = cam->cfg->height - (cam->cfg->height % 8) + 8; - MOTPLS_LOG(WRN, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(WRN, TYPE_VIDEO, NO_ERRNO ,_("Adjusting to height (%d)"), cam->cfg->height); } @@ -620,7 +620,7 @@ void cls_v4l2cam::params_check() } if ((spec < 0) || (spec > (int)palette.size())) { - MOTPLS_LOG(WRN, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(WRN, TYPE_VIDEO, NO_ERRNO ,_("Invalid palette. Changing to default")); util_parms_add(params,"palette","17"); } @@ -633,7 +633,7 @@ int cls_v4l2cam::pixfmt_list() int v4l2_pal, indx_palette, indx; struct v4l2_fmtdesc fmtd; - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO, _("Supported palettes:")); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO, _("Supported palettes:")); v4l2_pal = 0; memset(&fmtd, 0, sizeof(struct v4l2_fmtdesc)); @@ -642,7 +642,7 @@ int cls_v4l2cam::pixfmt_list() indx_palette = -1; /* -1 says not yet selected */ while (xioctl(VIDIOC_ENUM_FMT, &fmtd) != -1) { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO , "(%i) %c%c%c%c (%s)", v4l2_pal , fmtd.pixelformat >> 0, fmtd.pixelformat >> 8 , fmtd.pixelformat >> 16, fmtd.pixelformat >> 24 @@ -686,14 +686,14 @@ void cls_v4l2cam::palette_set() return; } - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO ,_("Configuration palette index %d (%s) for %dx%d doesn't work.") , indxp, palette[(uint)indxp].fourcc.c_str() ,cam->cfg->width, cam->cfg->height); indxp = pixfmt_list(); if (indxp < 0) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO ,_("Unable to find a compatible palette format.")); device_close(); return; @@ -701,14 +701,14 @@ void cls_v4l2cam::palette_set() retcd = pixfmt_set(palette[(uint)indxp].v4l2id); if (retcd < 0) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO , _("Palette selection failed for format %s") , palette[(uint)indxp].fourcc.c_str()); device_close(); return; } - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO ,_("Selected palette index %d (%s)") ,indxp, palette[(uint)indxp].fourcc.c_str()); @@ -735,7 +735,7 @@ void cls_v4l2cam::set_mmap() vidreq.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; vidreq.memory = V4L2_MEMORY_MMAP; if (xioctl(VIDIOC_REQBUFS, &vidreq) == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO ,_("Error requesting buffers %d for memory map. VIDIOC_REQBUFS") ,vidreq.count); device_close(); @@ -743,11 +743,11 @@ void cls_v4l2cam::set_mmap() } buffer_count = (int)vidreq.count; - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO ,_("mmap information: frames=%d"), buffer_count); if (buffer_count < MIN_MMAP_BUFFERS) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO ,_("Insufficient buffer memory %d < MIN_MMAP_BUFFERS.") ,buffer_count); device_close(); @@ -756,7 +756,7 @@ void cls_v4l2cam::set_mmap() buffers =(video_buff*) calloc((uint)buffer_count, sizeof(video_buff)); if (buffers == nullptr) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, _("Out of memory.")); + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, _("Out of memory.")); device_close(); return; } @@ -770,7 +770,7 @@ void cls_v4l2cam::set_mmap() p_buf.memory = V4L2_MEMORY_MMAP; p_buf.index = (uint)buffer_index; if (xioctl(VIDIOC_QUERYBUF, &p_buf) == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO ,_("Error querying buffer %i\nVIDIOC_QUERYBUF: ") ,buffer_index); myfree(buffers); @@ -784,14 +784,14 @@ void cls_v4l2cam::set_mmap() , MAP_SHARED, fd_device, p_buf.m.offset); if (buffers[buffer_index].ptr == MAP_FAILED) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO ,_("Error mapping buffer %i mmap"), buffer_index); myfree(buffers); device_close(); return; } - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO ,_("%i length=%d Address (%x)") ,buffer_index, p_buf.length, buffers[buffer_index].ptr); } @@ -804,7 +804,7 @@ void cls_v4l2cam::set_mmap() vidbuf.index = (uint)buffer_index; if (xioctl(VIDIOC_QBUF, &vidbuf) == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, "VIDIOC_QBUF"); + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, "VIDIOC_QBUF"); device_close(); return; } @@ -813,7 +813,7 @@ void cls_v4l2cam::set_mmap() type = V4L2_BUF_TYPE_VIDEO_CAPTURE; if (xioctl(VIDIOC_STREAMON, &type) == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO ,_("Error starting stream. VIDIOC_STREAMON")); device_close(); return; @@ -855,7 +855,7 @@ int cls_v4l2cam::capture() if (pframe >= 0) { retcd = xioctl(VIDIOC_QBUF, &vidbuf); if (retcd == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, "VIDIOC_QBUF"); + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, "VIDIOC_QBUF"); pthread_sigmask(SIG_UNBLOCK, &old, nullptr); return -1; } @@ -869,7 +869,7 @@ int cls_v4l2cam::capture() retcd = xioctl(VIDIOC_DQBUF, &vidbuf); if (retcd == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, "VIDIOC_DQBUF"); + MOTION_LOG(ERR, TYPE_VIDEO, SHOW_ERRNO, "VIDIOC_DQBUF"); pthread_sigmask(SIG_UNBLOCK, &old, nullptr); return -1; } @@ -904,14 +904,14 @@ void cls_v4l2cam::init_vars() /* Open the device */ void cls_v4l2cam::device_open() { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO , _("Opening video device %s") , cam->cfg->v4l2_device.c_str()); cam->watchdog = cam->cfg->watchdog_tmo * 3; /* 3 is arbritrary multiplier to give open function more time*/ fd_device = open(cam->cfg->v4l2_device.c_str(), O_RDWR|O_CLOEXEC); if (fd_device <= 0) { - MOTPLS_LOG(ALR, TYPE_VIDEO, SHOW_ERRNO + MOTION_LOG(ALR, TYPE_VIDEO, SHOW_ERRNO , _("Failed to open video device %s") , cam->cfg->v4l2_device.c_str()); fd_device = -1; @@ -919,13 +919,13 @@ void cls_v4l2cam::device_open() } if (xioctl(VIDIOC_QUERYCAP, &vidcap) < 0) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO, _("Not a V4L2 device?")); + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, _("Not a V4L2 device?")); device_close(); return; } if (!(vidcap.capabilities & V4L2_CAP_VIDEO_CAPTURE)) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO, _("Device does not support capturing.")); + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, _("Device does not support capturing.")); device_close(); return; } @@ -937,48 +937,48 @@ void cls_v4l2cam::log_types() return; } - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "------------------------"); - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "cap.driver: \"%s\"",vidcap.driver); - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "cap.card: \"%s\"",vidcap.card); - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "cap.bus_info: \"%s\"",vidcap.bus_info); - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "cap.capabilities=0x%08X",vidcap.capabilities); - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "------------------------"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "------------------------"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "cap.driver: \"%s\"",vidcap.driver); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "cap.card: \"%s\"",vidcap.card); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "cap.bus_info: \"%s\"",vidcap.bus_info); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "cap.capabilities=0x%08X",vidcap.capabilities); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "------------------------"); if (vidcap.capabilities & V4L2_CAP_VIDEO_CAPTURE) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- VIDEO_CAPTURE"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- VIDEO_CAPTURE"); } if (vidcap.capabilities & V4L2_CAP_VIDEO_OUTPUT) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- VIDEO_OUTPUT"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- VIDEO_OUTPUT"); } if (vidcap.capabilities & V4L2_CAP_VIDEO_OVERLAY) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- VIDEO_OVERLAY"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- VIDEO_OVERLAY"); } if (vidcap.capabilities & V4L2_CAP_VBI_CAPTURE) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- VBI_CAPTURE"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- VBI_CAPTURE"); } if (vidcap.capabilities & V4L2_CAP_VBI_OUTPUT) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- VBI_OUTPUT"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- VBI_OUTPUT"); } if (vidcap.capabilities & V4L2_CAP_RDS_CAPTURE) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- RDS_CAPTURE"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- RDS_CAPTURE"); } if (vidcap.capabilities & V4L2_CAP_TUNER) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- TUNER"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- TUNER"); } if (vidcap.capabilities & V4L2_CAP_AUDIO) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- AUDIO"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- AUDIO"); } if (vidcap.capabilities & V4L2_CAP_READWRITE) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- READWRITE"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- READWRITE"); } if (vidcap.capabilities & V4L2_CAP_ASYNCIO) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- ASYNCIO"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- ASYNCIO"); } if (vidcap.capabilities & V4L2_CAP_STREAMING) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- STREAMING"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- STREAMING"); } if (vidcap.capabilities & V4L2_CAP_TIMEPERFRAME) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- TIMEPERFRAME"); + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO, "- TIMEPERFRAME"); } } @@ -998,7 +998,7 @@ void cls_v4l2cam::log_formats() dev_format.index = indx_format = 0; dev_format.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; while (xioctl(VIDIOC_ENUM_FMT, &dev_format) != -1) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO ,_("Supported palette %s (%c%c%c%c)") ,dev_format.description ,dev_format.pixelformat >> 0 @@ -1010,7 +1010,7 @@ void cls_v4l2cam::log_formats() dev_sizes.index = indx_sizes = 0; dev_sizes.pixel_format = dev_format.pixelformat; while (xioctl(VIDIOC_ENUM_FRAMESIZES, &dev_sizes) != -1) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO ,_(" Width: %d, Height %d") ,dev_sizes.discrete.width ,dev_sizes.discrete.height); @@ -1021,7 +1021,7 @@ void cls_v4l2cam::log_formats() dev_frameint.width = dev_sizes.discrete.width; dev_frameint.height = dev_sizes.discrete.height; while (xioctl(VIDIOC_ENUM_FRAMEINTERVALS, &dev_frameint) != -1) { - MOTPLS_LOG(DBG, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(DBG, TYPE_VIDEO, NO_ERRNO ,_(" Framerate %d/%d") ,dev_frameint.discrete.numerator ,dev_frameint.discrete.denominator); @@ -1058,17 +1058,17 @@ void cls_v4l2cam::set_fps() setfps.parm.capture.timeperframe.numerator = 1; setfps.parm.capture.timeperframe.denominator = (uint)cam->cfg->framerate; - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO , _("Trying to set fps to %d") , setfps.parm.capture.timeperframe.denominator); retcd = xioctl(VIDIOC_S_PARM, &setfps); if (retcd != 0) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO ,_("Error setting fps. Return code %d"), retcd); } - MOTPLS_LOG(INF, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(INF, TYPE_VIDEO, NO_ERRNO , _("Device set fps to %d") , setfps.parm.capture.timeperframe.denominator); @@ -1079,7 +1079,7 @@ void cls_v4l2cam::stop_cam() enum v4l2_buf_type p_type; int indx; - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO ,_("Closing video device %s"), cam->cfg->v4l2_device.c_str()); p_type = V4L2_BUF_TYPE_VIDEO_CAPTURE; @@ -1105,7 +1105,7 @@ void cls_v4l2cam::stop_cam() void cls_v4l2cam::start_cam() { - MOTPLS_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("Opening V4L2 device")); + MOTION_LOG(NTC, TYPE_VIDEO, NO_ERRNO,_("Opening V4L2 device")); init_vars(); device_open(); log_types(); @@ -1120,7 +1120,7 @@ void cls_v4l2cam::start_cam() set_mmap(); set_imgs(); if (fd_device == -1) { - MOTPLS_LOG(ERR, TYPE_VIDEO, NO_ERRNO,_("V4L2 device failed to open")); + MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO,_("V4L2 device failed to open")); stop_cam(); return; } @@ -1139,17 +1139,17 @@ void cls_v4l2cam::noimage() reconnect_count++; } else { if (reconnect_count >= 500) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 2 hours.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 2 hours.")); slp_dur = 7200; } else if (reconnect_count >= 200) { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 10 minutes.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 10 minutes.")); reconnect_count++; slp_dur = 600; } else { - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); - MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 30 seconds.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Camera did not reconnect.")); + MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO,_("Checking for camera every 30 seconds.")); reconnect_count++; slp_dur = 30; } diff --git a/src/webu.cpp b/src/webu.cpp index 713e1af0..6566d9ec 100644 --- a/src/webu.cpp +++ b/src/webu.cpp @@ -89,13 +89,13 @@ void cls_webu::mhd_features_basic() mhdrslt retcd; retcd = MHD_is_feature_supported (MHD_FEATURE_BASIC_AUTH); if (retcd == MHD_YES) { - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("Basic authentication: available")); + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("Basic authentication: available")); } else { if (app->cfg->webcontrol_auth_method == "basic") { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Basic authentication: disabled")); + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Basic authentication: disabled")); app->cfg->webcontrol_auth_method = "none"; } else { - MOTPLS_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("Basic authentication: disabled")); + MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("Basic authentication: disabled")); } } #endif @@ -110,13 +110,13 @@ void cls_webu::mhd_features_digest() mhdrslt retcd; retcd = MHD_is_feature_supported (MHD_FEATURE_DIGEST_AUTH); if (retcd == MHD_YES) { - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("Digest authentication: available")); + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("Digest authentication: available")); } else { if (app->cfg->webcontrol_auth_method == "digest") { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Digest authentication: disabled")); + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Digest authentication: disabled")); app->cfg->webcontrol_auth_method = "none"; } else { - MOTPLS_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("Digest authentication: disabled")); + MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("Digest authentication: disabled")); } } #endif @@ -127,7 +127,7 @@ void cls_webu::mhd_features_ipv6() { #if MHD_VERSION < 0x00094400 if (mhdst->ipv6) { - MOTPLS_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("libmicrohttpd libary too old ipv6 disabled")); + MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("libmicrohttpd libary too old ipv6 disabled")); if (mhdst->ipv6) { mhdst->ipv6 = 0; } @@ -136,9 +136,9 @@ void cls_webu::mhd_features_ipv6() mhdrslt retcd; retcd = MHD_is_feature_supported (MHD_FEATURE_IPv6); if (retcd == MHD_YES) { - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("IPV6: available")); + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("IPV6: available")); } else { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("IPV6: disabled")); + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("IPV6: disabled")); if (mhdst->ipv6) { mhdst->ipv6 = 0; } @@ -151,20 +151,20 @@ void cls_webu::mhd_features_tls() { #if MHD_VERSION < 0x00094400 if (mhdst->tls_use) { - MOTPLS_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("libmicrohttpd libary too old SSL/TLS disabled")); + MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("libmicrohttpd libary too old SSL/TLS disabled")); mhdst->tls_use = false; } #else mhdrslt retcd; retcd = MHD_is_feature_supported (MHD_FEATURE_SSL); if (retcd == MHD_YES) { - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS: available")); + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS: available")); } else { if (mhdst->tls_use) { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS: disabled")); + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS: disabled")); mhdst->tls_use = false; } else { - MOTPLS_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS: disabled")); + MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS: disabled")); } } #endif @@ -205,7 +205,7 @@ void cls_webu::mhd_loadfile(std::string fname, std::string &filestr) file_char[file_size] = 0; filestr.assign(file_char, file_size); } else { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO ,_("Error reading file for SSL/TLS support.")); } free(file_char); @@ -229,12 +229,12 @@ void cls_webu::mhd_checktls() { if (mhdst->tls_use) { if ((app->cfg->webcontrol_cert == "") || (mhdst->tls_cert == "")) { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS requested but no cert file provided. SSL/TLS disabled")); mhdst->tls_use = false; } if ((app->cfg->webcontrol_key == "") || (mhdst->tls_key == "")) { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("SSL/TLS requested but no key file provided. SSL/TLS disabled")); mhdst->tls_use = false; } @@ -420,14 +420,14 @@ void cls_webu::start_daemon_port1() free(mhdst->mhd_ops); if (wb_daemon == nullptr) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO ,_("Unable to start webserver on port %d") ,app->cfg->webcontrol_port); - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO ,_("Validate no other applications/instances are using port %d") ,app->cfg->webcontrol_port); } else { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Started webcontrol on port %d") ,app->cfg->webcontrol_port); } @@ -442,7 +442,7 @@ void cls_webu::start_daemon_port2() return; } - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Starting secondary webcontrol on port %d") , app->cfg->webcontrol_port2); @@ -454,7 +454,7 @@ void cls_webu::start_daemon_port2() mhdst->tls_use = false; if (app->cfg->webcontrol_tls) { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("TLS will be disabled on webcontrol port %d") , app->cfg->webcontrol_port2); } @@ -473,14 +473,14 @@ void cls_webu::start_daemon_port2() free(mhdst->mhd_ops); if (wb_daemon2 == nullptr) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO ,_("Unable to start secondary webserver on port %d") ,app->cfg->webcontrol_port2); - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO ,_("Validate no other applications/instances are using port %d") ,app->cfg->webcontrol_port2); } else { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Started webcontrol on port %d") ,app->cfg->webcontrol_port2); } @@ -504,7 +504,7 @@ void cls_webu::startup() return; } - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Starting webcontrol on port %d") , app->cfg->webcontrol_port); @@ -530,7 +530,7 @@ void cls_webu::shutdown() finish = true; - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO, _("Closing webcontrol")); + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO, _("Closing webcontrol")); chkcnt = 0; while ((chkcnt < 1000) && (cnct_cnt >0)) { @@ -539,7 +539,7 @@ void cls_webu::shutdown() } if (chkcnt>=1000){ - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO, _("Excessive wait closing webcontrol")); + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO, _("Excessive wait closing webcontrol")); } if (wb_daemon != nullptr) { diff --git a/src/webu_ans.cpp b/src/webu_ans.cpp index 3b0f1887..62fa0fa6 100644 --- a/src/webu_ans.cpp +++ b/src/webu_ans.cpp @@ -85,7 +85,7 @@ int cls_webu_ans::check_tls() } if (file_chk != webu->info_tls) { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO , _("Webcontrol files have changed. Restarting webcontrol")); webu->restart = true; return -1; @@ -107,7 +107,7 @@ int cls_webu_ans::parseurl() uri_cmd2 = ""; uri_cmd3 = ""; - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO, _("Sent url: %s"),url.c_str()); + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO, _("Sent url: %s"),url.c_str()); tmpurl = (char*)mymalloc(url.length()+1); memcpy(tmpurl, url.c_str(), url.length()); @@ -117,7 +117,7 @@ int cls_webu_ans::parseurl() url.assign(tmpurl); free(tmpurl); - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO, _("Decoded url: %s"),url.c_str()); + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO, _("Decoded url: %s"),url.c_str()); baselen = app->cfg->webcontrol_base_path.length(); @@ -227,7 +227,7 @@ void cls_webu_ans::parms_edit() } } - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO , "camid: >%s< camindx: >%d< cmd1: >%s< cmd2: >%s< cmd3: >%s<" , uri_camid.c_str(), camindx , uri_cmd1.c_str(), uri_cmd2.c_str() @@ -289,7 +289,7 @@ void cls_webu_ans::hostname_get() app->cfg->webcontrol_base_path; } - MOTPLS_LOG(DBG,TYPE_ALL, NO_ERRNO, _("Full Host: %s"), hostfull.c_str()); + MOTION_LOG(DBG,TYPE_ALL, NO_ERRNO, _("Full Host: %s"), hostfull.c_str()); return; } @@ -301,7 +301,7 @@ void cls_webu_ans::failauth_log(bool userid_fail) ctx_webu_clients clients; std::list::iterator it; - MOTPLS_LOG(ALR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ALR, TYPE_STREAM, NO_ERRNO ,_("Failed authentication from %s"), clientip.c_str()); clock_gettime(CLOCK_MONOTONIC, &tm_cnct); @@ -362,7 +362,7 @@ void cls_webu_ans::client_connect() while (it != webu->wb_clients.end()) { if (it->clientip == clientip) { if (it->authenticated == false) { - MOTPLS_LOG(INF,TYPE_ALL, NO_ERRNO, _("Connection from: %s"),clientip.c_str()); + MOTION_LOG(INF,TYPE_ALL, NO_ERRNO, _("Connection from: %s"),clientip.c_str()); } it->authenticated = true; it->conn_nbr = 1; @@ -381,7 +381,7 @@ void cls_webu_ans::client_connect() clients.authenticated = true; webu->wb_clients.push_back(clients); - MOTPLS_LOG(INF,TYPE_ALL, NO_ERRNO, _("Connection from: %s"),clientip.c_str()); + MOTION_LOG(INF,TYPE_ALL, NO_ERRNO, _("Connection from: %s"),clientip.c_str()); return; @@ -406,7 +406,7 @@ mhdrslt cls_webu_ans::failauth_check() (app->cfg->webcontrol_lock_minutes*60)) && (it->authenticated == false) && (it->conn_nbr > app->cfg->webcontrol_lock_attempts)) { - MOTPLS_LOG(EMG, TYPE_STREAM, NO_ERRNO + MOTION_LOG(EMG, TYPE_STREAM, NO_ERRNO , "Ignoring connection from: %s" , clientip.c_str()); it->conn_time = tm_cnct; @@ -595,7 +595,7 @@ mhdrslt cls_webu_ans::mhd_auth() if (app->cfg->webcontrol_authentication == "") { authenticated = true; if (app->cfg->webcontrol_auth_method != "none") { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("No webcontrol user:pass provided")); + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("No webcontrol user:pass provided")); } return MHD_YES; } @@ -648,7 +648,7 @@ void cls_webu_ans::gzip_deflate() retcd = deflate(&zs, Z_FINISH); if (retcd < Z_OK) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO , _("deflate failed: %d") ,retcd); gzip_size = 0; } else { @@ -657,13 +657,13 @@ void cls_webu_ans::gzip_deflate() retcd = deflateEnd(&zs); if (retcd < Z_OK) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO , _("deflateEnd failed: %d"), retcd); gzip_size = 0; } if (zs.avail_in != 0) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO , _("deflate failed avail in: %d"), zs.avail_in); gzip_size = 0; } @@ -694,7 +694,7 @@ void cls_webu_ans::mhd_send() ,(void *)resp_page.c_str(), MHD_RESPMEM_PERSISTENT); } if (response == NULL) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Invalid response")); + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Invalid response")); return; } @@ -722,7 +722,7 @@ void cls_webu_ans::mhd_send() MHD_destroy_response (response); if (retcd == MHD_NO) { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("send page failed.")); + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("send page failed.")); } } @@ -742,7 +742,7 @@ void cls_webu_ans::bad_request() /* Answer the get request from the user */ void cls_webu_ans::answer_get() { - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,"processing get: %s",uri_cmd1.c_str()); if ((uri_cmd1 == "mjpg") || (uri_cmd1 == "mpegts") || @@ -794,7 +794,7 @@ mhdrslt cls_webu_ans::answer_main(struct MHD_Connection *p_connection if (cam != NULL) { if (cam->finish) { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Shutting down camera")); + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,_("Shutting down camera")); return MHD_NO; } } diff --git a/src/webu_file.cpp b/src/webu_file.cpp index e3f343d3..6fed3697 100644 --- a/src/webu_file.cpp +++ b/src/webu_file.cpp @@ -53,7 +53,7 @@ void cls_webu_file::main() { for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "movies") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Movies via webcontrol disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Movies via webcontrol disabled"); webua->bad_request(); return; } else { @@ -83,7 +83,7 @@ void cls_webu_file::main() { webua->req_file = myfopen(full_nm.c_str(), "rbe"); } else { webua->req_file = nullptr; - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO ,"Security warning: Client IP %s requested file: %s" ,webua->clientip.c_str(), webua->uri_cmd2.c_str()); } @@ -111,7 +111,7 @@ void cls_webu_file::main() { MHD_destroy_response (response); } if (retcd == MHD_NO) { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Error processing file request"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Error processing file request"); } } diff --git a/src/webu_html.cpp b/src/webu_html.cpp index b6252d53..fea996c1 100644 --- a/src/webu_html.cpp +++ b/src/webu_html.cpp @@ -1601,7 +1601,7 @@ void cls_webu_html::user_page() webua->resp_page = ""; fp = myfopen(app->cfg->webcontrol_html.c_str(), "re"); if (fp == NULL) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO , _("Invalid user html file: %s") , app->cfg->webcontrol_html.c_str()); } else { diff --git a/src/webu_json.cpp b/src/webu_json.cpp index 3c81164b..86eadc60 100644 --- a/src/webu_json.cpp +++ b/src/webu_json.cpp @@ -258,7 +258,7 @@ void cls_webu_json::movies_list() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "movies") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Movies via webcontrol disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Movies via webcontrol disabled"); webua->resp_page += "{\"count\" : 0} "; webua->resp_page += ",\"device_id\" : "; webua->resp_page += std::to_string(webua->cam->cfg->device_id); diff --git a/src/webu_mpegts.cpp b/src/webu_mpegts.cpp index 1c685092..f53bad25 100644 --- a/src/webu_mpegts.cpp +++ b/src/webu_mpegts.cpp @@ -84,7 +84,7 @@ int cls_webu_mpegts::pic_send(unsigned char *img) retcd = avcodec_send_frame(ctx_codec, picture); if (retcd < 0 ) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO , _("Error sending frame for encoding:%s"), errstr); av_frame_free(&picture); picture = NULL; @@ -111,7 +111,7 @@ int cls_webu_mpegts::pic_get() } if (retcd < 0 ) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO ,_("Error receiving encoded packet video:%s"), errstr); //Packet is freed upon failure of encoding return -1; @@ -122,7 +122,7 @@ int cls_webu_mpegts::pic_get() retcd = av_interleaved_write_frame(fmtctx, pkt); if (retcd < 0 ) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO ,_("Error while writing video frame. %s"), errstr); return -1; } @@ -227,7 +227,7 @@ int cls_webu_mpegts::avio_buf(myuint *buf, int buf_size) webus->resp_size = (size_t)buf_size + webus->resp_used; webus->resp_image = (unsigned char*)realloc( webus->resp_image, webus->resp_size); - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO ,_("resp_image reallocated %d %d %d") ,webus->resp_size ,webus->resp_used @@ -355,7 +355,7 @@ int cls_webu_mpegts::open_mpegts() retcd = avcodec_open2(ctx_codec, codec, &opts); if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO ,_("Failed to open codec context for %dx%d transport stream: %s") , img_w, img_h, errstr); av_dict_free(&opts); @@ -365,7 +365,7 @@ int cls_webu_mpegts::open_mpegts() retcd = avcodec_parameters_from_context(strm->codecpar, ctx_codec); if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO ,_("Failed to copy decoder parameters!: %s"), errstr); av_dict_free(&opts); return -1; @@ -387,7 +387,7 @@ int cls_webu_mpegts::open_mpegts() retcd = avformat_write_header(fmtctx, &opts); if (retcd < 0) { av_strerror(retcd, errstr, sizeof(errstr)); - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO ,_("Failed to write header!: %s"), errstr); av_dict_free(&opts); return -1; @@ -414,7 +414,7 @@ mhdrslt cls_webu_mpegts::main() } if (open_mpegts() < 0 ) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Unable to open mpegts")); + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Unable to open mpegts")); return MHD_NO; } @@ -423,7 +423,7 @@ mhdrslt cls_webu_mpegts::main() response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 4096 ,&webu_mpegts_response, this, NULL); if (!response) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Invalid response")); + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Invalid response")); return MHD_NO; } diff --git a/src/webu_post.cpp b/src/webu_post.cpp index 1c5005ba..3aaf790b 100644 --- a/src/webu_post.cpp +++ b/src/webu_post.cpp @@ -56,7 +56,7 @@ void cls_webu_post::cam_add() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "camera_add") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Camera add action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Camera add action disabled"); return; } else { break; @@ -64,7 +64,7 @@ void cls_webu_post::cam_add() } } - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Adding camera."); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Adding camera."); maxcnt = 100; @@ -77,11 +77,11 @@ void cls_webu_post::cam_add() if (indx == maxcnt) { app->cam_add = false; - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, "Error adding camera. Timed out"); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, "Error adding camera. Timed out"); return; } - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "New camera added."); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "New camera added."); } @@ -93,7 +93,7 @@ void cls_webu_post::cam_delete() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "camera_delete") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Camera delete action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Camera delete action disabled"); return; } else { break; @@ -101,7 +101,7 @@ void cls_webu_post::cam_delete() } } - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Deleting camera."); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Deleting camera."); app->cam_delete = webua->camindx; @@ -112,7 +112,7 @@ void cls_webu_post::cam_delete() indx++; } if (indx == maxcnt) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, "Error stopping camera. Timed out shutting down"); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, "Error stopping camera. Timed out shutting down"); app->cam_delete = -1; return; } @@ -137,19 +137,19 @@ void cls_webu_post::parse_cmd() webua->device_id = atoi(post_info[indx].key_val); } - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO ,"key: %s value: %s " + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO ,"key: %s value: %s " , post_info[indx].key_nm , post_info[indx].key_val ); } if (post_cmd == "") { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , "Invalid post request. No command"); return; } if (webua->device_id == -1) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , "Invalid post request. No camera id provided"); return; } @@ -162,7 +162,7 @@ void cls_webu_post::parse_cmd() } } if (webua->camindx == -1) { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO , "Invalid request. Device id %d not found" , webua->device_id); webua->device_id = -1; @@ -179,7 +179,7 @@ void cls_webu_post::action_eventend() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "event") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Event end action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Event end action disabled"); return; } else { break; @@ -205,7 +205,7 @@ void cls_webu_post::action_eventstart() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "event") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Event start action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Event start action disabled"); return; } else { break; @@ -232,7 +232,7 @@ void cls_webu_post::action_snapshot() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "snapshot") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Snapshot action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Snapshot action disabled"); return; } else { break; @@ -258,7 +258,7 @@ void cls_webu_post::action_pause_on() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "pause") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Pause action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Pause action disabled"); return; } else { break; @@ -283,7 +283,7 @@ void cls_webu_post::action_pause_off() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "pause") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Pause action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Pause action disabled"); return; } else { break; @@ -308,7 +308,7 @@ void cls_webu_post::action_pause_schedule() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "pause") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Pause action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Pause action disabled"); return; } else { break; @@ -334,7 +334,7 @@ void cls_webu_post::action_restart() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "restart") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Restart action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Restart action disabled"); return; } else { break; @@ -343,13 +343,13 @@ void cls_webu_post::action_restart() } if (webua->device_id == 0) { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO, _("Restarting all cameras")); + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO, _("Restarting all cameras")); for (indx=0; indxcam_cnt; indx++) { app->cam_list[indx]->handler_stop = false; app->cam_list[indx]->restart = true; } } else { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Restarting camera %d") , app->cam_list[webua->camindx]->cfg->device_id); app->cam_list[webua->camindx]->handler_stop = false; @@ -365,7 +365,7 @@ void cls_webu_post::action_stop() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "stop") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Stop action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Stop action disabled"); return; } else { break; @@ -375,7 +375,7 @@ void cls_webu_post::action_stop() if (webua->device_id == 0) { for (indx=0; indxcam_cnt; indx++) { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Stopping cam %d") , app->cam_list[indx]->cfg->device_id); app->cam_list[indx]->restart = false; @@ -384,7 +384,7 @@ void cls_webu_post::action_stop() app->cam_list[indx]->handler_stop = true; } } else { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Stopping cam %d") , app->cam_list[webua->camindx]->cfg->device_id); app->cam_list[webua->camindx]->restart = false; @@ -405,7 +405,7 @@ void cls_webu_post::action_user() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "action_user") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "User action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "User action disabled"); return; } else { break; @@ -424,14 +424,14 @@ void cls_webu_post::action_user() } for (indx2 = 0; indx2<(int)tmp.length(); indx2++) { if (isalnum(tmp.at((uint)indx2)) == false) { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Invalid character included in action user \"%c\"") , tmp.at((uint)indx2)); return; } } snprintf(cam->action_user, 40, "%s", tmp.c_str()); - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Executing user action on cam %d") , cam->cfg->device_id); util_exec_command(cam, cam->cfg->on_action_user.c_str(), NULL); @@ -446,7 +446,7 @@ void cls_webu_post::action_user() } for (indx2 = 0; indx2<(int)tmp.length(); indx2++) { if (isalnum(tmp.at((uint)indx2)) == false) { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Invalid character included in action user \"%c\"") , tmp.at((uint)indx2)); return; @@ -454,7 +454,7 @@ void cls_webu_post::action_user() } snprintf(cam->action_user, 40, "%s", tmp.c_str()); - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("Executing user action on cam %d") , cam->cfg->device_id); util_exec_command(cam, cam->cfg->on_action_user.c_str(), NULL); @@ -470,7 +470,7 @@ void cls_webu_post::write_config() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "config_write") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Config write action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Config write action disabled"); return; } else { break; @@ -540,7 +540,7 @@ void cls_webu_post::config_set(int indx_parm, std::string parm_vl) (parm_ct == PARM_CAT_15)) { return; } - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Config edit set. %s:%s" + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Config edit set. %s:%s" ,parm_nm.c_str(), parm_vl.c_str()); app->cam_list[webua->camindx]->conf_src->edit_set( parm_nm, parm_vl); @@ -607,7 +607,7 @@ void cls_webu_post::config() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "config") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "Config save action disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "Config save action disabled"); return; } else { break; @@ -655,28 +655,28 @@ void cls_webu_post::config() if (restart_list[indx].restart == true) { if (restart_list[indx].comp_type == "log") { motlog->restart = true; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO, + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "Restart request for log"); } else if (restart_list[indx].comp_type == "webu") { app->webu->restart = true; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO, + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "Restart request for webcontrol"); } else if (restart_list[indx].comp_type == "dbse") { app->dbse->restart = true; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO, + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "Restart request for database"); } else if (restart_list[indx].comp_type == "cam") { app->cam_list[restart_list[indx].comp_indx]->restart = true; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO, + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "Restart request for camera %d" , app->cam_list[restart_list[indx].comp_indx]->cfg->device_id); } else if (restart_list[indx].comp_type == "snd") { app->snd_list[restart_list[indx].comp_indx]->restart = true; - MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO, + MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO, "Restart request for sound %d" , app->cam_list[restart_list[indx].comp_indx]->cfg->device_id); } else { - MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO, "Bad programming"); + MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO, "Bad programming"); } } } @@ -696,7 +696,7 @@ void cls_webu_post::ptz() for (indx=0;indxwb_actions->params_cnt;indx++) { if (webu->wb_actions->params_array[indx].param_name == "ptz") { if (webu->wb_actions->params_array[indx].param_value == "off") { - MOTPLS_LOG(INF, TYPE_ALL, NO_ERRNO, "PTZ actions disabled"); + MOTION_LOG(INF, TYPE_ALL, NO_ERRNO, "PTZ actions disabled"); return; } else { break; @@ -761,12 +761,12 @@ void cls_webu_post::process_actions() action_snapshot(); } else if (post_cmd == "pause") { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("pause action deprecated. Use pause_on")); action_pause_on(); } else if (post_cmd == "unpause") { - MOTPLS_LOG(NTC, TYPE_STREAM, NO_ERRNO + MOTION_LOG(NTC, TYPE_STREAM, NO_ERRNO , _("unpause action deprecated. Use pause_off")); action_pause_off(); @@ -810,7 +810,7 @@ void cls_webu_post::process_actions() ptz(); } else { - MOTPLS_LOG(INF, TYPE_STREAM, NO_ERRNO + MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO , _("Invalid action requested: command: >%s< camindx : >%d< ") , post_cmd.c_str(), webua->camindx); } @@ -862,7 +862,7 @@ void cls_webu_post::iterate_post_new(const char *key post_info[post_sz-1].key_sz = datasz; if (retcd < 0) { - MOTPLS_LOG(INF, TYPE_STREAM, NO_ERRNO, _("Error processing post data")); + MOTION_LOG(INF, TYPE_STREAM, NO_ERRNO, _("Error processing post data")); } } diff --git a/src/webu_stream.cpp b/src/webu_stream.cpp index c65b11da..4ac40c1e 100644 --- a/src/webu_stream.cpp +++ b/src/webu_stream.cpp @@ -152,7 +152,7 @@ bool cls_webu_stream::all_ready() indx1++; } if (p_cam->passflag == false) { - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO , "Camera %d not ready", p_cam->cfg->device_id); return false; } @@ -160,7 +160,7 @@ bool cls_webu_stream::all_ready() } if ((webua->app->allcam->all_sizes.dst_h == 0) || (webua->app->allcam->all_sizes.dst_w == 0)) { - MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO, "All cameras not ready"); + MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO, "All cameras not ready"); return false; } @@ -489,13 +489,13 @@ bool cls_webu_stream::valid_request() pthread_mutex_lock(&app->mutex_camlst); if (webua->device_id < 0) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO , _("Invalid camera specified: %s"), webua->url.c_str()); pthread_mutex_unlock(&app->mutex_camlst); return false; } if ((webua->device_id > 0) && (webua->cam == NULL)) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO , _("Invalid camera specified: %s"), webua->url.c_str()); pthread_mutex_unlock(&app->mutex_camlst); return false; @@ -600,7 +600,7 @@ mhdrslt cls_webu_stream::stream_mjpeg() response = MHD_create_response_from_callback (MHD_SIZE_UNKNOWN, 1024 , &webu_mjpeg_response, (void *)this, NULL); if (response == NULL) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Invalid response")); + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Invalid response")); return MHD_NO; } @@ -630,7 +630,7 @@ mhdrslt cls_webu_stream::stream_static() int indx; if (resp_used == 0) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Could not get image to stream.")); + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Could not get image to stream.")); return MHD_NO; } @@ -638,7 +638,7 @@ mhdrslt cls_webu_stream::stream_static() resp_size,(void *)resp_image , MHD_RESPMEM_MUST_COPY); if (response == NULL) { - MOTPLS_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Invalid response")); + MOTION_LOG(ERR, TYPE_STREAM, NO_ERRNO, _("Invalid response")); return MHD_NO; }