Gentoo Archives: gentoo-commits

From: Haelwenn Monnier <contact@×××××××××.me>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/proj/guru:master commit in: media-video/uxplay/files/, media-video/uxplay/
Date: Tue, 25 May 2021 23:08:09
Message-Id: 1621939295.9426997cb815d737d7faf19caa8624e81d1d8bea.lanodan@gentoo
1 commit: 9426997cb815d737d7faf19caa8624e81d1d8bea
2 Author: Huang Rui <vowstar <AT> gmail <DOT> com>
3 AuthorDate: Tue May 25 10:41:35 2021 +0000
4 Commit: Haelwenn Monnier <contact <AT> hacktivis <DOT> me>
5 CommitDate: Tue May 25 10:41:35 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/proj/guru.git/commit/?id=9426997c
7
8 media-video/uxplay: new package
9
10 UxPlay: AirPlay Unix mirroring server
11 Package-Manager: Portage-3.0.18, Repoman-3.0.3
12 Signed-off-by: Huang Rui <vowstar <AT> gmail.com>
13
14 media-video/uxplay/Manifest | 1 +
15 .../uxplay-0_pre20210525-fix-installation.patch | 72 +++++++++
16 .../uxplay-0_pre20210525-fix-screen-sharing.patch | 162 +++++++++++++++++++++
17 ...uxplay-0_pre20210525-use-machine-hostname.patch | 49 +++++++
18 media-video/uxplay/metadata.xml | 23 +++
19 media-video/uxplay/uxplay-0_pre20210525.ebuild | 46 ++++++
20 6 files changed, 353 insertions(+)
21
22 diff --git a/media-video/uxplay/Manifest b/media-video/uxplay/Manifest
23 new file mode 100644
24 index 000000000..e9430a004
25 --- /dev/null
26 +++ b/media-video/uxplay/Manifest
27 @@ -0,0 +1 @@
28 +DIST uxplay-0_pre20210525.tar.gz 365673 BLAKE2B 363dbcb86ec194eb6bf1fbd5bd07d49650570da3a986c42d4da74e76adf9af6f5247cf1364758b822eeea24b70b88ec24aed8c3c18795276197fde5fa3097cc3 SHA512 0a22504f29a4dc41819187f7fbbc1f66da456c65c8c8c8a1189553ea7bb43beb207c9360e677605c51fab25da4ec1aef1e662b83965d376de12165d88c8b7579
29
30 diff --git a/media-video/uxplay/files/uxplay-0_pre20210525-fix-installation.patch b/media-video/uxplay/files/uxplay-0_pre20210525-fix-installation.patch
31 new file mode 100644
32 index 000000000..6b4a53a16
33 --- /dev/null
34 +++ b/media-video/uxplay/files/uxplay-0_pre20210525-fix-installation.patch
35 @@ -0,0 +1,72 @@
36 +From 4fd146e46ed505fd46fb1dcad83de272690376e9 Mon Sep 17 00:00:00 2001
37 +From: Michael Schlottke-Lakemper <michael@××××××.com>
38 +Date: Wed, 5 Aug 2020 11:46:15 +0200
39 +Subject: [PATCH 1/2] Reformat commands as code in README
40 +
41 +---
42 + README.md | 26 +++++++++++++++++---------
43 + 1 file changed, 17 insertions(+), 9 deletions(-)
44 +
45 +diff --git a/README.md b/README.md
46 +index 8502407..82c96f2 100644
47 +--- a/README.md
48 ++++ b/README.md
49 +@@ -1,19 +1,27 @@
50 ++# UxPlay
51 ++
52 + This project is an early stage prototype of unix AirPlay server.
53 + Work is based on https://github.com/FD-/RPiPlay.
54 + Tested on Ubuntu 19.10 desktop.
55 + 5G Wifi connection is the must.
56 +
57 +-Features:
58 ++## Features
59 + 1. Based on Gstreamer.
60 + 1. Video and audio are supported out of the box.
61 + 3. Gstreamer decoding is plugin agnostic. Uses accelerated decoders if availible. VAAPI is preferable.
62 + 4. Automatic screen orientation.
63 +
64 +-Building:
65 +-1. sudo apt-get install cmake
66 +-2. sudo apt-get install libssl-dev libavahi-compat-libdnssd-dev libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev gstreamer1.0-libav
67 +-3. sudo apt-get install gstreamer1.0-vaapi (For Intel graphics)
68 +-4. mkdir build
69 +-5. cd build
70 +-6. cmake ..
71 +-7. make
72 ++## Building
73 ++```bash
74 ++sudo apt-get install cmake
75 ++sudo apt-get install libssl-dev libavahi-compat-libdnssd-dev \
76 ++ libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev \
77 ++ gstreamer1.0-libav
78 ++sudo apt-get install gstreamer1.0-vaapi # For Intel graphics
79 ++mkdir build
80 ++cd build
81 ++cmake ..
82 ++# Alternatively (for higher optimization level and/or installation):
83 ++# cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=path/to/install/dir
84 ++make
85 ++```
86 +
87 +From 64bf832ccaadabfb12b427c2ea90194d3fbcf34b Mon Sep 17 00:00:00 2001
88 +From: Michael Schlottke-Lakemper <michael@××××××.com>
89 +Date: Wed, 5 Aug 2020 11:50:09 +0200
90 +Subject: [PATCH 2/2] Fix `install` command such that out-of-source builds work
91 + (fixes #12)
92 +
93 +---
94 + CMakeLists.txt | 2 +-
95 + 1 file changed, 1 insertion(+), 1 deletion(-)
96 +
97 +diff --git a/CMakeLists.txt b/CMakeLists.txt
98 +index c150f8d..f75664c 100755
99 +--- a/CMakeLists.txt
100 ++++ b/CMakeLists.txt
101 +@@ -14,5 +14,5 @@ add_subdirectory(renderers)
102 + add_executable( uxplay uxplay.cpp)
103 + target_link_libraries ( uxplay renderers airplay )
104 +
105 +-install(PROGRAMS uxplay DESTINATION bin)
106 ++install(TARGETS uxplay DESTINATION bin)
107 +
108
109 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
110 new file mode 100644
111 index 000000000..413afe3eb
112 --- /dev/null
113 +++ b/media-video/uxplay/files/uxplay-0_pre20210525-fix-screen-sharing.patch
114 @@ -0,0 +1,162 @@
115 +From 7c80c93cccf6534a0824c1d5783fc036812a76cb Mon Sep 17 00:00:00 2001
116 +From: david <davidventura27@×××××.com>
117 +Date: Fri, 22 Jan 2021 00:27:23 +0100
118 +Subject: [PATCH 1/2] Fix _NET_WM_NAME
119 +
120 +Gstreamer does not set the _NET_WM_NAME property on the window it
121 +creates when using `autovideosink` (or ximagesink/xvimagesink for that
122 +matter).
123 +
124 +A lot of tools (like Zoom) filter based on this field being non-null, so
125 +the window can't be shared.
126 +
127 +This horrible hack finds the first open window that matches our application
128 +name and proceeds to set _NET_WM_NAME on it.
129 +
130 +It is very ugly, but it works.
131 +---
132 + CMakeLists.txt | 7 +++-
133 + renderers/video_renderer_gstreamer.c | 52 ++++++++++++++++++++++++++--
134 + 2 files changed, 56 insertions(+), 3 deletions(-)
135 +
136 +diff --git a/CMakeLists.txt b/CMakeLists.txt
137 +index c150f8d..77e0b3a 100755
138 +--- a/CMakeLists.txt
139 ++++ b/CMakeLists.txt
140 +@@ -4,6 +4,11 @@ project(uxplay)
141 +
142 + set (CMAKE_CXX_STANDARD 11)
143 +
144 ++find_package(X11 REQUIRED)
145 ++link_libraries(${X11_LIBRARIES})
146 ++include_directories(${X11_INCLUDE_DIR})
147 ++# link_directories(${X11_LIBRARIES})
148 ++
149 + add_subdirectory(lib/curve25519)
150 + add_subdirectory(lib/ed25519)
151 + add_subdirectory(lib/playfair)
152 +@@ -12,7 +17,7 @@ add_subdirectory(lib)
153 + add_subdirectory(renderers)
154 +
155 + add_executable( uxplay uxplay.cpp)
156 +-target_link_libraries ( uxplay renderers airplay )
157 ++target_link_libraries ( uxplay renderers airplay ${X11_LIBRARIES})
158 +
159 + install(PROGRAMS uxplay DESTINATION bin)
160 +
161 +diff --git a/renderers/video_renderer_gstreamer.c b/renderers/video_renderer_gstreamer.c
162 +index 5ed2720..d8477d0 100644
163 +--- a/renderers/video_renderer_gstreamer.c
164 ++++ b/renderers/video_renderer_gstreamer.c
165 +@@ -21,6 +21,13 @@
166 + #include <assert.h>
167 + #include <gst/gst.h>
168 + #include <gst/app/gstappsrc.h>
169 ++#include <X11/Xlib.h>
170 ++#include <X11/Xutil.h>
171 ++#include <stdio.h>
172 ++
173 ++Display* display;
174 ++Window root, my_window;
175 ++const char* application_name = "UXPLAY";
176 +
177 + struct video_renderer_s {
178 + logger_t *logger;
179 +@@ -49,7 +56,38 @@ static gboolean check_plugins (void)
180 + return ret;
181 + }
182 +
183 ++Window enum_windows(Display* display, Window window, int depth) {
184 ++ int i;
185 ++
186 ++ XTextProperty text;
187 ++ XGetWMName(display, window, &text);
188 ++ char* name;
189 ++ XFetchName(display, window, &name);
190 ++
191 ++ if (name != 0 && strcmp(application_name, name) == 0) {
192 ++ return window;
193 ++ }
194 ++
195 ++ Window _root, parent;
196 ++ Window* children;
197 ++ int n;
198 ++ XQueryTree(display, window, &_root, &parent, &children, &n);
199 ++ if (children != NULL) {
200 ++ for (i = 0; i < n; i++) {
201 ++ Window w = enum_windows(display, children[i], depth + 1);
202 ++ if (w != NULL) return w;
203 ++ }
204 ++ XFree(children);
205 ++ }
206 ++
207 ++ return NULL;
208 ++}
209 ++
210 ++
211 + video_renderer_t *video_renderer_init(logger_t *logger, background_mode_t background_mode, bool low_latency) {
212 ++ display = XOpenDisplay(NULL);
213 ++ root = XDefaultRootWindow(display);
214 ++
215 + video_renderer_t *renderer;
216 + GError *error = NULL;
217 +
218 +@@ -57,6 +95,7 @@ video_renderer_t *video_renderer_init(logger_t *logger, background_mode_t backgr
219 + assert(renderer);
220 +
221 + gst_init(NULL, NULL);
222 ++ g_set_application_name(application_name);
223 +
224 + renderer->logger = logger;
225 +
226 +@@ -88,10 +127,20 @@ void video_renderer_render_buffer(video_renderer_t *renderer, raop_ntp_t *ntp, u
227 + GST_BUFFER_DTS(buffer) = (GstClockTime)pts;
228 + gst_buffer_fill(buffer, 0, data, data_len);
229 + gst_app_src_push_buffer (GST_APP_SRC(renderer->appsrc), buffer);
230 ++
231 ++ if (my_window == NULL) {
232 ++ my_window = enum_windows(display, root, 0);
233 ++ if (my_window != NULL) {
234 ++ char* str = "NEW NAME";
235 ++ Atom _NET_WM_NAME = XInternAtom(display, "_NET_WM_NAME", 0);
236 ++ Atom UTF8_STRING = XInternAtom(display, "UTF8_STRING", 0);
237 ++ XChangeProperty(display, my_window, _NET_WM_NAME, UTF8_STRING, 8, 0, str, strlen(str));
238 ++ XSync(display, False);
239 ++ }
240 ++ }
241 + }
242 +
243 + void video_renderer_flush(video_renderer_t *renderer) {
244 +-
245 + }
246 +
247 + void video_renderer_destroy(video_renderer_t *renderer) {
248 +@@ -104,5 +153,4 @@ void video_renderer_destroy(video_renderer_t *renderer) {
249 + }
250 +
251 + void video_renderer_update_background(video_renderer_t *renderer, int type) {
252 +-
253 + }
254 +
255 +From 4e0196eb5577e25d9af2e1af2d6d6c6d867c5393 Mon Sep 17 00:00:00 2001
256 +From: david <davidventura27@×××××.com>
257 +Date: Wed, 3 Feb 2021 23:08:32 +0100
258 +Subject: [PATCH 2/2] Change window name to UxPlay
259 +
260 +---
261 + renderers/video_renderer_gstreamer.c | 2 +-
262 + 1 file changed, 1 insertion(+), 1 deletion(-)
263 +
264 +diff --git a/renderers/video_renderer_gstreamer.c b/renderers/video_renderer_gstreamer.c
265 +index d8477d0..d57a8c3 100644
266 +--- a/renderers/video_renderer_gstreamer.c
267 ++++ b/renderers/video_renderer_gstreamer.c
268 +@@ -131,7 +131,7 @@ void video_renderer_render_buffer(video_renderer_t *renderer, raop_ntp_t *ntp, u
269 + if (my_window == NULL) {
270 + my_window = enum_windows(display, root, 0);
271 + if (my_window != NULL) {
272 +- char* str = "NEW NAME";
273 ++ char* str = "UxPlay";
274 + Atom _NET_WM_NAME = XInternAtom(display, "_NET_WM_NAME", 0);
275 + Atom UTF8_STRING = XInternAtom(display, "UTF8_STRING", 0);
276 + XChangeProperty(display, my_window, _NET_WM_NAME, UTF8_STRING, 8, 0, str, strlen(str));
277
278 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
279 new file mode 100644
280 index 000000000..207a0c8e5
281 --- /dev/null
282 +++ b/media-video/uxplay/files/uxplay-0_pre20210525-use-machine-hostname.patch
283 @@ -0,0 +1,49 @@
284 +From a5098ee748a7c6ba078479a6bffd1cacbb5a538d Mon Sep 17 00:00:00 2001
285 +From: mrbesen <y.g.2@×××.de>
286 +Date: Wed, 10 Mar 2021 12:04:56 +0100
287 +Subject: [PATCH] use Hostname as default Name
288 +
289 +---
290 + uxplay.cpp | 15 +++++++++++++++
291 + 1 file changed, 15 insertions(+)
292 +
293 +diff --git a/uxplay.cpp b/uxplay.cpp
294 +index c1e6b8a..b91151d 100755
295 +--- a/uxplay.cpp
296 ++++ b/uxplay.cpp
297 +@@ -24,6 +24,7 @@
298 + #include <string>
299 + #include <vector>
300 + #include <fstream>
301 ++#include <sys/utsname.h> // uname(read hostname)
302 +
303 + #include "log.h"
304 + #include "lib/raop.h"
305 +@@ -102,6 +103,18 @@ void print_info(char *name) {
306 + printf("-v/-h Displays this help and version information\n");
307 + }
308 +
309 ++/* read the mashines hostname an write it into name */
310 ++void get_hostname(std::string& name) {
311 ++ struct utsname buf;
312 ++ int res = uname(&buf);
313 ++ if(res) {
314 ++ //error
315 ++ printf("could not read hostname: %d %s\n", res, strerror(res));
316 ++ return;
317 ++ }
318 ++ name = buf.nodename;
319 ++}
320 ++
321 + int main(int argc, char *argv[]) {
322 + init_signals();
323 +
324 +@@ -112,6 +125,8 @@ int main(int argc, char *argv[]) {
325 + bool low_latency = DEFAULT_LOW_LATENCY;
326 + bool debug_log = DEFAULT_DEBUG_LOG;
327 +
328 ++ get_hostname(server_name);
329 ++
330 + // Parse arguments
331 + for (int i = 1; i < argc; i++) {
332 + std::string arg(argv[i]);
333
334 diff --git a/media-video/uxplay/metadata.xml b/media-video/uxplay/metadata.xml
335 new file mode 100644
336 index 000000000..e4f2e1f73
337 --- /dev/null
338 +++ b/media-video/uxplay/metadata.xml
339 @@ -0,0 +1,23 @@
340 +<?xml version="1.0" encoding="UTF-8"?>
341 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
342 +<pkgmetadata>
343 + <maintainer type="person">
344 + <email>vowstar@×××××.com</email>
345 + <name>Huang Rui</name>
346 + </maintainer>
347 + <upstream>
348 + <remote-id type="github">antimof/UxPlay</remote-id>
349 + </upstream>
350 + <longdescription lang="en">
351 + UxPlay - AirPlay Unix mirroring server.
352 + This project is an early stage prototype of unix AirPlay server. Work is
353 + based on https://github.com/FD-/RPiPlay. Tested on Ubuntu 19.10 desktop.
354 + 5G Wifi connection is the must.
355 + Features:
356 + Based on Gstreamer.
357 + Video and audio are supported out of the box.
358 + Gstreamer decoding is plugin agnostic.
359 + Uses accelerated decoders if availible. VAAPI is preferable.
360 + Automatic screen orientation.
361 + </longdescription>
362 +</pkgmetadata>
363
364 diff --git a/media-video/uxplay/uxplay-0_pre20210525.ebuild b/media-video/uxplay/uxplay-0_pre20210525.ebuild
365 new file mode 100644
366 index 000000000..0f74d6650
367 --- /dev/null
368 +++ b/media-video/uxplay/uxplay-0_pre20210525.ebuild
369 @@ -0,0 +1,46 @@
370 +# Copyright 1999-2021 Gentoo Authors
371 +# Distributed under the terms of the GNU General Public License v2
372 +
373 +EAPI=7
374 +
375 +GIT_PN="UxPlay"
376 +
377 +inherit cmake
378 +
379 +DESCRIPTION="AirPlay Unix mirroring server"
380 +HOMEPAGE="https://github.com/antimof/UxPlay"
381 +
382 +if [[ ${PV} == "9999" ]] ; then
383 + EGIT_REPO_URI="https://github.com/antimof/${GIT_PN}.git"
384 + inherit git-r3
385 +else
386 + EGIT_COMMIT="6a473d6026480c47b6d9f1b2d619039da3cd36ba"
387 + SRC_URI="https://github.com/antimof/${GIT_PN}/archive/${EGIT_COMMIT}.tar.gz -> ${P}.tar.gz"
388 + S="${WORKDIR}/${GIT_PN}-${EGIT_COMMIT}"
389 + KEYWORDS="~amd64 ~arm ~x86"
390 +fi
391 +
392 +LICENSE="GPL-3"
393 +SLOT="0"
394 +
395 +RDEPEND="
396 + dev-libs/openssl
397 + media-libs/gstreamer
398 + media-libs/gst-plugins-bad
399 + media-plugins/gst-plugins-libav
400 + net-dns/avahi[mdnsresponder-compat]
401 +"
402 +
403 +DEPEND="
404 + ${RDEPEND}
405 +"
406 +
407 +BDEPEND="
408 + virtual/pkgconfig
409 +"
410 +
411 +PATCHES=(
412 + "${FILESDIR}/${P}-fix-installation.patch"
413 + "${FILESDIR}/${P}-fix-screen-sharing.patch"
414 + "${FILESDIR}/${P}-use-machine-hostname.patch"
415 +)