From 5ab880f0e8255e855f8f71b7eafc9355fce85e6c Mon Sep 17 00:00:00 2001
From: "F. Duncanh"
Date: Sat, 14 Jan 2023 23:28:35 -0500
Subject: [PATCH] uxplay 1.62: add audio-only mode time offset option -ao x.y
---
README.html | 111 ++++++++++++++++++++++++++++++++--------------------
README.md | 93 +++++++++++++++++++++++++------------------
README.txt | 110 ++++++++++++++++++++++++++++++++-------------------
uxplay.1 | 6 ++-
uxplay.cpp | 27 ++++++++-----
5 files changed, 215 insertions(+), 132 deletions(-)
diff --git a/README.html b/README.html
index 02216b0..2691520 100644
--- a/README.html
+++ b/README.html
@@ -1,6 +1,6 @@
UxPlay
-1.61: AirPlay-Mirror and AirPlay-Audio server for Linux, macOS, and Unix
+id="uxplay-1.62-airplay-mirror-and-airplay-audio-server-for-linux-macos-and-unix-now-also-runs-on-windows.">UxPlay
+1.62: AirPlay-Mirror and AirPlay-Audio server for Linux, macOS, and Unix
(now also runs on Windows).
Now
@@ -304,7 +304,8 @@ the dns_sd library. OpenSSL is already installed as a System
Library.
Running UxPlay
-Debian-based systems
+Installing
+plugins (Debian-based Linux systems)
Next install the GStreamer plugins that are needed with
sudo apt-get install gstreamer1.0-<plugin>. Values of
<plugin> required are:
@@ -326,44 +327,8 @@ examining the GStreamer installation. If sound is not working,
“alsa”“,”pulseaudio”, or
“pipewire” plugins may need to be installed, depending
on how your audio is set up.
-Finally, run uxplay in a terminal window. On some
-systems, you can toggle into and out of fullscreen mode with F11 or
-(held-down left Alt)+Enter keys. Use Ctrl-C (or close the window) to
-terminate it when done. If the UxPlay server is not seen by the iOS
-client’s drop-down “Screen Mirroring” panel, check that your DNS-SD
-server (usually avahi-daemon) is running: do this in a terminal window
-with systemctl status avahi-daemon. If this shows the
-avahi-daemon is not running, control it with
-sudo systemctl [start,stop,enable,disable] avahi-daemon (or
-avahi-daemon.service). If UxPlay is seen, but the client fails to
-connect when it is selected, there may be a firewall on the server that
-prevents UxPlay from receiving client connection requests unless some
-network ports are opened: if a firewall is active, also open UDP port
-5353 (for mDNS queries) needed by Avahi. See 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>” in the foreground; terminate feh
-and then Uxplay with “ctrl-C fg ctrl-C”.
-One common problem involves GStreamer attempting to use
-incorrectly-configured or absent accelerated hardware h264 video
-decoding (e.g., VAAPI). Try “uxplay -avdec” to force
-software video decoding; if this works you can then try to fix
-accelerated hardware video decoding if you need it, or just uninstall
-the GStreamer VAAPI plugin. If your system uses the Wayland compositor
-for graphics, use “uxplay -vs waylandsink”. See Usage for more run-time options.
-Running uxplay
-Non-Debian-based Linux or *BSD
+Installing
+plugins (Non-Debian-based Linux or *BSD)
Red Hat, or clones like CentOS (now continued as Rocky
Linux or Alma Linux): (sudo dnf install, or sudo yum install)
@@ -396,6 +361,55 @@ gstreamer1-plugins, gstreamer1-plugins-* (* = core, good, bad, x, gtk,
gl, vulkan, pulse, v4l2, …), (+ gstreamer1-vaapi for Intel
graphics).
+Starting UxPlay
+Finally, run uxplay in a terminal window. On some
+systems, you can toggle into and out of fullscreen mode with F11 or
+(held-down left Alt)+Enter keys. Use Ctrl-C (or close the window) to
+terminate it when done. If the UxPlay server is not seen by the iOS
+client’s drop-down “Screen Mirroring” panel, check that your DNS-SD
+server (usually avahi-daemon) is running: do this in a terminal window
+with systemctl status avahi-daemon. If this shows the
+avahi-daemon is not running, control it with
+sudo systemctl [start,stop,enable,disable] avahi-daemon (or
+avahi-daemon.service). If UxPlay is seen, but the client fails to
+connect when it is selected, there may be a firewall on the server that
+prevents UxPlay from receiving client connection requests unless some
+network ports are opened: if a firewall is active, also open UDP port
+5353 (for mDNS queries) needed by Avahi. See 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>” in the foreground; terminate feh
+and then Uxplay with “ctrl-C fg ctrl-C”.
+If you wish to listen in Audio-Only mode on the server while
+watching the client screen (for video or Apple Music song lyrics, etc.),
+the video on the client is delayed by about 5 seconds behind the the
+audio on the server. This can be corrected with the audio
+offset option -ao x with an x of about
+5.0 (allowed values of x are decimal numbers between 0 and 10.0
+seconds); this workaround just delays playing of audio on the server by
+x seconds, so the effect of pausing or changing tracks on the
+client will unfortunately also be delayed. (The reason for the 5
+sec. video delay on the client may be because, while streaming in Legacy
+mode, the client does not get latency information from the
+server.)
+
+One common problem involves GStreamer attempting to use
+incorrectly-configured or absent accelerated hardware h264 video
+decoding (e.g., VAAPI). Try “uxplay -avdec” to force
+software video decoding; if this works you can then try to fix
+accelerated hardware video decoding if you need it, or just uninstall
+the GStreamer VAAPI plugin. If your system uses the Wayland compositor
+for graphics, use “uxplay -vs waylandsink”. See Usage for more run-time options.
Special
instructions for Raspberry Pi (only tested on model 4B):
@@ -491,7 +505,7 @@ 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.4. install
+release is 1.20.5. install
gstreamer-1.0-1.20.5-universal.pkg and
gstreamer-1.0-devel-1.20.5-universal.pkg. (If you have an
Intel-architecture Mac, and have problems with the “universal” packages,
@@ -753,6 +767,15 @@ parameters to be included with the audiosink name. (Some choices of
audiosink might not work on your system.)
-as 0 (or just -a) suppresses
playing of streamed audio, but displays streamed video.
+-ao x.y adds an audio offset time in (decimal)
+seconds to Audio-only (ALAC) streams to allow synchronization of sound
+playing on the UxPlay server with video on the client. In the AirPlay
+Legacy mode used by UxPlay, the client cannot obtain audio latency
+information from the server, and appears to assume a latency of about 5
+seconds. This can be corrected with offset values such as
+-ao 5 or -ao 4.9. The -ao option accepts
+values of the offset between 0 and 10 seconds, as a decimal number which
+it converts to a whole number of milliseconds.
-ca filename provides a file (where
filename can include a full path) used for output of “cover
art” (from Apple Music, etc.,) in audio-only ALAC mode. This
@@ -1055,6 +1078,10 @@ 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 UxPlay/lib/dnssdint.h.
Changelog
+1.62 2023-01-14 Added Audio-only mode time offset -ao x to allow user
+synchronization of ALAC audio playing on the server with video, song
+lyrics, etc. playing on the client. x = 5.0 appears to be optimal in
+many cases.
1.61 2022-12-30 Removed -t option (workaround for an Avahi issue,
correctly solved by opening network port UDP 5353 in firewall). Remove
-g debug flag from CMAKE_CFLAGS. Postpend (instead of prepend) build
diff --git a/README.md b/README.md
index b803d88..a180d50 100644
--- a/README.md
+++ b/README.md
@@ -1,4 +1,4 @@
-# UxPlay 1.61: AirPlay-Mirror and AirPlay-Audio server for Linux, macOS, and Unix (now also runs on Windows).
+# UxPlay 1.62: 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).
@@ -255,7 +255,7 @@ OpenSSL is already installed as a System Library.
## Running UxPlay
-### Debian-based systems
+### Installing plugins (Debian-based Linux systems)
Next install the GStreamer plugins that are needed with `sudo apt-get install gstreamer1.0-`.
Values of `` required are:
@@ -274,41 +274,8 @@ Also install "**tools**" to get the utility gst-inspect-1.0 for
examining the GStreamer installation. If sound is not working, "**alsa**"", "**pulseaudio**",
or "**pipewire**" plugins may need to be installed, depending on how your audio is set up.
-**Finally, run uxplay in a terminal window**. On some systems, you can toggle into and out of fullscreen mode
-with F11 or (held-down left Alt)+Enter keys. Use Ctrl-C (or close the window)
-to terminate it when done. If the UxPlay server is not seen by the
-iOS client's drop-down "Screen Mirroring" panel, check that your DNS-SD
-server (usually avahi-daemon) is running: do this in a terminal window
-with ```systemctl status avahi-daemon```.
-If this shows the avahi-daemon is not running, control it
-with ```sudo systemctl [start,stop,enable,disable] avahi-daemon``` (or
-avahi-daemon.service). If UxPlay is seen, but the client fails to connect
-when it is selected, there may be a firewall on the server that prevents
-UxPlay from receiving client connection requests unless some network ports
-are opened: if a firewall is active, also open UDP port 5353 (for mDNS queries)
-needed by Avahi. 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 &`" in the background, then run a image viewer with an autoreload feature: an example
-is "feh": run "``feh -R 1 ``"
-in the foreground; terminate feh and then Uxplay with "`ctrl-C fg ctrl-C`".
-
-
-**One common problem involves GStreamer
-attempting to use incorrectly-configured or absent accelerated hardware h264
-video decoding (e.g., VAAPI).
-Try "`uxplay -avdec`" to force software video decoding; if this works you can
-then try to fix accelerated hardware video decoding if you need it, or just uninstall the GStreamer VAAPI plugin. If
-your system uses the Wayland compositor for graphics, use "`uxplay -vs waylandsink`".**
-See [Usage](#usage) for more run-time options.
-
-
-### Running uxplay Non-Debian-based Linux or \*BSD
+### Installing plugins (Non-Debian-based Linux or \*BSD)
* **Red Hat, or clones like CentOS (now continued as Rocky Linux or Alma Linux):**
(sudo dnf install, or sudo yum install) The required GStreamer packages are:
@@ -338,6 +305,48 @@ for Intel graphics).
(\* = core, good, bad, x, gtk, gl, vulkan, pulse, v4l2, ...), (+ gstreamer1-vaapi for Intel graphics).
+### Starting UxPlay
+
+**Finally, run uxplay in a terminal window**. On some systems, you can toggle into and out of fullscreen mode
+with F11 or (held-down left Alt)+Enter keys. Use Ctrl-C (or close the window)
+to terminate it when done. If the UxPlay server is not seen by the
+iOS client's drop-down "Screen Mirroring" panel, check that your DNS-SD
+server (usually avahi-daemon) is running: do this in a terminal window
+with ```systemctl status avahi-daemon```.
+If this shows the avahi-daemon is not running, control it
+with ```sudo systemctl [start,stop,enable,disable] avahi-daemon``` (or
+avahi-daemon.service). If UxPlay is seen, but the client fails to connect
+when it is selected, there may be a firewall on the server that prevents
+UxPlay from receiving client connection requests unless some network ports
+are opened: if a firewall is active, also open UDP port 5353 (for mDNS queries)
+needed by Avahi. 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 &`" in the background, then run a image viewer with an autoreload feature: an example
+is "feh": run "``feh -R 1 ``"
+in the foreground; terminate feh and then Uxplay with "`ctrl-C fg ctrl-C`".
+
+* If you wish to listen in Audio-Only mode on the server while watching the client screen (for video or Apple Music song lyrics, etc.),
+the video on the client is delayed by about 5 seconds behind the the audio on the server. This can be corrected with
+the **audio offset** option `-ao x` with an _x_ of about 5.0
+(allowed values of _x_ are decimal numbers between 0 and 10.0 seconds); this workaround just delays playing of audio on the server by _x_ seconds, so the effect
+of pausing or changing tracks on the client will unfortunately also be delayed. _(The reason for the 5 sec. video delay on the client
+may be because, while streaming in Legacy mode, the client does not get latency information from the
+server.)_
+
+**One common problem involves GStreamer
+attempting to use incorrectly-configured or absent accelerated hardware h264
+video decoding (e.g., VAAPI).
+Try "`uxplay -avdec`" to force software video decoding; if this works you can
+then try to fix accelerated hardware video decoding if you need it, or just uninstall the GStreamer VAAPI plugin. If
+your system uses the Wayland compositor for graphics, use "`uxplay -vs waylandsink`".**
+See [Usage](#usage) for more run-time options.
+
### **Special instructions for Raspberry Pi (only tested on model 4B)**:
@@ -411,7 +420,7 @@ 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.4.
+**For the "official" release**: install both the macOS runtime and development installer packages. Assuming that the latest release is 1.20.5.
install `gstreamer-1.0-1.20.5-universal.pkg` and ``gstreamer-1.0-devel-1.20.5-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
@@ -646,6 +655,12 @@ which will not work if a firewall is running.
**-as 0** (or just **-a**) suppresses playing of streamed audio, but displays streamed video.
+**-ao x.y** adds an audio offset time in (decimal) seconds to Audio-only (ALAC) streams to allow synchronization of sound
+ playing on the UxPlay server with video on the client. In the AirPlay Legacy mode used by UxPlay, the client cannot
+ obtain audio latency information from the server, and appears to assume a latency of about 5 seconds. This can be corrected
+ with offset values such as `-ao 5` or ``-ao 4.9``. The -ao option accepts values of the offset between 0 and 10 seconds, as
+ a decimal number which it converts to a whole number of milliseconds.
+
**-ca _filename_** provides a file (where _filename_ can include a full path) used for output of "cover art"
(from Apple Music, _etc._,) in audio-only ALAC mode. This file is overwritten with the latest cover art as
it arrives. Cover art (jpeg format) is discarded if this option is not used. Use with a image viewer that reloads the image
@@ -894,6 +909,10 @@ 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.62 2023-01-14 Added Audio-only mode time offset -ao x to allow user synchronization of ALAC
+ audio playing on the server with video, song lyrics, etc. playing on the client.
+ x = 5.0 appears to be optimal in many cases.
+
1.61 2022-12-30 Removed -t option (workaround for an Avahi issue, correctly solved by opening network
port UDP 5353 in firewall). Remove -g debug flag from CMAKE_CFLAGS. Postpend (instead
of prepend) build environment CFLAGS to CMAKE_CFLAGS. Refactor parts of uxplay.cpp
diff --git a/README.txt b/README.txt
index ea187ab..8a87822 100644
--- a/README.txt
+++ b/README.txt
@@ -1,4 +1,4 @@
-# UxPlay 1.61: AirPlay-Mirror and AirPlay-Audio server for Linux, macOS, and Unix (now also runs on Windows).
+# UxPlay 1.62: AirPlay-Mirror and AirPlay-Audio server for Linux, macOS, and Unix (now also runs on Windows).
### Now developed at the GitHub site (where all user issues should be posted).
@@ -308,7 +308,7 @@ installed)
## Running UxPlay
-### Debian-based systems
+### Installing plugins (Debian-based Linux systems)
Next install the GStreamer plugins that are needed with
`sudo apt-get install gstreamer1.0-`. Values of ``
@@ -329,44 +329,7 @@ gst-inspect-1.0 for examining the GStreamer installation. If sound is
not working, "**alsa**"","**pulseaudio**", or "**pipewire**" plugins may
need to be installed, depending on how your audio is set up.
-**Finally, run uxplay in a terminal window**. On some systems, you can
-toggle into and out of fullscreen mode with F11 or (held-down left
-Alt)+Enter keys. Use Ctrl-C (or close the window) to terminate it when
-done. If the UxPlay server is not seen by the iOS client's drop-down
-"Screen Mirroring" panel, check that your DNS-SD server (usually
-avahi-daemon) is running: do this in a terminal window with
-`systemctl status avahi-daemon`. If this shows the avahi-daemon is not
-running, control it with
-`sudo systemctl [start,stop,enable,disable] avahi-daemon` (or
-avahi-daemon.service). If UxPlay is seen, but the client fails to
-connect when it is selected, there may be a firewall on the server that
-prevents UxPlay from receiving client connection requests unless some
-network ports are opened: if a firewall is active, also open UDP port
-5353 (for mDNS queries) needed by Avahi. 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 &`" in the background,
-then run a image viewer with an autoreload feature: an example is "feh":
-run "`feh -R 1 `" in the foreground; terminate feh and then Uxplay
-with "`ctrl-C fg ctrl-C`".
-
-**One common problem involves GStreamer attempting to use
-incorrectly-configured or absent accelerated hardware h264 video
-decoding (e.g., VAAPI). Try "`uxplay -avdec`" to force software video
-decoding; if this works you can then try to fix accelerated hardware
-video decoding if you need it, or just uninstall the GStreamer VAAPI
-plugin. If your system uses the Wayland compositor for graphics, use
-"`uxplay -vs waylandsink`".** See [Usage](#usage) for more run-time
-options.
-
-### Running uxplay Non-Debian-based Linux or \*BSD
+### Installing plugins (Non-Debian-based Linux or \*BSD)
- **Red Hat, or clones like CentOS (now continued as Rocky Linux or
Alma Linux):** (sudo dnf install, or sudo yum install) The required
@@ -400,6 +363,57 @@ options.
gtk, gl, vulkan, pulse, v4l2, ...), (+ gstreamer1-vaapi for Intel
graphics).
+### Starting UxPlay
+
+**Finally, run uxplay in a terminal window**. On some systems, you can
+toggle into and out of fullscreen mode with F11 or (held-down left
+Alt)+Enter keys. Use Ctrl-C (or close the window) to terminate it when
+done. If the UxPlay server is not seen by the iOS client's drop-down
+"Screen Mirroring" panel, check that your DNS-SD server (usually
+avahi-daemon) is running: do this in a terminal window with
+`systemctl status avahi-daemon`. If this shows the avahi-daemon is not
+running, control it with
+`sudo systemctl [start,stop,enable,disable] avahi-daemon` (or
+avahi-daemon.service). If UxPlay is seen, but the client fails to
+connect when it is selected, there may be a firewall on the server that
+prevents UxPlay from receiving client connection requests unless some
+network ports are opened: if a firewall is active, also open UDP port
+5353 (for mDNS queries) needed by Avahi. 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 &`" in the
+ background, then run a image viewer with an autoreload feature: an
+ example is "feh": run "`feh -R 1 `" in the foreground;
+ terminate feh and then Uxplay with "`ctrl-C fg ctrl-C`".
+
+- If you wish to listen in Audio-Only mode on the server while
+ watching the client screen (for video or Apple Music song lyrics,
+ etc.), the video on the client is delayed by about 5 seconds behind
+ the the audio on the server. This can be corrected with the **audio
+ offset** option `-ao x` with an *x* of about 5.0 (allowed values of
+ *x* are decimal numbers between 0 and 10.0 seconds); this workaround
+ just delays playing of audio on the server by *x* seconds, so the
+ effect of pausing or changing tracks on the client will
+ unfortunately also be delayed. *(The reason for the 5 sec. video
+ delay on the client may be because, while streaming in Legacy mode,
+ the client does not get latency information from the server.)*
+
+**One common problem involves GStreamer attempting to use
+incorrectly-configured or absent accelerated hardware h264 video
+decoding (e.g., VAAPI). Try "`uxplay -avdec`" to force software video
+decoding; if this works you can then try to fix accelerated hardware
+video decoding if you need it, or just uninstall the GStreamer VAAPI
+plugin. If your system uses the Wayland compositor for graphics, use
+"`uxplay -vs waylandsink`".** 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
@@ -495,7 +509,7 @@ 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.4. install `gstreamer-1.0-1.20.5-universal.pkg` and
+1.20.5. install `gstreamer-1.0-1.20.5-universal.pkg` and
`gstreamer-1.0-devel-1.20.5-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
@@ -776,6 +790,15 @@ name. (Some choices of audiosink might not work on your system.)
**-as 0** (or just **-a**) suppresses playing of streamed audio, but
displays streamed video.
+**-ao x.y** adds an audio offset time in (decimal) seconds to Audio-only
+(ALAC) streams to allow synchronization of sound playing on the UxPlay
+server with video on the client. In the AirPlay Legacy mode used by
+UxPlay, the client cannot obtain audio latency information from the
+server, and appears to assume a latency of about 5 seconds. This can be
+corrected with offset values such as `-ao 5` or `-ao 4.9`. The -ao
+option accepts values of the offset between 0 and 10 seconds, as a
+decimal number which it converts to a whole number of milliseconds.
+
**-ca *filename*** provides a file (where *filename* can include a full
path) used for output of "cover art" (from Apple Music, *etc.*,) in
audio-only ALAC mode. This file is overwritten with the latest cover art
@@ -1095,6 +1118,11 @@ other settings are set in `UxPlay/lib/dnssdint.h`.
# Changelog
+1.62 2023-01-14 Added Audio-only mode time offset -ao x to allow user
+synchronization of ALAC audio playing on the server with video, song
+lyrics, etc. playing on the client. x = 5.0 appears to be optimal in
+many cases.
+
1.61 2022-12-30 Removed -t option (workaround for an Avahi issue,
correctly solved by opening network port UDP 5353 in firewall). Remove
-g debug flag from CMAKE_CFLAGS. Postpend (instead of prepend) build
diff --git a/uxplay.1 b/uxplay.1
index 688d88e..31be5dc 100644
--- a/uxplay.1
+++ b/uxplay.1
@@ -1,11 +1,11 @@
-.TH UXPLAY "1" "December 2022" "1.61" "User Commands"
+.TH UXPLAY "1" "January 2023" "1.62" "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.61: An open\-source AirPlay mirroring (+ audio streaming) server.
+UxPlay 1.62: An open\-source AirPlay mirroring (+ audio streaming) server.
.SH OPTIONS
.TP
.B
@@ -73,6 +73,8 @@ UxPlay 1.61: An open\-source AirPlay mirroring (+ audio streaming) server.
.TP
\fB\-as\fR 0 (or \fB\-a\fR) Turn audio off, streamed video only.
.TP
+\fB\-ao\fR x.y Audio offset time in seconds (default 0.0) in Audio-only mode.
+.TP
\fB\-ca\fI fn \fR In Airplay Audio (ALAC) mode, write cover-art to file fn.
.TP
\fB\-reset\fR n Reset after 3n seconds client silence (default 5, 0=never).
diff --git a/uxplay.cpp b/uxplay.cpp
index fcbbd1d..6cfdc43 100644
--- a/uxplay.cpp
+++ b/uxplay.cpp
@@ -51,7 +51,7 @@
#include "renderers/video_renderer.h"
#include "renderers/audio_renderer.h"
-#define VERSION "1.61"
+#define VERSION "1.62"
#define DEFAULT_NAME "UxPlay"
#define DEFAULT_DEBUG_LOG false
@@ -387,6 +387,7 @@ static void print_info (char *name) {
printf(" some choices:pulsesink,alsasink,pipewiresink,jackaudiosink,\n");
printf(" osssink,oss4sink,osxaudiosink,wasapisink,directsoundsink.\n");
printf("-as 0 (or -a) Turn audio off, streamed video only\n");
+ printf("-ao x.y Audio offset time in seconds (default 0.0) in Audio-only mode.\n");
printf("-ca In Airplay Audio (ALAC) mode, write cover-art to file \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");
@@ -736,20 +737,26 @@ static void parse_arguments (int argc, char *argv[]) {
bt709_fix = true;
} else if (arg == "-nohold") {
max_connections = 3;
- } else if (arg == "-ad") {
+ } else if (arg == "-ao") {
+ int n;
+ char *end;
if (i < argc - 1 && *argv[i+1] != '-') {
- unsigned int n = 0;
- if (get_value (argv[++i], &n)) {
+ n = (int) (1000 * strtof(argv[++i], &end));
+ if (*end == '\0' && n >=0 && n <= 10000) {
audiodelay.erase();
if (n > 0) {
- audiodelay = argv[i];
+ char* delay = new char[6];
+ snprintf(delay, 6, "%d", n);
+ audiodelay = delay;
+ delete[] delay;
}
+ continue;
}
- } else {
- LOGE("option -ad must be followed by a positive time delay in millisecs");
- exit(1);
}
- } else {
+ LOGE("invalid argument -ao %s: must be a decimal time offset in seconds, range [0,10]\n"
+ "(like 5 or 4.8, which will be converted to a whole number of milliseconds)", argv[i]);
+ exit(1);
+ } else {
LOGE("unknown option %s, stopping\n",argv[i]);
exit(1);
}
@@ -1278,7 +1285,7 @@ int main (int argc, char *argv[]) {
if (use_audio) {
if (audiodelay.c_str()[0]) {
- LOGI("Audio-only ALAC streams will be delayed by %s millisecs", audiodelay.c_str());
+ LOGI("Audio-only ALAC streams will be delayed by %s milliseconds", audiodelay.c_str());
}
audio_renderer_init(render_logger, audiosink.c_str(), audiodelay.c_str());
} else {