import ports/multimedia/motion, ok/tweak ajacoutot@

Motion is a C program that monitors the video signal from one or
more V4L2/video(4) cameras or network-based webcams, and is able to
detect if a significant part of the picture has changed. Or in
other words, it can detect motion.
This commit is contained in:
sthen 2014-10-10 13:32:05 +00:00
parent 58aa598f98
commit 5c39e2b175
13 changed files with 241 additions and 0 deletions

View File

@ -0,0 +1,58 @@
# $OpenBSD: Makefile,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $
COMMENT= motion detection software for video
GH_ACCOUNT= Mr-Dave
GH_PROJECT= motion
GH_COMMIT= 7cfdf13cd63378e45589650f7d20195cb7bf9936
DISTNAME= motion-0.20140910
CATEGORIES= multimedia
HOMEPAGE= http://www.lavrsen.dk/foswiki/bin/view/Motion/
MAINTAINER= Stuart Henderson <sthen@openbsd.org>
# GPL (according to source files, v2 only. website says v2+).
PERMIT_PACKAGE_CDROM= Yes
WANTLIB += SDL avcodec avformat avutil c jpeg m pthread sqlite3 swscale z
FLAVOR?=
FLAVORS= mysql pgsql
LIB_DEPENDS= graphics/jpeg \
graphics/ffmpeg
FAKE_FLAGS= docdir=${PREFIX}/share/doc/motion \
examplesdir=${PREFIX}/share/examples/motion
USE_GMAKE= Yes
CONFIGURE_STYLE= autoconf
AUTOCONF_VERSION= 2.68
CONFIGURE_ARGS= --without-optimizecpu \
LDFLAGS="-L${LOCALBASE}/lib" \
CPPFLAGS="-I${LOCALBASE}/include"
.if ${FLAVOR:L:Mmysql}
LIB_DEPENDS+= databases/mariadb
WANTLIB+= lib/mysql/mysqlclient
.else
CONFIGURE_ARGS+= --without-mysql
.endif
.if ${FLAVOR:L:Mpgsql}
LIB_DEPENDS+= databases/postgresql
WANTLIB+= pq
CONFIGURE_ARGS+= --with-pgsql-lib=${LOCALBASE}/lib
.else
CONFIGURE_ARGS+= --without-pgsql
.endif
NO_TEST= Yes
pre-configure:
perl -pi -e s,/usr/local/etc,${SYSCONFDIR},g \
${WRKSRC}/motion-dist.conf.in
.include <bsd.port.mk>

View File

@ -0,0 +1,2 @@
SHA256 (motion-0.20140910.tar.gz) = dtjbbv3ZPH7y5sttM1oMPXWxx4tTFbqks7N3Tp7kan8=
SIZE (motion-0.20140910.tar.gz) = 454091

View File

@ -0,0 +1,30 @@
$OpenBSD: patch-configure_ac,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $
--- configure.ac.orig Wed Sep 10 03:53:41 2014
+++ configure.ac Fri Oct 10 11:41:32 2014
@@ -37,7 +37,7 @@ if test "${Darwin}" = ""; then
AC_MSG_RESULT(no)
AC_MSG_CHECKING(for *BSD)
- FreeBSD=`uname -a | grep "BSD"`
+ FreeBSD=`uname -a | grep "FreeBSD"`
if test "${FreeBSD}" = ""; then
AC_MSG_RESULT(no)
VIDEO="video.o video2.o video_common.o"
@@ -915,7 +915,7 @@ fi
#Checks for header files.
AC_HEADER_STDC
-AC_CHECK_HEADERS(stdio.h unistd.h stdint.h fcntl.h time.h signal.h sys/ioctl.h sys/mman.h linux/videodev.h linux/videodev2.h sys/param.h sys/types.h)
+AC_CHECK_HEADERS(stdio.h unistd.h stdint.h fcntl.h time.h signal.h sys/ioctl.h sys/mman.h linux/videodev.h linux/videodev2.h sys/param.h sys/types.h sys/videoio.h)
AC_CHECK_FUNCS(get_current_dir_name)
@@ -931,7 +931,7 @@ else
[SUPPORTED_V4L2=true],
[SUPPORTED_V4L2=false],
[#include <sys/time.h>
- #include <linux/videodev.h>])
+ #include <sys/videoio.h>])
AC_MSG_CHECKING(for V42L support)
if test x$SUPPORTED_V4L2 = xtrue; then

View File

@ -0,0 +1,14 @@
$OpenBSD: patch-motion-dist_conf_in,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $
--- motion-dist.conf.in.orig Wed Sep 10 03:53:41 2014
+++ motion-dist.conf.in Fri Oct 10 12:53:44 2014
@@ -72,8 +72,8 @@ v4l2_palette 17
; tunerdevice /dev/tuner0
# The video input to be used (default: -1)
-# Should normally be set to 0 or 1 for video/TV cards, and -1 for USB cameras
-input -1
+# On OpenBSD, set to 0 - uvideo_enum_input() does not support other inputs.
+input 0
# The video norm to use (only for video capture and TV tuner cards)
# Values: 0 (PAL), 1 (NTSC), 2 (SECAM), 3 (PAL NC no colour). Default: 0 (PAL)

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-motion_c,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $
--- motion.c.orig Wed Sep 10 03:53:41 2014
+++ motion.c Fri Oct 10 11:37:35 2014
@@ -25,6 +25,7 @@
/* Forward declarations */
static int motion_init(struct context *cnt);
static void motion_cleanup(struct context *cnt);
+static void setup_signals(struct sigaction *, struct sigaction *);
/**

View File

@ -0,0 +1,11 @@
$OpenBSD: patch-netcam_rtsp_c,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $
--- netcam_rtsp.c.orig Fri Oct 10 11:43:35 2014
+++ netcam_rtsp.c Fri Oct 10 11:43:36 2014
@@ -18,6 +18,7 @@
*
***********************************************************/
+#include <pthread.h>
#include <stdio.h>
#include "netcam_rtsp.h"
#include "rotate.h" /* already includes motion.h */

View File

@ -0,0 +1,22 @@
$OpenBSD: patch-pwc-ioctl_h,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $
--- pwc-ioctl.h.orig Wed Sep 10 03:53:41 2014
+++ pwc-ioctl.h Fri Oct 10 11:37:35 2014
@@ -61,6 +61,9 @@
typedef __u16 __le16;
#endif
+#else /* ( !BSD ) */
+typedef u_int16_t __le16;
+typedef u_int8_t __u8;
#endif /* ( !BSD ) */
/* Enumeration of image sizes */
@@ -309,7 +312,7 @@ struct pwc_table_init_buffer {
* use interface offer by v4l2.
*/
-#if (defined(MOTION_V4L2)) && (!defined(BSD))
+#if defined(MOTION_V4L2)
#define V4L2_CID_PRIVATE_SAVE_USER (V4L2_CID_PRIVATE_BASE + 0)
#define V4L2_CID_PRIVATE_RESTORE_USER (V4L2_CID_PRIVATE_BASE + 1)

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-track_c,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $
--- track.c.orig Wed Sep 10 03:53:41 2014
+++ track.c Fri Oct 10 11:37:35 2014
@@ -9,7 +9,7 @@
#include <math.h>
#include "motion.h"
-#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
+#if (defined(HAVE_LINUX_VIDEODEV_H) || defined(HAVE_SYS_VIDEOIO_H)) && (!defined(WITHOUT_V4L))
#include "pwc-ioctl.h"
#endif

View File

@ -0,0 +1,12 @@
$OpenBSD: patch-video2_c,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $
--- video2.c.orig Fri Oct 10 12:47:52 2014
+++ video2.c Fri Oct 10 12:48:03 2014
@@ -179,7 +179,7 @@ typedef struct {
/**
* xioctl
*/
-static int xioctl(int fd, int request, void *arg)
+static int xioctl(int fd, unsigned long request, void *arg)
{
int ret;

View File

@ -0,0 +1,17 @@
$OpenBSD: patch-video_h,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $
--- video.h.orig Wed Sep 10 03:53:41 2014
+++ video.h Fri Oct 10 11:37:35 2014
@@ -14,8 +14,12 @@
#include <sys/mman.h>
-#if defined(HAVE_LINUX_VIDEODEV_H) && (!defined(WITHOUT_V4L))
+#if !defined(WITHOUT_V4L)
+#if defined(HAVE_LINUX_VIDEODEV_H)
#include <linux/videodev.h>
+#elif defined(HAVE_SYS_VIDEOIO_H)
+#include <sys/videoio.h>
+#endif
#include "vloopback_motion.h"
#include "pwc-ioctl.h"
#endif

View File

@ -0,0 +1,15 @@
Motion is a C program that monitors the video signal from one or
more V4L2/video(4) cameras or network-based webcams, and is able to
detect if a significant part of the picture has changed. Or in
other words, it can detect motion.
Motion is a command line based tool. It has absolutely no graphical
user interface. Everything is setup either via the command line or
via a set of configuration files (simple ASCII files that can be
edited by any ASCII editor).
Motion can output JPEG/PPM images and MPEG video sequences, call
external programs, log to a database, etc.
Motion hasn't had an official release for some time; at present,
this package uses the forked code at https://github.com/Mr-Dave/motion/

View File

@ -0,0 +1,23 @@
@comment $OpenBSD: PLIST,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $
@newgroup _motion:704
@newuser _motion:704:_motion:daemon:motion user:/nonexistent:/sbin/nologin
@bin bin/motion
@man man/man1/motion.1
share/doc/motion/
share/doc/motion/CHANGELOG
share/doc/motion/COPYING
share/doc/motion/CREDITS
share/doc/motion/INSTALL
share/doc/motion/README
share/doc/motion/motion_guide.html
share/examples/motion/
share/examples/motion/motion-dist.conf
@sample ${SYSCONFDIR}/motion.conf
@comment share/examples/motion/motion.init-Debian
@comment share/examples/motion/motion.init-Fedora
@comment share/examples/motion/motion.init-FreeBSD.sh
share/examples/motion/thread1.conf
share/examples/motion/thread2.conf
share/examples/motion/thread3.conf
share/examples/motion/thread4.conf
@rcscript ${RCDIR}/motion

View File

@ -0,0 +1,14 @@
#!/bin/sh
#
# $OpenBSD: motion.rc,v 1.1.1.1 2014/10/10 13:32:05 sthen Exp $
daemon="${TRUEPREFIX}/bin/motion"
daemon_user="_motion"
. /etc/rc.d/rc.subr
rc_pre() {
install -d -o _motion /var/run/motion
}
rc_cmd $1