Add media-video/v4l2loopback-0.12.3{,-r1}
authorStefan Huber <shuber@sthu.org>
Sun, 15 Mar 2020 12:13:12 +0000 (13:13 +0100)
committerStefan Huber <shuber@sthu.org>
Sun, 15 Mar 2020 12:45:01 +0000 (13:45 +0100)
media-video/v4l2loopback/Manifest [new file with mode: 0644]
media-video/v4l2loopback/files/use-v4l2-buffer-ptr-instead-timeval.patch [new file with mode: 0644]
media-video/v4l2loopback/v4l2loopback-0.12.3-r1.ebuild [new file with mode: 0644]
media-video/v4l2loopback/v4l2loopback-0.12.3.ebuild [new file with mode: 0644]

diff --git a/media-video/v4l2loopback/Manifest b/media-video/v4l2loopback/Manifest
new file mode 100644 (file)
index 0000000..7a8d58f
--- /dev/null
@@ -0,0 +1,4 @@
+AUX use-v4l2-buffer-ptr-instead-timeval.patch 2276 BLAKE2B 65de87fccc14b8401f33ad26b907e522a2167ff0bcbd66d92d6e92863b888558492ed958a59600ebdc391f525d2ba13e2f44033a8558a19956c45f3433231d15 SHA512 558eada721cbc2cf6ce9bc1aec0e1165d6cd46ac8151da404d551fe0bea5994e242f1af77699a0de554bff7e3ef835e458958037b8ee3c429448f024d7525a84
+DIST v4l2loopback-0.12.3.tar.gz 49060 BLAKE2B 6caa3d8fed14beea599d05a18ea0cbcc2e1522fb32dcf80b35d1de057a8a2ea4239da2f123acf9969f571d32e6696fa8d12b81c877ca5b1aa31d84b6ab5c27da SHA512 0d2af7fa86d0730d227f067dc53c281817eea327f707fea2b60386afde39ff094dd8197f39fb140685e4e3024f0730f3e5185dea3da5224195e4cb50faa846b6
+EBUILD v4l2loopback-0.12.3-r1.ebuild 1233 BLAKE2B e8351fe1960841257b1907531b6b0f8ec21f272e93fe795424590153205cc290f0f40b740d6f55971d8c1c185211f89f99dc6f2062f59fb55ec405d12e50db92 SHA512 b61833059f4d555fbbca604648bc28bc340cbb231ff955adb13b10ad0b2e59c7ca938be45fac6fc6b1fd19fbab8e55a2d24b8fc395bb5b00c60b2ea5c5b0d72e
+EBUILD v4l2loopback-0.12.3.ebuild 1169 BLAKE2B 771848ef1c1dd15b476ca46ee428bb79ab6de769c6e28aae921ad1b87748b33807fdfb220bfd6a1ef3d96dda9f42339b728e0afd60aa1c782f4f531f4c4a6c3f SHA512 ad478be0b415fbd2dc13a100f614766ad3bb77478bef1834cdc7326fee7bec0e747775082b97e6ec26b1bdb5429ab91ebbc3c46dc17c481f02b618273c25bb83
diff --git a/media-video/v4l2loopback/files/use-v4l2-buffer-ptr-instead-timeval.patch b/media-video/v4l2loopback/files/use-v4l2-buffer-ptr-instead-timeval.patch
new file mode 100644 (file)
index 0000000..6e95ea3
--- /dev/null
@@ -0,0 +1,61 @@
+commit d7b657802c109ece5195208db26059921d2d6ebe
+Author: Alex Xu (Hello71) <alex_y_xu@yahoo.ca>
+Date:   Fri Jan 31 22:04:36 2020 -0500
+
+    use v4l2_buffer ptr instead of timeval
+    
+    577c89b0ce726e44c08c396d14f84a00070a57b7 changes timestamp to type
+    __kernel_v4l2_timeval. use v4l2_buffer instead of raw timeval for better
+    compatibility.
+
+diff --git a/v4l2loopback.c b/v4l2loopback.c
+index f43f98c..4f43a73 100644
+--- a/v4l2loopback.c
++++ b/v4l2loopback.c
+@@ -134,7 +134,7 @@ void *v4l2l_vzalloc(unsigned long size)
+ # define v4l2l_vzalloc vzalloc
+ #endif
+-static inline void v4l2l_get_timestamp(struct timeval *tv) {
++static inline void v4l2l_get_timestamp(struct v4l2_buffer *b) {
+       /* ktime_get_ts is considered deprecated, so use ktime_get_ts64 if possible */
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
+       struct timespec ts;
+@@ -144,8 +144,8 @@ static inline void v4l2l_get_timestamp(struct timeval *tv) {
+       ktime_get_ts64(&ts);
+ #endif
+-      tv->tv_sec = (time_t)ts.tv_sec;
+-      tv->tv_usec = (suseconds_t)(ts.tv_nsec / NSEC_PER_USEC);
++      b->timestamp.tv_sec = (time_t)ts.tv_sec;
++      b->timestamp.tv_usec = (suseconds_t)(ts.tv_nsec / NSEC_PER_USEC);
+ }
+@@ -1520,7 +1520,7 @@ static int vidioc_qbuf(struct file *file, void *private_data, struct v4l2_buffer
+       case V4L2_BUF_TYPE_VIDEO_OUTPUT:
+               dprintkrw("output QBUF pos: %d index: %d\n", dev->write_position, index);
+               if (buf->timestamp.tv_sec == 0 && buf->timestamp.tv_usec == 0)
+-                      v4l2l_get_timestamp(&b->buffer.timestamp);
++                      v4l2l_get_timestamp(&b->buffer);
+               else
+                       b->buffer.timestamp = buf->timestamp;
+               b->buffer.bytesused = buf->bytesused;
+@@ -1947,7 +1947,7 @@ static ssize_t v4l2_loopback_write(struct file *file,
+                       count);
+               return -EFAULT;
+       }
+-      v4l2l_get_timestamp(&b->timestamp);
++      v4l2l_get_timestamp(b);
+       b->bytesused = count;
+       b->sequence = dev->write_position;
+       buffer_written(dev, &dev->buffers[write_index]);
+@@ -2052,7 +2052,7 @@ static void init_buffers(struct v4l2_loopback_device *dev)
+               b->timestamp.tv_usec = 0;
+               b->type              = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+-              v4l2l_get_timestamp(&b->timestamp);
++              v4l2l_get_timestamp(b);
+       }
+       dev->timeout_image_buffer = dev->buffers[0];
+       dev->timeout_image_buffer.buffer.m.offset = MAX_BUFFERS * buffer_size;
diff --git a/media-video/v4l2loopback/v4l2loopback-0.12.3-r1.ebuild b/media-video/v4l2loopback/v4l2loopback-0.12.3-r1.ebuild
new file mode 100644 (file)
index 0000000..0e8a32a
--- /dev/null
@@ -0,0 +1,61 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit linux-mod toolchain-funcs
+
+case ${PV} in
+9999)
+       inherit git-r3
+       KEYWORDS=""
+       EGIT_REPO_URI="git://github.com/umlaeute/v4l2loopback.git"
+       ;;
+*)
+       inherit vcs-snapshot
+       KEYWORDS="~amd64 ~x86"
+       SNAPSHOT_COMMIT=""
+       SRC_URI="https://github.com/umlaeute/v4l2loopback/archive/${PV}.tar.gz -> ${P}.tar.gz"
+       ;;
+esac
+
+DESCRIPTION="v4l2 loopback device which output is it's own input"
+HOMEPAGE="https://github.com/umlaeute/v4l2loopback"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="examples"
+
+CONFIG_CHECK="VIDEO_DEV"
+MODULE_NAMES="v4l2loopback(video:)"
+BUILD_TARGETS="all"
+
+pkg_setup() {
+       linux-mod_pkg_setup
+       export KERNELRELEASE=${KV_FULL}
+}
+
+src_prepare() {
+       default
+       epatch "${FILESDIR}/use-v4l2-buffer-ptr-instead-timeval.patch"
+       sed -i -e 's/gcc /$(CC) /' examples/Makefile || die
+}
+
+src_compile() {
+       linux-mod_src_compile
+       if use examples; then
+               emake CC=$(tc-getCC) -C examples
+       fi
+}
+
+src_install() {
+       linux-mod_src_install
+       dosbin utils/v4l2loopback-ctl
+       dodoc doc/kernel_debugging.txt
+       dodoc doc/docs.txt
+       if use examples; then
+               dosbin examples/yuv4mpeg_to_v4l2
+               docinto examples
+               dodoc examples/{*.sh,*.c,Makefile}
+       fi
+}
diff --git a/media-video/v4l2loopback/v4l2loopback-0.12.3.ebuild b/media-video/v4l2loopback/v4l2loopback-0.12.3.ebuild
new file mode 100644 (file)
index 0000000..644122a
--- /dev/null
@@ -0,0 +1,60 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=6
+
+inherit linux-mod toolchain-funcs
+
+case ${PV} in
+9999)
+       inherit git-r3
+       KEYWORDS=""
+       EGIT_REPO_URI="git://github.com/umlaeute/v4l2loopback.git"
+       ;;
+*)
+       inherit vcs-snapshot
+       KEYWORDS="~amd64 ~x86"
+       SNAPSHOT_COMMIT=""
+       SRC_URI="https://github.com/umlaeute/v4l2loopback/archive/${PV}.tar.gz -> ${P}.tar.gz"
+       ;;
+esac
+
+DESCRIPTION="v4l2 loopback device which output is it's own input"
+HOMEPAGE="https://github.com/umlaeute/v4l2loopback"
+
+LICENSE="GPL-2"
+SLOT="0"
+IUSE="examples"
+
+CONFIG_CHECK="VIDEO_DEV"
+MODULE_NAMES="v4l2loopback(video:)"
+BUILD_TARGETS="all"
+
+pkg_setup() {
+       linux-mod_pkg_setup
+       export KERNELRELEASE=${KV_FULL}
+}
+
+src_prepare() {
+       default
+       sed -i -e 's/gcc /$(CC) /' examples/Makefile || die
+}
+
+src_compile() {
+       linux-mod_src_compile
+       if use examples; then
+               emake CC=$(tc-getCC) -C examples
+       fi
+}
+
+src_install() {
+       linux-mod_src_install
+       dosbin utils/v4l2loopback-ctl
+       dodoc doc/kernel_debugging.txt
+       dodoc doc/docs.txt
+       if use examples; then
+               dosbin examples/yuv4mpeg_to_v4l2
+               docinto examples
+               dodoc examples/{*.sh,*.c,Makefile}
+       fi
+}