mirror of
https://github.com/morgan9e/UxPlay
synced 2026-04-14 00:04:13 +09:00
Merge pull request #113 from FDH2/master
UxPlay 1.58: new user requested option -nohold added
This commit is contained in:
118
README.html
118
README.html
@@ -1,6 +1,6 @@
|
||||
<h1
|
||||
id="uxplay-1.57-airplay-mirror-and-airplay-audio-server-for-linux-macos-and-unix-now-also-runs-on-windows.">UxPlay
|
||||
1.57: AirPlay-Mirror and AirPlay-Audio server for Linux, macOS, and Unix
|
||||
id="uxplay-1.58-airplay-mirror-and-airplay-audio-server-for-linux-macos-and-unix-now-also-runs-on-windows.">UxPlay
|
||||
1.58: AirPlay-Mirror and AirPlay-Audio server for Linux, macOS, and Unix
|
||||
(now also runs on Windows).</h1>
|
||||
<h3
|
||||
id="now-developed-at-the-github-site-httpsgithub.comfdh2uxplay-where-all-user-issues-should-be-posted.">Now
|
||||
@@ -20,7 +20,7 @@ running UxPlay. Using AirPlay, UxPlay can emulate a second display for
|
||||
macOS clients.</p></li>
|
||||
<li><p>Support for older iOS clients (such as 32-bit iPad 2nd gen., iPod
|
||||
Touch 5th gen. and iPhone 4S, when upgraded to iOS 9.3.5, or later
|
||||
64-bit versions), plus a Windows AirPlay-client emulator,
|
||||
64-bit devices), plus a Windows AirPlay-client emulator,
|
||||
AirMyPC.</p></li>
|
||||
<li><p>Uses GStreamer plugins for audio and video rendering (with
|
||||
options to select different hardware-appropriate output “videosinks” and
|
||||
@@ -30,10 +30,10 @@ pipeline).</p></li>
|
||||
<li><p><strong>New</strong>: Support for Raspberry Pi, with hardware
|
||||
video acceleration using Video4Linux2 (v4l2), which supports both 32-
|
||||
and 64-bit systems: this is the replacement for 32-bit-only OpenMAX
|
||||
(omx), for which support by RPi distributions is being discontinued.
|
||||
(Until GStreamer 1.22 is released, a backport of changes from the
|
||||
GStreamer development branch is needed: this has now been done by
|
||||
Raspberry Pi OS (Bullseye); for other distributions a <a
|
||||
(omx), no longer actively supported by RPi distributions. (Until
|
||||
GStreamer 1.22 is released, a backport of changes from the GStreamer
|
||||
development branch is needed: this has now been done by Raspberry Pi OS
|
||||
(Bullseye); for other distributions a <a
|
||||
href="https://github.com/FDH2/UxPlay/wiki/Gstreamer-Video4Linux2-plugin-patches">patch</a>
|
||||
to the GStreamer Video4Linux2 plugin, available in the <a
|
||||
href="https://github.com/FDH2/UxPlay/wiki">UxPlay Wiki</a>, is
|
||||
@@ -293,6 +293,12 @@ prevents UxPlay from receiving client connection requests unless some
|
||||
network ports are opened. See <a
|
||||
href="#troubleshooting">Troubleshooting</a> below for help with this or
|
||||
other problems.</p>
|
||||
<ul>
|
||||
<li>By default, UxPlay is locked to its current client until that client
|
||||
drops the connection; the option <code>-nohold</code> modifies this
|
||||
behavior so that when a new client requests a connection, it removes the
|
||||
current client and takes over.</li>
|
||||
</ul>
|
||||
<p>To display the accompanying “Cover Art” from sources like Apple Music
|
||||
in Audio-Only (ALAC) mode, run
|
||||
“<code>uxplay -ca <name> &</code>” in the background, then run
|
||||
@@ -313,12 +319,19 @@ instructions for Raspberry Pi (only tested on model 4B)</strong>:</h3>
|
||||
<ul>
|
||||
<li><p>For good performance, the Raspberry Pi needs the GStreamer
|
||||
Video4linux2 plugin to use its Broadcom GPU hardware for decoding h264
|
||||
video. You can also test UxPlay with software-only video decoding using
|
||||
option <code>-avdec</code>.</p></li>
|
||||
<li><p>The upcoming GStreamer-1.22 release will work well, but older
|
||||
releases of GStreamer will not work unless patched with backports of the
|
||||
improvements from GStreamer-1.22. Raspberry Pi OS (Bullseye) now has the
|
||||
needed backports. For other distributions, patches for GStreamer are <a
|
||||
video. The plugin accesses the GPU using the bcm2835_codec kernel module
|
||||
which is maintained by Raspberry Pi in the drivers/staging/VC04_services
|
||||
part of the <a href="https://github.com/raspberrypi/linux">Raspberry Pi
|
||||
kernel tree</a>, but is not yet included in the mainline Linux kernel.
|
||||
Distributions for R Pi that supply it include Raspberry Pi OS, Ubuntu,
|
||||
and Manjaro. Some others may not. <strong>Without this kernel module,
|
||||
UxPlay cannot use the GPU.</strong></p></li>
|
||||
<li><p>The plugin in the upcoming GStreamer-1.22 release will work well,
|
||||
but the one in older releases of GStreamer will not work unless patched
|
||||
with backports of the improvements from GStreamer-1.22. Raspberry Pi OS
|
||||
(Bullseye) now has a working backport. For a fuller backport, or for
|
||||
other distributions, patches for the GStreamer Video4Linux2 plugin are
|
||||
<a
|
||||
href="https://github.com/FDH2/UxPlay/wiki/Gstreamer-Video4Linux2-plugin-patches">available
|
||||
with instructions in the UxPlay Wiki</a>.</p></li>
|
||||
</ul>
|
||||
@@ -341,12 +354,18 @@ latest GStreamer patches from the Wiki, you will need to use the UxPlay
|
||||
option <code>-bt709</code></strong>: previously the GStreamer v4l2
|
||||
plugin could not recognise Apple’s color format (an unusual “full-range”
|
||||
variant of the bt709 HDTV standard), which -bt709 fixes.
|
||||
GStreamer-1.20.4 will have a fix for this, which is included in the
|
||||
latest patches, so beginning with UxPlay-1.56, the bt709 fix is no
|
||||
longer automatically applied. <strong>After a recent update, Raspberry
|
||||
Pi OS (Bullseye) now supplies an already-patched GStreamer-1.18.4 that
|
||||
works with UxPlay, but needs the <code>-bt709</code> option with
|
||||
UxPlay-1.56 or later.</strong></p></li>
|
||||
GStreamer-1.20.4 has a fix for this, which is included in the latest
|
||||
patches, so beginning with UxPlay-1.56, the bt709 fix is no longer
|
||||
automatically applied.</p></li>
|
||||
<li><p>As mentioned, <strong>Raspberry Pi OS (Bullseye) now supplies a
|
||||
GStreamer-1.18.4 package with backports that works with UxPlay, but
|
||||
needs the <code>-bt709</code> option with UxPlay-1.56 or later.</strong>
|
||||
Although this Raspberry Pi OS package
|
||||
gstreamer1.0-plugins-good-1.18.4-2+deb11u1+rpt1 works without having to
|
||||
be patched, <strong>don’t use options <code>-v4l2</code> and
|
||||
<code>-rpi*</code> with it, as they cause a crash if the client screen
|
||||
is rotated</strong>. (This does not occur when the patch from the UxPlay
|
||||
Wiki has been applied.)</p></li>
|
||||
<li><p>Tip: to start UxPlay on a remote host (such as a Raspberry Pi)
|
||||
using ssh:</p></li>
|
||||
</ul>
|
||||
@@ -363,10 +382,12 @@ FILE (which can be /dev/null to discard it).</p>
|
||||
Alma Linux):</strong> (sudo yum install) openssl-devel libplist-devel
|
||||
avahi-compat-libdns_sd-devel (some from the “PowerTools” add-on
|
||||
repository) (+libX11-devel for ZOOMFIX). The required GStreamer packages
|
||||
(some from <a href="https://rpmfusion.org">rpmfusion.org</a>) are:
|
||||
gstreamer1-devel gstreamer1-plugins-base-devel gstreamer1-libav
|
||||
gstreamer1-plugins-bad-free (+ gstreamer1-vaapi for intel
|
||||
graphics).</p></li>
|
||||
are: gstreamer1-devel gstreamer1-plugins-base-devel gstreamer1-libav
|
||||
gstreamer1-plugins-bad-free (+ gstreamer1-vaapi for intel graphics); you
|
||||
may need to get some of them (in particular gstreamer1-libav) from <a
|
||||
href="https://rpmfusion.org">rpmfusion.org</a> (which provides packages
|
||||
including plugins that RedHat does not ship for license
|
||||
reasons).</p></li>
|
||||
<li><p><strong>OpenSUSE:</strong> (sudo zypper install) libopenssl-devel
|
||||
libplist-devel avahi-compat-mDNSResponder-devel (+ libX11-devel for
|
||||
ZOOMFIX). The required GStreamer packages are: gstreamer-devel
|
||||
@@ -374,7 +395,8 @@ gstreamer-plugins-base-devel gstreamer-plugins-libav
|
||||
gstreamer-plugins-bad (+ gstreamer-plugins-vaapi for Intel graphics); in
|
||||
some cases, you may need to use gstreamer packages for OpenSUSE from <a
|
||||
href="https://ftp.gwdg.de/pub/linux/misc/packman/suse/">Packman</a>
|
||||
“Essentials”.</p></li>
|
||||
“Essentials” (which provides packages including plugins that OpenSUSE
|
||||
does not ship for license reasons).</p></li>
|
||||
<li><p><strong>Arch Linux</strong> (sudo pacman -Syu) openssl libplist
|
||||
avahi gst-plugins-base gst-plugins-good gst-plugins-bad gst-libav (+
|
||||
gstreamer-vaapi for Intel graphics). (<strong>Also available as a
|
||||
@@ -419,9 +441,9 @@ it, but compiled to use X11).</li>
|
||||
</ul>
|
||||
<p><strong>For the “official” release</strong>: install both the macOS
|
||||
runtime and development installer packages. Assuming that the latest
|
||||
release is 1.20.3. install
|
||||
<code>gstreamer-1.0-1.20.3-universal.pkg</code> and
|
||||
<code>gstreamer-1.0-devel-1.20.3-universal.pkg</code>. (If you have an
|
||||
release is 1.20.4. install
|
||||
<code>gstreamer-1.0-1.20.4-universal.pkg</code> and
|
||||
<code>gstreamer-1.0-devel-1.20.4-universal.pkg</code>. (If you have an
|
||||
Intel-architecture Mac, and have problems with the “universal” packages,
|
||||
you can also use <code>gstreamer-1.0-1.18.6-x86_64.pkg</code> and
|
||||
<code>gstreamer-1.0-devel-1.18.6-x86_64.pkg</code>.) Click on them to
|
||||
@@ -454,7 +476,9 @@ not affect the (small) initial OpenGL mirror window size, but the window
|
||||
can be expanded using the mouse or trackpad. In contrast, a window
|
||||
created with “-vs osxvideosink” is initially big, but has the wrong
|
||||
aspect ratio (stretched image); in this case the aspect ratio changes
|
||||
when the window width is changed by dragging its side.</p></li>
|
||||
when the window width is changed by dragging its side; the option “-vs
|
||||
osxvideosink force-aspect-ratio=true” can be used to make the window
|
||||
have the correct aspect ratio when it first opens.</p></li>
|
||||
</ul>
|
||||
<p><strong><em>Using GStreamer installed from MacPorts (not
|
||||
recommended):</em></strong></p>
|
||||
@@ -622,11 +646,12 @@ such as vaapisink.</p>
|
||||
h264 parser element, default is h264parse. Using quotes “…” allows
|
||||
options to be added.</p>
|
||||
<p><strong>-vd <em>decoder</em></strong> chooses the GStreamer
|
||||
pipeline’s h264 decoder element, instead of letting decodebin pick it
|
||||
for you. Software decoding is done by avdec_h264; various hardware
|
||||
decoders include: vaapih264dec, nvdec, nvh264dec, v4l2h264dec (these
|
||||
require that the appropriate hardware is available). Using quotes “…”
|
||||
allows some parameters to be included with the decoder name.</p>
|
||||
pipeline’s h264 decoder element, instead of the default value
|
||||
“decodebin” which chooses it for you. Software decoding is done by
|
||||
avdec_h264; various hardware decoders include: vaapih264dec, nvdec,
|
||||
nvh264dec, v4l2h264dec (these require that the appropriate hardware is
|
||||
available). Using quotes “…” allows some parameters to be included with
|
||||
the decoder name.</p>
|
||||
<p><strong>-vc <em>converter</em></strong> chooses the GStreamer
|
||||
pipeline’s videoconverter element, instead of the default value
|
||||
“videoconvert”. When using Video4Linux2 hardware-decoding by a
|
||||
@@ -634,14 +659,14 @@ GPU,<code>-vc v4l2convert</code> will also use the GPU for video
|
||||
conversion. Using quotes “…” allows some parameters to be included with
|
||||
the converter name.</p>
|
||||
<p><strong>-vs <em>videosink</em></strong> chooses the GStreamer
|
||||
videosink, instead of letting autovideosink pick it for you. Some
|
||||
videosink choices are: ximagesink, xvimagesink, vaapisink (for intel
|
||||
graphics), gtksink, glimagesink, waylandsink, osximagesink (for macOS),
|
||||
kmssink (for systems without X11, like Raspberry Pi OS lite) or
|
||||
fpsdisplaysink (which shows the streaming framerate in fps). Using
|
||||
quotes “…” allows some parameters to be included with the videosink
|
||||
name. For example, <strong>fullscreen</strong> mode is supported by the
|
||||
vaapisink plugin, and is obtained using
|
||||
videosink, instead of the default value “autovideosink” which chooses it
|
||||
for you. Some videosink choices are: ximagesink, xvimagesink, vaapisink
|
||||
(for intel graphics), gtksink, glimagesink, waylandsink, osximagesink
|
||||
(for macOS), kmssink (for systems without X11, like Raspberry Pi OS
|
||||
lite) or fpsdisplaysink (which shows the streaming framerate in fps).
|
||||
Using quotes “…” allows some parameters to be included with the
|
||||
videosink name. For example, <strong>fullscreen</strong> mode is
|
||||
supported by the vaapisink plugin, and is obtained using
|
||||
<code>-vs "vaapisink fullscreen=true"</code>; this also works with
|
||||
<code>waylandsink</code>. The syntax of such options is specific to a
|
||||
given plugin, and some choices of videosink might not work on your
|
||||
@@ -706,6 +731,9 @@ client sends the “Stop Mirroring” signal. <em>This option is currently
|
||||
used by default in macOS, as the window created in macOS by GStreamer
|
||||
does not terminate correctly (it causes a segfault) if it is still open
|
||||
when the GStreamer pipeline is closed.</em></p>
|
||||
<p><strong>-nohold</strong> Drops the current connection when a new
|
||||
client attempts to connect. Without this option, the current client
|
||||
maintains exclusive ownership of UxPlay until it disconnects.</p>
|
||||
<p><strong>-FPSdata</strong> Turns on monitoring of regular reports
|
||||
about video streaming performance that are sent by the client. These
|
||||
will be displayed in the terminal window if this option is used. The
|
||||
@@ -761,9 +789,9 @@ containerized to make it playable with standard audio players.</em></p>
|
||||
<p><strong>-d</strong> Enable debug output. Note: this does not show
|
||||
GStreamer error or debug messages. To see GStreamer error and warning
|
||||
messages, set the environment variable GST_DEBUG with “export
|
||||
GST_DEBUG=2” before running uxplay. To see GStreamer debug messages, set
|
||||
GST_DEBUG=4; increase this to see even more of the GStreamer inner
|
||||
workings.</p>
|
||||
GST_DEBUG=2” before running uxplay. To see GStreamer information
|
||||
messages, set GST_DEBUG=4; for DEBUG messages, GST_DEBUG=5; increase
|
||||
this to see even more of the GStreamer inner workings.</p>
|
||||
<h1 id="troubleshooting">Troubleshooting</h1>
|
||||
<p>Note: <code>uxplay</code> is run from a terminal command line, and
|
||||
informational messages are written to the terminal.</p>
|
||||
@@ -962,6 +990,8 @@ as “SupportsLegacyPairing”) of the “features” plist code (reported to
|
||||
the client by the AirPlay server) to be set. The “features” code and
|
||||
other settings are set in <code>UxPlay/lib/dnssdint.h</code>.</p>
|
||||
<h1 id="changelog">Changelog</h1>
|
||||
<p>1.58 2022-10-29 Add option “-nohold” that will drop existing
|
||||
connections when a new client connects. Update llhttp to v8.1.0.</p>
|
||||
<p>1.57 2022-10-09 Minor fixes: (fix coredump on AUR on “stop
|
||||
mirroring”, occurs when compiled with AUR CFLAGS -DFORTIFY_SOURCE);
|
||||
graceful exit when required plugins are missing; improved support for
|
||||
|
||||
80
README.md
80
README.md
@@ -1,4 +1,4 @@
|
||||
# UxPlay 1.57: AirPlay-Mirror and AirPlay-Audio server for Linux, macOS, and Unix (now also runs on Windows).
|
||||
# UxPlay 1.58: AirPlay-Mirror and AirPlay-Audio server for Linux, macOS, and Unix (now also runs on Windows).
|
||||
|
||||
### Now developed at the GitHub site [https://github.com/FDH2/UxPlay](https://github.com/FDH2/UxPlay) (where all user issues should be posted).
|
||||
|
||||
@@ -14,7 +14,7 @@ Highlights:
|
||||
as the server running UxPlay. Using AirPlay, UxPlay can
|
||||
emulate a second display for macOS clients.
|
||||
* Support for older iOS clients (such as 32-bit iPad 2nd gen., iPod Touch 5th gen. and
|
||||
iPhone 4S, when upgraded to iOS 9.3.5, or later 64-bit versions), plus a
|
||||
iPhone 4S, when upgraded to iOS 9.3.5, or later 64-bit devices), plus a
|
||||
Windows AirPlay-client emulator, AirMyPC.
|
||||
* Uses GStreamer plugins for audio and video rendering (with options
|
||||
to select different hardware-appropriate output "videosinks" and
|
||||
@@ -22,7 +22,7 @@ Highlights:
|
||||
* Support for server behind a firewall.
|
||||
* **New**: Support for Raspberry Pi, with hardware video acceleration using
|
||||
Video4Linux2 (v4l2), which supports both 32- and 64-bit systems: this is the replacement for
|
||||
32-bit-only OpenMAX (omx), for which support by RPi distributions is being discontinued. (Until GStreamer 1.22
|
||||
32-bit-only OpenMAX (omx), no longer actively supported by RPi distributions. (Until GStreamer 1.22
|
||||
is released, a backport of changes from the GStreamer development branch is needed: this has now been done
|
||||
by Raspberry Pi OS (Bullseye); for other distributions
|
||||
a [patch](https://github.com/FDH2/UxPlay/wiki/Gstreamer-Video4Linux2-plugin-patches)
|
||||
@@ -249,6 +249,10 @@ UxPlay from receiving client connection requests unless some network ports
|
||||
are opened. See [Troubleshooting](#troubleshooting) below for
|
||||
help with this or other problems.
|
||||
|
||||
* By default, UxPlay is locked to
|
||||
its current client until that client drops the connection; the option `-nohold` modifies this
|
||||
behavior so that when a new client requests a connection, it removes the current client and takes over.
|
||||
|
||||
To display the accompanying "Cover Art" from sources like Apple Music in Audio-Only (ALAC) mode,
|
||||
run "`uxplay -ca <name> &`" in the background, then run a image viewer with an autoreload feature: an example
|
||||
is "feh": run "``feh -R 1 <name>``"
|
||||
@@ -265,12 +269,16 @@ See [Usage](#usage) for more run-time options.
|
||||
|
||||
### **Special instructions for Raspberry Pi (only tested on model 4B)**:
|
||||
|
||||
* For good performance, the Raspberry Pi needs the GStreamer Video4linux2 plugin to use its Broadcom GPU hardware for decoding h264 video.
|
||||
You can also test UxPlay with software-only video decoding using option `-avdec`.
|
||||
* For good performance, the Raspberry Pi needs the GStreamer Video4linux2 plugin to use its Broadcom GPU hardware
|
||||
for decoding h264 video. The plugin accesses the GPU using the bcm2835_codec kernel module
|
||||
which is maintained by Raspberry Pi in the drivers/staging/VC04_services part of
|
||||
the [Raspberry Pi kernel tree](https://github.com/raspberrypi/linux), but
|
||||
is not yet included in the mainline Linux kernel. Distributions for R Pi that supply it include Raspberry Pi OS, Ubuntu,
|
||||
and Manjaro. Some others may not. **Without this kernel module, UxPlay cannot use the GPU.**
|
||||
|
||||
|
||||
* The upcoming GStreamer-1.22 release will work well, but older releases of GStreamer will not work unless patched with backports of the
|
||||
improvements from GStreamer-1.22. Raspberry Pi OS (Bullseye) now has the needed backports. For other distributions, patches for GStreamer
|
||||
* The plugin in the upcoming GStreamer-1.22 release will work well, but the one in older releases of GStreamer will not
|
||||
work unless patched with backports of the improvements from GStreamer-1.22. Raspberry Pi OS (Bullseye) now has a
|
||||
working backport. For a fuller backport, or for other distributions, patches for the GStreamer Video4Linux2 plugin
|
||||
are [available with instructions in the UxPlay Wiki](https://github.com/FDH2/UxPlay/wiki/Gstreamer-Video4Linux2-plugin-patches).
|
||||
|
||||
The basic uxplay options for R Pi are ```uxplay [-v4l2] [-vs <videosink>]```. The
|
||||
@@ -284,10 +292,15 @@ provides the best results.
|
||||
|
||||
* **For UxPlay-1.56 and later, if you are not using the latest GStreamer patches from the Wiki, you will need to use the UxPlay option `-bt709`**:
|
||||
previously the GStreamer v4l2 plugin could
|
||||
not recognise Apple's color format (an unusual "full-range" variant of the bt709 HDTV standard), which -bt709 fixes. GStreamer-1.20.4 will have
|
||||
a fix for this, which is included in the latest patches, so beginning with UxPlay-1.56, the bt709 fix is no longer automatically applied.
|
||||
**After a recent update, Raspberry Pi OS (Bullseye) now supplies an already-patched GStreamer-1.18.4 that works with UxPlay, but
|
||||
needs the `-bt709` option with UxPlay-1.56 or later.**
|
||||
not recognise Apple's color format (an unusual "full-range" variant of the bt709 HDTV standard), which -bt709 fixes. GStreamer-1.20.4 has
|
||||
a fix for this, which is included in the latest patches, so beginning with UxPlay-1.56, the bt709 fix is no longer automatically
|
||||
applied.
|
||||
|
||||
* As mentioned, **Raspberry Pi OS (Bullseye) now supplies a GStreamer-1.18.4 package with backports that works
|
||||
with UxPlay, but needs the `-bt709` option with UxPlay-1.56 or later.** Although this Raspberry Pi OS
|
||||
package gstreamer1.0-plugins-good-1.18.4-2+deb11u1+rpt1 works without having to be patched,
|
||||
**don't use options `-v4l2` and ``-rpi*`` with it, as they
|
||||
cause a crash if the client screen is rotated**. (This does not occur when the patch from the UxPlay Wiki has been applied.)
|
||||
|
||||
|
||||
* Tip: to start UxPlay on a remote host (such as a Raspberry Pi) using ssh:
|
||||
@@ -304,14 +317,19 @@ needs the `-bt709` option with UxPlay-1.56 or later.**
|
||||
|
||||
* **Red Hat, Fedora, CentOS (now continued as Rocky Linux or Alma Linux):**
|
||||
(sudo yum install) openssl-devel libplist-devel avahi-compat-libdns_sd-devel (some from the "PowerTools" add-on repository)
|
||||
(+libX11-devel for ZOOMFIX). The required GStreamer packages (some from [rpmfusion.org](https://rpmfusion.org)) are:
|
||||
gstreamer1-devel gstreamer1-plugins-base-devel gstreamer1-libav gstreamer1-plugins-bad-free (+ gstreamer1-vaapi for intel graphics).
|
||||
(+libX11-devel for ZOOMFIX). The required GStreamer packages are:
|
||||
gstreamer1-devel gstreamer1-plugins-base-devel gstreamer1-libav gstreamer1-plugins-bad-free (+ gstreamer1-vaapi
|
||||
for intel graphics);
|
||||
you may need to get some of them (in particular gstreamer1-libav) from [rpmfusion.org](https://rpmfusion.org)
|
||||
(which provides packages including plugins that RedHat does not ship for license reasons).
|
||||
|
||||
* **OpenSUSE:**
|
||||
(sudo zypper install) libopenssl-devel libplist-devel
|
||||
avahi-compat-mDNSResponder-devel (+ libX11-devel for ZOOMFIX). The required
|
||||
GStreamer packages are: gstreamer-devel gstreamer-plugins-base-devel gstreamer-plugins-libav gstreamer-plugins-bad (+ gstreamer-plugins-vaapi for Intel graphics); in some cases,
|
||||
you may need to use gstreamer packages for OpenSUSE from [Packman](https://ftp.gwdg.de/pub/linux/misc/packman/suse/) "Essentials".
|
||||
avahi-compat-mDNSResponder-devel (+ libX11-devel for ZOOMFIX). The required GStreamer packages are: gstreamer-devel
|
||||
gstreamer-plugins-base-devel gstreamer-plugins-libav gstreamer-plugins-bad (+ gstreamer-plugins-vaapi
|
||||
for Intel graphics); in some cases, you may need to use gstreamer packages for OpenSUSE
|
||||
from [Packman](https://ftp.gwdg.de/pub/linux/misc/packman/suse/) "Essentials"
|
||||
(which provides packages including plugins that OpenSUSE does not ship for license reasons).
|
||||
|
||||
|
||||
* **Arch Linux**
|
||||
@@ -348,8 +366,8 @@ Next get the latest macOS release of GStreamer-1.0.
|
||||
from [https://gstreamer.freedesktop.org/download/](https://gstreamer.freedesktop.org/download/). The alternative is to install it from Homebrew
|
||||
(MacPorts also supplies it, but compiled to use X11).
|
||||
|
||||
**For the "official" release**: install both the macOS runtime and development installer packages. Assuming that the latest release is 1.20.3.
|
||||
install `gstreamer-1.0-1.20.3-universal.pkg` and ``gstreamer-1.0-devel-1.20.3-universal.pkg``. (If
|
||||
**For the "official" release**: install both the macOS runtime and development installer packages. Assuming that the latest release is 1.20.4.
|
||||
install `gstreamer-1.0-1.20.4-universal.pkg` and ``gstreamer-1.0-devel-1.20.4-universal.pkg``. (If
|
||||
you have an Intel-architecture Mac, and have problems with the "universal" packages, you can also
|
||||
use `gstreamer-1.0-1.18.6-x86_64.pkg` and ``gstreamer-1.0-devel-1.18.6-x86_64.pkg``.) Click on them to
|
||||
install (they install to /Library/FrameWorks/GStreamer.framework).
|
||||
@@ -380,7 +398,9 @@ Finally, build and install uxplay (without ZOOMFIX): open a terminal and change
|
||||
* In the case of glimagesink, the resolution settings "-s wxh" do not affect
|
||||
the (small) initial OpenGL mirror window size, but the window can be expanded using the mouse or trackpad.
|
||||
In contrast, a window created with "-vs osxvideosink" is initially big, but has the wrong aspect ratio (stretched image);
|
||||
in this case the aspect ratio changes when the window width is changed by dragging its side.
|
||||
in this case the aspect ratio changes when the window width is changed by dragging its side;
|
||||
the option "-vs osxvideosink force-aspect-ratio=true" can be used to make the window have the
|
||||
correct aspect ratio when it first opens.
|
||||
|
||||
|
||||
***Using GStreamer installed from MacPorts (not recommended):***
|
||||
@@ -532,8 +552,8 @@ which will not work if a firewall is running.
|
||||
**-vp _parser_** choses the GStreamer pipeline's h264 parser element, default is h264parse. Using
|
||||
quotes "..." allows options to be added.
|
||||
|
||||
**-vd _decoder_** chooses the GStreamer pipeline's h264 decoder element, instead of letting
|
||||
decodebin pick it for you. Software decoding is done by avdec_h264; various hardware decoders
|
||||
**-vd _decoder_** chooses the GStreamer pipeline's h264 decoder element, instead of the default value
|
||||
"decodebin" which chooses it for you. Software decoding is done by avdec_h264; various hardware decoders
|
||||
include: vaapih264dec, nvdec, nvh264dec, v4l2h264dec (these require that the appropriate hardware is
|
||||
available). Using quotes "..." allows some parameters to be included with the decoder name.
|
||||
|
||||
@@ -541,9 +561,10 @@ which will not work if a firewall is running.
|
||||
value "videoconvert". When using Video4Linux2 hardware-decoding by a GPU,`-vc v4l2convert` will also use
|
||||
the GPU for video conversion. Using quotes "..." allows some parameters to be included with the converter name.
|
||||
|
||||
**-vs _videosink_** chooses the GStreamer videosink, instead of letting
|
||||
autovideosink pick it for you. Some videosink choices are: ximagesink, xvimagesink,
|
||||
vaapisink (for intel graphics), gtksink, glimagesink, waylandsink, osximagesink (for macOS), kmssink (for systems without X11, like Raspberry Pi OS lite) or
|
||||
**-vs _videosink_** chooses the GStreamer videosink, instead of the default value
|
||||
"autovideosink" which chooses it for you. Some videosink choices are: ximagesink, xvimagesink,
|
||||
vaapisink (for intel graphics), gtksink, glimagesink, waylandsink, osximagesink (for macOS), kmssink (for
|
||||
systems without X11, like Raspberry Pi OS lite) or
|
||||
fpsdisplaysink (which shows the streaming framerate in fps). Using quotes
|
||||
"..." allows some parameters to be included with the videosink name.
|
||||
For example, **fullscreen** mode is supported by the vaapisink plugin, and is
|
||||
@@ -600,6 +621,9 @@ which will not work if a firewall is running.
|
||||
as the window created in macOS by GStreamer does not terminate correctly (it causes a segfault)
|
||||
if it is still open when the GStreamer pipeline is closed._
|
||||
|
||||
**-nohold** Drops the current connection when a new client attempts to connect. Without this option,
|
||||
the current client maintains exclusive ownership of UxPlay until it disconnects.
|
||||
|
||||
**-FPSdata** Turns on monitoring of regular reports about video streaming performance
|
||||
that are sent by the client. These will be displayed in the terminal window if this
|
||||
option is used. The data is updated by the client at 1 second intervals.
|
||||
@@ -649,7 +673,8 @@ which will not work if a firewall is running.
|
||||
|
||||
**-d** Enable debug output. Note: this does not show GStreamer error or debug messages. To see GStreamer error
|
||||
and warning messages, set the environment variable GST_DEBUG with "export GST_DEBUG=2" before running uxplay.
|
||||
To see GStreamer debug messages, set GST_DEBUG=4; increase this to see even more of the GStreamer inner workings.
|
||||
To see GStreamer information messages, set GST_DEBUG=4; for DEBUG messages, GST_DEBUG=5; increase this to see even
|
||||
more of the GStreamer inner workings.
|
||||
|
||||
# Troubleshooting
|
||||
|
||||
@@ -809,6 +834,9 @@ tvOS 12.2.1); it seems that the use of "legacy" protocol just requires bit 27 (l
|
||||
The "features" code and other settings are set in `UxPlay/lib/dnssdint.h`.
|
||||
|
||||
# Changelog
|
||||
1.58 2022-10-29 Add option "-nohold" that will drop existing connections when a new client connects.
|
||||
Update llhttp to v8.1.0.
|
||||
|
||||
1.57 2022-10-09 Minor fixes: (fix coredump on AUR on "stop mirroring", occurs when compiled with
|
||||
AUR CFLAGS -DFORTIFY_SOURCE); graceful exit when required plugins are missing;
|
||||
improved support for builds on Windows. Include audioresample in GStreamer
|
||||
|
||||
117
README.txt
117
README.txt
@@ -1,4 +1,4 @@
|
||||
# UxPlay 1.57: AirPlay-Mirror and AirPlay-Audio server for Linux, macOS, and Unix (now also runs on Windows).
|
||||
# UxPlay 1.58: AirPlay-Mirror and AirPlay-Audio server for Linux, macOS, and Unix (now also runs on Windows).
|
||||
|
||||
### Now developed at the GitHub site <https://github.com/FDH2/UxPlay> (where all user issues should be posted).
|
||||
|
||||
@@ -18,7 +18,7 @@ Highlights:
|
||||
|
||||
- Support for older iOS clients (such as 32-bit iPad 2nd gen., iPod
|
||||
Touch 5th gen. and iPhone 4S, when upgraded to iOS 9.3.5, or later
|
||||
64-bit versions), plus a Windows AirPlay-client emulator, AirMyPC.
|
||||
64-bit devices), plus a Windows AirPlay-client emulator, AirMyPC.
|
||||
|
||||
- Uses GStreamer plugins for audio and video rendering (with options
|
||||
to select different hardware-appropriate output "videosinks" and
|
||||
@@ -29,9 +29,9 @@ Highlights:
|
||||
|
||||
- **New**: Support for Raspberry Pi, with hardware video acceleration
|
||||
using Video4Linux2 (v4l2), which supports both 32- and 64-bit
|
||||
systems: this is the replacement for 32-bit-only OpenMAX (omx), for
|
||||
which support by RPi distributions is being discontinued. (Until
|
||||
GStreamer 1.22 is released, a backport of changes from the GStreamer
|
||||
systems: this is the replacement for 32-bit-only OpenMAX (omx), no
|
||||
longer actively supported by RPi distributions. (Until GStreamer
|
||||
1.22 is released, a backport of changes from the GStreamer
|
||||
development branch is needed: this has now been done by Raspberry Pi
|
||||
OS (Bullseye); for other distributions a
|
||||
[patch](https://github.com/FDH2/UxPlay/wiki/Gstreamer-Video4Linux2-plugin-patches)
|
||||
@@ -293,6 +293,11 @@ prevents UxPlay from receiving client connection requests unless some
|
||||
network ports are opened. See [Troubleshooting](#troubleshooting) below
|
||||
for help with this or other problems.
|
||||
|
||||
- By default, UxPlay is locked to its current client until that client
|
||||
drops the connection; the option `-nohold` modifies this behavior so
|
||||
that when a new client requests a connection, it removes the current
|
||||
client and takes over.
|
||||
|
||||
To display the accompanying "Cover Art" from sources like Apple Music in
|
||||
Audio-Only (ALAC) mode, run "`uxplay -ca <name> &`" in the background,
|
||||
then run a image viewer with an autoreload feature: an example is "feh":
|
||||
@@ -312,14 +317,20 @@ options.
|
||||
|
||||
- For good performance, the Raspberry Pi needs the GStreamer
|
||||
Video4linux2 plugin to use its Broadcom GPU hardware for decoding
|
||||
h264 video. You can also test UxPlay with software-only video
|
||||
decoding using option `-avdec`.
|
||||
h264 video. The plugin accesses the GPU using the bcm2835_codec
|
||||
kernel module which is maintained by Raspberry Pi in the
|
||||
drivers/staging/VC04_services part of the [Raspberry Pi kernel
|
||||
tree](https://github.com/raspberrypi/linux), but is not yet included
|
||||
in the mainline Linux kernel. Distributions for R Pi that supply it
|
||||
include Raspberry Pi OS, Ubuntu, and Manjaro. Some others may not.
|
||||
**Without this kernel module, UxPlay cannot use the GPU.**
|
||||
|
||||
- The upcoming GStreamer-1.22 release will work well, but older
|
||||
releases of GStreamer will not work unless patched with backports of
|
||||
the improvements from GStreamer-1.22. Raspberry Pi OS (Bullseye) now
|
||||
has the needed backports. For other distributions, patches for
|
||||
GStreamer are [available with instructions in the UxPlay
|
||||
- The plugin in the upcoming GStreamer-1.22 release will work well,
|
||||
but the one in older releases of GStreamer will not work unless
|
||||
patched with backports of the improvements from GStreamer-1.22.
|
||||
Raspberry Pi OS (Bullseye) now has a working backport. For a fuller
|
||||
backport, or for other distributions, patches for the GStreamer
|
||||
Video4Linux2 plugin are [available with instructions in the UxPlay
|
||||
Wiki](https://github.com/FDH2/UxPlay/wiki/Gstreamer-Video4Linux2-plugin-patches).
|
||||
|
||||
The basic uxplay options for R Pi are
|
||||
@@ -338,12 +349,18 @@ results.
|
||||
GStreamer patches from the Wiki, you will need to use the UxPlay
|
||||
option `-bt709`**: previously the GStreamer v4l2 plugin could not
|
||||
recognise Apple's color format (an unusual "full-range" variant of
|
||||
the bt709 HDTV standard), which -bt709 fixes. GStreamer-1.20.4 will
|
||||
have a fix for this, which is included in the latest patches, so
|
||||
beginning with UxPlay-1.56, the bt709 fix is no longer automatically
|
||||
applied. **After a recent update, Raspberry Pi OS (Bullseye) now
|
||||
supplies an already-patched GStreamer-1.18.4 that works with UxPlay,
|
||||
but needs the `-bt709` option with UxPlay-1.56 or later.**
|
||||
the bt709 HDTV standard), which -bt709 fixes. GStreamer-1.20.4 has a
|
||||
fix for this, which is included in the latest patches, so beginning
|
||||
with UxPlay-1.56, the bt709 fix is no longer automatically applied.
|
||||
|
||||
- As mentioned, **Raspberry Pi OS (Bullseye) now supplies a
|
||||
GStreamer-1.18.4 package with backports that works with UxPlay, but
|
||||
needs the `-bt709` option with UxPlay-1.56 or later.** Although this
|
||||
Raspberry Pi OS package
|
||||
gstreamer1.0-plugins-good-1.18.4-2+deb11u1+rpt1 works without having
|
||||
to be patched, **don't use options `-v4l2` and `-rpi*` with it, as
|
||||
they cause a crash if the client screen is rotated**. (This does not
|
||||
occur when the patch from the UxPlay Wiki has been applied.)
|
||||
|
||||
- Tip: to start UxPlay on a remote host (such as a Raspberry Pi) using
|
||||
ssh:
|
||||
@@ -365,9 +382,12 @@ running if the ssh session is closed. Terminal output is saved to FILE
|
||||
Linux):** (sudo yum install) openssl-devel libplist-devel
|
||||
avahi-compat-libdns_sd-devel (some from the "PowerTools" add-on
|
||||
repository) (+libX11-devel for ZOOMFIX). The required GStreamer
|
||||
packages (some from [rpmfusion.org](https://rpmfusion.org)) are:
|
||||
gstreamer1-devel gstreamer1-plugins-base-devel gstreamer1-libav
|
||||
gstreamer1-plugins-bad-free (+ gstreamer1-vaapi for intel graphics).
|
||||
packages are: gstreamer1-devel gstreamer1-plugins-base-devel
|
||||
gstreamer1-libav gstreamer1-plugins-bad-free (+ gstreamer1-vaapi for
|
||||
intel graphics); you may need to get some of them (in particular
|
||||
gstreamer1-libav) from [rpmfusion.org](https://rpmfusion.org) (which
|
||||
provides packages including plugins that RedHat does not ship for
|
||||
license reasons).
|
||||
|
||||
- **OpenSUSE:** (sudo zypper install) libopenssl-devel libplist-devel
|
||||
avahi-compat-mDNSResponder-devel (+ libX11-devel for ZOOMFIX). The
|
||||
@@ -377,7 +397,8 @@ running if the ssh session is closed. Terminal output is saved to FILE
|
||||
graphics); in some cases, you may need to use gstreamer packages for
|
||||
OpenSUSE from
|
||||
[Packman](https://ftp.gwdg.de/pub/linux/misc/packman/suse/)
|
||||
"Essentials".
|
||||
"Essentials" (which provides packages including plugins that
|
||||
OpenSUSE does not ship for license reasons).
|
||||
|
||||
- **Arch Linux** (sudo pacman -Syu) openssl libplist avahi
|
||||
gst-plugins-base gst-plugins-good gst-plugins-bad gst-libav (+
|
||||
@@ -423,8 +444,8 @@ Next get the latest macOS release of GStreamer-1.0.
|
||||
|
||||
**For the "official" release**: install both the macOS runtime and
|
||||
development installer packages. Assuming that the latest release is
|
||||
1.20.3. install `gstreamer-1.0-1.20.3-universal.pkg` and
|
||||
`gstreamer-1.0-devel-1.20.3-universal.pkg`. (If you have an
|
||||
1.20.4. install `gstreamer-1.0-1.20.4-universal.pkg` and
|
||||
`gstreamer-1.0-devel-1.20.4-universal.pkg`. (If you have an
|
||||
Intel-architecture Mac, and have problems with the "universal" packages,
|
||||
you can also use `gstreamer-1.0-1.18.6-x86_64.pkg` and
|
||||
`gstreamer-1.0-devel-1.18.6-x86_64.pkg`.) Click on them to install (they
|
||||
@@ -461,7 +482,9 @@ downloads, "UxPlay" for "git clone" downloads) and build/install with
|
||||
can be expanded using the mouse or trackpad. In contrast, a window
|
||||
created with "-vs osxvideosink" is initially big, but has the wrong
|
||||
aspect ratio (stretched image); in this case the aspect ratio
|
||||
changes when the window width is changed by dragging its side.
|
||||
changes when the window width is changed by dragging its side; the
|
||||
option "-vs osxvideosink force-aspect-ratio=true" can be used to
|
||||
make the window have the correct aspect ratio when it first opens.
|
||||
|
||||
***Using GStreamer installed from MacPorts (not recommended):***
|
||||
|
||||
@@ -642,11 +665,11 @@ vaapisink.
|
||||
default is h264parse. Using quotes "..." allows options to be added.
|
||||
|
||||
**-vd *decoder*** chooses the GStreamer pipeline's h264 decoder element,
|
||||
instead of letting decodebin pick it for you. Software decoding is done
|
||||
by avdec_h264; various hardware decoders include: vaapih264dec, nvdec,
|
||||
nvh264dec, v4l2h264dec (these require that the appropriate hardware is
|
||||
available). Using quotes "..." allows some parameters to be included
|
||||
with the decoder name.
|
||||
instead of the default value "decodebin" which chooses it for you.
|
||||
Software decoding is done by avdec_h264; various hardware decoders
|
||||
include: vaapih264dec, nvdec, nvh264dec, v4l2h264dec (these require that
|
||||
the appropriate hardware is available). Using quotes "..." allows some
|
||||
parameters to be included with the decoder name.
|
||||
|
||||
**-vc *converter*** chooses the GStreamer pipeline's videoconverter
|
||||
element, instead of the default value "videoconvert". When using
|
||||
@@ -654,17 +677,17 @@ Video4Linux2 hardware-decoding by a GPU,`-vc v4l2convert` will also use
|
||||
the GPU for video conversion. Using quotes "..." allows some parameters
|
||||
to be included with the converter name.
|
||||
|
||||
**-vs *videosink*** chooses the GStreamer videosink, instead of letting
|
||||
autovideosink pick it for you. Some videosink choices are: ximagesink,
|
||||
xvimagesink, vaapisink (for intel graphics), gtksink, glimagesink,
|
||||
waylandsink, osximagesink (for macOS), kmssink (for systems without X11,
|
||||
like Raspberry Pi OS lite) or fpsdisplaysink (which shows the streaming
|
||||
framerate in fps). Using quotes "..." allows some parameters to be
|
||||
included with the videosink name. For example, **fullscreen** mode is
|
||||
supported by the vaapisink plugin, and is obtained using
|
||||
`-vs "vaapisink fullscreen=true"`; this also works with `waylandsink`.
|
||||
The syntax of such options is specific to a given plugin, and some
|
||||
choices of videosink might not work on your system.
|
||||
**-vs *videosink*** chooses the GStreamer videosink, instead of the
|
||||
default value "autovideosink" which chooses it for you. Some videosink
|
||||
choices are: ximagesink, xvimagesink, vaapisink (for intel graphics),
|
||||
gtksink, glimagesink, waylandsink, osximagesink (for macOS), kmssink
|
||||
(for systems without X11, like Raspberry Pi OS lite) or fpsdisplaysink
|
||||
(which shows the streaming framerate in fps). Using quotes "..." allows
|
||||
some parameters to be included with the videosink name. For example,
|
||||
**fullscreen** mode is supported by the vaapisink plugin, and is
|
||||
obtained using `-vs "vaapisink fullscreen=true"`; this also works with
|
||||
`waylandsink`. The syntax of such options is specific to a given plugin,
|
||||
and some choices of videosink might not work on your system.
|
||||
|
||||
**-vs 0** suppresses display of streamed video, but plays streamed
|
||||
audio. (The client's screen is still mirrored at a reduced rate of 1
|
||||
@@ -731,6 +754,10 @@ window created in macOS by GStreamer does not terminate correctly (it
|
||||
causes a segfault) if it is still open when the GStreamer pipeline is
|
||||
closed.*
|
||||
|
||||
**-nohold** Drops the current connection when a new client attempts to
|
||||
connect. Without this option, the current client maintains exclusive
|
||||
ownership of UxPlay until it disconnects.
|
||||
|
||||
**-FPSdata** Turns on monitoring of regular reports about video
|
||||
streaming performance that are sent by the client. These will be
|
||||
displayed in the terminal window if this option is used. The data is
|
||||
@@ -791,8 +818,9 @@ audio players.*
|
||||
**-d** Enable debug output. Note: this does not show GStreamer error or
|
||||
debug messages. To see GStreamer error and warning messages, set the
|
||||
environment variable GST_DEBUG with "export GST_DEBUG=2" before running
|
||||
uxplay. To see GStreamer debug messages, set GST_DEBUG=4; increase this
|
||||
to see even more of the GStreamer inner workings.
|
||||
uxplay. To see GStreamer information messages, set GST_DEBUG=4; for
|
||||
DEBUG messages, GST_DEBUG=5; increase this to see even more of the
|
||||
GStreamer inner workings.
|
||||
|
||||
# Troubleshooting
|
||||
|
||||
@@ -1004,6 +1032,9 @@ other settings are set in `UxPlay/lib/dnssdint.h`.
|
||||
|
||||
# Changelog
|
||||
|
||||
1.58 2022-10-29 Add option "-nohold" that will drop existing connections
|
||||
when a new client connects. Update llhttp to v8.1.0.
|
||||
|
||||
1.57 2022-10-09 Minor fixes: (fix coredump on AUR on "stop mirroring",
|
||||
occurs when compiled with AUR CFLAGS -DFORTIFY_SOURCE); graceful exit
|
||||
when required plugins are missing; improved support for builds on
|
||||
|
||||
41
lib/httpd.c
41
lib/httpd.c
@@ -97,6 +97,20 @@ httpd_destroy(httpd_t *httpd)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
httpd_remove_connection(httpd_t *httpd, http_connection_t *connection)
|
||||
{
|
||||
if (connection->request) {
|
||||
http_request_destroy(connection->request);
|
||||
connection->request = NULL;
|
||||
}
|
||||
httpd->callbacks.conn_destroy(connection->user_data);
|
||||
shutdown(connection->socket_fd, SHUT_WR);
|
||||
closesocket(connection->socket_fd);
|
||||
connection->connected = 0;
|
||||
httpd->open_connections--;
|
||||
}
|
||||
|
||||
static int
|
||||
httpd_add_connection(httpd_t *httpd, int fd, unsigned char *local, int local_len, unsigned char *remote, int remote_len)
|
||||
{
|
||||
@@ -158,6 +172,19 @@ httpd_accept_connection(httpd_t *httpd, int server_fd, int is_ipv6)
|
||||
local = netutils_get_address(&local_saddr, &local_len);
|
||||
remote = netutils_get_address(&remote_saddr, &remote_len);
|
||||
|
||||
/* for uxplay, remove existing connections to make way for new connections:
|
||||
* this will only occur if max_connections > 2 */
|
||||
if (httpd->open_connections >= 2) {
|
||||
logger_log(httpd->logger, LOGGER_INFO, "Destroying current connections to allow connection by new client");
|
||||
for (int i = 0; i<httpd->max_connections; i++) {
|
||||
http_connection_t *connection = &httpd->connections[i];
|
||||
if (!connection->connected) {
|
||||
continue;
|
||||
}
|
||||
httpd_remove_connection(httpd, connection);
|
||||
}
|
||||
}
|
||||
|
||||
ret = httpd_add_connection(httpd, fd, local, local_len, remote, remote_len);
|
||||
if (ret == -1) {
|
||||
shutdown(fd, SHUT_RDWR);
|
||||
@@ -167,20 +194,6 @@ httpd_accept_connection(httpd_t *httpd, int server_fd, int is_ipv6)
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void
|
||||
httpd_remove_connection(httpd_t *httpd, http_connection_t *connection)
|
||||
{
|
||||
if (connection->request) {
|
||||
http_request_destroy(connection->request);
|
||||
connection->request = NULL;
|
||||
}
|
||||
httpd->callbacks.conn_destroy(connection->user_data);
|
||||
shutdown(connection->socket_fd, SHUT_WR);
|
||||
closesocket(connection->socket_fd);
|
||||
connection->connected = 0;
|
||||
httpd->open_connections--;
|
||||
}
|
||||
|
||||
static THREAD_RETVAL
|
||||
httpd_thread(void *arg)
|
||||
{
|
||||
|
||||
@@ -60,13 +60,26 @@ const llhttp_settings_t wasm_settings = {
|
||||
wasm_on_message_begin,
|
||||
wasm_on_url,
|
||||
wasm_on_status,
|
||||
NULL,
|
||||
NULL,
|
||||
wasm_on_header_field,
|
||||
wasm_on_header_value,
|
||||
NULL,
|
||||
NULL,
|
||||
wasm_on_headers_complete_wrap,
|
||||
wasm_on_body,
|
||||
wasm_on_message_complete,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
NULL,
|
||||
};
|
||||
|
||||
|
||||
@@ -80,6 +93,8 @@ void llhttp_free(llhttp_t* parser) {
|
||||
free(parser);
|
||||
}
|
||||
|
||||
#endif // defined(__wasm__)
|
||||
|
||||
/* Some getters required to get stuff from the parser */
|
||||
|
||||
uint8_t llhttp_get_type(llhttp_t* parser) {
|
||||
@@ -106,8 +121,6 @@ uint8_t llhttp_get_upgrade(llhttp_t* parser) {
|
||||
return parser->upgrade;
|
||||
}
|
||||
|
||||
#endif // defined(__wasm__)
|
||||
|
||||
|
||||
void llhttp_reset(llhttp_t* parser) {
|
||||
llhttp_type_t type = parser->type;
|
||||
@@ -226,6 +239,15 @@ const char* llhttp_method_name(llhttp_method_t method) {
|
||||
#undef HTTP_METHOD_GEN
|
||||
}
|
||||
|
||||
const char* llhttp_status_name(llhttp_status_t status) {
|
||||
#define HTTP_STATUS_GEN(NUM, NAME, STRING) case HTTP_STATUS_##NAME: return #STRING;
|
||||
switch (status) {
|
||||
HTTP_STATUS_MAP(HTTP_STATUS_GEN)
|
||||
default: abort();
|
||||
}
|
||||
#undef HTTP_STATUS_GEN
|
||||
}
|
||||
|
||||
|
||||
void llhttp_set_lenient_headers(llhttp_t* parser, int enabled) {
|
||||
if (enabled) {
|
||||
@@ -299,6 +321,34 @@ int llhttp__on_status_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_method(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
SPAN_CALLBACK_MAYBE(s, on_method, p, endp - p);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_method_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
CALLBACK_MAYBE(s, on_method_complete);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_version(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
SPAN_CALLBACK_MAYBE(s, on_version, p, endp - p);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_version_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
CALLBACK_MAYBE(s, on_version_complete);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_header_field(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
SPAN_CALLBACK_MAYBE(s, on_header_field, p, endp - p);
|
||||
@@ -355,6 +405,34 @@ int llhttp__on_chunk_header(llhttp_t* s, const char* p, const char* endp) {
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_chunk_extension_name(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
SPAN_CALLBACK_MAYBE(s, on_chunk_extension_name, p, endp - p);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_chunk_extension_name_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
CALLBACK_MAYBE(s, on_chunk_extension_name_complete);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_chunk_extension_value(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
SPAN_CALLBACK_MAYBE(s, on_chunk_extension_value, p, endp - p);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_chunk_extension_value_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
CALLBACK_MAYBE(s, on_chunk_extension_value_complete);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_chunk_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
CALLBACK_MAYBE(s, on_chunk_complete);
|
||||
@@ -362,6 +440,13 @@ int llhttp__on_chunk_complete(llhttp_t* s, const char* p, const char* endp) {
|
||||
}
|
||||
|
||||
|
||||
int llhttp__on_reset(llhttp_t* s, const char* p, const char* endp) {
|
||||
int err;
|
||||
CALLBACK_MAYBE(s, on_reset);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
||||
/* Private */
|
||||
|
||||
|
||||
|
||||
6316
lib/llhttp/llhttp.c
6316
lib/llhttp/llhttp.c
File diff suppressed because it is too large
Load Diff
@@ -1,9 +1,9 @@
|
||||
#ifndef INCLUDE_LLHTTP_H_
|
||||
#define INCLUDE_LLHTTP_H_
|
||||
|
||||
#define LLHTTP_VERSION_MAJOR 6
|
||||
#define LLHTTP_VERSION_MINOR 0
|
||||
#define LLHTTP_VERSION_PATCH 7
|
||||
#define LLHTTP_VERSION_MAJOR 8
|
||||
#define LLHTTP_VERSION_MINOR 1
|
||||
#define LLHTTP_VERSION_PATCH 0
|
||||
|
||||
#ifndef LLHTTP_STRICT_MODE
|
||||
# define LLHTTP_STRICT_MODE 0
|
||||
@@ -38,6 +38,7 @@ struct llhttp__internal_s {
|
||||
uint8_t finish;
|
||||
uint16_t flags;
|
||||
uint16_t status_code;
|
||||
uint8_t initial_message_completed;
|
||||
void* settings;
|
||||
};
|
||||
|
||||
@@ -62,6 +63,7 @@ enum llhttp_errno {
|
||||
HPE_CR_EXPECTED = 25,
|
||||
HPE_LF_EXPECTED = 3,
|
||||
HPE_UNEXPECTED_CONTENT_LENGTH = 4,
|
||||
HPE_UNEXPECTED_SPACE = 30,
|
||||
HPE_CLOSED_CONNECTION = 5,
|
||||
HPE_INVALID_METHOD = 6,
|
||||
HPE_INVALID_URL = 7,
|
||||
@@ -81,7 +83,16 @@ enum llhttp_errno {
|
||||
HPE_PAUSED = 21,
|
||||
HPE_PAUSED_UPGRADE = 22,
|
||||
HPE_PAUSED_H2_UPGRADE = 23,
|
||||
HPE_USER = 24
|
||||
HPE_USER = 24,
|
||||
HPE_CB_URL_COMPLETE = 26,
|
||||
HPE_CB_STATUS_COMPLETE = 27,
|
||||
HPE_CB_METHOD_COMPLETE = 32,
|
||||
HPE_CB_VERSION_COMPLETE = 33,
|
||||
HPE_CB_HEADER_FIELD_COMPLETE = 28,
|
||||
HPE_CB_HEADER_VALUE_COMPLETE = 29,
|
||||
HPE_CB_CHUNK_EXTENSION_NAME_COMPLETE = 34,
|
||||
HPE_CB_CHUNK_EXTENSION_VALUE_COMPLETE = 35,
|
||||
HPE_CB_RESET = 31
|
||||
};
|
||||
typedef enum llhttp_errno llhttp_errno_t;
|
||||
|
||||
@@ -102,7 +113,8 @@ enum llhttp_lenient_flags {
|
||||
LENIENT_HEADERS = 0x1,
|
||||
LENIENT_CHUNKED_LENGTH = 0x2,
|
||||
LENIENT_KEEP_ALIVE = 0x4,
|
||||
LENIENT_TRANSFER_ENCODING = 0x8
|
||||
LENIENT_TRANSFER_ENCODING = 0x8,
|
||||
LENIENT_VERSION = 0x10
|
||||
};
|
||||
typedef enum llhttp_lenient_flags llhttp_lenient_flags_t;
|
||||
|
||||
@@ -170,6 +182,109 @@ enum llhttp_method {
|
||||
};
|
||||
typedef enum llhttp_method llhttp_method_t;
|
||||
|
||||
enum llhttp_status {
|
||||
HTTP_STATUS_CONTINUE = 100,
|
||||
HTTP_STATUS_SWITCHING_PROTOCOLS = 101,
|
||||
HTTP_STATUS_PROCESSING = 102,
|
||||
HTTP_STATUS_EARLY_HINTS = 103,
|
||||
HTTP_STATUS_RESPONSE_IS_STALE = 110,
|
||||
HTTP_STATUS_REVALIDATION_FAILED = 111,
|
||||
HTTP_STATUS_DISCONNECTED_OPERATION = 112,
|
||||
HTTP_STATUS_HEURISTIC_EXPIRATION = 113,
|
||||
HTTP_STATUS_MISCELLANEOUS_WARNING = 199,
|
||||
HTTP_STATUS_OK = 200,
|
||||
HTTP_STATUS_CREATED = 201,
|
||||
HTTP_STATUS_ACCEPTED = 202,
|
||||
HTTP_STATUS_NON_AUTHORITATIVE_INFORMATION = 203,
|
||||
HTTP_STATUS_NO_CONTENT = 204,
|
||||
HTTP_STATUS_RESET_CONTENT = 205,
|
||||
HTTP_STATUS_PARTIAL_CONTENT = 206,
|
||||
HTTP_STATUS_MULTI_STATUS = 207,
|
||||
HTTP_STATUS_ALREADY_REPORTED = 208,
|
||||
HTTP_STATUS_TRANSFORMATION_APPLIED = 214,
|
||||
HTTP_STATUS_IM_USED = 226,
|
||||
HTTP_STATUS_MISCELLANEOUS_PERSISTENT_WARNING = 299,
|
||||
HTTP_STATUS_MULTIPLE_CHOICES = 300,
|
||||
HTTP_STATUS_MOVED_PERMANENTLY = 301,
|
||||
HTTP_STATUS_FOUND = 302,
|
||||
HTTP_STATUS_SEE_OTHER = 303,
|
||||
HTTP_STATUS_NOT_MODIFIED = 304,
|
||||
HTTP_STATUS_USE_PROXY = 305,
|
||||
HTTP_STATUS_SWITCH_PROXY = 306,
|
||||
HTTP_STATUS_TEMPORARY_REDIRECT = 307,
|
||||
HTTP_STATUS_PERMANENT_REDIRECT = 308,
|
||||
HTTP_STATUS_BAD_REQUEST = 400,
|
||||
HTTP_STATUS_UNAUTHORIZED = 401,
|
||||
HTTP_STATUS_PAYMENT_REQUIRED = 402,
|
||||
HTTP_STATUS_FORBIDDEN = 403,
|
||||
HTTP_STATUS_NOT_FOUND = 404,
|
||||
HTTP_STATUS_METHOD_NOT_ALLOWED = 405,
|
||||
HTTP_STATUS_NOT_ACCEPTABLE = 406,
|
||||
HTTP_STATUS_PROXY_AUTHENTICATION_REQUIRED = 407,
|
||||
HTTP_STATUS_REQUEST_TIMEOUT = 408,
|
||||
HTTP_STATUS_CONFLICT = 409,
|
||||
HTTP_STATUS_GONE = 410,
|
||||
HTTP_STATUS_LENGTH_REQUIRED = 411,
|
||||
HTTP_STATUS_PRECONDITION_FAILED = 412,
|
||||
HTTP_STATUS_PAYLOAD_TOO_LARGE = 413,
|
||||
HTTP_STATUS_URI_TOO_LONG = 414,
|
||||
HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE = 415,
|
||||
HTTP_STATUS_RANGE_NOT_SATISFIABLE = 416,
|
||||
HTTP_STATUS_EXPECTATION_FAILED = 417,
|
||||
HTTP_STATUS_IM_A_TEAPOT = 418,
|
||||
HTTP_STATUS_PAGE_EXPIRED = 419,
|
||||
HTTP_STATUS_ENHANCE_YOUR_CALM = 420,
|
||||
HTTP_STATUS_MISDIRECTED_REQUEST = 421,
|
||||
HTTP_STATUS_UNPROCESSABLE_ENTITY = 422,
|
||||
HTTP_STATUS_LOCKED = 423,
|
||||
HTTP_STATUS_FAILED_DEPENDENCY = 424,
|
||||
HTTP_STATUS_TOO_EARLY = 425,
|
||||
HTTP_STATUS_UPGRADE_REQUIRED = 426,
|
||||
HTTP_STATUS_PRECONDITION_REQUIRED = 428,
|
||||
HTTP_STATUS_TOO_MANY_REQUESTS = 429,
|
||||
HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL = 430,
|
||||
HTTP_STATUS_REQUEST_HEADER_FIELDS_TOO_LARGE = 431,
|
||||
HTTP_STATUS_LOGIN_TIMEOUT = 440,
|
||||
HTTP_STATUS_NO_RESPONSE = 444,
|
||||
HTTP_STATUS_RETRY_WITH = 449,
|
||||
HTTP_STATUS_BLOCKED_BY_PARENTAL_CONTROL = 450,
|
||||
HTTP_STATUS_UNAVAILABLE_FOR_LEGAL_REASONS = 451,
|
||||
HTTP_STATUS_CLIENT_CLOSED_LOAD_BALANCED_REQUEST = 460,
|
||||
HTTP_STATUS_INVALID_X_FORWARDED_FOR = 463,
|
||||
HTTP_STATUS_REQUEST_HEADER_TOO_LARGE = 494,
|
||||
HTTP_STATUS_SSL_CERTIFICATE_ERROR = 495,
|
||||
HTTP_STATUS_SSL_CERTIFICATE_REQUIRED = 496,
|
||||
HTTP_STATUS_HTTP_REQUEST_SENT_TO_HTTPS_PORT = 497,
|
||||
HTTP_STATUS_INVALID_TOKEN = 498,
|
||||
HTTP_STATUS_CLIENT_CLOSED_REQUEST = 499,
|
||||
HTTP_STATUS_INTERNAL_SERVER_ERROR = 500,
|
||||
HTTP_STATUS_NOT_IMPLEMENTED = 501,
|
||||
HTTP_STATUS_BAD_GATEWAY = 502,
|
||||
HTTP_STATUS_SERVICE_UNAVAILABLE = 503,
|
||||
HTTP_STATUS_GATEWAY_TIMEOUT = 504,
|
||||
HTTP_STATUS_HTTP_VERSION_NOT_SUPPORTED = 505,
|
||||
HTTP_STATUS_VARIANT_ALSO_NEGOTIATES = 506,
|
||||
HTTP_STATUS_INSUFFICIENT_STORAGE = 507,
|
||||
HTTP_STATUS_LOOP_DETECTED = 508,
|
||||
HTTP_STATUS_BANDWIDTH_LIMIT_EXCEEDED = 509,
|
||||
HTTP_STATUS_NOT_EXTENDED = 510,
|
||||
HTTP_STATUS_NETWORK_AUTHENTICATION_REQUIRED = 511,
|
||||
HTTP_STATUS_WEB_SERVER_UNKNOWN_ERROR = 520,
|
||||
HTTP_STATUS_WEB_SERVER_IS_DOWN = 521,
|
||||
HTTP_STATUS_CONNECTION_TIMEOUT = 522,
|
||||
HTTP_STATUS_ORIGIN_IS_UNREACHABLE = 523,
|
||||
HTTP_STATUS_TIMEOUT_OCCURED = 524,
|
||||
HTTP_STATUS_SSL_HANDSHAKE_FAILED = 525,
|
||||
HTTP_STATUS_INVALID_SSL_CERTIFICATE = 526,
|
||||
HTTP_STATUS_RAILGUN_ERROR = 527,
|
||||
HTTP_STATUS_SITE_IS_OVERLOADED = 529,
|
||||
HTTP_STATUS_SITE_IS_FROZEN = 530,
|
||||
HTTP_STATUS_IDENTITY_PROVIDER_AUTHENTICATION_ERROR = 561,
|
||||
HTTP_STATUS_NETWORK_READ_TIMEOUT = 598,
|
||||
HTTP_STATUS_NETWORK_CONNECT_TIMEOUT = 599
|
||||
};
|
||||
typedef enum llhttp_status llhttp_status_t;
|
||||
|
||||
#define HTTP_ERRNO_MAP(XX) \
|
||||
XX(0, OK, OK) \
|
||||
XX(1, INTERNAL, INTERNAL) \
|
||||
@@ -177,6 +292,7 @@ typedef enum llhttp_method llhttp_method_t;
|
||||
XX(25, CR_EXPECTED, CR_EXPECTED) \
|
||||
XX(3, LF_EXPECTED, LF_EXPECTED) \
|
||||
XX(4, UNEXPECTED_CONTENT_LENGTH, UNEXPECTED_CONTENT_LENGTH) \
|
||||
XX(30, UNEXPECTED_SPACE, UNEXPECTED_SPACE) \
|
||||
XX(5, CLOSED_CONNECTION, CLOSED_CONNECTION) \
|
||||
XX(6, INVALID_METHOD, INVALID_METHOD) \
|
||||
XX(7, INVALID_URL, INVALID_URL) \
|
||||
@@ -197,6 +313,15 @@ typedef enum llhttp_method llhttp_method_t;
|
||||
XX(22, PAUSED_UPGRADE, PAUSED_UPGRADE) \
|
||||
XX(23, PAUSED_H2_UPGRADE, PAUSED_H2_UPGRADE) \
|
||||
XX(24, USER, USER) \
|
||||
XX(26, CB_URL_COMPLETE, CB_URL_COMPLETE) \
|
||||
XX(27, CB_STATUS_COMPLETE, CB_STATUS_COMPLETE) \
|
||||
XX(32, CB_METHOD_COMPLETE, CB_METHOD_COMPLETE) \
|
||||
XX(33, CB_VERSION_COMPLETE, CB_VERSION_COMPLETE) \
|
||||
XX(28, CB_HEADER_FIELD_COMPLETE, CB_HEADER_FIELD_COMPLETE) \
|
||||
XX(29, CB_HEADER_VALUE_COMPLETE, CB_HEADER_VALUE_COMPLETE) \
|
||||
XX(34, CB_CHUNK_EXTENSION_NAME_COMPLETE, CB_CHUNK_EXTENSION_NAME_COMPLETE) \
|
||||
XX(35, CB_CHUNK_EXTENSION_VALUE_COMPLETE, CB_CHUNK_EXTENSION_VALUE_COMPLETE) \
|
||||
XX(31, CB_RESET, CB_RESET) \
|
||||
|
||||
|
||||
#define HTTP_METHOD_MAP(XX) \
|
||||
@@ -302,6 +427,108 @@ typedef enum llhttp_method llhttp_method_t;
|
||||
XX(45, FLUSH, FLUSH) \
|
||||
|
||||
|
||||
#define HTTP_STATUS_MAP(XX) \
|
||||
XX(100, CONTINUE, CONTINUE) \
|
||||
XX(101, SWITCHING_PROTOCOLS, SWITCHING_PROTOCOLS) \
|
||||
XX(102, PROCESSING, PROCESSING) \
|
||||
XX(103, EARLY_HINTS, EARLY_HINTS) \
|
||||
XX(110, RESPONSE_IS_STALE, RESPONSE_IS_STALE) \
|
||||
XX(111, REVALIDATION_FAILED, REVALIDATION_FAILED) \
|
||||
XX(112, DISCONNECTED_OPERATION, DISCONNECTED_OPERATION) \
|
||||
XX(113, HEURISTIC_EXPIRATION, HEURISTIC_EXPIRATION) \
|
||||
XX(199, MISCELLANEOUS_WARNING, MISCELLANEOUS_WARNING) \
|
||||
XX(200, OK, OK) \
|
||||
XX(201, CREATED, CREATED) \
|
||||
XX(202, ACCEPTED, ACCEPTED) \
|
||||
XX(203, NON_AUTHORITATIVE_INFORMATION, NON_AUTHORITATIVE_INFORMATION) \
|
||||
XX(204, NO_CONTENT, NO_CONTENT) \
|
||||
XX(205, RESET_CONTENT, RESET_CONTENT) \
|
||||
XX(206, PARTIAL_CONTENT, PARTIAL_CONTENT) \
|
||||
XX(207, MULTI_STATUS, MULTI_STATUS) \
|
||||
XX(208, ALREADY_REPORTED, ALREADY_REPORTED) \
|
||||
XX(214, TRANSFORMATION_APPLIED, TRANSFORMATION_APPLIED) \
|
||||
XX(226, IM_USED, IM_USED) \
|
||||
XX(299, MISCELLANEOUS_PERSISTENT_WARNING, MISCELLANEOUS_PERSISTENT_WARNING) \
|
||||
XX(300, MULTIPLE_CHOICES, MULTIPLE_CHOICES) \
|
||||
XX(301, MOVED_PERMANENTLY, MOVED_PERMANENTLY) \
|
||||
XX(302, FOUND, FOUND) \
|
||||
XX(303, SEE_OTHER, SEE_OTHER) \
|
||||
XX(304, NOT_MODIFIED, NOT_MODIFIED) \
|
||||
XX(305, USE_PROXY, USE_PROXY) \
|
||||
XX(306, SWITCH_PROXY, SWITCH_PROXY) \
|
||||
XX(307, TEMPORARY_REDIRECT, TEMPORARY_REDIRECT) \
|
||||
XX(308, PERMANENT_REDIRECT, PERMANENT_REDIRECT) \
|
||||
XX(400, BAD_REQUEST, BAD_REQUEST) \
|
||||
XX(401, UNAUTHORIZED, UNAUTHORIZED) \
|
||||
XX(402, PAYMENT_REQUIRED, PAYMENT_REQUIRED) \
|
||||
XX(403, FORBIDDEN, FORBIDDEN) \
|
||||
XX(404, NOT_FOUND, NOT_FOUND) \
|
||||
XX(405, METHOD_NOT_ALLOWED, METHOD_NOT_ALLOWED) \
|
||||
XX(406, NOT_ACCEPTABLE, NOT_ACCEPTABLE) \
|
||||
XX(407, PROXY_AUTHENTICATION_REQUIRED, PROXY_AUTHENTICATION_REQUIRED) \
|
||||
XX(408, REQUEST_TIMEOUT, REQUEST_TIMEOUT) \
|
||||
XX(409, CONFLICT, CONFLICT) \
|
||||
XX(410, GONE, GONE) \
|
||||
XX(411, LENGTH_REQUIRED, LENGTH_REQUIRED) \
|
||||
XX(412, PRECONDITION_FAILED, PRECONDITION_FAILED) \
|
||||
XX(413, PAYLOAD_TOO_LARGE, PAYLOAD_TOO_LARGE) \
|
||||
XX(414, URI_TOO_LONG, URI_TOO_LONG) \
|
||||
XX(415, UNSUPPORTED_MEDIA_TYPE, UNSUPPORTED_MEDIA_TYPE) \
|
||||
XX(416, RANGE_NOT_SATISFIABLE, RANGE_NOT_SATISFIABLE) \
|
||||
XX(417, EXPECTATION_FAILED, EXPECTATION_FAILED) \
|
||||
XX(418, IM_A_TEAPOT, IM_A_TEAPOT) \
|
||||
XX(419, PAGE_EXPIRED, PAGE_EXPIRED) \
|
||||
XX(420, ENHANCE_YOUR_CALM, ENHANCE_YOUR_CALM) \
|
||||
XX(421, MISDIRECTED_REQUEST, MISDIRECTED_REQUEST) \
|
||||
XX(422, UNPROCESSABLE_ENTITY, UNPROCESSABLE_ENTITY) \
|
||||
XX(423, LOCKED, LOCKED) \
|
||||
XX(424, FAILED_DEPENDENCY, FAILED_DEPENDENCY) \
|
||||
XX(425, TOO_EARLY, TOO_EARLY) \
|
||||
XX(426, UPGRADE_REQUIRED, UPGRADE_REQUIRED) \
|
||||
XX(428, PRECONDITION_REQUIRED, PRECONDITION_REQUIRED) \
|
||||
XX(429, TOO_MANY_REQUESTS, TOO_MANY_REQUESTS) \
|
||||
XX(430, REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL, REQUEST_HEADER_FIELDS_TOO_LARGE_UNOFFICIAL) \
|
||||
XX(431, REQUEST_HEADER_FIELDS_TOO_LARGE, REQUEST_HEADER_FIELDS_TOO_LARGE) \
|
||||
XX(440, LOGIN_TIMEOUT, LOGIN_TIMEOUT) \
|
||||
XX(444, NO_RESPONSE, NO_RESPONSE) \
|
||||
XX(449, RETRY_WITH, RETRY_WITH) \
|
||||
XX(450, BLOCKED_BY_PARENTAL_CONTROL, BLOCKED_BY_PARENTAL_CONTROL) \
|
||||
XX(451, UNAVAILABLE_FOR_LEGAL_REASONS, UNAVAILABLE_FOR_LEGAL_REASONS) \
|
||||
XX(460, CLIENT_CLOSED_LOAD_BALANCED_REQUEST, CLIENT_CLOSED_LOAD_BALANCED_REQUEST) \
|
||||
XX(463, INVALID_X_FORWARDED_FOR, INVALID_X_FORWARDED_FOR) \
|
||||
XX(494, REQUEST_HEADER_TOO_LARGE, REQUEST_HEADER_TOO_LARGE) \
|
||||
XX(495, SSL_CERTIFICATE_ERROR, SSL_CERTIFICATE_ERROR) \
|
||||
XX(496, SSL_CERTIFICATE_REQUIRED, SSL_CERTIFICATE_REQUIRED) \
|
||||
XX(497, HTTP_REQUEST_SENT_TO_HTTPS_PORT, HTTP_REQUEST_SENT_TO_HTTPS_PORT) \
|
||||
XX(498, INVALID_TOKEN, INVALID_TOKEN) \
|
||||
XX(499, CLIENT_CLOSED_REQUEST, CLIENT_CLOSED_REQUEST) \
|
||||
XX(500, INTERNAL_SERVER_ERROR, INTERNAL_SERVER_ERROR) \
|
||||
XX(501, NOT_IMPLEMENTED, NOT_IMPLEMENTED) \
|
||||
XX(502, BAD_GATEWAY, BAD_GATEWAY) \
|
||||
XX(503, SERVICE_UNAVAILABLE, SERVICE_UNAVAILABLE) \
|
||||
XX(504, GATEWAY_TIMEOUT, GATEWAY_TIMEOUT) \
|
||||
XX(505, HTTP_VERSION_NOT_SUPPORTED, HTTP_VERSION_NOT_SUPPORTED) \
|
||||
XX(506, VARIANT_ALSO_NEGOTIATES, VARIANT_ALSO_NEGOTIATES) \
|
||||
XX(507, INSUFFICIENT_STORAGE, INSUFFICIENT_STORAGE) \
|
||||
XX(508, LOOP_DETECTED, LOOP_DETECTED) \
|
||||
XX(509, BANDWIDTH_LIMIT_EXCEEDED, BANDWIDTH_LIMIT_EXCEEDED) \
|
||||
XX(510, NOT_EXTENDED, NOT_EXTENDED) \
|
||||
XX(511, NETWORK_AUTHENTICATION_REQUIRED, NETWORK_AUTHENTICATION_REQUIRED) \
|
||||
XX(520, WEB_SERVER_UNKNOWN_ERROR, WEB_SERVER_UNKNOWN_ERROR) \
|
||||
XX(521, WEB_SERVER_IS_DOWN, WEB_SERVER_IS_DOWN) \
|
||||
XX(522, CONNECTION_TIMEOUT, CONNECTION_TIMEOUT) \
|
||||
XX(523, ORIGIN_IS_UNREACHABLE, ORIGIN_IS_UNREACHABLE) \
|
||||
XX(524, TIMEOUT_OCCURED, TIMEOUT_OCCURED) \
|
||||
XX(525, SSL_HANDSHAKE_FAILED, SSL_HANDSHAKE_FAILED) \
|
||||
XX(526, INVALID_SSL_CERTIFICATE, INVALID_SSL_CERTIFICATE) \
|
||||
XX(527, RAILGUN_ERROR, RAILGUN_ERROR) \
|
||||
XX(529, SITE_IS_OVERLOADED, SITE_IS_OVERLOADED) \
|
||||
XX(530, SITE_IS_FROZEN, SITE_IS_FROZEN) \
|
||||
XX(561, IDENTITY_PROVIDER_AUTHENTICATION_ERROR, IDENTITY_PROVIDER_AUTHENTICATION_ERROR) \
|
||||
XX(598, NETWORK_READ_TIMEOUT, NETWORK_READ_TIMEOUT) \
|
||||
XX(599, NETWORK_CONNECT_TIMEOUT, NETWORK_CONNECT_TIMEOUT) \
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
@@ -333,8 +560,12 @@ struct llhttp_settings_s {
|
||||
/* Possible return values 0, -1, HPE_USER */
|
||||
llhttp_data_cb on_url;
|
||||
llhttp_data_cb on_status;
|
||||
llhttp_data_cb on_method;
|
||||
llhttp_data_cb on_version;
|
||||
llhttp_data_cb on_header_field;
|
||||
llhttp_data_cb on_header_value;
|
||||
llhttp_data_cb on_chunk_extension_name;
|
||||
llhttp_data_cb on_chunk_extension_value;
|
||||
|
||||
/* Possible return values:
|
||||
* 0 - Proceed normally
|
||||
@@ -352,6 +583,14 @@ struct llhttp_settings_s {
|
||||
|
||||
/* Possible return values 0, -1, `HPE_PAUSED` */
|
||||
llhttp_cb on_message_complete;
|
||||
llhttp_cb on_url_complete;
|
||||
llhttp_cb on_status_complete;
|
||||
llhttp_cb on_method_complete;
|
||||
llhttp_cb on_version_complete;
|
||||
llhttp_cb on_header_field_complete;
|
||||
llhttp_cb on_header_value_complete;
|
||||
llhttp_cb on_chunk_extension_name_complete;
|
||||
llhttp_cb on_chunk_extension_value_complete;
|
||||
|
||||
/* When on_chunk_header is called, the current chunk length is stored
|
||||
* in parser->content_length.
|
||||
@@ -359,12 +598,7 @@ struct llhttp_settings_s {
|
||||
*/
|
||||
llhttp_cb on_chunk_header;
|
||||
llhttp_cb on_chunk_complete;
|
||||
|
||||
/* Information-only callbacks, return value is ignored */
|
||||
llhttp_cb on_url_complete;
|
||||
llhttp_cb on_status_complete;
|
||||
llhttp_cb on_header_field_complete;
|
||||
llhttp_cb on_header_value_complete;
|
||||
llhttp_cb on_reset;
|
||||
};
|
||||
|
||||
/* Initialize the parser with specific type and user settings.
|
||||
@@ -514,6 +748,9 @@ const char* llhttp_errno_name(llhttp_errno_t err);
|
||||
LLHTTP_EXPORT
|
||||
const char* llhttp_method_name(llhttp_method_t method);
|
||||
|
||||
/* Returns textual name of HTTP status */
|
||||
LLHTTP_EXPORT
|
||||
const char* llhttp_status_name(llhttp_status_t status);
|
||||
|
||||
/* Enables/disables lenient header value parsing (disabled by default).
|
||||
*
|
||||
@@ -553,6 +790,7 @@ void llhttp_set_lenient_chunked_length(llhttp_t* parser, int enabled);
|
||||
*
|
||||
* **(USE AT YOUR OWN RISK)**
|
||||
*/
|
||||
LLHTTP_EXPORT
|
||||
void llhttp_set_lenient_keep_alive(llhttp_t* parser, int enabled);
|
||||
|
||||
/* Enables/disables lenient handling of `Transfer-Encoding` header.
|
||||
@@ -566,6 +804,7 @@ void llhttp_set_lenient_keep_alive(llhttp_t* parser, int enabled);
|
||||
*
|
||||
* **(USE AT YOUR OWN RISK)**
|
||||
*/
|
||||
LLHTTP_EXPORT
|
||||
void llhttp_set_lenient_transfer_encoding(llhttp_t* parser, int enabled);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -359,7 +359,7 @@ static void
|
||||
conn_destroy(void *ptr) {
|
||||
raop_conn_t *conn = ptr;
|
||||
|
||||
logger_log(conn->raop->logger, LOGGER_INFO, "Destroying connection");
|
||||
logger_log(conn->raop->logger, LOGGER_DEBUG, "Destroying connection");
|
||||
|
||||
if (conn->raop->callbacks.conn_destroy) {
|
||||
conn->raop->callbacks.conn_destroy(conn->raop->callbacks.cls);
|
||||
|
||||
6
uxplay.1
6
uxplay.1
@@ -1,11 +1,11 @@
|
||||
.TH UXPLAY "1" "October 2022" "1.57" "User Commands"
|
||||
.TH UXPLAY "1" "November 2022" "1.58" "User Commands"
|
||||
.SH NAME
|
||||
uxplay \- start AirPlay server
|
||||
.SH SYNOPSIS
|
||||
.B uxplay
|
||||
[\fI\,-n name\/\fR] [\fI\,-s wxh\/\fR] [\fI\,-p \/\fR[\fI\,n\/\fR]] [more \fI OPTIONS \/\fR ...]
|
||||
.SH DESCRIPTION
|
||||
UxPlay 1.57: An open\-source AirPlay mirroring server based on RPiPlay
|
||||
UxPlay 1.58: An open\-source AirPlay mirroring server based on RPiPlay
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.B
|
||||
@@ -79,6 +79,8 @@ UxPlay 1.57: An open\-source AirPlay mirroring server based on RPiPlay
|
||||
.TP
|
||||
\fB\-nc\fR Do not close video window when client stops mirroring
|
||||
.TP
|
||||
\fB\-nohold\fR Drop current connection when new client connects.
|
||||
.TP
|
||||
\fB\-FPSdata\fR Show video-streaming performance reports sent by client.
|
||||
.TP
|
||||
\fB\-fps\fR n Set maximum allowed streaming framerate, default 30
|
||||
|
||||
20
uxplay.cpp
20
uxplay.cpp
@@ -50,7 +50,7 @@
|
||||
#include "renderers/video_renderer.h"
|
||||
#include "renderers/audio_renderer.h"
|
||||
|
||||
#define VERSION "1.57"
|
||||
#define VERSION "1.58"
|
||||
|
||||
#define DEFAULT_NAME "UxPlay"
|
||||
#define DEFAULT_DEBUG_LOG false
|
||||
@@ -111,6 +111,7 @@ static bool use_random_hw_addr = false;
|
||||
static unsigned short display[5] = {0}, tcp[3] = {0}, udp[3] = {0};
|
||||
static bool debug_log = DEFAULT_DEBUG_LOG;
|
||||
static bool bt709_fix = false;
|
||||
static int max_connections = 2;
|
||||
|
||||
/* 95 byte png file with a 1x1 white square (single pixel): placeholder for coverart*/
|
||||
static const unsigned char empty_image[] = {
|
||||
@@ -416,7 +417,8 @@ static void print_info (char *name) {
|
||||
printf("-as 0 (or -a) Turn audio off, streamed video only\n");
|
||||
printf("-ca <fn> In Airplay Audio (ALAC) mode, write cover-art to file <fn>\n");
|
||||
printf("-reset n Reset after 3n seconds client silence (default %d, 0=never)\n", NTP_TIMEOUT_LIMIT);
|
||||
printf("-nc do Not Close video window when client stops mirroring\n");
|
||||
printf("-nc do Not Close video window when client stops mirroring\n");
|
||||
printf("-nohold Drop current connection when new client connects.\n");
|
||||
printf("-FPSdata Show video-streaming performance reports sent by client.\n");
|
||||
printf("-fps n Set maximum allowed streaming framerate, default 30\n");
|
||||
printf("-f {H|V|I}Horizontal|Vertical flip, or both=Inversion=rotate 180 deg\n");
|
||||
@@ -763,8 +765,10 @@ void parse_arguments (int argc, char *argv[]) {
|
||||
LOGE("option -ca must be followed by a filename for cover-art output");
|
||||
exit(1);
|
||||
}
|
||||
} else if (arg == "-bt709" ) {
|
||||
} else if (arg == "-bt709") {
|
||||
bt709_fix = true;
|
||||
} else if (arg == "-nohold") {
|
||||
max_connections = 3;
|
||||
} else {
|
||||
LOGE("unknown option %s, stopping\n",argv[i]);
|
||||
exit(1);
|
||||
@@ -945,15 +949,15 @@ int main (int argc, char *argv[]) {
|
||||
extern "C" void conn_init (void *cls) {
|
||||
open_connections++;
|
||||
connections_stopped = false;
|
||||
LOGI("Open connections: %i", open_connections);
|
||||
//LOGD("Open connections: %i", open_connections);
|
||||
//video_renderer_update_background(1);
|
||||
}
|
||||
|
||||
extern "C" void conn_destroy (void *cls) {
|
||||
//video_renderer_update_background(-1);
|
||||
open_connections--;
|
||||
LOGI("Open connections: %i", open_connections);
|
||||
if(!open_connections) {
|
||||
//LOGD("Open connections: %i", open_connections);
|
||||
if (!open_connections) {
|
||||
connections_stopped = true;
|
||||
}
|
||||
}
|
||||
@@ -1133,8 +1137,8 @@ int start_raop_server (std::vector<char> hw_addr, std::string name, unsigned sho
|
||||
raop_cbs.audio_set_metadata = audio_set_metadata;
|
||||
raop_cbs.audio_set_coverart = audio_set_coverart;
|
||||
|
||||
/* set max number of connections = 2 */
|
||||
raop = raop_init(2, &raop_cbs);
|
||||
/* set max number of connections = 2 to protect against capture by new client */
|
||||
raop = raop_init(max_connections, &raop_cbs);
|
||||
if (raop == NULL) {
|
||||
LOGE("Error initializing raop!");
|
||||
return -1;
|
||||
|
||||
Reference in New Issue
Block a user