aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHuang Rui <vowstar@gmail.com>2021-05-25 18:41:35 +0800
committerHuang Rui <vowstar@gmail.com>2021-05-25 18:41:35 +0800
commit9426997cb815d737d7faf19caa8624e81d1d8bea (patch)
tree33471b380175ac6f5a02e89c7d208d68531c59c5
parentdev-python/asyncssh: support python 3.9 (diff)
downloadguru-9426997c.tar.gz
guru-9426997c.tar.bz2
guru-9426997c.zip
media-video/uxplay: new package
UxPlay: AirPlay Unix mirroring server Package-Manager: Portage-3.0.18, Repoman-3.0.3 Signed-off-by: Huang Rui <vowstar@gmail.com>
-rw-r--r--media-video/uxplay/Manifest1
-rw-r--r--media-video/uxplay/files/uxplay-0_pre20210525-fix-installation.patch72
-rw-r--r--media-video/uxplay/files/uxplay-0_pre20210525-fix-screen-sharing.patch162
-rw-r--r--media-video/uxplay/files/uxplay-0_pre20210525-use-machine-hostname.patch49
-rw-r--r--media-video/uxplay/metadata.xml23
-rw-r--r--media-video/uxplay/uxplay-0_pre20210525.ebuild46
6 files changed, 353 insertions, 0 deletions
diff --git a/media-video/uxplay/Manifest b/media-video/uxplay/Manifest
new file mode 100644
index 000000000..e9430a004
--- /dev/null
+++ b/media-video/uxplay/Manifest
@@ -0,0 +1 @@
+DIST uxplay-0_pre20210525.tar.gz 365673 BLAKE2B 363dbcb86ec194eb6bf1fbd5bd07d49650570da3a986c42d4da74e76adf9af6f5247cf1364758b822eeea24b70b88ec24aed8c3c18795276197fde5fa3097cc3 SHA512 0a22504f29a4dc41819187f7fbbc1f66da456c65c8c8c8a1189553ea7bb43beb207c9360e677605c51fab25da4ec1aef1e662b83965d376de12165d88c8b7579
diff --git a/media-video/uxplay/files/uxplay-0_pre20210525-fix-installation.patch b/media-video/uxplay/files/uxplay-0_pre20210525-fix-installation.patch
new file mode 100644
index 000000000..6b4a53a16
--- /dev/null
+++ b/media-video/uxplay/files/uxplay-0_pre20210525-fix-installation.patch
@@ -0,0 +1,72 @@
+From 4fd146e46ed505fd46fb1dcad83de272690376e9 Mon Sep 17 00:00:00 2001
+From: Michael Schlottke-Lakemper <michael@sloede.com>
+Date: Wed, 5 Aug 2020 11:46:15 +0200
+Subject: [PATCH 1/2] Reformat commands as code in README
+
+---
+ README.md | 26 +++++++++++++++++---------
+ 1 file changed, 17 insertions(+), 9 deletions(-)
+
+diff --git a/README.md b/README.md
+index 8502407..82c96f2 100644
+--- a/README.md
++++ b/README.md
+@@ -1,19 +1,27 @@
++# UxPlay
++
+ This project is an early stage prototype of unix AirPlay server.
+ Work is based on https://github.com/FD-/RPiPlay.
+ Tested on Ubuntu 19.10 desktop.
+ 5G Wifi connection is the must.
+
+-Features:
++## Features
+ 1. Based on Gstreamer.
+ 1. Video and audio are supported out of the box.
+ 3. Gstreamer decoding is plugin agnostic. Uses accelerated decoders if availible. VAAPI is preferable.
+ 4. Automatic screen orientation.
+
+-Building:
+-1. sudo apt-get install cmake
+-2. sudo apt-get install libssl-dev libavahi-compat-libdnssd-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-libav
+-3. sudo apt-get install gstreamer1.0-vaapi (For Intel graphics)
+-4. mkdir build
+-5. cd build
+-6. cmake ..
+-7. make
++## Building
++```bash
++sudo apt-get install cmake
++sudo apt-get install libssl-dev libavahi-compat-libdnssd-dev \
++ libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
++ gstreamer1.0-libav
++sudo apt-get install gstreamer1.0-vaapi # For Intel graphics
++mkdir build
++cd build
++cmake ..
++# Alternatively (for higher optimization level and/or installation):
++# cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=path/to/install/dir
++make
++```
+
+From 64bf832ccaadabfb12b427c2ea90194d3fbcf34b Mon Sep 17 00:00:00 2001
+From: Michael Schlottke-Lakemper <michael@sloede.com>
+Date: Wed, 5 Aug 2020 11:50:09 +0200
+Subject: [PATCH 2/2] Fix `install` command such that out-of-source builds work
+ (fixes #12)
+
+---
+ CMakeLists.txt | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c150f8d..f75664c 100755
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -14,5 +14,5 @@ add_subdirectory(renderers)
+ add_executable( uxplay uxplay.cpp)
+ target_link_libraries ( uxplay renderers airplay )
+
+-install(PROGRAMS uxplay DESTINATION bin)
++install(TARGETS uxplay DESTINATION bin)
+
diff --git a/media-video/uxplay/files/uxplay-0_pre20210525-fix-screen-sharing.patch b/media-video/uxplay/files/uxplay-0_pre20210525-fix-screen-sharing.patch
new file mode 100644
index 000000000..413afe3eb
--- /dev/null
+++ b/media-video/uxplay/files/uxplay-0_pre20210525-fix-screen-sharing.patch
@@ -0,0 +1,162 @@
+From 7c80c93cccf6534a0824c1d5783fc036812a76cb Mon Sep 17 00:00:00 2001
+From: david <davidventura27@gmail.com>
+Date: Fri, 22 Jan 2021 00:27:23 +0100
+Subject: [PATCH 1/2] Fix _NET_WM_NAME
+
+Gstreamer does not set the _NET_WM_NAME property on the window it
+creates when using `autovideosink` (or ximagesink/xvimagesink for that
+matter).
+
+A lot of tools (like Zoom) filter based on this field being non-null, so
+the window can't be shared.
+
+This horrible hack finds the first open window that matches our application
+name and proceeds to set _NET_WM_NAME on it.
+
+It is very ugly, but it works.
+---
+ CMakeLists.txt | 7 +++-
+ renderers/video_renderer_gstreamer.c | 52 ++++++++++++++++++++++++++--
+ 2 files changed, 56 insertions(+), 3 deletions(-)
+
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index c150f8d..77e0b3a 100755
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -4,6 +4,11 @@ project(uxplay)
+
+ set (CMAKE_CXX_STANDARD 11)
+
++find_package(X11 REQUIRED)
++link_libraries(${X11_LIBRARIES})
++include_directories(${X11_INCLUDE_DIR})
++# link_directories(${X11_LIBRARIES})
++
+ add_subdirectory(lib/curve25519)
+ add_subdirectory(lib/ed25519)
+ add_subdirectory(lib/playfair)
+@@ -12,7 +17,7 @@ add_subdirectory(lib)
+ add_subdirectory(renderers)
+
+ add_executable( uxplay uxplay.cpp)
+-target_link_libraries ( uxplay renderers airplay )
++target_link_libraries ( uxplay renderers airplay ${X11_LIBRARIES})
+
+ install(PROGRAMS uxplay DESTINATION bin)
+
+diff --git a/renderers/video_renderer_gstreamer.c b/renderers/video_renderer_gstreamer.c
+index 5ed2720..d8477d0 100644
+--- a/renderers/video_renderer_gstreamer.c
++++ b/renderers/video_renderer_gstreamer.c
+@@ -21,6 +21,13 @@
+ #include <assert.h>
+ #include <gst/gst.h>
+ #include <gst/app/gstappsrc.h>
++#include <X11/Xlib.h>
++#include <X11/Xutil.h>
++#include <stdio.h>
++
++Display* display;
++Window root, my_window;
++const char* application_name = "UXPLAY";
+
+ struct video_renderer_s {
+ logger_t *logger;
+@@ -49,7 +56,38 @@ static gboolean check_plugins (void)
+ return ret;
+ }
+
++Window enum_windows(Display* display, Window window, int depth) {
++ int i;
++
++ XTextProperty text;
++ XGetWMName(display, window, &text);
++ char* name;
++ XFetchName(display, window, &name);
++
++ if (name != 0 && strcmp(application_name, name) == 0) {
++ return window;
++ }
++
++ Window _root, parent;
++ Window* children;
++ int n;
++ XQueryTree(display, window, &_root, &parent, &children, &n);
++ if (children != NULL) {
++ for (i = 0; i < n; i++) {
++ Window w = enum_windows(display, children[i], depth + 1);
++ if (w != NULL) return w;
++ }
++ XFree(children);
++ }
++
++ return NULL;
++}
++
++
+ video_renderer_t *video_renderer_init(logger_t *logger, background_mode_t background_mode, bool low_latency) {
++ display = XOpenDisplay(NULL);
++ root = XDefaultRootWindow(display);
++
+ video_renderer_t *renderer;
+ GError *error = NULL;
+
+@@ -57,6 +95,7 @@ video_renderer_t *video_renderer_init(logger_t *logger, background_mode_t backgr
+ assert(renderer);
+
+ gst_init(NULL, NULL);
++ g_set_application_name(application_name);
+
+ renderer->logger = logger;
+
+@@ -88,10 +127,20 @@ void video_renderer_render_buffer(video_renderer_t *renderer, raop_ntp_t *ntp, u
+ GST_BUFFER_DTS(buffer) = (GstClockTime)pts;
+ gst_buffer_fill(buffer, 0, data, data_len);
+ gst_app_src_push_buffer (GST_APP_SRC(renderer->appsrc), buffer);
++
++ if (my_window == NULL) {
++ my_window = enum_windows(display, root, 0);
++ if (my_window != NULL) {
++ char* str = "NEW NAME";
++ Atom _NET_WM_NAME = XInternAtom(display, "_NET_WM_NAME", 0);
++ Atom UTF8_STRING = XInternAtom(display, "UTF8_STRING", 0);
++ XChangeProperty(display, my_window, _NET_WM_NAME, UTF8_STRING, 8, 0, str, strlen(str));
++ XSync(display, False);
++ }
++ }
+ }
+
+ void video_renderer_flush(video_renderer_t *renderer) {
+-
+ }
+
+ void video_renderer_destroy(video_renderer_t *renderer) {
+@@ -104,5 +153,4 @@ void video_renderer_destroy(video_renderer_t *renderer) {
+ }
+
+ void video_renderer_update_background(video_renderer_t *renderer, int type) {
+-
+ }
+
+From 4e0196eb5577e25d9af2e1af2d6d6c6d867c5393 Mon Sep 17 00:00:00 2001
+From: david <davidventura27@gmail.com>
+Date: Wed, 3 Feb 2021 23:08:32 +0100
+Subject: [PATCH 2/2] Change window name to UxPlay
+
+---
+ renderers/video_renderer_gstreamer.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/renderers/video_renderer_gstreamer.c b/renderers/video_renderer_gstreamer.c
+index d8477d0..d57a8c3 100644
+--- a/renderers/video_renderer_gstreamer.c
++++ b/renderers/video_renderer_gstreamer.c
+@@ -131,7 +131,7 @@ void video_renderer_render_buffer(video_renderer_t *renderer, raop_ntp_t *ntp, u
+ if (my_window == NULL) {
+ my_window = enum_windows(display, root, 0);
+ if (my_window != NULL) {
+- char* str = "NEW NAME";
++ char* str = "UxPlay";
+ Atom _NET_WM_NAME = XInternAtom(display, "_NET_WM_NAME", 0);
+ Atom UTF8_STRING = XInternAtom(display, "UTF8_STRING", 0);
+ XChangeProperty(display, my_window, _NET_WM_NAME, UTF8_STRING, 8, 0, str, strlen(str));
diff --git a/media-video/uxplay/files/uxplay-0_pre20210525-use-machine-hostname.patch b/media-video/uxplay/files/uxplay-0_pre20210525-use-machine-hostname.patch
new file mode 100644
index 000000000..207a0c8e5
--- /dev/null
+++ b/media-video/uxplay/files/uxplay-0_pre20210525-use-machine-hostname.patch
@@ -0,0 +1,49 @@
+From a5098ee748a7c6ba078479a6bffd1cacbb5a538d Mon Sep 17 00:00:00 2001
+From: mrbesen <y.g.2@gmx.de>
+Date: Wed, 10 Mar 2021 12:04:56 +0100
+Subject: [PATCH] use Hostname as default Name
+
+---
+ uxplay.cpp | 15 +++++++++++++++
+ 1 file changed, 15 insertions(+)
+
+diff --git a/uxplay.cpp b/uxplay.cpp
+index c1e6b8a..b91151d 100755
+--- a/uxplay.cpp
++++ b/uxplay.cpp
+@@ -24,6 +24,7 @@
+ #include <string>
+ #include <vector>
+ #include <fstream>
++#include <sys/utsname.h> // uname(read hostname)
+
+ #include "log.h"
+ #include "lib/raop.h"
+@@ -102,6 +103,18 @@ void print_info(char *name) {
+ printf("-v/-h Displays this help and version information\n");
+ }
+
++/* read the mashines hostname an write it into name */
++void get_hostname(std::string& name) {
++ struct utsname buf;
++ int res = uname(&buf);
++ if(res) {
++ //error
++ printf("could not read hostname: %d %s\n", res, strerror(res));
++ return;
++ }
++ name = buf.nodename;
++}
++
+ int main(int argc, char *argv[]) {
+ init_signals();
+
+@@ -112,6 +125,8 @@ int main(int argc, char *argv[]) {
+ bool low_latency = DEFAULT_LOW_LATENCY;
+ bool debug_log = DEFAULT_DEBUG_LOG;
+
++ get_hostname(server_name);
++
+ // Parse arguments
+ for (int i = 1; i < argc; i++) {
+ std::string arg(argv[i]);
diff --git a/media-video/uxplay/metadata.xml b/media-video/uxplay/metadata.xml
new file mode 100644
index 000000000..e4f2e1f73
--- /dev/null
+++ b/media-video/uxplay/metadata.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
+<pkgmetadata>
+ <maintainer type="person">
+ <email>vowstar@gmail.com</email>
+ <name>Huang Rui</name>
+ </maintainer>
+ <upstream>
+ <remote-id type="github">antimof/UxPlay</remote-id>
+ </upstream>
+ <longdescription lang="en">
+ UxPlay - AirPlay Unix mirroring server.
+ This project is an early stage prototype of unix AirPlay server. Work is
+ based on https://github.com/FD-/RPiPlay. Tested on Ubuntu 19.10 desktop.
+ 5G Wifi connection is the must.
+ Features:
+ Based on Gstreamer.
+ Video and audio are supported out of the box.
+ Gstreamer decoding is plugin agnostic.
+ Uses accelerated decoders if availible. VAAPI is preferable.
+ Automatic screen orientation.
+ </longdescription>
+</pkgmetadata>
diff --git a/media-video/uxplay/uxplay-0_pre20210525.ebuild b/media-video/uxplay/uxplay-0_pre20210525.ebuild
new file mode 100644
index 000000000..0f74d6650
--- /dev/null
+++ b/media-video/uxplay/uxplay-0_pre20210525.ebuild
@@ -0,0 +1,46 @@
+# Copyright 1999-2021 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=7
+
+GIT_PN="UxPlay"
+
+inherit cmake
+
+DESCRIPTION="AirPlay Unix mirroring server"
+HOMEPAGE="https://github.com/antimof/UxPlay"
+
+if [[ ${PV} == "9999" ]] ; then
+ EGIT_REPO_URI="https://github.com/antimof/${GIT_PN}.git"
+ inherit git-r3
+else
+ EGIT_COMMIT="6a473d6026480c47b6d9f1b2d619039da3cd36ba"
+ SRC_URI="https://github.com/antimof/${GIT_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
+ S="${WORKDIR}/${GIT_PN}-${EGIT_COMMIT}"
+ KEYWORDS="~amd64 ~arm ~x86"
+fi
+
+LICENSE="GPL-3"
+SLOT="0"
+
+RDEPEND="
+ dev-libs/openssl
+ media-libs/gstreamer
+ media-libs/gst-plugins-bad
+ media-plugins/gst-plugins-libav
+ net-dns/avahi[mdnsresponder-compat]
+"
+
+DEPEND="
+ ${RDEPEND}
+"
+
+BDEPEND="
+ virtual/pkgconfig
+"
+
+PATCHES=(
+ "${FILESDIR}/${P}-fix-installation.patch"
+ "${FILESDIR}/${P}-fix-screen-sharing.patch"
+ "${FILESDIR}/${P}-use-machine-hostname.patch"
+)