Skip to content

Commit

Permalink
- Allow image dimension not 4:3 changing a check of modulo 16 by modu…
Browse files Browse the repository at this point in the history
…lo 8.

- Free file descriptor buffers on exit.
  • Loading branch information
sackmotion committed Jan 24, 2012
1 parent 05b8157 commit fcdd331
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 30 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ Features
http://www.lavrsen.dk/foswiki/bin/view/Motion/FeatureRequest2010x04x14x082244 (Angel Carpintero)
* Added new log type COR , to filter messages from CORE. (Angel Carpintero)
* Added a new starting option -m to disable motion detection. (Angel Carpintero)
* Allow image dimension not 4:3 changing a check of modulo 16 by modulo 8. (Jeroen Massar)

Bugfixes
* Avoid segfault detecting strerror_r() version GNU or SUSv3. (Angel Carpintero)
Expand Down Expand Up @@ -73,6 +74,8 @@ Bugfixes
* Fixed motion.conf-dist , adding text according with config options.
* Fixed a bug in post_capture. It was missed under certain conditions.
* Fixed configure for SDL.
* Replace malloc() by calloc(). (Jeroen Massar)
* Free file descriptor buffers on exit.

3.2.12 Summary of Changes

Expand Down
1 change: 0 additions & 1 deletion conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,6 @@ struct config conf_template = {
log_file: NULL,
log_level: LEVEL_DEFAULT+10,
log_type_str: NULL,
// motion_detection_pause: 1,
};


Expand Down
1 change: 0 additions & 1 deletion conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ struct config {
int minimum_motion_frames;
const char *exif_text;
char *pid_file;
// unsigned int motion_detection_pause;
int argc;
char **argv;
};
Expand Down
18 changes: 9 additions & 9 deletions configure
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.67 for motion Git-2efcf1bb6170c04862519af700be5f23e77128ec.
# Generated by GNU Autoconf 2.67 for motion Git-05b815771a359a3a66c1c06a597cb6b947fefe89.
#
#
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
Expand Down Expand Up @@ -549,8 +549,8 @@ MAKEFLAGS=
# Identity of this package.
PACKAGE_NAME='motion'
PACKAGE_TARNAME='motion'
PACKAGE_VERSION='Git-2efcf1bb6170c04862519af700be5f23e77128ec'
PACKAGE_STRING='motion Git-2efcf1bb6170c04862519af700be5f23e77128ec'
PACKAGE_VERSION='Git-05b815771a359a3a66c1c06a597cb6b947fefe89'
PACKAGE_STRING='motion Git-05b815771a359a3a66c1c06a597cb6b947fefe89'
PACKAGE_BUGREPORT=''
PACKAGE_URL=''

Expand Down Expand Up @@ -1217,7 +1217,7 @@ if test "$ac_init_help" = "long"; then
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
\`configure' configures motion Git-2efcf1bb6170c04862519af700be5f23e77128ec to adapt to many kinds of systems.
\`configure' configures motion Git-05b815771a359a3a66c1c06a597cb6b947fefe89 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
Expand Down Expand Up @@ -1278,7 +1278,7 @@ fi

if test -n "$ac_init_help"; then
case $ac_init_help in
short | recursive ) echo "Configuration of motion Git-2efcf1bb6170c04862519af700be5f23e77128ec:";;
short | recursive ) echo "Configuration of motion Git-05b815771a359a3a66c1c06a597cb6b947fefe89:";;
esac
cat <<\_ACEOF
Expand Down Expand Up @@ -1424,7 +1424,7 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
motion configure Git-2efcf1bb6170c04862519af700be5f23e77128ec
motion configure Git-05b815771a359a3a66c1c06a597cb6b947fefe89
generated by GNU Autoconf 2.67
Copyright (C) 2010 Free Software Foundation, Inc.
Expand Down Expand Up @@ -2021,7 +2021,7 @@ cat >config.log <<_ACEOF
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by motion $as_me Git-2efcf1bb6170c04862519af700be5f23e77128ec, which was
It was created by motion $as_me Git-05b815771a359a3a66c1c06a597cb6b947fefe89, which was
generated by GNU Autoconf 2.67. Invocation command line was
$ $0 $@
Expand Down Expand Up @@ -6531,7 +6531,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
This file was extended by motion $as_me Git-2efcf1bb6170c04862519af700be5f23e77128ec, which was
This file was extended by motion $as_me Git-05b815771a359a3a66c1c06a597cb6b947fefe89, which was
generated by GNU Autoconf 2.67. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
Expand Down Expand Up @@ -6593,7 +6593,7 @@ _ACEOF
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
motion config.status Git-2efcf1bb6170c04862519af700be5f23e77128ec
motion config.status Git-05b815771a359a3a66c1c06a597cb6b947fefe89
configured by $0, generated by GNU Autoconf 2.67,
with options \\"\$ac_cs_config\\"
Expand Down
12 changes: 6 additions & 6 deletions motion.c
Original file line number Diff line number Diff line change
Expand Up @@ -389,8 +389,8 @@ static void motion_remove_pid(void)
if (ptr_logfile) {
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Closing logfile (%s).",
cnt_list[0]->conf.log_file);
set_log_mode(LOGMODE_SYSLOG);
myfclose(ptr_logfile);
set_log_mode(LOGMODE_SYSLOG);
ptr_logfile = NULL;
}

Expand Down Expand Up @@ -3085,13 +3085,13 @@ int myfclose(FILE* fh)
for (i = 0; i < MYBUFCOUNT; i++) {
if (buffers[i].fh == fh) {
buffers[i].fh = NULL;
#if 0 /* Don't free the buffers for now, reuse them instead */
if (buffers[i].buffer)
free(buffers[i].buffer);
if ( finish ) {
/* Free the buffers */
if (buffers[i].buffer)
free(buffers[i].buffer);
buffers[i].buffer = NULL;
buffers[i].bufsize = 0;
#endif
break;
}
}
}
return rval;
Expand Down
16 changes: 8 additions & 8 deletions video_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@ void vid_close(struct context *cnt)
* Returns
* device number
* -1 if failed to open device.
* -3 image dimensions are not modulo 16
* -3 image dimensions are not modulo 8
*/
static int vid_v4lx_start(struct context *cnt)
{
Expand All @@ -659,17 +659,17 @@ static int vid_v4lx_start(struct context *cnt)
* We use width and height from conf in this function. They will be assigned
* to width and height in imgs here, and cap_width and cap_height in
* rotate_data won't be set until in rotate_init.
* Motion requires that width and height is a multiple of 16 so we check
* Motion requires that width and height is a multiple of 8 so we check
* for this first.
*/
if (conf->width % 16) {
MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: config image width (%d) is not modulo 16",
if (conf->width % 8) {
MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: config image width (%d) is not modulo 8",
conf->width);
return -3;
}

if (conf->height % 16) {
MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: config image height (%d) is not modulo 16",
if (conf->height % 8) {
MOTION_LOG(ERR, TYPE_VIDEO, NO_ERRNO, "%s: config image height (%d) is not modulo 8",
conf->height);
return -3;
}
Expand Down Expand Up @@ -837,7 +837,7 @@ static int vid_v4lx_start(struct context *cnt)
* vid_start setup the capture device. This will be either a V4L device or a netcam.
* The function does the following:
* - If the camera is a netcam - netcam_start is called and function returns
* - Width and height are checked for valid value (multiple of 16)
* - Width and height are checked for valid value (multiple of 8)
* - Copy the config height and width to the imgs struct. Note that height and width are
* only copied to the from the conf struct to the imgs struct during program startup
* The width and height can no later be changed via http remote control as this would
Expand All @@ -851,7 +851,7 @@ static int vid_v4lx_start(struct context *cnt)
* Returns
* device number
* -1 if failed to open device.
* -3 image dimensions are not modulo 16
* -3 image dimensions are not modulo 8
*/
int vid_start(struct context *cnt)
{
Expand Down
10 changes: 5 additions & 5 deletions video_freebsd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1080,18 +1080,18 @@ int vid_start(struct context *cnt)
* We use width and height from conf in this function. They will be assigned
* to width and height in imgs here, and cap_width and cap_height in
* rotate_data won't be set until in rotate_init.
* Motion requires that width and height are multiples of 16 so we check for this.
* Motion requires that width and height are multiples of 8 so we check for this.
*/
if (conf->width % 16) {
if (conf->width % 8) {
MOTION_LOG(CRT, TYPE_VIDEO, NO_ERRNO,
"%s: config image width (%d) is not modulo 16",
"%s: config image width (%d) is not modulo 8",
conf->width);
return -1;
}

if (conf->height % 16) {
if (conf->height % 8) {
MOTION_LOG(CRT, TYPE_VIDEO, NO_ERRNO,
"%s: config image height (%d) is not modulo 16",
"%s: config image height (%d) is not modulo 8",
conf->height);
return -1;
}
Expand Down

0 comments on commit fcdd331

Please sign in to comment.