Skip to content

Commit

Permalink
4.2.1
Browse files Browse the repository at this point in the history
4.2.1
  • Loading branch information
Mr-Dave authored Dec 9, 2018
2 parents 4b72282 + b7f8b2d commit 68112cb
Show file tree
Hide file tree
Showing 16 changed files with 1,014 additions and 769 deletions.
22 changes: 20 additions & 2 deletions CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
Summary of changes for version 4.2.1 are below
* Update version number to 4.2.1 / Changelog
* Report to log options included in build
* Add log messages on database actions(tosiara)
* Revise log messages of port used for stream
* Revise log messages when using v4l2 via netcam
* Fix null terminator on EXIF of jpgs(tosiara)
* Fix build with static libs for webp(Fabrice)
* Guide update for initial setup.
* Prevent webcontrol update of movie_passthrough
* Remove confusing log message
* Fix motion detection when using privacy mask
* Correct thread locking for movie_passthrough
* Revise guide for better mobile viewing
* Revise additional stream timing
* Fix stream timing(adameat)
* Remove obsolete function reference
* Change version number to 4.2+git
Summary of Changes for version 4.2 are below
* html fixes for legacy interface
* Fix typo in guide
Expand Down Expand Up @@ -89,7 +107,7 @@ Summary of Changes for version 4.2 are below
* Revise %{host} and add %{ver} (tosiara)
* Update for passthrough processing of cameras
* Updated motion_guide.html
* Revise webcontrol page to indicate the webcontrol_parms selection
* Revise webcontrol page to indicate the webcontrol_parms selection
* Validate v4l2 parms when using v4l2 via netcam
* Capture images at start to prevent immediate events
* Initialize thread number to eliminate inaccurate log notice.
Expand All @@ -101,7 +119,7 @@ Summary of Changes for version 4.2 are below
* Include EXIF for webp images.
* Report to log when user specifies invalid URL.
* Update guide that is installed locally.
* Updated version script to include date and dirty vs clean.
* Updated version script to include date and dirty vs clean.
Version 4.1.1 Changes Below
* Fix file name for debug movies
* Fix image saving when using highres option
Expand Down
4 changes: 2 additions & 2 deletions alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1327,7 +1327,7 @@ void alg_update_reference_frame(struct context *cnt, int action)
int accept_timer = cnt->lastrate * ACCEPT_STATIC_OBJECT_TIME;
int i, threshold_ref;
int *ref_dyn = cnt->imgs.ref_dyn;
unsigned char *image_virgin = cnt->imgs.image_virgin.image_norm;
unsigned char *image_virgin = cnt->imgs.image_vprvcy.image_norm;
unsigned char *ref = cnt->imgs.ref;
unsigned char *smartmask = cnt->imgs.smartmask_final;
unsigned char *out = cnt->imgs.img_motion.image_norm;
Expand Down Expand Up @@ -1367,7 +1367,7 @@ void alg_update_reference_frame(struct context *cnt, int action)

} else { /* action == RESET_REF_FRAME - also used to initialize the frame at startup. */
/* Copy fresh image */
memcpy(cnt->imgs.ref, cnt->imgs.image_virgin.image_norm, cnt->imgs.size_norm);
memcpy(cnt->imgs.ref, cnt->imgs.image_vprvcy.image_norm, cnt->imgs.size_norm);
/* Reset static objects */
memset(cnt->imgs.ref_dyn, 0, cnt->imgs.motionsize * sizeof(*cnt->imgs.ref_dyn));
}
Expand Down
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ if test "${WEBP}" = "yes"; then
AC_MSG_RESULT(found)
AC_DEFINE([HAVE_WEBP], 1, [Define to 1 if WEBP is around])
HAVE_WEBP="yes"
TEMP_LIBS="$TEMP_LIBS -lwebp -lwebpmux"
TEMP_LIBS="$TEMP_LIBS -lwebpmux -lwebp"
else
AC_MSG_RESULT(not found)
fi
Expand Down
6 changes: 5 additions & 1 deletion event.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,13 @@ static void do_sql_query(char *sqlquery, struct context *cnt, int save_id)

if (strlen(sqlquery) <= 0) {
/* don't try to execute empty queries */
MOTION_LOG(WRN, TYPE_DB, NO_ERRNO, "Ignoring empty sql query");
return;
}

#ifdef HAVE_MYSQL
if (!strcmp(cnt->conf.database_type, "mysql")) {
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO, "Executing mysql query");
if (mysql_query(cnt->database, sqlquery) != 0) {
int error_code = mysql_errno(cnt->database);

Expand Down Expand Up @@ -209,6 +211,7 @@ static void do_sql_query(char *sqlquery, struct context *cnt, int save_id)

#ifdef HAVE_PGSQL
if (!strcmp(cnt->conf.database_type, "postgresql")) {
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO, "Executing postgresql query");
PGresult *res;

res = PQexec(cnt->database_pg, sqlquery);
Expand Down Expand Up @@ -250,6 +253,7 @@ static void do_sql_query(char *sqlquery, struct context *cnt, int save_id)
if ((!strcmp(cnt->conf.database_type, "sqlite3")) && (cnt->conf.database_dbname)) {
int res;
char *errmsg = 0;
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO, "Executing sqlite query");
res = sqlite3_exec(cnt->database_sqlite3, sqlquery, NULL, 0, &errmsg);
if (res != SQLITE_OK ) {
MOTION_LOG(ERR, TYPE_DB, NO_ERRNO, _("SQLite error was %s"), errmsg);
Expand Down Expand Up @@ -672,7 +676,7 @@ static void event_image_preview(struct context *cnt,
* Save best preview-shot also when no movies are recorded or imagepath
* is used. Filename has to be generated - nothing available to reuse!
*/
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "different filename or picture only!");

/*
* conf.picture_filename would normally be defined but if someone deleted it by
* control interface it is better to revert to the default than fail.
Expand Down
86 changes: 76 additions & 10 deletions motion.c
Original file line number Diff line number Diff line change
Expand Up @@ -1234,6 +1234,7 @@ static int motion_init(struct context *cnt)
cnt->imgs.width_high = 0;
cnt->imgs.height_high = 0;
cnt->imgs.size_high = 0;
cnt->movie_passthrough = cnt->conf.movie_passthrough;

MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO
,_("Camera %d started: motion detection %s"),
Expand All @@ -1245,9 +1246,9 @@ static int motion_init(struct context *cnt)
if (init_camera_type(cnt) != 0 ) return -3;

if ((cnt->camera_type != CAMERA_TYPE_RTSP) &&
(cnt->conf.movie_passthrough)) {
(cnt->movie_passthrough)) {
MOTION_LOG(WRN, TYPE_ALL, NO_ERRNO,_("Pass-through processing disabled."));
cnt->conf.movie_passthrough = 0;
cnt->movie_passthrough = FALSE;
}

if ((cnt->conf.height == 0) || (cnt->conf.width == 0)) {
Expand Down Expand Up @@ -1327,6 +1328,7 @@ static int motion_init(struct context *cnt)
/* contains the moving objects of ref. frame */
cnt->imgs.ref_dyn = mymalloc(cnt->imgs.motionsize * sizeof(*cnt->imgs.ref_dyn));
cnt->imgs.image_virgin.image_norm = mymalloc(cnt->imgs.size_norm);
cnt->imgs.image_vprvcy.image_norm = mymalloc(cnt->imgs.size_norm);
cnt->imgs.smartmask = mymalloc(cnt->imgs.motionsize);
cnt->imgs.smartmask_final = mymalloc(cnt->imgs.motionsize);
cnt->imgs.smartmask_buffer = mymalloc(cnt->imgs.motionsize * sizeof(*cnt->imgs.smartmask_buffer));
Expand Down Expand Up @@ -1625,6 +1627,9 @@ static void motion_cleanup(struct context *cnt) {
free(cnt->imgs.image_virgin.image_norm);
cnt->imgs.image_virgin.image_norm = NULL;

free(cnt->imgs.image_vprvcy.image_norm);
cnt->imgs.image_vprvcy.image_norm = NULL;

free(cnt->imgs.labels);
cnt->imgs.labels = NULL;

Expand Down Expand Up @@ -2048,6 +2053,8 @@ static int mlp_capture(struct context *cnt){

mlp_mask_privacy(cnt);

memcpy(cnt->imgs.image_vprvcy.image_norm, cnt->current_image->image_norm, cnt->imgs.size_norm);

/*
* If the camera is a netcam we let the camera decide the pace.
* Otherwise we will keep on adding duplicate frames.
Expand Down Expand Up @@ -2121,7 +2128,7 @@ static int mlp_capture(struct context *cnt){

if (cnt->video_dev >= 0 &&
cnt->missing_frame_counter < (MISSING_FRAMES_TIMEOUT * cnt->conf.framerate)) {
memcpy(cnt->current_image->image_norm, cnt->imgs.image_virgin.image_norm, cnt->imgs.size_norm);
memcpy(cnt->current_image->image_norm, cnt->imgs.image_vprvcy.image_norm, cnt->imgs.size_norm);
} else {
cnt->lost_connection = 1;

Expand Down Expand Up @@ -2185,9 +2192,9 @@ static void mlp_detection(struct context *cnt){
* anyway
*/
if (cnt->detecting_motion || cnt->conf.setup_mode)
cnt->current_image->diffs = alg_diff_standard(cnt, cnt->imgs.image_virgin.image_norm);
cnt->current_image->diffs = alg_diff_standard(cnt, cnt->imgs.image_vprvcy.image_norm);
else
cnt->current_image->diffs = alg_diff(cnt, cnt->imgs.image_virgin.image_norm);
cnt->current_image->diffs = alg_diff(cnt, cnt->imgs.image_vprvcy.image_norm);

/* Lightswitch feature - has light intensity changed?
* This can happen due to change of light conditions or due to a sudden change of the camera
Expand Down Expand Up @@ -2290,7 +2297,7 @@ static void mlp_tuning(struct context *cnt){
*/
if ((cnt->conf.noise_tune && cnt->shots == 0) &&
(!cnt->detecting_motion && (cnt->current_image->diffs <= cnt->threshold)))
alg_noise_tune(cnt, cnt->imgs.image_virgin.image_norm);
alg_noise_tune(cnt, cnt->imgs.image_vprvcy.image_norm);


/*
Expand Down Expand Up @@ -3125,6 +3132,65 @@ static void motion_camera_ids(void){
}
}

static void motion_ntc(void){

#ifdef HAVE_V4L2
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("v4l2 : available"));
#else
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("v4l2 : not available"));
#endif

#ifdef HAVE_BKTR
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("bktr : available"));
#else
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("bktr : not available"));
#endif

#ifdef HAVE_WEBP
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("webp : available"));
#else
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("webp : not available"));
#endif

#ifdef HAVE_MMAL
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("mmal : available"));
#else
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("mmal : not available"));
#endif

#ifdef HAVE_FFMPEG
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("ffmpeg : available"));
#else
MOTION_LOG(DBG, TYPE_ALL, NO_ERRNO,_("ffmpeg : not available"));
#endif

#ifdef HAVE_MYSQL
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("mysql : available"));
#else
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("mysql : not available"));
#endif

#ifdef HAVE_SQLITE3
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("sqlite3: available"));
#else
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("sqlite3: not available"));
#endif

#ifdef HAVE_PGSQL
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("pgsql : available"));
#else
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("pgsql : not available"));
#endif

#ifdef HAVE_INTL
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("nls : available"));
#else
MOTION_LOG(DBG, TYPE_DB, NO_ERRNO,_("nls : not available"));
#endif


}


/**
* motion_startup
Expand Down Expand Up @@ -3217,6 +3283,8 @@ static void motion_startup(int daemonize, int argc, char *argv[])

conf_output_parms(cnt_list);

motion_ntc();

motion_camera_ids();

initialize_chars();
Expand Down Expand Up @@ -3254,8 +3322,6 @@ static void motion_start_thread(struct context *cnt){
snprintf(service,6,"%s",cnt->conf.netcam_url);
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Camera ID: %d Camera Name: %s Service: %s")
,cnt->camera_id, cnt->conf.camera_name,service);
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, _("Stream port %d"),
cnt->conf.stream_port);
} else {
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO,_("Camera ID: %d Camera Name: %s Device: %s")
,cnt->camera_id, cnt->conf.camera_name,cnt->conf.video_device);
Expand Down Expand Up @@ -4039,12 +4105,12 @@ void util_threadname_get(char *threadname){
}
int util_check_passthrough(struct context *cnt){
#if (HAVE_FFMPEG && LIBAVFORMAT_VERSION_MAJOR < 55)
if (cnt->conf.movie_passthrough)
if (cnt->movie_passthrough)
MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO
,_("FFMPEG version too old. Disabling pass-through processing."));
return 0;
#else
if (cnt->conf.movie_passthrough){
if (cnt->movie_passthrough){
MOTION_LOG(INF, TYPE_NETCAM, NO_ERRNO
,_("pass-through is enabled but is still experimental."));
return 1;
Expand Down
8 changes: 5 additions & 3 deletions motion.h
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ struct images {
struct image_data img_motion; /* Picture buffer for motion images */
int *ref_dyn; /* Dynamic objects to be excluded from reference frame */
struct image_data image_virgin; /* Last picture frame with no text or locate overlay */
struct image_data image_vprvcy; /* Virgin image with the privacy mask applied */
struct image_data preview_image; /* Picture buffer for best image when enables */
unsigned char *mask; /* Buffer for the mask file */
unsigned char *smartmask;
Expand Down Expand Up @@ -472,9 +473,10 @@ struct context {
char extpipefilename[PATH_MAX];
int movie_last_shot;

struct ffmpeg *ffmpeg_output;
struct ffmpeg *ffmpeg_output_motion;
struct ffmpeg *ffmpeg_timelapse;
struct ffmpeg *ffmpeg_output;
struct ffmpeg *ffmpeg_output_motion;
struct ffmpeg *ffmpeg_timelapse;
int movie_passthrough;

char timelapsefilename[PATH_MAX];
char motionfilename[PATH_MAX];
Expand Down
Loading

0 comments on commit 68112cb

Please sign in to comment.