media-video/pipewire: New package, 0.2.6 initial version
authorAndreas Sturmlechner <asturm@gentoo.org>
Sun, 7 Jul 2019 15:09:07 +0000 (17:09 +0200)
committerAndreas Sturmlechner <asturm@gentoo.org>
Sun, 7 Jul 2019 15:51:01 +0000 (17:51 +0200)
Bug: https://bugs.gentoo.org/667014
Package-Manager: Portage-2.3.68, Repoman-2.3.16
Signed-off-by: Andreas Sturmlechner <asturm@gentoo.org>
media-video/pipewire/Manifest [new file with mode: 0644]
media-video/pipewire/files/pipewire-0.2.6-alsa-lib-1.1.9.patch [new file with mode: 0644]
media-video/pipewire/files/pipewire-0.2.6-fix-probing-without-starting.patch [new file with mode: 0644]
media-video/pipewire/files/pipewire-0.2.6-reuse-fd-in-pipewiresrc.patch [new file with mode: 0644]
media-video/pipewire/files/pipewire-0.2.6-revert-combine-all-perms.patch [new file with mode: 0644]
media-video/pipewire/metadata.xml [new file with mode: 0644]
media-video/pipewire/pipewire-0.2.6.ebuild [new file with mode: 0644]

diff --git a/media-video/pipewire/Manifest b/media-video/pipewire/Manifest
new file mode 100644 (file)
index 0000000..edaa0d8
--- /dev/null
@@ -0,0 +1 @@
+DIST pipewire-0.2.6.tar.gz 421137 BLAKE2B 155667d14fe5380e21f0b70accea72dc4478085916a9126185136f6d33bd7729d91b790c171dcf7b6aea2c52894462d16516f8821229ca0bf9f6cde15df524d9 SHA512 3d1db41f5beb42a0ee15ae7bc8afb89b54a37c3a6a414e88b5e33ceaf98ec6dda0d9a2d03ac47a8dfce48e9637e647291919e6670bb70589b0d1951fbcbd3ff8
diff --git a/media-video/pipewire/files/pipewire-0.2.6-alsa-lib-1.1.9.patch b/media-video/pipewire/files/pipewire-0.2.6-alsa-lib-1.1.9.patch
new file mode 100644 (file)
index 0000000..7b2b4c8
--- /dev/null
@@ -0,0 +1,66 @@
+From 37613b67ba52b5ad4e81d7ea38adc04027d9f9e5 Mon Sep 17 00:00:00 2001
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Thu, 23 May 2019 09:25:51 +0200
+Subject: [PATCH] alsa: handle alsa-lib 1.1.9
+
+alsa-lib 1.1.9 removed /usr/include/alsa from the include path, we
+must include <alsa/asoundlib.h>
+---
+ spa/plugins/alsa/alsa-monitor.c | 2 +-
+ spa/plugins/alsa/alsa-sink.c    | 2 +-
+ spa/plugins/alsa/alsa-source.c  | 2 +-
+ spa/plugins/alsa/alsa-utils.h   | 2 +-
+ 4 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/spa/plugins/alsa/alsa-monitor.c b/spa/plugins/alsa/alsa-monitor.c
+index d8935cd7..16a01302 100644
+--- a/spa/plugins/alsa/alsa-monitor.c
++++ b/spa/plugins/alsa/alsa-monitor.c
+@@ -25,7 +25,7 @@
+ #include <poll.h>
+ #include <libudev.h>
+-#include <asoundlib.h>
++#include <alsa/asoundlib.h>
+ #include <spa/support/log.h>
+ #include <spa/support/type-map.h>
+diff --git a/spa/plugins/alsa/alsa-sink.c b/spa/plugins/alsa/alsa-sink.c
+index c31fe3e2..3c252fab 100644
+--- a/spa/plugins/alsa/alsa-sink.c
++++ b/spa/plugins/alsa/alsa-sink.c
+@@ -19,7 +19,7 @@
+ #include <stddef.h>
+-#include <asoundlib.h>
++#include <alsa/asoundlib.h>
+ #include <spa/node/node.h>
+ #include <spa/param/audio/format.h>
+diff --git a/spa/plugins/alsa/alsa-source.c b/spa/plugins/alsa/alsa-source.c
+index 74bbb3c0..8efc8fde 100644
+--- a/spa/plugins/alsa/alsa-source.c
++++ b/spa/plugins/alsa/alsa-source.c
+@@ -19,7 +19,7 @@
+ #include <stddef.h>
+-#include <asoundlib.h>
++#include <alsa/asoundlib.h>
+ #include <spa/node/node.h>
+ #include <spa/utils/list.h>
+diff --git a/spa/plugins/alsa/alsa-utils.h b/spa/plugins/alsa/alsa-utils.h
+index 5ba57bc5..3b590007 100644
+--- a/spa/plugins/alsa/alsa-utils.h
++++ b/spa/plugins/alsa/alsa-utils.h
+@@ -26,7 +26,7 @@ extern "C" {
+ #include <stddef.h>
+-#include <asoundlib.h>
++#include <alsa/asoundlib.h>
+ #include <spa/support/type-map.h>
+ #include <spa/support/loop.h>
diff --git a/media-video/pipewire/files/pipewire-0.2.6-fix-probing-without-starting.patch b/media-video/pipewire/files/pipewire-0.2.6-fix-probing-without-starting.patch
new file mode 100644 (file)
index 0000000..9b3aed3
--- /dev/null
@@ -0,0 +1,63 @@
+From 37e66c9e55f556558088d9f6b2200d4341a37f04 Mon Sep 17 00:00:00 2001
+From: Michael Olbrich <m.olbrich@pengutronix.de>
+Date: Tue, 18 Jun 2019 09:53:12 +0200
+Subject: [PATCH] deviceprovider: fix probing without starting
+
+self->type is needed in registry_event_global() so it must be set in
+gst_pipewire_device_provider_probe() as well.
+
+self->devices is initialized as NULL when probing is started. So it should
+be just a simple GList* pointer.
+
+Signed-off-by: Michael Olbrich <m.olbrich@pengutronix.de>
+---
+ src/gst/gstpipewiredeviceprovider.c | 8 ++++++--
+ src/gst/gstpipewiredeviceprovider.h | 2 +-
+ 2 files changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/src/gst/gstpipewiredeviceprovider.c b/src/gst/gstpipewiredeviceprovider.c
+index b6472d96..02b38c2e 100644
+--- a/src/gst/gstpipewiredeviceprovider.c
++++ b/src/gst/gstpipewiredeviceprovider.c
+@@ -265,7 +265,7 @@ static void do_add_node(void *data)
+   nd->dev = new_node (self, nd);
+   if (nd->dev) {
+     if(self->list_only)
+-      *self->devices = g_list_prepend (*self->devices, gst_object_ref_sink (nd->dev));
++      self->devices = g_list_prepend (self->devices, gst_object_ref_sink (nd->dev));
+     else
+       gst_device_provider_device_add (GST_DEVICE_PROVIDER (self), nd->dev);
+   }
+@@ -555,6 +555,8 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
+   t = pw_core_get_type(c);
++  self->type = pw_core_get_type (c);
++
+   if (!(r = pw_remote_new (c, NULL, sizeof(*data))))
+     goto failed;
+@@ -612,7 +614,9 @@ gst_pipewire_device_provider_probe (GstDeviceProvider * provider)
+   pw_core_destroy (c);
+   pw_loop_destroy (l);
+-  return *self->devices;
++  self->type = NULL;
++
++  return self->devices;
+ failed:
+   pw_loop_destroy (l);
+diff --git a/src/gst/gstpipewiredeviceprovider.h b/src/gst/gstpipewiredeviceprovider.h
+index 81622605..3cf2d41b 100644
+--- a/src/gst/gstpipewiredeviceprovider.h
++++ b/src/gst/gstpipewiredeviceprovider.h
+@@ -98,7 +98,7 @@ struct _GstPipeWireDeviceProvider {
+   gboolean end;
+   gboolean list_only;
+-  GList **devices;
++  GList *devices;
+ };
+ struct _GstPipeWireDeviceProviderClass {
diff --git a/media-video/pipewire/files/pipewire-0.2.6-reuse-fd-in-pipewiresrc.patch b/media-video/pipewire/files/pipewire-0.2.6-reuse-fd-in-pipewiresrc.patch
new file mode 100644 (file)
index 0000000..a1176d3
--- /dev/null
@@ -0,0 +1,137 @@
+From 151b2b266e1dae3679584f38b954e4357cf1e5cc Mon Sep 17 00:00:00 2001
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Wed, 19 Jun 2019 10:49:28 +0200
+Subject: [PATCH] connection: add do_close flag to connect_fd
+
+Make pw_remote_connect_fd() not automatically close the provided
+fd but let the caller take care of that. This allows us to reuse
+the fd in pipewiresrc.
+
+Fixes #155
+---
+ src/modules/module-protocol-native.c              | 7 ++++---
+ src/modules/module-protocol-native/local-socket.c | 2 +-
+ src/pipewire/protocol.h                           | 4 ++--
+ src/pipewire/remote.c                             | 8 ++++----
+ src/pipewire/remote.h                             | 3 ++-
+ 5 files changed, 13 insertions(+), 11 deletions(-)
+
+diff --git a/src/modules/module-protocol-native.c b/src/modules/module-protocol-native.c
+index 131657f6..0e7b7e27 100644
+--- a/src/modules/module-protocol-native.c
++++ b/src/modules/module-protocol-native.c
+@@ -619,7 +619,7 @@ static const struct pw_protocol_native_connection_events conn_events = {
+       .need_flush = on_need_flush,
+ };
+-static int impl_connect_fd(struct pw_protocol_client *client, int fd)
++static int impl_connect_fd(struct pw_protocol_client *client, int fd, bool do_close)
+ {
+       struct client *impl = SPA_CONTAINER_OF(client, struct client, this);
+       struct pw_remote *remote = client->remote;
+@@ -638,14 +638,15 @@ static int impl_connect_fd(struct pw_protocol_client *client, int fd)
+         impl->source = pw_loop_add_io(remote->core->main_loop,
+                                       fd,
+                                       SPA_IO_IN | SPA_IO_HUP | SPA_IO_ERR,
+-                                      true, on_remote_data, impl);
++                                      do_close, on_remote_data, impl);
+       if (impl->source == NULL)
+               goto error_close;
+       return 0;
+       error_close:
+-        close(fd);
++      if (do_close)
++              close(fd);
+         return -ENOMEM;
+ }
+diff --git a/src/modules/module-protocol-native/local-socket.c b/src/modules/module-protocol-native/local-socket.c
+index 5ab5a210..0e68eea9 100644
+--- a/src/modules/module-protocol-native/local-socket.c
++++ b/src/modules/module-protocol-native/local-socket.c
+@@ -84,7 +84,7 @@ int pw_protocol_native_connect_local_socket(struct pw_protocol_client *client,
+                 goto error_close;
+       }
+-      res = pw_protocol_client_connect_fd(client, fd);
++      res = pw_protocol_client_connect_fd(client, fd, true);
+       done_callback(data, res);
+diff --git a/src/pipewire/protocol.h b/src/pipewire/protocol.h
+index 2b6592d1..4a0845fb 100644
+--- a/src/pipewire/protocol.h
++++ b/src/pipewire/protocol.h
+@@ -44,14 +44,14 @@ struct pw_protocol_client {
+       int (*connect) (struct pw_protocol_client *client,
+                       void (*done_callback) (void *data, int result),
+                       void *data);
+-      int (*connect_fd) (struct pw_protocol_client *client, int fd);
++      int (*connect_fd) (struct pw_protocol_client *client, int fd, bool close);
+       int (*steal_fd) (struct pw_protocol_client *client);
+       void (*disconnect) (struct pw_protocol_client *client);
+       void (*destroy) (struct pw_protocol_client *client);
+ };
+ #define pw_protocol_client_connect(c,cb,d)    ((c)->connect(c,cb,d))
+-#define pw_protocol_client_connect_fd(c,fd)   ((c)->connect_fd(c,fd))
++#define pw_protocol_client_connect_fd(c,fd,cl)        ((c)->connect_fd(c,fd,cl))
+ #define pw_protocol_client_steal_fd(c)                ((c)->steal_fd(c))
+ #define pw_protocol_client_disconnect(c)      ((c)->disconnect(c))
+ #define pw_protocol_client_destroy(c)         ((c)->destroy(c))
+diff --git a/src/pipewire/remote.c b/src/pipewire/remote.c
+index f63a973a..472b2684 100644
+--- a/src/pipewire/remote.c
++++ b/src/pipewire/remote.c
+@@ -305,7 +305,7 @@ void pw_remote_destroy(struct pw_remote *remote)
+       spa_list_consume(stream, &remote->stream_list, link)
+               pw_stream_destroy(stream);
+-      pw_protocol_client_destroy (remote->conn);
++      pw_protocol_client_destroy(remote->conn);
+       spa_list_remove(&remote->link);
+@@ -413,7 +413,7 @@ int pw_remote_connect(struct pw_remote *remote)
+       pw_remote_update_state(remote, PW_REMOTE_STATE_CONNECTING, NULL);
+-      if ((res = pw_protocol_client_connect (remote->conn, done_connect, remote)) < 0) {
++      if ((res = pw_protocol_client_connect(remote->conn, done_connect, remote)) < 0) {
+               pw_remote_update_state(remote, PW_REMOTE_STATE_ERROR,
+                               "connect failed %s", spa_strerror(res));
+               return res;
+@@ -428,7 +428,7 @@ int pw_remote_connect_fd(struct pw_remote *remote, int fd)
+       pw_remote_update_state(remote, PW_REMOTE_STATE_CONNECTING, NULL);
+-      if ((res = pw_protocol_client_connect_fd (remote->conn, fd)) < 0) {
++      if ((res = pw_protocol_client_connect_fd(remote->conn, fd, false)) < 0) {
+               pw_remote_update_state(remote, PW_REMOTE_STATE_ERROR,
+                               "connect_fd failed %s", spa_strerror(res));
+               return res;
+@@ -462,7 +462,7 @@ int pw_remote_disconnect(struct pw_remote *remote)
+               pw_proxy_destroy(proxy);
+       remote->core_proxy = NULL;
+-      pw_protocol_client_disconnect (remote->conn);
++      pw_protocol_client_disconnect(remote->conn);
+       pw_map_clear(&remote->objects);
+       pw_map_clear(&remote->types);
+diff --git a/src/pipewire/remote.h b/src/pipewire/remote.h
+index df0c496c..2974a04a 100644
+--- a/src/pipewire/remote.h
++++ b/src/pipewire/remote.h
+@@ -177,7 +177,8 @@ void pw_remote_add_listener(struct pw_remote *remote,
+ int pw_remote_connect(struct pw_remote *remote);
+ /** Connect to a remote PipeWire on the given socket \memberof pw_remote
+- * \param fd the connected socket to use
++ * \param fd the connected socket to use, the socket will not be closed
++ *    automatically on disconnect or error.
+  * \return 0 on success, < 0 on error */
+ int pw_remote_connect_fd(struct pw_remote *remote, int fd);
diff --git a/media-video/pipewire/files/pipewire-0.2.6-revert-combine-all-perms.patch b/media-video/pipewire/files/pipewire-0.2.6-revert-combine-all-perms.patch
new file mode 100644 (file)
index 0000000..57ada7d
--- /dev/null
@@ -0,0 +1,34 @@
+From 4350bd624f165de81de10293a8ec5a59e8b7ce64 Mon Sep 17 00:00:00 2001
+From: Wim Taymans <wtaymans@redhat.com>
+Date: Fri, 28 Jun 2019 12:22:33 +0200
+Subject: [PATCH] Revert "global: combine all permissions of the object tree"
+
+This reverts commit 83bc033837f7525d898f1de91119f669f9bf97f5.
+
+This needs some more work.
+---
+ src/pipewire/global.c | 10 ++--------
+ 1 file changed, 2 insertions(+), 8 deletions(-)
+
+diff --git a/src/pipewire/global.c b/src/pipewire/global.c
+index c963965e..00258ff8 100644
+--- a/src/pipewire/global.c
++++ b/src/pipewire/global.c
+@@ -38,15 +38,9 @@ uint32_t pw_global_get_permissions(struct pw_global *global, struct pw_client *c
+ {
+       uint32_t perms = PW_PERM_RWX;
+-      if (client->permission_func == NULL)
+-              return perms;
+-
+-      perms = client->permission_func(global, client, client->permission_data);
+-
+-      while (global != global->parent) {
+-              global = global->parent;
++      if (client->permission_func != NULL)
+               perms &= client->permission_func(global, client, client->permission_data);
+-      }
++
+       return perms;
+ }
diff --git a/media-video/pipewire/metadata.xml b/media-video/pipewire/metadata.xml
new file mode 100644 (file)
index 0000000..a5d6bb1
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+       <maintainer type="project">
+               <email>gnome@gentoo.org</email>
+               <name>Gentoo GNOME Desktop</name>
+       </maintainer>
+       <maintainer type="person">
+               <email>asturm@gentoo.org</email>
+               <name>Andreas Sturmlechner</name>
+       </maintainer>
+       <upstream>
+               <remote-id type="github">PipeWire/pipewire</remote-id>
+       </upstream>
+</pkgmetadata>
diff --git a/media-video/pipewire/pipewire-0.2.6.ebuild b/media-video/pipewire/pipewire-0.2.6.ebuild
new file mode 100644 (file)
index 0000000..53944bc
--- /dev/null
@@ -0,0 +1,88 @@
+# Copyright 1999-2019 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+inherit meson
+
+if [[ ${PV} == 9999 ]]; then
+       EGIT_REPO_URI="https://github.com/PipeWire/pipewire.git"
+       inherit git-r3
+else
+       SRC_URI="https://github.com/PipeWire/${PN}/archive/${PV}.tar.gz -> ${P}.tar.gz"
+       KEYWORDS="~amd64"
+fi
+
+DESCRIPTION="Multimedia processing graphs"
+HOMEPAGE="https://pipewire.org/"
+
+LICENSE="LGPL-2.1"
+SLOT="0"
+IUSE="bluetooth doc ffmpeg libav gstreamer sdl systemd vaapi X"
+
+BDEPEND="
+       app-doc/xmltoman
+       doc? (
+               app-doc/doxygen
+               media-gfx/graphviz
+       )
+"
+DEPEND="
+       media-libs/alsa-lib
+       sys-apps/dbus
+       virtual/libudev
+       bluetooth? ( media-libs/sbc )
+       ffmpeg? (
+               !libav? ( media-video/ffmpeg:= )
+               libav? ( media-video/libav:= )
+       )
+       gstreamer? (
+               media-libs/gstreamer:1.0
+               media-libs/gst-plugins-base:1.0
+       )
+       sdl? ( media-libs/libsdl2 )
+       systemd? ( sys-apps/systemd )
+       vaapi? ( x11-libs/libva )
+       X? ( x11-libs/libX11 )
+"
+RDEPEND="${DEPEND}"
+
+PATCHES=(
+       "${FILESDIR}"/${P}-alsa-lib-1.1.9.patch
+       "${FILESDIR}"/${P}-reuse-fd-in-pipewiresrc.patch
+       "${FILESDIR}"/${P}-fix-probing-without-starting.patch
+       "${FILESDIR}"/${P}-revert-combine-all-perms.patch
+)
+
+src_prepare() {
+       spa_use() {
+               if ! use ${1}; then
+                       sed -e "/.*dependency.*'${2-$1}'/s/'${2-$1}'/'${2-$1}-disabled-by-USE-no-${1}'/" \
+                               -i spa/meson.build || die
+               fi
+       }
+
+       default
+       spa_use bluetooth sbc
+       spa_use ffmpeg libavcodec
+       spa_use ffmpeg libavformat
+       spa_use ffmpeg libavfilter
+       spa_use vaapi libva
+       spa_use sdl sdl2
+       spa_use X x11
+}
+
+src_configure() {
+       local emesonargs=(
+               -Dman=true
+               $(meson_use doc docs)
+               $(meson_feature gstreamer)
+               $(meson_use systemd)
+       )
+       meson_src_configure
+}
+
+pkg_postinst() {
+       elog "Package has optional sys-auth/rtkit RUNTIME support that may be"
+       elog "disabled by setting DISABLE_RTKIT env var."
+}