summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--media-video/motion/ChangeLog181
-rw-r--r--media-video/motion/Manifest19
-rw-r--r--media-video/motion/files/ffmpeg08.patch53
-rw-r--r--media-video/motion/files/ffmpeg1.patch122
-rw-r--r--media-video/motion/files/motion-3.2.12-workaround-v4l1_deprecation.patch35
-rw-r--r--media-video/motion/files/motion.confd4
-rw-r--r--media-video/motion/files/motion.initd-r239
-rw-r--r--media-video/motion/metadata.xml8
-rw-r--r--media-video/motion/motion-9999.ebuild70
9 files changed, 531 insertions, 0 deletions
diff --git a/media-video/motion/ChangeLog b/media-video/motion/ChangeLog
new file mode 100644
index 0000000..aa215de
--- /dev/null
+++ b/media-video/motion/ChangeLog
@@ -0,0 +1,181 @@
+# ChangeLog for media-video/motion
+# Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/motion/ChangeLog,v 1.42 2013/02/15 19:17:27 aballier Exp $
+
+ 15 Feb 2013; Alexis Ballier <aballier@gentoo.org> +files/ffmpeg1.patch,
+ motion-3.2.12-r2.ebuild:
+ Fix build with ffmpeg-1. Disable mpeg1 append code based on the ffurl API as
+ mpeg1 is blacklisted with
+ new ffmpeg versions in this code anyway.
+
+ 09 Jun 2012; Zac Medico <zmedico@gentoo.org> motion-3.2.12-r2.ebuild:
+ inherit user for enewuser
+
+ 16 Jan 2012; Samuli Suominen <ssuominen@gentoo.org> -motion-3.2.12-r1.ebuild:
+ old
+
+ 16 Jan 2012; Samuli Suominen <ssuominen@gentoo.org> motion-3.2.12-r2.ebuild:
+ amd64/x86 stable
+
+*motion-3.2.12-r2 (10 Dec 2011)
+
+ 10 Dec 2011; Samuli Suominen <ssuominen@gentoo.org> +motion-3.2.12-r2.ebuild,
+ +files/motion-3.2.12-workaround-v4l1_deprecation.patch:
+ Since motion doesn't separate v4l1 and v4l2 support, use the
+ libv4l1-videodev.h include from libv4l to allow succesful compilation of both
+ backends. This should be only temporary workaround since upstream has
+ separated the backends in version control. See bug 376225.
+
+ 03 Dec 2011; Alexis Ballier <aballier@gentoo.org> +files/ffmpeg08.patch,
+ motion-3.2.12-r1.ebuild:
+ fix build with ffmpeg 0.8, bug #392695
+
+ 14 Nov 2011; Samuli Suominen <ssuominen@gentoo.org> -motion-3.2.11.1.ebuild,
+ -motion-3.2.12.ebuild, -files/motion.init-r1, -files/motion.initd:
+ old
+
+ 06 Oct 2011; Samuli Suominen <ssuominen@gentoo.org> motion-3.2.12-r1.ebuild:
+ amd64 stable wrt #385359
+
+*motion-3.2.12-r1 (02 Oct 2011)
+
+ 02 Oct 2011; Samuli Suominen <ssuominen@gentoo.org> +motion-3.2.12-r1.ebuild,
+ +files/motion.initd-r2:
+ Use more recent s-s-d syntax wrt #380279 by Tom Hendrikx
+
+*motion-3.2.12 (19 May 2011)
+
+ 19 May 2011; Samuli Suominen <ssuominen@gentoo.org> +motion-3.2.12.ebuild,
+ +files/motion.initd:
+ Version bump. Create /var/run/motion from init script instead of ebuild wrt
+ #332633. Don't (temporarily) enable v4l if linux-headers >= 2.6.38 wrt
+ #361509. Use virtual/ffmpeg wrt #362145.
+
+ 30 Mar 2011; Michael Weber <xmw@gentoo.org> motion-3.2.11.1.ebuild:
+ added ~arm (bug 302981)
+
+ 19 Jan 2011; Dror Levin <spatz@gentoo.org> motion-3.2.11.1.ebuild:
+ Change dep to virtual/jpeg, bug 347977.
+
+ 17 Jun 2010; Patrick Lauer <patrick@gentoo.org> motion-3.2.11.1.ebuild:
+ Migrating away from deprecated postgres virtuals
+
+ 26 Jan 2010; Patrick Lauer <patrick@gentoo.org> motion-3.2.11.1.ebuild:
+ Fixing postgres dep for #300908
+
+ 19 Jan 2010; Samuli Suominen <ssuominen@gentoo.org>
+ motion-3.2.11.1.ebuild:
+ Rename conflicting type of jpeg_mem_dest for jpeg-8.
+
+ 23 Oct 2009; Samuli Suominen <ssuominen@gentoo.org>
+ motion-3.2.11.1.ebuild:
+ amd64 stable wrt #288276
+
+*motion-3.2.11.1 (09 Oct 2009)
+
+ 09 Oct 2009; Samuli Suominen <ssuominen@gentoo.org>
+ +motion-3.2.11.1.ebuild:
+ Version bump wrt #287506, thanks to Markus for reporting.
+
+ 19 Dec 2008; Peter Volkov <pva@gentoo.org> motion-3.2.11.ebuild:
+ Removed || die after enewuser, bug #237299.
+
+ 22 Nov 2008; Markus Meier <maekke@gentoo.org> motion-3.2.11.ebuild:
+ amd64 stable, bug #245527
+
+ 04 Nov 2008; Peter Alfredsen <loki_val@gentoo.org> motion-3.2.11.ebuild:
+ 3.2.11 will work with new AND old ffmpeg. Thanks aballier.
+
+ 04 Nov 2008; Peter Alfredsen <loki_val@gentoo.org> motion-3.2.10.1.ebuild,
+ motion-3.2.11.ebuild:
+ Fix ffmpeg dependencies in preparation for ffmpeg bump.
+
+*motion-3.2.11 (14 Oct 2008)
+
+ 14 Oct 2008; Alexis Ballier <aballier@gentoo.org>
+ +files/motion-3.2.11-offsett.patch, +motion-3.2.11.ebuild:
+ version bump
+
+ 14 Oct 2008; Alexis Ballier <aballier@gentoo.org>
+ -files/motion-3.2.4-ffmpeg-compat.patch,
+ -files/motion-3.2.9-asneeded.patch, -files/motion.init,
+ -motion-3.2.4.ebuild, -motion-3.2.7.ebuild, -motion-3.2.8.ebuild,
+ -motion-3.2.9.ebuild:
+ remove old
+
+ 22 Jun 2008; Markus Meier <maekke@gentoo.org> motion-3.2.10.1.ebuild:
+ amd64 stable, bug #227053
+
+*motion-3.2.10.1 (20 Jun 2008)
+
+ 20 Jun 2008; Alexis Ballier <aballier@gentoo.org>
+ +files/motion-3.2.10.1-asneeded.patch,
+ +files/motion-3.2.10.1-ffmpegheaders.patch, +motion-3.2.10.1.ebuild:
+ version bump for bug #227053 and add compatibility with older ffmpegs
+
+ 21 May 2008; Tiziano Müller <dev-zero@gentoo.org> motion-3.2.4.ebuild,
+ motion-3.2.7.ebuild, motion-3.2.8.ebuild, motion-3.2.9.ebuild:
+ Changed dependency for postgresql from dev-db/postgresql to
+ virtual/postgresql-server
+
+*motion-3.2.9 (19 Nov 2007)
+
+ 19 Nov 2007; Alexis Ballier <aballier@gentoo.org>
+ +files/motion-3.2.9-asneeded.patch, +files/motion.confd,
+ +files/motion.init-r1, +motion-3.2.9.ebuild:
+ version bump, tune a bit init script to let it run as non root, bug #157913
+
+ 19 Oct 2007; Samuli Suominen <drac@gentoo.org> files/motion.init:
+ Add after mysql statement to init script wrt #168777.
+
+*motion-3.2.8 (19 Oct 2007)
+
+ 19 Oct 2007; Samuli Suominen <drac@gentoo.org> +motion-3.2.8.ebuild:
+ Version bump.
+
+ 28 Apr 2007; Torsten Veller <tove@gentoo.org> motion-3.2.4.ebuild:
+ Use newinitd
+
+ 31 Mar 2007; Alexis Ballier <aballier@gentoo.org> -motion-3.1.19.ebuild:
+ Cleanup old version
+
+ 05 Jan 2007; Diego Pettenò <flameeyes@gentoo.org> motion-3.2.4.ebuild,
+ motion-3.2.7.ebuild:
+ Convert to use elog.
+
+ 23 Nov 2006; Francesco Riosa <vivo@gentoo.org> motion-3.2.4.ebuild,
+ motion-3.2.7.ebuild:
+ dev-db/mysql => virtual/mysql
+
+*motion-3.2.7 (21 Oct 2006)
+
+ 21 Oct 2006; Alexis Ballier <aballier@gentoo.org> +motion-3.2.7.ebuild:
+ Version bump, thanks to Nathan Sullivan & Gunnar Skjold, bug #144000
+
+ 21 Oct 2006; Alexis Ballier <aballier@gentoo.org>
+ +files/motion-3.2.4-ffmpeg-compat.patch, motion-3.2.4.ebuild:
+ Adding a patch to compile with ffmpeg 0.4.9, bug #149400
+
+ 04 Sep 2006; <malc@gentoo.org> motion-3.2.4.ebuild:
+ Stable on amd64 - thanks to angelos(AT) for bug #146258
+
+*motion-3.2.4 (30 May 2006)
+
+ 30 May 2006; Luca Barbato <lu_zero@gentoo.org> +files/motion.init,
+ +motion-3.2.4.ebuild:
+ New version, ebuild kindly provided by Marko Djukic <djukic@gmail.com> and
+ Andreas Hinterland <ich@meister-rohrfix.de> in bug #107650
+
+ 03 May 2006; Diego Pettenò <flameeyes@gentoo.org> metadata.xml:
+ Update metadata to list media-video@gentoo.org as maintainer.
+
+ 19 May 2005; Jan Brinkmann <luckyduck@gentoo.org> +metadata.xml,
+ motion-3.1.19.ebuild:
+ added ~amd64 to KEYWORDS, fixes #93110
+
+ 30 Apr 2005; Bryan Østergaard <kloeri@gentoo.org> motion-3.1.19.ebuild:
+ ~alpha keyword, bug 89340.
+
+* motion-3.1.19 (08 Apr 2005):
+ 08 Apr 2005 - Pieter Van den Abeele <pvdabeel@gentoo.org> : motion-3.1.19.ebuild
+ New package
diff --git a/media-video/motion/Manifest b/media-video/motion/Manifest
new file mode 100644
index 0000000..b5659f1
--- /dev/null
+++ b/media-video/motion/Manifest
@@ -0,0 +1,19 @@
+-----BEGIN PGP SIGNED MESSAGE-----
+Hash: SHA256
+
+AUX ffmpeg08.patch 2118 SHA256 98522037700b1b437c217f31fdade69fa3d407eba8593903e9e0057ac040b299 SHA512 0968d6b698834bfcc409085ef79da64b14623c0a14062e363355a25f5e4c7b447cc974970dafda40717d78e689e560ac8e094ef1dcec5b714f8f0fc4819ebed6 WHIRLPOOL 6890a42529a73e395640c91067f1e4742ac24df589a3ddfce718bc4232078a3f31915098743d77afcba154332490c7f2f39606c9ae30a779ecaad684eb28c422
+AUX ffmpeg1.patch 4370 SHA256 5a11fe115253e6681087e8b09feaeac06a048eedb62c5d97f0b322d333f2ff5b SHA512 36bcc4f7a74a560020e88e660fa109c081ad25887351a4cc3afb8287ec4a6a1c527e5e9b75534c4879aef93aaa210b27cc0d84434f619d09ebaf0cb8b412fd94 WHIRLPOOL ee4edbf013425ad6ad6bbd2e198c71e5128a8d3779d2800a370fa0d286015ed18438dfb0d73c673e519c9f7d188a60f778d1e25b4ca4acc8ba1166022c8bdb46
+AUX motion-3.2.12-workaround-v4l1_deprecation.patch 786 SHA256 70791141dfd39b3c52a4707720c934d12f455ac8328bfef18429e973a89695fe SHA512 f1ec270bf7ccf1328310ea055300cea76fe5c3f53b4567c2058eddf1083687047bf3820c93d9ca03223b3db426e95a0d2df236fad15ab8121456ec5db122f0c7 WHIRLPOOL ca77a0e8aa04119a99ee1a983a2cb964e32f8b61b2369eff192e7eb83af9d7448e032357a7329206bbd0c6054a129ab68566e8912c91b5d8cbe3c990c4339934
+AUX motion.confd 99 SHA256 c43ac28bcf76d96b105a03d0d3685688c5f731894bf68a501706681bba76b060 SHA512 b0135b220ac2f1857012455726fb5c5aaa73a79f864619cb7fbfbb1e8aaf95b0c4dd51bbc30f29714cc29a271f9196f3d92e160fa75a90ccbcf0024640620d5d WHIRLPOOL fc69fca880a1f6b53d216b2ca7ffba73041f696e64a9df6986ec98bc49306d0770d8b7164c17c1961bb5300cc5bb4c7665d0aad5418f2645cf1cb561743774ee
+AUX motion.initd-r2 904 SHA256 a862507d2b0096efca041768a21ebeaac1733211aa008ebacc73fd4c214be6e0 SHA512 5fc1c01fa4dad1db6ee205cc22aad5aedfc4ba0ba9947ab87705b77a10be1325d15cf815b1758c656f259427e01456bbf8a7299d17182ea4e91fdaff746f9757 WHIRLPOOL 65dd450d49cb4a50486d02e6c9b4881bcb282dfdda79566ae56f27b48ba90e200853672e6d356d0975b075c1aa7eec0a9954ed8af7cc2c5eb5b2a216dece1f10
+DIST motion-3.2.12.tar.gz 425729 SHA256 a597f8d7ec0bf3c5fb62722c4eead59717fe01c2ae0d256c642027cea74b2f0a SHA512 d44620f8865420da71ff1dc1e1d8ba8e5465b395f2cf3b2cc9a91d3d415694b26376a9f8e3a1b78ffd0efde22d9e0338daa77237aed38c060dc3577af4c0864c WHIRLPOOL 0b7618d48161e8ffefacc5331d1078004d87839b532100c37bfaf06e99772921228feea6eea063301dfdc9e5f5a1dc07fd0847858440c6f876c1e03deaa078c8
+EBUILD motion-3.2.12-r2.ebuild 1761 SHA256 bf999f8806b503e55f12253a36cb740d9c27a24bbe4567c8de6765b1ecfa37f3 SHA512 1b65675529ae9cb98418f0ca154bb3562a1af0d9759e49e60caee8756f7b3fa5ebd7914a922264530213f70766c20b7dfb1021829bff04c87211e47d95357957 WHIRLPOOL a1d7c001841e76543d5e4c916bc99901350cfd0a789d661ffb18e8abb1a3e3090edeb8158d2006fc3547106eb20f5584699ba8482262612eb506f09779c5a62b
+MISC ChangeLog 6680 SHA256 06f1c314f7ae8f6b0af02f1ac9f206a9c977114a7f8dd28a5c01b47e9841ac03 SHA512 2aafdac943ec860bb5980c24a15174f4187e5b17a9c19bb797ff4fec7ba18cbd5ed1d74eedea9b7de94ca8f927a4ed22380b919bd6beebe73500361060f94338 WHIRLPOOL ee01889705241bdf98bb889d6d91cb48ef7cc0cc8c00f5dcd26e7c76d7e8e5481ae104500693495fbf1dc366d6b30c1f6c85de391a2f3f933f27103353829fb8
+MISC metadata.xml 223 SHA256 dd48e823ec9a151bc3611121402ed26ee24eb3304aa62870b1e875a8fa0ac812 SHA512 cacba929b8688a7270637f34d348216fdeb89e725cdee4b40e5577ca3f626c5f72e73c1c125605a284506aff47265f41e3fedaa76ed4074c540fc1f200e6d494 WHIRLPOOL dcd04d57abcfe2704036097ed68500917f74b7024b46580e9054e1c933d55678992c350fe07ff0efd590b9345fbcdd81665b8ce546f786dd31f5a0f4eb654da3
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v2.0.19 (GNU/Linux)
+
+iEYEAREIAAYFAlEeicgACgkQvFcC4BYPU0ozLACfft0Y9G7/IuOj3y4dPuvYOwIa
++ZUAn1QJ0jOSQyXpu8LqqS26Zp49pteY
+=Knhp
+-----END PGP SIGNATURE-----
diff --git a/media-video/motion/files/ffmpeg08.patch b/media-video/motion/files/ffmpeg08.patch
new file mode 100644
index 0000000..f6743e3
--- /dev/null
+++ b/media-video/motion/files/ffmpeg08.patch
@@ -0,0 +1,53 @@
+Index: motion-3.2.12/ffmpeg.c
+===================================================================
+--- motion-3.2.12.orig/ffmpeg.c
++++ motion-3.2.12/ffmpeg.c
+@@ -60,6 +60,10 @@
+ */
+ #define APPEND_PROTO "appfile"
+
++#ifndef guess_format
++#define guess_format av_guess_format
++#endif
++
+ /* Some forward-declarations. */
+ void ffmpeg_put_frame(struct ffmpeg *, AVFrame *);
+ void ffmpeg_cleanups(struct ffmpeg *);
+@@ -228,7 +232,9 @@ void ffmpeg_init()
+ mpeg1_file_protocol.url_close = file_protocol.url_close;
+
+ /* Register the append file protocol. */
+-#if LIBAVFORMAT_BUILD >= (52<<16 | 31<<8)
++#if LIBAVFORMAT_BUILD >= (53<<16 )
++ av_register_protocol2(&mpeg1_file_protocol, sizeof(mpeg1_file_protocol));
++#elif LIBAVFORMAT_BUILD >= (52<<16 | 31<<8)
+ av_register_protocol(&mpeg1_file_protocol);
+ #else
+ register_protocol(&mpeg1_file_protocol);
+@@ -377,7 +383,7 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_
+
+ 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 +652,7 @@ void ffmpeg_put_frame(struct ffmpeg *ffm
+ 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 +673,7 @@ void ffmpeg_put_frame(struct ffmpeg *ffm
+ #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/media-video/motion/files/ffmpeg1.patch b/media-video/motion/files/ffmpeg1.patch
new file mode 100644
index 0000000..c7d114b
--- /dev/null
+++ b/media-video/motion/files/ffmpeg1.patch
@@ -0,0 +1,122 @@
+Convert to avio API.
+Disable mpeg1 append code based or the ffurl API as mpeg1 is blacklisted with
+new ffmpeg versions in this code anyway.
+Fix build with ffmpeg-1
+
+Index: motion-3.2.12/ffmpeg.c
+===================================================================
+--- motion-3.2.12.orig/ffmpeg.c
++++ motion-3.2.12/ffmpeg.c
+@@ -73,6 +73,7 @@ AVFrame *ffmpeg_prepare_frame(struct ffm
+ /* This is the trailer used to end mpeg1 videos. */
+ static unsigned char mpeg1_trailer[] = {0x00, 0x00, 0x01, 0xb7};
+
++#ifndef FFMPEG_NO_NONSTD_MPEG1
+ /* Append version of the file open function used in libavformat when opening
+ * an ordinary file. The original file open function truncates an existing
+ * file, but this version appends to it instead.
+@@ -118,6 +119,7 @@ URLProtocol mpeg1_file_protocol = {
+ .url_open = file_open_append
+ };
+
++#endif
+
+ #ifdef HAVE_FFMPEG_NEW
+
+@@ -132,6 +134,7 @@ URLProtocol mpeg1_file_protocol = {
+ #include "avstring.h"
+ #endif
+
++#ifndef FFMPEG_NO_NONSTD_MPEG1
+ static int file_open(URLContext *h, const char *filename, int flags)
+ {
+ int access_flags, fd;
+@@ -195,6 +198,7 @@ URLProtocol file_protocol = {
+ };
+
+ #endif
++#endif
+
+
+ /* We set AVOutputFormat->write_trailer to this function for mpeg1. That way,
+@@ -203,8 +207,8 @@ URLProtocol file_protocol = {
+ static int mpeg1_write_trailer(AVFormatContext *s)
+ {
+ #if LIBAVFORMAT_BUILD >= (52<<16)
+- put_buffer(s->pb, mpeg1_trailer, 4);
+- put_flush_packet(s->pb);
++ avio_write(s->pb, mpeg1_trailer, 4);
++ avio_flush(s->pb);
+ #else
+ put_buffer(&s->pb, mpeg1_trailer, 4);
+ put_flush_packet(&s->pb);
+@@ -226,6 +230,7 @@ void ffmpeg_init()
+ /* Copy the functions to use for the append file protocol from the standard
+ * file protocol.
+ */
++#ifndef FFMPEG_NO_NONSTD_MPEG1
+ mpeg1_file_protocol.url_read = file_protocol.url_read;
+ mpeg1_file_protocol.url_write = file_protocol.url_write;
+ mpeg1_file_protocol.url_seek = file_protocol.url_seek;
+@@ -239,6 +244,7 @@ void ffmpeg_init()
+ #else
+ register_protocol(&mpeg1_file_protocol);
+ #endif
++#endif
+ }
+
+ /* Obtains the output format used for the specified codec. For mpeg4 codecs,
+@@ -422,13 +428,6 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_
+ c->flags |= CODEC_FLAG_GLOBAL_HEADER;
+ }
+
+- /* set the output parameters (must be done even if no parameters). */
+- if (av_set_parameters(ffmpeg->oc, NULL) < 0) {
+- motion_log(LOG_ERR, 0, "ffmpeg av_set_parameters error: Invalid output format parameters");
+- ffmpeg_cleanups(ffmpeg);
+- return NULL;
+- }
+-
+ /* Dump the format settings. This shows how the various streams relate to each other */
+ //dump_format(ffmpeg->oc, 0, filename, 1);
+
+@@ -504,7 +503,7 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_
+ snprintf(file_proto, sizeof(file_proto), "%s", filename);
+
+
+- if (url_fopen(&ffmpeg->oc->pb, file_proto, URL_WRONLY) < 0) {
++ if (avio_open(&ffmpeg->oc->pb, file_proto, AVIO_FLAG_WRITE) < 0) {
+ /* path did not exist? */
+ if (errno == ENOENT) {
+ /* create path for file (don't use file_proto)... */
+@@ -514,7 +513,7 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_
+ }
+
+ /* and retry opening the file (use file_proto) */
+- if (url_fopen(&ffmpeg->oc->pb, file_proto, URL_WRONLY) < 0) {
++ if (avio_open(&ffmpeg->oc->pb, file_proto, AVIO_FLAG_WRITE) < 0) {
+ motion_log(LOG_ERR, 1, "url_fopen - error opening file %s",filename);
+ ffmpeg_cleanups(ffmpeg);
+ return NULL;
+@@ -535,7 +534,11 @@ struct ffmpeg *ffmpeg_open(char *ffmpeg_
+ }
+
+ /* write the stream header, if any */
+- av_write_header(ffmpeg->oc);
++ if(avformat_write_header(ffmpeg->oc, NULL) < 0) {
++ motion_log(LOG_ERR, 1, "Error while writing header for %s", filename);
++ ffmpeg_cleanups(ffmpeg);
++ return NULL;
++ }
+
+ return ffmpeg;
+ }
+@@ -602,7 +605,7 @@ void ffmpeg_close(struct ffmpeg *ffmpeg)
+ if (!(ffmpeg->oc->oformat->flags & AVFMT_NOFILE)) {
+ /* close the output file */
+ #if LIBAVFORMAT_BUILD >= (52<<16)
+- url_fclose(ffmpeg->oc->pb);
++ avio_close(ffmpeg->oc->pb);
+ #else
+ url_fclose(&ffmpeg->oc->pb);
+ #endif /* LIBAVFORMAT_BUILD >= (52<<16) */
diff --git a/media-video/motion/files/motion-3.2.12-workaround-v4l1_deprecation.patch b/media-video/motion/files/motion-3.2.12-workaround-v4l1_deprecation.patch
new file mode 100644
index 0000000..04a18dc
--- /dev/null
+++ b/media-video/motion/files/motion-3.2.12-workaround-v4l1_deprecation.patch
@@ -0,0 +1,35 @@
+motion has both v4l1 and v4l2 support but they are not separate except in upstream version control.
+so, temporarily use the libv4l1-videodev.h from libv4l to allow succesful build of the v4l2 (pay attention here!) backend.
+
+--- motion.h
++++ motion.h
+@@ -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>
+--- track.c
++++ track.c
+@@ -11,6 +11,7 @@
+ #include "motion.h"
+
+ #ifndef WITHOUT_V4L
++#include <linux/videodev2.h>
+ #include "pwc-ioctl.h"
+ #endif
+
+--- video.h
++++ video.h
+@@ -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/media-video/motion/files/motion.confd b/media-video/motion/files/motion.confd
new file mode 100644
index 0000000..f79c97a
--- /dev/null
+++ b/media-video/motion/files/motion.confd
@@ -0,0 +1,4 @@
+# Set the user and group under which motion will be ran
+
+MOTION_USER="motion"
+MOTION_GROUP="video"
diff --git a/media-video/motion/files/motion.initd-r2 b/media-video/motion/files/motion.initd-r2
new file mode 100644
index 0000000..2e0b120
--- /dev/null
+++ b/media-video/motion/files/motion.initd-r2
@@ -0,0 +1,39 @@
+#!/sbin/runscript
+# Copyright 1999-2011 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/motion/files/motion.initd-r2,v 1.1 2011/10/02 18:48:35 ssuominen Exp $
+
+extra_started_commands="reload"
+
+_create_motion_run_dir() {
+ local dir="/var/run/motion"
+ if ! [ -d "$dir" ]; then
+ mkdir -p -m750 "$dir"
+ chown ${MOTION_USER}:${MOTION_GROUP} "$dir"
+ fi
+}
+
+depend() {
+ need modules
+ after mysql
+}
+
+start() {
+ _create_motion_run_dir
+
+ ebegin "Starting motion detection"
+ start-stop-daemon --start -u ${MOTION_USER} -g ${MOTION_GROUP} --quiet --exec /usr/bin/motion
+ eend $?
+}
+
+stop() {
+ ebegin "Stopping motion detection"
+ start-stop-daemon --stop --quiet --exec /usr/bin/motion
+ eend $?
+}
+
+reload() {
+ ebegin "Reloading motion detection configuration"
+ start-stop-daemon --stop --signal HUP --exec /usr/bin/motion
+ eend $?
+}
diff --git a/media-video/motion/metadata.xml b/media-video/motion/metadata.xml
new file mode 100644
index 0000000..edccfe5
--- /dev/null
+++ b/media-video/motion/metadata.xml
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+<herd>video</herd>
+<maintainer>
+<email>media-video@gentoo.org</email>
+</maintainer>
+</pkgmetadata>
diff --git a/media-video/motion/motion-9999.ebuild b/media-video/motion/motion-9999.ebuild
new file mode 100644
index 0000000..b23c6e7
--- /dev/null
+++ b/media-video/motion/motion-9999.ebuild
@@ -0,0 +1,70 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/motion/motion-3.2.12-r2.ebuild,v 1.4 2013/02/15 19:17:27 aballier Exp $
+
+EAPI=4
+inherit eutils user git-2
+
+EGIT_REPO_URI="git://github.com/sackmotion/motion.git"
+
+DESCRIPTION="A software motion detector"
+HOMEPAGE="http://www.lavrsen.dk/twiki/bin/view/Motion/WebHome"
+SRC_URI=""
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~alpha amd64 ~arm ~ppc x86"
+IUSE="ffmpeg mysql postgres +v4l"
+
+RDEPEND="sys-libs/zlib
+ virtual/jpeg
+ ffmpeg? ( virtual/ffmpeg )
+ mysql? ( virtual/mysql )
+ postgres? ( dev-db/postgresql-base )"
+# note: libv4l is only in dependencies for the libv4l1-videodev.h header file
+# used by the -workaround-v4l1_deprecation.patch.
+DEPEND="${RDEPEND}
+ v4l? ( virtual/os-headers media-libs/libv4l )"
+
+pkg_setup() {
+ enewuser motion -1 -1 -1 video
+}
+
+#src_prepare() {
+# epatch \
+# "${FILESDIR}"/ffmpeg08.patch \
+# "${FILESDIR}"/ffmpeg1.patch \
+# "${FILESDIR}"/${P}-workaround-v4l1_deprecation.patch
+#}
+
+src_configure() {
+ econf \
+ $(use_with v4l) \
+ $(use_with ffmpeg) \
+ $(use_with mysql) \
+ $(use_with postgres pgsql)
+}
+
+src_install() {
+ emake \
+ DESTDIR="${D}" \
+ DOC='CHANGELOG CODE_STANDARD CREDITS FAQ README' \
+ docdir=/usr/share/doc/${PF} \
+ EXAMPLES='thread*.conf' \
+ examplesdir=/usr/share/doc/${PF}/examples \
+ install
+
+ dohtml *.html
+
+ newinitd "${FILESDIR}"/motion.initd-r2 motion
+ newconfd "${FILESDIR}"/motion.confd motion
+
+ mv -vf "${D}"/etc/motion{-dist,}.conf || die
+}
+
+pkg_postinst() {
+ elog "You need to setup /etc/motion.conf before running"
+ elog "motion for the first time."
+ elog "You can install motion detection as a service, use:"
+ elog "rc-update add motion default"
+}