summaryrefslogtreecommitdiff
path: root/community-staging/motion
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2012-06-20 00:01:41 +0000
committerroot <root@rshg054.dnsready.net>2012-06-20 00:01:41 +0000
commit530e6e88786befa5d1bcd569e480f1b9fec5b102 (patch)
tree78088a8187ab892bdaa7001bcd2e76abd66837df /community-staging/motion
parente4afcc505c31482d7d7cee60bb6388bfacc8ad7f (diff)
Wed Jun 20 00:01:41 UTC 2012
Diffstat (limited to 'community-staging/motion')
-rw-r--r--community-staging/motion/PKGBUILD81
-rw-r--r--community-staging/motion/ffmpeg-0.8.patch112
-rw-r--r--community-staging/motion/linux-headers.patch35
-rw-r--r--community-staging/motion/rc.motion37
4 files changed, 265 insertions, 0 deletions
diff --git a/community-staging/motion/PKGBUILD b/community-staging/motion/PKGBUILD
new file mode 100644
index 000000000..8387624c0
--- /dev/null
+++ b/community-staging/motion/PKGBUILD
@@ -0,0 +1,81 @@
+# $Id: PKGBUILD 72669 2012-06-18 22:08:51Z spupykin $
+# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
+
+pkgname=motion
+pkgver=3.2.12
+pkgrel=5
+pkgdesc="A software motion detector which grabs images from video4linux devices and/or from webcams"
+arch=('i686' 'x86_64')
+license=('GPL')
+url="http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome"
+depends=('libjpeg' 'v4l-utils')
+
+# ffmpeg workaround
+depends=(${depends[@]} speex libpulse bzip2 lame xvidcore opencore-amr libvpx libva sdl openjpeg rtmpdump gsm schroedinger libtheora x264)
+makedepends=(alsa-lib bzip2 gsm lame libpulse libtheora libva libvorbis libvpx opencore-amr openjpeg
+ rtmpdump schroedinger sdl speex x264 xvidcore zlib yasm libvdpau)
+
+backup=('etc/motion/motion.conf')
+options=('!makeflags')
+source=(http://downloads.sourceforge.net/${pkgname}/${pkgname}-${pkgver}.tar.gz
+ rc.motion
+ ffmpeg-0.8.patch
+ linux-headers.patch
+ ftp://ftp.archlinux.org/other/ffmpeg/ffmpeg-20120509.tar.xz)
+md5sums=('1ba0065ed50509aaffb171594c689f46'
+ '2e8c53c4980edddd420f08fdd572c9be'
+ 'd36687710837d69fbce4608b1345fa34'
+ 'd8c3c4fdded5cfbd729710475559a21d'
+ 'a35359e424608f369d380f03e4dc9966')
+
+build() {
+ cd $srcdir/ffmpeg
+ ./configure \
+ --prefix=$srcdir/ffmpeg \
+ --enable-libmp3lame \
+ --enable-libvorbis \
+ --enable-libxvid \
+ --enable-libx264 \
+ --enable-libvpx \
+ --enable-libtheora \
+ --enable-libgsm \
+ --enable-libspeex \
+ --enable-postproc \
+ --enable-x11grab \
+ --enable-libopencore_amrnb \
+ --enable-libopencore_amrwb \
+ --enable-libschroedinger \
+ --enable-libopenjpeg \
+ --enable-librtmp \
+ --enable-libpulse \
+ --enable-gpl \
+ --enable-version3 \
+ --enable-runtime-cpudetect \
+ --disable-debug \
+ --enable-static \
+ --disable-shared
+ make
+ make install
+
+
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ patch -Np1 -i $srcdir/ffmpeg-0.8.patch
+ patch -Np1 -i $srcdir/linux-headers.patch
+
+ # ffmpeg workaround
+ export LDFLAGS="-ldl -lX11 -lXext -lXfixes -lva -lasound -lSDL -lpthread -lxvidcore -lx264 -lvpx -lvpx -lvorbisenc -lvorbis -logg -ltheoraenc -ltheoradec -logg -lspeex -lschroedinger-1.0 -lrtmp -lz -lssl -lcrypto -lpulse-simple -lpulse -lopenjpeg -lopencore-amrwb -lopencore-amrnb -lmp3lame -lgsm -lm -pthread -lbz2 -lz"
+
+ ./configure --prefix=/usr \
+ --without-pgsql \
+ --without-mysql \
+ --sysconfdir=/etc/motion \
+ --with-ffmpeg=$srcdir/ffmpeg
+ make
+}
+
+package(){
+ cd "${srcdir}/${pkgname}-${pkgver}"
+ make DESTDIR="${pkgdir}" install
+ mv "${pkgdir}/etc/motion/motion-dist.conf" "${pkgdir}/etc/motion/motion.conf"
+ install -Dm755 "${srcdir}/rc.motion" "${pkgdir}/etc/rc.d/motion"
+}
diff --git a/community-staging/motion/ffmpeg-0.8.patch b/community-staging/motion/ffmpeg-0.8.patch
new file mode 100644
index 000000000..5dcc6e686
--- /dev/null
+++ b/community-staging/motion/ffmpeg-0.8.patch
@@ -0,0 +1,112 @@
+diff -aur motion-3.2.12/ffmpeg.c motion-3.2.12.new/ffmpeg.c
+--- motion-3.2.12/ffmpeg.c 2010-06-01 08:48:23.000000000 +0200
++++ motion-3.2.12.new/ffmpeg.c 2011-10-31 17:25:03.000000000 +0100
+@@ -14,7 +14,7 @@
+
+ #include "ffmpeg.h"
+ #include "motion.h"
+-
++#include <libavformat/avformat.h>
+ #if LIBAVCODEC_BUILD > 4680
+ /* FFmpeg after build 4680 doesn't have support for mpeg1 videos with
+ * non-standard framerates. Previous builds contained a broken hack
+@@ -228,10 +228,12 @@
+ mpeg1_file_protocol.url_close = file_protocol.url_close;
+
+ /* Register the append file protocol. */
+-#if LIBAVFORMAT_BUILD >= (52<<16 | 31<<8)
+- av_register_protocol(&mpeg1_file_protocol);
++#ifdef have_av_register_protocol2
++ av_register_protocol2(&mpeg1_file_protocol, sizeof(mpeg1_file_protocol));
++#elif defined have_av_register_protocol
++ av_register_protocol(&mpeg1_file_protocol);
+ #else
+- register_protocol(&mpeg1_file_protocol);
++# warning av_register_protocolXXX missing
+ #endif
+ }
+
+@@ -244,7 +246,7 @@
+ const char *ext;
+ AVOutputFormat *of = NULL;
+
+- /* Here, we use guess_format to automatically setup the codec information.
++ /* Here, we use av_guess_format to automatically setup the codec information.
+ * If we are using msmpeg4, manually set that codec here.
+ * We also dynamically add the file extension to the filename here. This was
+ * done to support both mpeg1 and mpeg4 codecs since they have different extensions.
+@@ -258,7 +260,7 @@
+ /* We use "mpeg1video" for raw mpeg1 format. Using "mpeg" would
+ * result in a muxed output file, which isn't appropriate here.
+ */
+- of = guess_format("mpeg1video", NULL, NULL);
++ of = av_guess_format("mpeg1video", NULL, NULL);
+ if (of) {
+ /* But we want the trailer to be correctly written. */
+ of->write_trailer = mpeg1_write_trailer;
+@@ -270,24 +272,24 @@
+ #endif
+ } else if (strcmp(codec, "mpeg4") == 0) {
+ ext = ".avi";
+- of = guess_format("avi", NULL, NULL);
++ of = av_guess_format("avi", NULL, NULL);
+ } else if (strcmp(codec, "msmpeg4") == 0) {
+ ext = ".avi";
+- of = guess_format("avi", NULL, NULL);
++ of = av_guess_format("avi", NULL, NULL);
+ if (of) {
+ /* Manually override the codec id. */
+ of->video_codec = CODEC_ID_MSMPEG4V2;
+ }
+ } else if (strcmp(codec, "swf") == 0) {
+ ext = ".swf";
+- of = guess_format("swf", NULL, NULL);
++ of = av_guess_format("swf", NULL, NULL);
+ } else if (strcmp(codec, "flv") == 0) {
+ ext = ".flv";
+- of = guess_format("flv", NULL, NULL);
++ of = av_guess_format("flv", NULL, NULL);
+ of->video_codec = CODEC_ID_FLV1;
+ } else if (strcmp(codec, "ffv1") == 0) {
+ ext = ".avi";
+- of = guess_format("avi", NULL, NULL);
++ of = av_guess_format("avi", NULL, NULL);
+ if (of) {
+ /* Use the FFMPEG Lossless Video codec (experimental!).
+ Requires strict_std_compliance to be <= -2 */
+@@ -295,7 +297,7 @@
+ }
+ } else if (strcmp(codec, "mov") == 0) {
+ ext = ".mov";
+- of = guess_format("mov", NULL, NULL);
++ of = av_guess_format("mov", NULL, NULL);
+ } else {
+ motion_log(LOG_ERR, 0, "ffmpeg_video_codec option value %s is not supported", codec);
+ return NULL;
+@@ -377,7 +379,7 @@
+
+ ffmpeg->c = c = AVSTREAM_CODEC_PTR(ffmpeg->video_st);
+ c->codec_id = ffmpeg->oc->oformat->video_codec;
+- c->codec_type = CODEC_TYPE_VIDEO;
++ c->codec_type = AVMEDIA_TYPE_VIDEO;
+ is_mpeg1 = c->codec_id == CODEC_ID_MPEG1VIDEO;
+
+ if (strcmp(ffmpeg_video_codec, "ffv1") == 0)
+@@ -646,7 +648,7 @@
+ if (ffmpeg->oc->oformat->flags & AVFMT_RAWPICTURE) {
+ /* raw video case. The API will change slightly in the near future for that */
+ #ifdef FFMPEG_AVWRITEFRAME_NEWAPI
+- pkt.flags |= PKT_FLAG_KEY;
++ pkt.flags |= AV_PKT_FLAG_KEY;
+ pkt.data = (uint8_t *)pic;
+ pkt.size = sizeof(AVPicture);
+ ret = av_write_frame(ffmpeg->oc, &pkt);
+@@ -667,7 +669,7 @@
+ #ifdef FFMPEG_AVWRITEFRAME_NEWAPI
+ pkt.pts = AVSTREAM_CODEC_PTR(ffmpeg->video_st)->coded_frame->pts;
+ if (AVSTREAM_CODEC_PTR(ffmpeg->video_st)->coded_frame->key_frame) {
+- pkt.flags |= PKT_FLAG_KEY;
++ pkt.flags |= AV_PKT_FLAG_KEY;
+ }
+ pkt.data = ffmpeg->video_outbuf;
+ pkt.size = out_size;
diff --git a/community-staging/motion/linux-headers.patch b/community-staging/motion/linux-headers.patch
new file mode 100644
index 000000000..795c8aec5
--- /dev/null
+++ b/community-staging/motion/linux-headers.patch
@@ -0,0 +1,35 @@
+diff -urN motion-3.2.12-OLD/motion.h motion-3.2.12-NEW/motion.h
+--- motion-3.2.12-OLD/motion.h 2010-05-31 23:48:23.000000000 -0700
++++ motion-3.2.12-NEW/motion.h 2011-08-30 02:11:08.000000000 -0700
+@@ -40,7 +40,7 @@
+
+ #define _LINUX_TIME_H 1
+ #if !defined(WITHOUT_V4L) && !defined(BSD)
+-#include <linux/videodev.h>
++#include <libv4l1-videodev.h>
+ #endif
+
+ #include <pthread.h>
+diff -urN motion-3.2.12-OLD/track.c motion-3.2.12-NEW/track.c
+--- motion-3.2.12-OLD/track.c 2010-05-31 23:48:23.000000000 -0700
++++ motion-3.2.12-NEW/track.c 2011-08-30 23:05:09.000000000 -0700
+@@ -11,6 +11,7 @@
+ #include "motion.h"
+
+ #ifndef WITHOUT_V4L
++#include <linux/videodev2.h>
+ #include "pwc-ioctl.h"
+ #endif
+
+diff -urN motion-3.2.12-OLD/video.h motion-3.2.12-NEW/video.h
+--- motion-3.2.12-OLD/video.h 2010-05-31 23:48:23.000000000 -0700
++++ motion-3.2.12-NEW/video.h 2011-08-30 02:11:12.000000000 -0700
+@@ -12,7 +12,7 @@
+
+ #define _LINUX_TIME_H 1
+ #ifndef WITHOUT_V4L
+-#include <linux/videodev.h>
++#include <libv4l1-videodev.h>
+ #include <sys/mman.h>
+ #include "pwc-ioctl.h"
+ #endif
diff --git a/community-staging/motion/rc.motion b/community-staging/motion/rc.motion
new file mode 100644
index 000000000..5b4c65500
--- /dev/null
+++ b/community-staging/motion/rc.motion
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof -o %PPID /usr/bin/motion`
+case "$1" in
+ start)
+ stat_busy "Starting Motion"
+ mkdir -p /var/run/motion
+ [ -z "$PID" ] && /usr/bin/motion 1>/dev/null 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon motion
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping Motion"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon motion
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ sleep 3
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0