Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge changes from Mr-Dave Master #29

Closed
wants to merge 44 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
048791e
Merge tosiara/rtsp branch (commit 46cfcf31d, 2014/05/21)
Jun 14, 2014
976fe42
Removed compiler warnings and small bug fix for webhttpd.c
Jun 14, 2014
b6f8c44
RTSP and Configure revisions
Jun 14, 2014
fe8c801
Plug memory leaks in RTSP
Jun 14, 2014
0ba3f6c
Undo changes from code editor and other unnecessary changes
Jun 15, 2014
8060fd2
Remove conf files
Jun 15, 2014
d11348b
Call to netcam_shutdown_rtsp moved.
Jun 16, 2014
87d271e
Regession fix for memory leaks and reconnection.
Jun 18, 2014
ca413db
Added support for libav V53
Jun 20, 2014
9d07be5
Added support for libav V53
Jun 20, 2014
225804c
RTSP fully functional with Libav packages(0.8 and 0.9) in addition to…
Jun 21, 2014
abfd68a
Updated configure
Jun 24, 2014
4a8f8de
Remove some files that should not be in source tree
tosiara Jun 24, 2014
68cb3fe
Restored 0644 permissions for some files
tosiara Jun 24, 2014
6c8ab87
Updated CHANGELOG with credits for some previous commits
tosiara Jun 24, 2014
e459e30
Merge pull request #9 from tosiara/rtsp-mr-dave
Mr-Dave Jun 25, 2014
cdfcdc2
Additional validations for successful connection and clean up messages
Jun 27, 2014
7c3164c
Isolate RTSP and revise configure
Jun 28, 2014
05f915c
Merge branch 'master' into unstable
Jun 28, 2014
b9b4ef6
New configure and isolation of RTSP
Jun 28, 2014
51aa406
Merge pull request #1 from Mr-Dave/unstable
tosiara Jun 30, 2014
4d8b57f
Additional validations on rtsp start
Jul 4, 2014
42403e6
Merge Mr-Dave ustable branch into local rtsp-mr-dave
tosiara Jul 4, 2014
546727b
Implement init of AV libraries from bcl fork and clean up
Jul 5, 2014
b993616
Merge with unstable
Jul 5, 2014
8b12669
Gray image upon disconnection
bsb002-flash-tester Jul 7, 2014
eeafdf7
Add grey picture on rtsp disconnect by Mr-Dave https://github.com/Mr-…
tosiara Jul 8, 2014
e85feb0
Add config option for transport from Hyberbolic2346 commit 423ef7bb
bsb002-flash-tester Jul 9, 2014
e9abd61
Revised motion-dist
bsb002-flash-tester Jul 12, 2014
eb8e2e2
Merge pull request #4 from tosiara/mr-dave-pull-request
tosiara Jul 23, 2014
c6a7bae
Removed motion-dist.conf, it is autogenerated upon configure
tosiara Jul 23, 2014
259f959
Whitespace fix
tosiara Jul 23, 2014
1184a9c
Whitespace fix
tosiara Jul 23, 2014
250b2e4
Whitespace fix (finnaly INSTALL is done)
tosiara Jul 23, 2014
3528e65
Whitespace fix
tosiara Jul 23, 2014
0dfdbec
Whitespace fix
tosiara Jul 23, 2014
7a55468
Whitespace fix
tosiara Jul 23, 2014
02ff965
Whitespace fix
tosiara Jul 23, 2014
646fb10
Whitespace fix
tosiara Jul 23, 2014
8f4d2cc
Whitespace fix
tosiara Jul 23, 2014
3aeaef7
Whitespace fix
tosiara Jul 23, 2014
de38cbc
Merge pull request #18 from tosiara/rtsp-mr-dave
Mr-Dave Jul 23, 2014
de77c45
RTSP rotate/resize/non YUV420/MJPEG. Now requires libswscale-dev
Aug 11, 2014
815923d
Add git commit number to version number
Mr-Dave Sep 4, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
*.log
.svn/
*.o
.depend
motion
config.h
config.status
Makefile
motion-dist.conf
motion.init-Debian
motion.init-Fedora
motion.init-FreeBSD.sh
motion.spec
thread1.conf
thread2.conf
thread3.conf
thread4.conf
34 changes: 34 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,40 @@ Features
http://www.lavrsen.dk/foswiki/bin/view/Motion/OggTimelapse (Michael Luich)
* Added support for ffmpeg 0.11 new API.
* Added RSTP support for netcam ( merge https://github.com/hyperbolic2346/motion )
* Merge tosiara/rtsp branch (commit 46cfcf31d, 2014/05/21) (Mr-Dave)
* 3fps bugfix from SVN rev559 (tosiara, Joerg Weber)
* Buffer overflow vulnerabilities (hyperbolic2346)
* Redundand -- boundary prefix (torao)
* Proper size for memset and allocation size (Alfred Klomp)
* Removed compiler warnings: (Mr-Dave)
logger.c,jpegutils.c,netcam_ftp.c,track.c,
picture.c,webhttpd.c,stream.c,ffmpeg.c
* Bug fix as part of warnings in webhttpd.c fixed(Mr-Dave)
* Removed compiler warning regarding ffmpeg being newer than 0.4 version(Mr-Dave)
* New configure script and identification of ffmpeg version and additional libs. (Mr-Dave)
* Resolve additional compiler warnings in ffmpeg (Mr-Dave)
* Revised INSTALL with samples(Mr-Dave)
* Revisions for RTSP and code standard.(Mr-Dave)
* Plugged most(?) memory leaks in RTSP. (Mr-Dave)
* Undo changes caused by code editor and other unnecessary changes (Mr-Dave)
* Moved call to netcam_shutdown_rtsp into netcam_cleanup where it belongs. (Mr-Dave)
* Regession fix for memory leaks and reconnection (Mr-Dave)
* Eliminated requirement to manually build FFMPEG for RTSP support. (Mr-Dave)
* Revised RTSP to support version 53 of libavformat (Mr-Dave)
* Revised FFMPEG.c to eliminate warnings and functions no longer supported by Libav/FFMPEG(Mr-Dave)
* Revised INSTALL to have sample PI configure option.(Mr-Dave)
* Revised configure.ac to generate compiler flag AVFMT_V53.(Mr-Dave)
* Revised INSTALL to indicate standard APT packages for RTSP (Mr-Dave)
* Revised configure.ac to recognize libavformat version 54 RTSP (Mr-Dave)
* Clean up the messaging for RTSP.
* Additional validations for RTSP connection and corrected free sequences
* Removed seg fault on failure to open first image, comments, isolation of RTSP
* Add AC_GNU_SOURCE macro to check for GNU C Library, fix compile when no FFMpeg.
* Implement inits of AV functions from bcl fork
* Add gray image upon disconnection
* Added tcp/udp transport config option from hyperbolic(commit 423ef7bb3)
* Revised comments to be in line with application standard.
* Restructure rtsp to handle rescaling and non YUV420 format, rotate, MJPEG input format

Bugfixes
* Avoid segfault detecting strerror_r() version GNU or SUSv3. (Angel Carpintero)
Expand Down
57 changes: 51 additions & 6 deletions INSTALL
Original file line number Diff line number Diff line change
@@ -1,16 +1,61 @@
Very simple:
NOTE: Versions come, versions go, packages change, etc. These instructions are intended as a starting point
and may need modification by the time you read this.

type:
**********************************
*** DEBIAN BASED SYSTEMS ***

Required Packages:
sudo apt-get install autoconf automake build-essential libtool libjpeg8-dev libzip-dev

Obtain source code (via git)
sudo apt-get install git
cd ~
git clone {https://github.com/your favorite fork}

To rebuild the motion configure file use
autoreconf

Optional: With FFMPEG support:
Build FFMPEG via their instructions
Configure with manually built ffmpeg which currently installs to ~/bin and ~/ffmpeg_build
Basic
./configure --with-ffmpeg=$HOME/ffmpeg_build --with-ffmpeg-headers=$HOME/ffmpeg_build/include

With extra libraries for ffmpeg IMPORTANT NOTE: Your libraries will vary depending upon your build of FFMPEG
./configure --with-ffmpeg=$HOME/ffmpeg_build --with-ffmpeg-headers=$HOME/ffmpeg_build/include --with-ffmpeg-libs=" -lavformat -lswscale -lavcodec -lavutil -lfdk-aac -lswresample -lm -lopus -lz -lva -lvpx -lx264 -lmp3lame -lbz2 -ldl -lvorbisenc -lvorbis -ltheoraenc -ltheoradec "

With extra libraries for ffmpeg and install to ~/motion_build
./configure --prefix=$HOME/motion_build --with-ffmpeg=$HOME/ffmpeg_build --with-ffmpeg-headers=$HOME/ffmpeg_build/include --with-ffmpeg-libs=" -lavformat -lswscale -lavcodec -lavutil -lfdk-aac -lswresample -lm -lopus -lz -lva -lvpx -lx264 -lmp3lame -lbz2 -ldl -lvorbisenc -lvorbis -ltheoraenc -ltheoradec "

With LIBAV APT versions of libraries
sudo apt-get install libavformat-dev libavcodec-dev libavutil-dev libav-tools libswscale-dev

Without any LIBAV/FFMPEG support or the installed version of libavcodec/libavformat
./configure

followed by:
Sample PI configuration with LIBAV
./configure --with-ffmpeg=/usr/lib/arm-linux-gnueabihf --with-ffmpeg-headers=/usr/include


Once configured type:
make
make install

And
*****************************
*** OpenSUSE SYSTEM ***

sudo zypper install autoconf automake libtool git
sudo zypper install --type pattern devel_basis
sudo zypper install libjpeg8-devel
sudo zypper install -t pattern devel_C_C++

Optional: FFmpeg files
sudo zypper ar -f -n packman-essentials http://packman.inode.at/suse/openSUSE_13.1/Essentials/ packman-essentials
sudo zypper ar -f -n packman-multimedia http://packman.inode.at/suse/openSUSE_13.1/Multimedia/ packman-multimedia
sudo zypper install libffmpeg-devel

./configure
make
make install


Next read the README
*************************
4 changes: 2 additions & 2 deletions alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ static int alg_labeling(struct context *cnt)
imgs->labels_above = 0;

/* Init: 0 means no label set / not checked. */
memset(labels, 0, width * height * sizeof(labels));
memset(labels, 0, width * height * sizeof(*labels));
pixelpos = 0;

for (iy = 0; iy < height - 1; iy++) {
Expand Down Expand Up @@ -1363,6 +1363,6 @@ void alg_update_reference_frame(struct context *cnt, int action)
/* Copy fresh image */
memcpy(cnt->imgs.ref, cnt->imgs.image_virgin, cnt->imgs.size);
/* Reset static objects */
memset(cnt->imgs.ref_dyn, 0, cnt->imgs.motionsize * sizeof(cnt->imgs.ref_dyn));
memset(cnt->imgs.ref_dyn, 0, cnt->imgs.motionsize * sizeof(*cnt->imgs.ref_dyn));
}
}
50 changes: 34 additions & 16 deletions conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ struct config conf_template = {
netcam_keepalive: "off",
netcam_proxy: NULL,
netcam_tolerant_check: 0,
rtsp_uses_tcp: 1,
text_changes: 0,
text_left: NULL,
text_right: DEF_TIMESTAMP,
Expand Down Expand Up @@ -411,6 +412,15 @@ config_param config_params[] = {
print_bool
},
{
"rtsp_uses_tcp",
"# RTSP connection uses TCP to communicate to the camera. Can prevent image corruption.\n"
"# Default: on",
1,
CONF_OFFSET(rtsp_uses_tcp),
copy_bool,
print_bool
},
{
"auto_brightness",
"# Let motion regulate the brightness of a video device (default: off).\n"
"# The auto_brightness feature uses the brightness option as its target value.\n"
Expand Down Expand Up @@ -1569,17 +1579,23 @@ static void conf_cmdline(struct context *cnt, int thread)
cnt->log_level = (unsigned int)atoi(optarg);
break;
case 'k':
if (thread == -1)
strcpy(cnt->log_type_str, optarg);
break;
if (thread == -1) {
strncpy(cnt->log_type_str, optarg, sizeof(cnt->log_type_str) - 1);
cnt->log_type_str[sizeof(cnt->log_type_str) - 1] = '\0';
}
break;
case 'p':
if (thread == -1)
strcpy(cnt->pid_file, optarg);
break;
if (thread == -1) {
strncpy(cnt->pid_file, optarg, sizeof(cnt->pid_file) - 1);
cnt->pid_file[sizeof(cnt->pid_file) - 1] = '\0';
}
break;
case 'l':
if (thread == -1)
strcpy(cnt->log_file, optarg);
break;
if (thread == -1) {
strncpy(cnt->log_file, optarg, sizeof(cnt->log_file) - 1);
cnt->log_file[sizeof(cnt->log_file) - 1] = '\0';
}
break;
case 'm':
cnt->pause = 1;
break;
Expand Down Expand Up @@ -1868,8 +1884,9 @@ struct context **conf_load(struct context **cnt)
conf_cmdline(cnt[0], -1);

if (cnt[0]->conf_filename[0]) { /* User has supplied filename on Command-line. */
strcpy(filename, cnt[0]->conf_filename);
fp = fopen (filename, "r");
strncpy(filename, cnt[0]->conf_filename, PATH_MAX-1);
filename[PATH_MAX-1] = '\0';
fp = fopen (filename, "r");
}

if (!fp) { /* Command-line didn't work, try current dir. */
Expand Down Expand Up @@ -1905,11 +1922,12 @@ struct context **conf_load(struct context **cnt)

/* Now we process the motion.conf config file and close it. */
if (fp) {
strcpy(cnt[0]->conf_filename, filename);
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Processing thread 0 - config file %s",
filename);
cnt = conf_process(cnt, fp);
myfclose(fp);
strncpy(cnt[0]->conf_filename, filename, sizeof(cnt[0]->conf_filename) - 1);
cnt[0]->conf_filename[sizeof(cnt[0]->conf_filename) - 1] = '\0';
MOTION_LOG(NTC, TYPE_ALL, NO_ERRNO, "%s: Processing thread 0 - config file %s",
filename);
cnt = conf_process(cnt, fp);
myfclose(fp);
} else {
MOTION_LOG(CRT, TYPE_ALL, NO_ERRNO, "%s: Not config file to process using default values");
}
Expand Down
1 change: 1 addition & 0 deletions conf.h
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ struct config {
const char *netcam_keepalive;
const char *netcam_proxy;
unsigned int netcam_tolerant_check;
unsigned int rtsp_uses_tcp;
int text_changes;
const char *text_left;
const char *text_right;
Expand Down
49 changes: 33 additions & 16 deletions config.h.in
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* config.h.in. Generated from configure.in by autoheader. */
/* config.h.in. Generated from configure.ac by autoheader. */

/* Define to 1 if you have the <fcntl.h> header file. */
#undef HAVE_FCNTL_H
Expand Down Expand Up @@ -108,20 +108,37 @@
/* Define to 1 if you have the ANSI C header files. */
#undef STDC_HEADERS

/* Enable extensions on AIX 3, Interix. */
#ifndef _ALL_SOURCE
# undef _ALL_SOURCE
#endif
/* Enable GNU extensions on systems that have them. */
#ifndef _GNU_SOURCE
# undef _GNU_SOURCE
#endif
/* Enable threading extensions on Solaris. */
#ifndef _POSIX_PTHREAD_SEMANTICS
# undef _POSIX_PTHREAD_SEMANTICS
#endif
/* Enable extensions on HP NonStop. */
#ifndef _TANDEM_SOURCE
# undef _TANDEM_SOURCE
#endif
/* Enable general extensions on Solaris. */
#ifndef __EXTENSIONS__
# undef __EXTENSIONS__
#endif


/* Define to 1 if on MINIX. */
#undef _MINIX

/* Define to 2 if the system does not provide POSIX.1 features except with
this defined. */
#undef _POSIX_1_SOURCE

/* Define to 1 if you need to in order for `stat' and other things to work. */
#undef _POSIX_SOURCE

/* Define to empty if `const' does not conform to ANSI C. */
#undef const

/* Define to 1 if you have av_avformat_alloc_context support */
#undef have_av_avformat_alloc_context

/* Define to 1 if you have av_get_media_type_string support */
#undef have_av_get_media_type_string

/* Define to 1 if you have av_register_protocol support */
#undef have_av_register_protocol

/* Define to 1 if you have av_register_protocol2 support */
#undef have_av_register_protocol2

/* Define to 1 if you have avformat_alloc_context support */
#undef have_avformat_alloc_context
Loading