summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMikle Kolyada <zlogene@gentoo.org>2015-08-10 13:19:27 +0300
committerMikle Kolyada <zlogene@gentoo.org>2015-08-10 13:20:42 +0300
commit5356a342d4ad09098a73f130105ff049c56318ce (patch)
tree3208c2bff25c4e3ed7a77dd0d2f77f5313a2aa9c /media-video/mjpg-streamer
parentdev-python/peewee bump, rm old (diff)
downloadgentoo-5356a342d4ad09098a73f130105ff049c56318ce.tar.gz
gentoo-5356a342d4ad09098a73f130105ff049c56318ce.tar.bz2
gentoo-5356a342d4ad09098a73f130105ff049c56318ce.zip
media-video/mjpg-streamer: Fix compatibility with kernels newer than 3.18 (bug 556402)
Package-Manager: portage-2.2.20
Diffstat (limited to 'media-video/mjpg-streamer')
-rw-r--r--media-video/mjpg-streamer/files/0_pre20120621-to-work-with-kernel-3.18.patch74
-rw-r--r--media-video/mjpg-streamer/mjpg-streamer-0_pre20120621-r1.ebuild76
2 files changed, 150 insertions, 0 deletions
diff --git a/media-video/mjpg-streamer/files/0_pre20120621-to-work-with-kernel-3.18.patch b/media-video/mjpg-streamer/files/0_pre20120621-to-work-with-kernel-3.18.patch
new file mode 100644
index 000000000000..5f16f4ab3f45
--- /dev/null
+++ b/media-video/mjpg-streamer/files/0_pre20120621-to-work-with-kernel-3.18.patch
@@ -0,0 +1,74 @@
+From 03796a1d930212aea460405b86cd41bea8fa5150 Mon Sep 17 00:00:00 2001
+From: Eric Lee <saintgimp@hotmail.com>
+Date: Thu, 26 Feb 2015 19:31:41 -0800
+Subject: [PATCH] Fix mjpg-streamer to work with kernel 3.18
+
+I didn't create this fix, it was originally posted to http://www.raspberrypi.org/forums/viewtopic.php?f=28&t=97983&p=681259. @koosvriezen tried to create a pull request #3 but made kind of a hash of it, so this is the same fix only a proper pull request.
+---
+ mjpg-streamer/plugins/input_uvc/input_uvc.c | 8 +++++---
+ mjpg-streamer/plugins/input_uvc/v4l2uvc.c | 2 ++
+ mjpg-streamer/plugins/input_uvc/v4l2uvc.h | 3 +++
+ 3 files changed, 10 insertions(+), 3 deletions(-)
+
+diff --git a/mjpg-streamer/plugins/input_uvc/input_uvc.c b/mjpg-streamer/plugins/input_uvc/input_uvc.c
+index c0b2d10..ef264e9 100644
+--- a/mjpg-streamer/plugins/input_uvc/input_uvc.c
++++ b/mjpg-streamer/plugins/input_uvc/input_uvc.c
+@@ -405,9 +405,13 @@ void *cam_thread(void *arg)
+ if(pcontext->videoIn->formatIn == V4L2_PIX_FMT_YUYV) {
+ DBG("compressing frame from input: %d\n", (int)pcontext->id);
+ pglobal->in[pcontext->id].size = compress_yuyv_to_jpeg(pcontext->videoIn, pglobal->in[pcontext->id].buf, pcontext->videoIn->framesizeIn, gquality);
++ /* copy this frame's timestamp to user space */
++ pglobal->in[pcontext->id].timestamp = pcontext->videoIn->buf.timestamp;
+ } else {
+ DBG("copying frame from input: %d\n", (int)pcontext->id);
+- pglobal->in[pcontext->id].size = memcpy_picture(pglobal->in[pcontext->id].buf, pcontext->videoIn->tmpbuffer, pcontext->videoIn->buf.bytesused);
++ pglobal->in[pcontext->id].size = memcpy_picture(pglobal->in[pcontext->id].buf, pcontext->videoIn->tmpbuffer, pcontext->videoIn->tmpbytesused);
++ /* copy this frame's timestamp to user space */
++ pglobal->in[pcontext->id].timestamp = pcontext->videoIn->tmptimestamp;
+ }
+
+ #if 0
+@@ -418,8 +422,6 @@ void *cam_thread(void *arg)
+ prev_size = global->size;
+ #endif
+
+- /* copy this frame's timestamp to user space */
+- pglobal->in[pcontext->id].timestamp = pcontext->videoIn->buf.timestamp;
+
+ /* signal fresh_frame */
+ pthread_cond_broadcast(&pglobal->in[pcontext->id].db_update);
+diff --git a/mjpg-streamer/plugins/input_uvc/v4l2uvc.c b/mjpg-streamer/plugins/input_uvc/v4l2uvc.c
+index 48fd189..329233b 100644
+--- a/mjpg-streamer/plugins/input_uvc/v4l2uvc.c
++++ b/mjpg-streamer/plugins/input_uvc/v4l2uvc.c
+@@ -450,6 +450,8 @@ int uvcGrab(struct vdIn *vd)
+ */
+
+ memcpy(vd->tmpbuffer, vd->mem[vd->buf.index], vd->buf.bytesused);
++ vd->tmpbytesused = vd->buf.bytesused;
++ vd->tmptimestamp = vd->buf.timestamp;
+
+ if(debug)
+ fprintf(stderr, "bytes in used %d \n", vd->buf.bytesused);
+diff --git a/mjpg-streamer/plugins/input_uvc/v4l2uvc.h b/mjpg-streamer/plugins/input_uvc/v4l2uvc.h
+index d5296fc..0e3f99f 100644
+--- a/mjpg-streamer/plugins/input_uvc/v4l2uvc.h
++++ b/mjpg-streamer/plugins/input_uvc/v4l2uvc.h
+@@ -28,6 +28,7 @@
+
+
+ #include <stdio.h>
++#include <stdint.h>
+ #include <string.h>
+ #include <fcntl.h>
+ #include <unistd.h>
+@@ -105,6 +106,8 @@ struct vdIn {
+ int framecount;
+ int recordstart;
+ int recordtime;
++ uint32_t tmpbytesused;
++ struct timeval tmptimestamp;
+ };
+
+ /* context of each camera thread */
diff --git a/media-video/mjpg-streamer/mjpg-streamer-0_pre20120621-r1.ebuild b/media-video/mjpg-streamer/mjpg-streamer-0_pre20120621-r1.ebuild
new file mode 100644
index 000000000000..76fc2e3a86c8
--- /dev/null
+++ b/media-video/mjpg-streamer/mjpg-streamer-0_pre20120621-r1.ebuild
@@ -0,0 +1,76 @@
+# Copyright 1999-2012 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Header: /var/cvsroot/gentoo-x86/media-video/mjpg-streamer/mjpg-streamer-0_pre20120421.ebuild,v 1.1 2012/04/23 10:00:59 aidecoe Exp $
+
+EAPI=4
+
+inherit eutils
+
+DESCRIPTION="MJPG-streamer takes JPGs from Linux-UVC compatible webcams"
+HOMEPAGE="http://sourceforge.net/projects/mjpg-streamer"
+SRC_URI="http://dev.gentoo.org/~aidecoe/distfiles/${CATEGORY}/${PN}/${P}.tar.bz2"
+
+LICENSE="GPL-2"
+SLOT="0"
+KEYWORDS="~x86 ~amd64"
+
+INPUT_PLUGINS="input_testpicture input_control input_file input_uvc"
+OUTPUT_PLUGINS="output_file output_udp output_http output_autofocus output_rtsp"
+IUSE_PLUGINS="${INPUT_PLUGINS} ${OUTPUT_PLUGINS}"
+IUSE="input_testpicture input_control +input_file input_uvc output_file
+ output_udp +output_http output_autofocus output_rtsp
+ www v4l"
+REQUIRED_USE="|| ( ${INPUT_PLUGINS} )
+ || ( ${OUTPUT_PLUGINS} )
+ v4l? ( input_uvc )"
+
+RDEPEND="virtual/jpeg
+ v4l? ( input_uvc? ( media-libs/libv4l ) )"
+DEPEND="${RDEPEND}
+ input_testpicture? ( media-gfx/imagemagick )"
+
+src_prepare() {
+ epatch "${FILESDIR}/${PV}-make-var-instead-of-cmd.patch"
+ epatch "${FILESDIR}/${PV}-to-work-with-kernel-3.18.patch"
+
+
+ local flag switch
+
+ for flag in ${IUSE_PLUGINS}; do
+ use ${flag} && switch='' || switch='#'
+ sed -i \
+ -e "s|^#*PLUGINS +\?= ${flag}.so|${switch}PLUGINS += ${flag}.so|" \
+ Makefile
+ done
+}
+
+src_compile() {
+ local v4l=$(use v4l && use input_uvc && echo 'USE_LIBV4L2=true')
+ emake ${v4l}
+}
+
+src_install() {
+ into /usr
+ dobin ${PN//-/_}
+ dolib.so *.so
+
+ if use www ; then
+ insinto /usr/share/${PN}
+ doins -r www
+ fi
+
+ dodoc README TODO
+
+ newinitd "${FILESDIR}"/${PN}.initd ${PN}
+ newconfd "${FILESDIR}"/${PN}.confd ${PN}
+}
+
+pkg_postinst() {
+ elog "Remember to set an input and output plugin for mjpg-streamer."
+
+ if use www ; then
+ echo
+ elog "An example webinterface has been installed into"
+ elog "/usr/share/mjpg-streamer/www for your usage."
+ fi
+}