mirror of
https://github.com/Motion-Project/motion.git
synced 2026-05-24 14:37:31 -04:00
Revise from MOTPLS to MOTION
This commit is contained in:
@@ -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. <code><strong>wget https://raw.githubusercontent.com/Motion-Project/motion-packaging/master/buildplus.sh </strong></code>
|
||||
command. <code><strong>wget https://raw.githubusercontent.com/Motion-Project/motion-packaging/master/builddeb.sh </strong></code>
|
||||
<p></p>
|
||||
Review the script and specify the following few optional parameters.
|
||||
<code><strong> Username, EmailAddress, branch, install, arch</strong></code>. If
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;indx<params->params_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++;
|
||||
|
||||
@@ -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; indx<active_cnt; indx++) {
|
||||
p_cam = active_cam[indx];
|
||||
getsizes_img(p_cam);
|
||||
MOTPLS_LOG(DBG, TYPE_STREAM, NO_ERRNO
|
||||
MOTION_LOG(DBG, TYPE_STREAM, NO_ERRNO
|
||||
, "Device %d Original Size %dx%d Scale %d New Size %dx%d"
|
||||
, p_cam->cfg->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; indx<active_cnt; indx++) {
|
||||
p_cam = active_cam[indx];
|
||||
MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO
|
||||
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO
|
||||
,"stream_preview_params values. Device %d row %d col %d"
|
||||
, p_cam->cfg->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);
|
||||
}
|
||||
|
||||
106
src/camera.cpp
106
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; indx<imgs.ring_size; indx++) {
|
||||
memset(imgs.image_ring[indx].image_norm
|
||||
@@ -536,20 +536,20 @@ void cls_camera::init_firstimage()
|
||||
void cls_camera::check_szimg()
|
||||
{
|
||||
if ((imgs.width % 8) || (imgs.height % 8)) {
|
||||
MOTPLS_LOG(ERR, TYPE_NETCAM, NO_ERRNO
|
||||
MOTION_LOG(ERR, TYPE_NETCAM, NO_ERRNO
|
||||
,_("Image width (%d) or height(%d) requested is not modulo 8.")
|
||||
,imgs.width, imgs.height);
|
||||
device_status = STATUS_CLOSED;
|
||||
}
|
||||
if ((imgs.width < 64) || (imgs.height < 64)) {
|
||||
MOTPLS_LOG(ERR, TYPE_ALL, NO_ERRNO
|
||||
MOTION_LOG(ERR, TYPE_ALL, NO_ERRNO
|
||||
,_("Motion only supports width and height greater than or equal to 64 %dx%d")
|
||||
,imgs.width, imgs.height);
|
||||
device_status = STATUS_CLOSED;
|
||||
}
|
||||
/* Substream size notification*/
|
||||
if ((imgs.width % 16) || (imgs.height % 16)) {
|
||||
MOTPLS_LOG(NTC, TYPE_NETCAM, NO_ERRNO
|
||||
MOTION_LOG(NTC, TYPE_NETCAM, NO_ERRNO
|
||||
,_("Substream not available. Image sizes not modulo 16."));
|
||||
}
|
||||
|
||||
@@ -633,7 +633,7 @@ void cls_camera::init_values()
|
||||
movie_passthrough = cfg->movie_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);
|
||||
}
|
||||
|
||||
534
src/conf.cpp
534
src/conf.cpp
File diff suppressed because it is too large
Load Diff
130
src/dbse.cpp
130
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;indx<col_names.size();indx++) {
|
||||
if (col_names[indx].found == false) {
|
||||
dbse_action = DBSE_COLS_ADD;
|
||||
sql_motpls(sql
|
||||
sql_motion(sql
|
||||
, col_names[indx].col_nm
|
||||
, col_names[indx].col_typ);
|
||||
sqlite3db_exec(sql.c_str());
|
||||
@@ -295,11 +295,11 @@ void cls_dbse::sqlite3db_cols_rename()
|
||||
}
|
||||
|
||||
dbse_action = DBSE_COLS_CURRENT;
|
||||
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;
|
||||
@@ -309,7 +309,7 @@ void cls_dbse::sqlite3db_cols_rename()
|
||||
if (col_names[indx].col_nm.substr(0,5) == "movie") {
|
||||
dbse_action = DBSE_COLS_RENAME;
|
||||
tmp = "file"+col_names[indx].col_nm.substr(5);
|
||||
sql_motpls(sql,col_names[indx].col_nm, tmp);
|
||||
sql_motion(sql,col_names[indx].col_nm, tmp);
|
||||
sqlite3db_exec(sql.c_str());
|
||||
}
|
||||
}
|
||||
@@ -329,7 +329,7 @@ void cls_dbse::sqlite3db_init()
|
||||
return;
|
||||
}
|
||||
|
||||
MOTPLS_LOG(NTC, TYPE_DB, NO_ERRNO
|
||||
MOTION_LOG(NTC, TYPE_DB, NO_ERRNO
|
||||
, _("SQLite3 Database filename %s")
|
||||
, app->cfg->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;indx<col_names.size();indx++) {
|
||||
if (col_names[indx].found == false) {
|
||||
dbse_action = DBSE_COLS_ADD;
|
||||
sql_motpls(sql
|
||||
sql_motion(sql
|
||||
,col_names[indx].col_nm
|
||||
,col_names[indx].col_typ);
|
||||
mariadb_exec(sql.c_str());
|
||||
@@ -585,7 +585,7 @@ void cls_dbse::mariadb_cols_rename()
|
||||
}
|
||||
|
||||
dbse_action = DBSE_COLS_CURRENT;
|
||||
sql_motpls(sql);
|
||||
sql_motion(sql);
|
||||
mariadb_recs(sql.c_str());
|
||||
|
||||
for (indx=0;indx<col_names.size();indx++) {
|
||||
@@ -593,7 +593,7 @@ void cls_dbse::mariadb_cols_rename()
|
||||
if (col_names[indx].col_nm.substr(0,5) == "movie") {
|
||||
dbse_action = DBSE_COLS_RENAME;
|
||||
tmp = "file"+col_names[indx].col_nm.substr(5);
|
||||
sql_motpls(sql,col_names[indx].col_nm, tmp);
|
||||
sql_motion(sql,col_names[indx].col_nm, tmp);
|
||||
mariadb_exec(sql.c_str());
|
||||
}
|
||||
}
|
||||
@@ -609,14 +609,14 @@ void cls_dbse::mariadb_setup()
|
||||
}
|
||||
|
||||
dbse_action = DBSE_TBL_CHECK;
|
||||
sql_motpls(sql);
|
||||
sql_motion(sql);
|
||||
mariadb_recs(sql.c_str());
|
||||
|
||||
if (table_ok == false) {
|
||||
MOTPLS_LOG(INF, TYPE_DB, NO_ERRNO
|
||||
MOTION_LOG(INF, TYPE_DB, NO_ERRNO
|
||||
, _("Creating motion table"));
|
||||
dbse_action = DBSE_TBL_CREATE;
|
||||
sql_motpls(sql);
|
||||
sql_motion(sql);
|
||||
mariadb_exec(sql.c_str());
|
||||
}
|
||||
|
||||
@@ -636,7 +636,7 @@ void cls_dbse::mariadb_init()
|
||||
}
|
||||
|
||||
if (mysql_library_init(0, nullptr, nullptr)) {
|
||||
MOTPLS_LOG(ERR, TYPE_DB, NO_ERRNO
|
||||
MOTION_LOG(ERR, TYPE_DB, NO_ERRNO
|
||||
, _("Could not initialize database %s")
|
||||
, app->cfg->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;indx<col_names.size();indx++) {
|
||||
if (col_names[indx].found == false) {
|
||||
dbse_action = DBSE_COLS_ADD;
|
||||
sql_motpls(sql
|
||||
sql_motion(sql
|
||||
, col_names[indx].col_nm
|
||||
, col_names[indx].col_typ);
|
||||
pgsqldb_exec(sql.c_str());
|
||||
@@ -861,7 +861,7 @@ void cls_dbse::pgsqldb_cols_rename()
|
||||
}
|
||||
|
||||
dbse_action = DBSE_COLS_CURRENT;
|
||||
sql_motpls(sql);
|
||||
sql_motion(sql);
|
||||
pgsqldb_recs(sql.c_str());
|
||||
|
||||
for (indx=0;indx<col_names.size();indx++) {
|
||||
@@ -869,7 +869,7 @@ void cls_dbse::pgsqldb_cols_rename()
|
||||
if (col_names[indx].col_nm.substr(0,5) == "movie") {
|
||||
dbse_action = DBSE_COLS_RENAME;
|
||||
tmp = "file"+col_names[indx].col_nm.substr(5);
|
||||
sql_motpls(sql,col_names[indx].col_nm, tmp);
|
||||
sql_motion(sql,col_names[indx].col_nm, tmp);
|
||||
pgsqldb_exec(sql.c_str());
|
||||
}
|
||||
}
|
||||
@@ -885,14 +885,14 @@ void cls_dbse::pgsqldb_setup()
|
||||
}
|
||||
|
||||
dbse_action = DBSE_TBL_CHECK;
|
||||
sql_motpls(sql);
|
||||
sql_motion(sql);
|
||||
pgsqldb_recs(sql.c_str());
|
||||
|
||||
if (table_ok == false) {
|
||||
MOTPLS_LOG(INF, TYPE_DB, NO_ERRNO
|
||||
MOTION_LOG(INF, TYPE_DB, NO_ERRNO
|
||||
, _("Creating motion table"));
|
||||
dbse_action = DBSE_TBL_CREATE;
|
||||
sql_motpls(sql);
|
||||
sql_motion(sql);
|
||||
pgsqldb_exec(sql.c_str());
|
||||
}
|
||||
|
||||
@@ -918,7 +918,7 @@ void cls_dbse::pgsqldb_init()
|
||||
constr += " port="+std::to_string(app->cfg->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);
|
||||
}
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
362
src/libcam.cpp
362
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;indx<params->params_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<CameraManager>();
|
||||
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<FrameBufferAllocator>(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> 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> &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
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
114
src/motion.cpp
114
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; indx<cam_cnt; indx++) {
|
||||
cam_list[indx]->action_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; indx<cam_cnt; indx++) {
|
||||
cam_list[indx]->event_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; indx<cam_cnt; indx++) {
|
||||
@@ -141,7 +141,7 @@ void cls_motapp::signal_process()
|
||||
snd_list[indx]->handler_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);
|
||||
|
||||
@@ -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_ */
|
||||
|
||||
166
src/movie.cpp
166
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"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
260
src/netcam.cpp
260
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;
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
}
|
||||
|
||||
@@ -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. */
|
||||
|
||||
@@ -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;indx<flst.size();indx++) {
|
||||
if (stat(flst[indx].full_nm.c_str(), &statbuf) == 0) {
|
||||
MOTPLS_LOG(DBG, TYPE_ALL, NO_ERRNO
|
||||
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO
|
||||
, _("Removing %s"),flst[indx].full_nm.c_str());
|
||||
remove(flst[indx].full_nm.c_str());
|
||||
sql = " delete from motion ";
|
||||
@@ -189,13 +189,13 @@ void cls_schedule::cleandir_run(cls_camera *p_cam)
|
||||
} else if (p_cam->cleandir->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);
|
||||
}
|
||||
|
||||
124
src/sound.cpp
124
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;indx<snd_info->params->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; indx<cnt; indx++) {
|
||||
snd_pcm_info_set_subdevice(alsa->pcm_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);
|
||||
}
|
||||
|
||||
74
src/util.cpp
74
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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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;indx<device_ctrls.size();indx++){
|
||||
itm = &device_ctrls[indx];
|
||||
if (itm->ctrl_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;
|
||||
}
|
||||
|
||||
54
src/webu.cpp
54
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) {
|
||||
|
||||
@@ -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<ctx_webu_clients>::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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -53,7 +53,7 @@ void cls_webu_file::main() {
|
||||
for (indx=0;indx<webu->wb_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");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -258,7 +258,7 @@ void cls_webu_json::movies_list()
|
||||
for (indx=0;indx<webu->wb_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);
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,7 @@ void cls_webu_post::cam_add()
|
||||
for (indx=0;indx<webu->wb_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;indx<webu->wb_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;indx<webu->wb_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;indx<webu->wb_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;indx<webu->wb_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;indx<webu->wb_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;indx<webu->wb_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;indx<webu->wb_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;indx<webu->wb_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; indx<app->cam_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;indx<webu->wb_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; indx<app->cam_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;indx<webu->wb_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;indx<webu->wb_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;indx<webu->wb_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;indx<webu->wb_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"));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user