Skip to content

Commit

Permalink
games/moonlight-embedded: Update to 2.6.2
Browse files Browse the repository at this point in the history
In addition to maintainers patch fix REINPLACE_CMD for docs/README.pod

Changelog:
https://github.com/moonlight-stream/moonlight-embedded/releases/tag/v2.6.2

PR:		276144
  • Loading branch information
armin-25689 authored and Daniel Engberg committed Jan 14, 2024
1 parent f1ef8a6 commit 251a845
Show file tree
Hide file tree
Showing 24 changed files with 162 additions and 1,171 deletions.
16 changes: 13 additions & 3 deletions games/moonlight-embedded/Makefile
@@ -1,5 +1,5 @@
PORTNAME= moonlight-embedded
DISTVERSION= 2.6.1
DISTVERSION= 2.6.2
CATEGORIES= games
MASTER_SITES= https://github.com/moonlight-stream/moonlight-embedded/releases/download/v${DISTVERSION}/

Expand Down Expand Up @@ -33,10 +33,20 @@ USE_XORG= x11
NO_WRKSUBDIR= yes
CFLAGS+= -DHAS_SOCKLEN_T=1 -I${LOCALBASE}/include/libepoll-shim/
LDFLAGS+= -lepoll-shim
CMAKE_OFF= ENABLE_CEC ENABLE_PULSE
CMAKE_ON= ENET_NO_INSTALL

post-patch:
@${REINPLACE_CMD} -e 's@/usr/local@${PREFIX}@' \
PLIST_FILES= bin/moonlight \
"@sample etc/moonlight.conf.sample" \
share/man/man1/moonlight.1.gz \
share/moonlight/gamecontrollerdb.txt

post-extract:
@${REINPLACE_CMD} -e 's|/etc/moonlight/|${PREFIX}/etc/moonlight/|g' \
${WRKSRC}/docs/README.pod
@${REINPLACE_CMD} -e 's@/usr/local@${PREFIX}@' \
-e 's@/etc@${PREFIX}/etc@' \
${WRKSRC}/src/config.c

post-install:
@${MV} ${STAGEDIR}${PREFIX}/etc/moonlight.conf \
Expand Down
6 changes: 3 additions & 3 deletions games/moonlight-embedded/distinfo
@@ -1,3 +1,3 @@
TIMESTAMP = 1697067500
SHA256 (moonlight-embedded-2.6.1.tar.xz) = 1a252e18ac637e0ad7180238fa868e04629a3d8e43232097d5ccaa3b4142fded
SIZE (moonlight-embedded-2.6.1.tar.xz) = 327632
TIMESTAMP = 1701007066
SHA256 (moonlight-embedded-2.6.2.tar.xz) = 8bcc69b403a628efaf8686d40c0d1428b46defe4c65b06ff6ccc3fe32f0b2356
SIZE (moonlight-embedded-2.6.2.tar.xz) = 328660
53 changes: 11 additions & 42 deletions games/moonlight-embedded/files/patch-CMakeLists.txt
@@ -1,45 +1,14 @@
--- CMakeLists.txt.orig 2023-09-01 23:40:56 UTC
--- CMakeLists.txt.orig 2023-11-03 06:08:34 UTC
+++ CMakeLists.txt
@@ -5,14 +5,11 @@ SET(CMAKE_C_STANDARD 99)
include(${CMAKE_ROOT}/Modules/GNUInstallDirs.cmake)
include(${CMAKE_SOURCE_DIR}/cmake/generate_version_header.cmake)

-add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-pointer-sign -Wno-sign-compare -Wno-switch)
-
aux_source_directory(./src SRC_LIST)
list(APPEND SRC_LIST ./src/input/evdev.c ./src/input/mapping.c ./src/input/udev.c)

set(MOONLIGHT_DEFINITIONS)

-find_package(ALSA)
find_package(Opus REQUIRED)
find_package(Broadcom-OMX)
find_package(Freescale)
@@ -46,10 +43,8 @@ if (ENABLE_FFMPEG)
endif()
endif()
if (ENABLE_PULSE)
- pkg_check_modules(PULSE libpulse-simple)
endif()
if (ENABLE_CEC)
- pkg_check_modules(CEC libcec>=4)
endif()

pkg_check_modules(MMAL mmal)
@@ -91,7 +86,6 @@ if (CEC_FOUND)
@@ -87,6 +87,11 @@ add_executable(moonlight ${SRC_LIST})
target_link_libraries(moonlight m)
target_link_libraries(moonlight gamestream)

+if (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ set(ALSA_FOUND FALSE)
+ target_sources(moonlight PRIVATE ./src/audio/oss.c)
+endif()
+
if (CEC_FOUND)
list(APPEND MOONLIGHT_DEFINITIONS HAVE_LIBCEC)
list(APPEND MOONLIGHT_OPTIONS CEC)
target_sources(moonlight PRIVATE ./src/input/cec.c)
- target_include_directories(moonlight PRIVATE ./third_party/libcec ${CEC_INCLUDE_DIRS})
target_link_libraries(moonlight ${CEC_LIBRARIES})
endif()

@@ -158,7 +152,7 @@ if (SOFTWARE_FOUND)
if(X11_FOUND)
list(APPEND MOONLIGHT_DEFINITIONS HAVE_X11)
list(APPEND MOONLIGHT_OPTIONS X11)
- target_sources(moonlight PRIVATE ./src/video/x11.c ./src/video/egl.c ./src/input/x11.c)
+ target_sources(moonlight PRIVATE ./src/video/x11.c ./src/video/egl.c ./src/input/x11.c ./src/audio/oss.c)
target_include_directories(moonlight PRIVATE ${XLIB_INCLUDE_DIRS} ${EGL_INCLUDE_DIRS} ${GLES_INCLUDE_DIRS})
target_link_libraries(moonlight ${XLIB_LIBRARIES} ${EGL_LIBRARIES} ${GLES_LIBRARIES})
endif()
8 changes: 0 additions & 8 deletions games/moonlight-embedded/files/patch-docs_CMakeLists.txt

This file was deleted.

120 changes: 0 additions & 120 deletions games/moonlight-embedded/files/patch-docs_README.pod

This file was deleted.

@@ -1,4 +1,4 @@
--- libgamestream/CMakeLists.txt.orig 2023-09-01 23:40:56 UTC
--- libgamestream/CMakeLists.txt.orig 2023-11-03 06:08:34 UTC
+++ libgamestream/CMakeLists.txt
@@ -3,7 +3,7 @@ set(SO_VERSION 4)
find_package(LibUUID REQUIRED)
Expand Down
13 changes: 9 additions & 4 deletions games/moonlight-embedded/files/patch-libgamestream_client.c
@@ -1,13 +1,18 @@
--- libgamestream/client.c.orig 2023-09-01 23:40:56 UTC
--- libgamestream/client.c.orig 2023-11-03 06:08:34 UTC
+++ libgamestream/client.c
@@ -537,7 +537,11 @@ int gs_pair(PSERVER_DATA server, char* pin) {
@@ -537,7 +537,16 @@ int gs_pair(PSERVER_DATA server, char* pin) {
RAND_bytes(client_secret_data, sizeof(client_secret_data));

const ASN1_BIT_STRING *asnSignature;
+#if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
+
+#ifdef __FreeBSD__
+ #if OPENSSL_VERSION_NUMBER >= 0x10100000L && !defined(LIBRESSL_VERSION_NUMBER)
X509_get0_signature(&asnSignature, NULL, cert);
+#else
+ #else
+ asnSignature = cert->signature;
+ #endif
+#else
+ X509_get0_signature(&asnSignature, NULL, cert);
+#endif

char challenge_response[16 + SIGNATURE_LEN + sizeof(client_secret_data)];
Expand Down
6 changes: 3 additions & 3 deletions games/moonlight-embedded/files/patch-libgamestream_http.c
@@ -1,12 +1,12 @@
--- libgamestream/http.c.orig 2023-09-01 23:40:56 UTC
--- libgamestream/http.c.orig 2023-11-03 06:08:34 UTC
+++ libgamestream/http.c
@@ -73,6 +73,9 @@ int http_init(const char* keyDirectory, int logLevel)
int http_request(char* url, PHTTP_DATA data) {
curl_easy_setopt(curl, CURLOPT_WRITEDATA, data);
curl_easy_setopt(curl, CURLOPT_URL, url);
+ curl_easy_setopt(curl, CURLOPT_TCP_FASTOPEN, 1L);
+ curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1);
+#ifdef __FreeBSD__
+ curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1);
+#endif

if (debug)
printf("Request %s\n", url);
6 changes: 4 additions & 2 deletions games/moonlight-embedded/files/patch-src_audio_audio.h
@@ -1,7 +1,9 @@
--- src/audio/audio.h.orig 2023-09-01 23:40:56 UTC
--- src/audio/audio.h.orig 2023-11-03 06:08:34 UTC
+++ src/audio/audio.h
@@ -31,3 +31,4 @@ extern AUDIO_RENDERER_CALLBACKS audio_callbacks_sdl;
@@ -31,3 +31,6 @@ extern AUDIO_RENDERER_CALLBACKS audio_callbacks_sdl;
extern AUDIO_RENDERER_CALLBACKS audio_callbacks_pulse;
bool audio_pulse_init(char* audio_device);
#endif
+#ifdef __FreeBSD__
+extern AUDIO_RENDERER_CALLBACKS audio_callbacks_oss;
+#endif
37 changes: 20 additions & 17 deletions games/moonlight-embedded/files/patch-src_audio_oss.c
@@ -1,6 +1,6 @@
--- src/audio/oss.c.orig 2023-09-24 06:52:39 UTC
--- src/audio/oss.c.orig 2024-01-01 05:31:28 UTC
+++ src/audio/oss.c
@@ -0,0 +1,102 @@
@@ -0,0 +1,105 @@
+/*
+ * This file is part of Moonlight Embedded.
+ *
Expand All @@ -20,21 +20,24 @@
+ * along with Moonlight; if not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef __FreeBSD__
+#include <sys/soundcard.h>
+#include <sys/ioctl.h>
+#include "audio.h"
+
+#include <stdio.h>
+#include <opus_multistream.h>
+
+#include <sys/ioctl.h>
+#include <unistd.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+static OpusMSDecoder* decoder;
+static short* pcmBuffer;
+static int samplesPerFrame;
+static int channelCount;
+static int fd;
+static int fd = -1;
+
+static int oss_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int arFlags) {
+ int rc;
Expand All @@ -46,27 +49,26 @@
+ if (pcmBuffer == NULL)
+ return -1;
+
+ char* oss_name = "/dev/dsp";
+ const char* oss_name = "/dev/dsp";
+ fd = open(oss_name, O_WRONLY);
+ // buffer size for fragment ,selector 12 is 4096;11 is 2048;10 is 1024; 13is 8192
+ if (fd == -1) {
+ close(fd);
+ printf("Open audio device /dev/dsp faild!!!");
+ printf("Open audio device /dev/dsp failed! error %d\n", errno);
+ return -1;
+ }
+ // buffer size for fragment ,selector 12 is 4096;11 is 2048;10 is 1024; 13is 8192
+ int frag = 12;
+ if (ioctl(fd, SNDCTL_DSP_SETFRAGMENT, &frag) == -1)
+ printf("Set framgment for /dev/dsp faild.");
+ printf("Set fragment for /dev/dsp failed.");
+
+ int format = AFMT_S16_LE;
+ int channels = opusConfig->channelCount;
+ int rate = opusConfig->sampleRate;
+ if (ioctl(fd, SNDCTL_DSP_SETFMT, &format) == -1)
+ printf("Set framgment for /dev/dsp faild.");
+ printf("Set format for /dev/dsp failed.");
+ if (ioctl(fd, SNDCTL_DSP_CHANNELS, &channels) == -1)
+ printf("Set channels for /dev/dsp faild.");
+ printf("Set channels for /dev/dsp failed.");
+ if (ioctl(fd, SNDCTL_DSP_SPEED, &rate) == -1)
+ printf("Set sameple rate for /dev/dsp faild.");
+ printf("Set sample rate for /dev/dsp failed.");
+
+ return 0;
+}
Expand All @@ -82,17 +84,17 @@
+ pcmBuffer = NULL;
+ }
+
+ if (fd != 0) {
+ if (fd != -1) {
+ close(fd);
+ fd = 0;
+ fd = -1;
+ }
+}
+
+static void oss_renderer_decode_and_play_sample(char* data, int length) {
+ int decodeLen = opus_multistream_decode(decoder, data, length, pcmBuffer, samplesPerFrame, 0);
+ if (decodeLen > 0) {
+ write(fd, pcmBuffer, decodeLen * channelCount * sizeof(short));
+ } else {
+ } else if (decodeLen < 0) {
+ printf("Opus error from decode: %d\n", decodeLen);
+ }
+}
Expand All @@ -103,3 +105,4 @@
+ .decodeAndPlaySample = oss_renderer_decode_and_play_sample,
+ .capabilities = CAPABILITY_DIRECT_SUBMIT | CAPABILITY_SUPPORTS_ARBITRARY_AUDIO_DURATION,
+};
+#endif

0 comments on commit 251a845

Please sign in to comment.