From ffa0c61d5e9a247104ec4afafade21b6e2bc230d Mon Sep 17 00:00:00 2001
From: "F. Duncanh"
Add any UxPlay options you want to use as defaults to a startup
file ~/.uxplayrc (see “man uxplay” or
-“uxplay -h” for format and other possible locations). In
+“uxplay -h” for format and other possible locations; the
+location can also be set with “uxplay -rc location”). In
particular, if your system uses PipeWire audio or Wayland video systems,
you may wish to add “as pipewiresink” or “vs waylandsink” as defaults to
the file. (Output from terminal commands “ps waux | grep pulse” or
@@ -135,8 +136,10 @@ uxplay.service. Then
On Raspberry Pi: models using hardware h264 video decoding by the Broadcom GPU (models 4B and earlier) may require the uxplay option -bt709. If you use Ubuntu 22.10 or earlier, GStreamer must be
OpenBSD: (doas pkg_add) libplist gstreamer1-plugins-base. avahi-libs must also be installed to provide -the dns_sd library. OpenSSL is already installed as a System -Library.
OpenBSD: Install gstreamer1-libav, -gstreamer-plugins-* (* = core, bad, base, good). avahi-main must also be -installed for the avahi_daemon rc startup script.
Since UxPlay-1.64, UxPlay can be started with options read from a
@@ -1007,6 +1009,9 @@ or ~/.config/uxplayrc); lines begining with
“#” are treated as comments, and ignored. Command line
options supersede options in the startup file.
+
-rc file can also be used to specify the
+startup file location: this overrides $UXPLAYRC,
+~/.uxplayrc, etc.
-n server_name (Default: UxPlay);
server_name@_hostname_ will be the name that appears offering AirPlay
services to your iPad, iPhone etc, where hostname is the name
diff --git a/README.md b/README.md
index af66a00..115bebf 100644
--- a/README.md
+++ b/README.md
@@ -101,7 +101,8 @@ status](https://repology.org/badge/vertical-allrepos/uxplay.svg)](https://repolo
- Add any UxPlay options you want to use as defaults to a startup file
`~/.uxplayrc` (see "`man uxplay`" or "`uxplay -h`" for format and
- other possible locations). In particular, if your system uses
+ other possible locations; the location can also be set with "uxplay -rc _location_").
+ In particular, if your system uses
PipeWire audio or Wayland video systems, you may wish to add "as
pipewiresink" or "vs waylandsink" as defaults to the file. *(Output
from terminal commands "ps waux \| grep pulse" or "pactl info" will
@@ -121,7 +122,9 @@ status](https://repology.org/badge/vertical-allrepos/uxplay.svg)](https://repolo
can be used to control the daemon. If it is enabled, the daemon will start
at the user's first login and stop when they no longer have any open sessions. See
https://www.baeldung.com/linux/systemd-create-user-services for more about
- systemd user services. **Note: it is NOT recommended to run UxPlay as a root service.**
+ systemd user services. If more than one user might simultaneously run uxplay this way, they should
+ specify distinct -p and -m options (ports and deviceID) in their startup files.
+ **Note: it is NOT recommended to run UxPlay as a root service.**
- On Raspberry Pi: models using hardware h264 video decoding by the
Broadcom GPU (models 4B and earlier) may require the uxplay option -bt709.
@@ -413,7 +416,8 @@ package](#building-an-installable-rpm-package).
dns_sd library. OpenSSL is already installed as a System Library.
- **OpenBSD:** (doas pkg_add) libplist gstreamer1-plugins-base.
- avahi-libs must also be installed to provide the dns_sd library.
+ avahi-libs must also be installed to provide the dns_sd library;
+ (avahi-main must also be installed).
OpenSSL is already installed as a System Library.
#### Building an installable RPM package
@@ -498,8 +502,7 @@ repositories for those distributions.
pulse, v4l2, ...), (+ gstreamer1-vaapi for Intel/AMD graphics).
- **OpenBSD:** Install gstreamer1-libav, gstreamer-plugins-\*
- (\* = core, bad, base, good). avahi-main must also be installed for
- the avahi_daemon rc startup script.
+ (\* = core, bad, base, good).
### Starting and running UxPlay
@@ -995,6 +998,9 @@ Options:
comments, and ignored. Command line options supersede options in the
startup file.
+**-rc _file_** can also be used to specify the startup file location: this
+overrides `$UXPLAYRC`, ``~/.uxplayrc``, etc.
+
**-n server_name** (Default: UxPlay); server_name@\_hostname\_ will be
the name that appears offering AirPlay services to your iPad, iPhone
etc, where *hostname* is the name of the server running uxplay. This
diff --git a/README.txt b/README.txt
index 7eb51a8..b5a7538 100644
--- a/README.txt
+++ b/README.txt
@@ -108,11 +108,12 @@ status](https://repology.org/badge/vertical-allrepos/uxplay.svg)](https://repolo
- Add any UxPlay options you want to use as defaults to a startup file
`~/.uxplayrc` (see "`man uxplay`" or "`uxplay -h`" for format and
- other possible locations). In particular, if your system uses
- PipeWire audio or Wayland video systems, you may wish to add "as
- pipewiresink" or "vs waylandsink" as defaults to the file. *(Output
- from terminal commands "ps waux \| grep pulse" or "pactl info" will
- contain "pipewire" if your Linux/BSD system uses it).*
+ other possible locations; the location can also be set with "uxplay
+ -rc *location*"). In particular, if your system uses PipeWire audio
+ or Wayland video systems, you may wish to add "as pipewiresink" or
+ "vs waylandsink" as defaults to the file. *(Output from terminal
+ commands "ps waux \| grep pulse" or "pactl info" will contain
+ "pipewire" if your Linux/BSD system uses it).*
- For Linux systems using systemd, there is a **systemd** service file
**uxplay.service** found in the UxPlay top directory of the
@@ -131,8 +132,10 @@ status](https://repology.org/badge/vertical-allrepos/uxplay.svg)](https://repolo
start at the user's first login and stop when they no longer have
any open sessions. See
https://www.baeldung.com/linux/systemd-create-user-services for more
- about systemd user services. **Note: it is NOT recommended to run
- UxPlay as a root service.**
+ about systemd user services. If more than one user might
+ simultaneously run uxplay this way, they should specify distinct -p
+ and -m options (ports and deviceID) in their startup files. **Note:
+ it is NOT recommended to run UxPlay as a root service.**
- On Raspberry Pi: models using hardware h264 video decoding by the
Broadcom GPU (models 4B and earlier) may require the uxplay option
@@ -426,8 +429,9 @@ package](#building-an-installable-rpm-package).
dns_sd library. OpenSSL is already installed as a System Library.
- **OpenBSD:** (doas pkg_add) libplist gstreamer1-plugins-base.
- avahi-libs must also be installed to provide the dns_sd library.
- OpenSSL is already installed as a System Library.
+ avahi-libs must also be installed to provide the dns_sd library;
+ (avahi-main must also be installed). OpenSSL is already installed as
+ a System Library.
#### Building an installable RPM package
@@ -511,8 +515,7 @@ repositories for those distributions.
pulse, v4l2, ...), (+ gstreamer1-vaapi for Intel/AMD graphics).
- **OpenBSD:** Install gstreamer1-libav, gstreamer-plugins-\* (\* =
- core, bad, base, good). avahi-main must also be installed for the
- avahi_daemon rc startup script.
+ core, bad, base, good).
### Starting and running UxPlay
@@ -1019,6 +1022,9 @@ Options:
comments, and ignored. Command line options supersede options in the
startup file.
+**-rc *file*** can also be used to specify the startup file location:
+this overrides `$UXPLAYRC`, `~/.uxplayrc`, etc.
+
**-n server_name** (Default: UxPlay); server_name@\_hostname\_ will be
the name that appears offering AirPlay services to your iPad, iPhone
etc, where *hostname* is the name of the server running uxplay. This
diff --git a/uxplay.1 b/uxplay.1
index c2739ae..3675670 100644
--- a/uxplay.1
+++ b/uxplay.1
@@ -181,6 +181,8 @@ UxPlay 1.72: An open\-source AirPlay mirroring (+ audio streaming) server:
\fB\-v\fR Displays version information
.TP
\fB\-h\fR Displays help information
+.TP
+\fB\-rc\fI fn\fR Read startup options from file "fn" instead of ~/.uxplayrc, etc
.SH
FILES
Options in one of $UXPLAYRC, or ~/.uxplayrc, or ~/.config/uxplayrc
diff --git a/uxplay.cpp b/uxplay.cpp
index fb0cc8c..0eadbef 100644
--- a/uxplay.cpp
+++ b/uxplay.cpp
@@ -741,6 +741,7 @@ static void print_info (char *name) {
printf("-d [n] Enable debug logging; optional: n=1 to skip normal packet data\n");
printf("-v Displays version information\n");
printf("-h Displays this help\n");
+ printf("-rc fn Read startup options from file \"fn\" instead of ~/.uxplayrc, etc\n");
printf("Startup options in $UXPLAYRC, ~/.uxplayrc, or ~/.config/uxplayrc are\n");
printf("applied first (command-line options may modify them): format is one \n");
printf("option per line, no initial \"-\"; lines starting with \"#\" are ignored.\n");
@@ -882,7 +883,9 @@ static void parse_arguments (int argc, char *argv[]) {
// Parse arguments
for (int i = 1; i < argc; i++) {
std::string arg(argv[i]);
- if (arg == "-allow") {
+ if (arg == "-rc") {
+ i++; //specifies startup file: has already been processed
+ } else if (arg == "-allow") {
if (!option_has_value(i, argc, arg, argv[i+1])) exit(1);
i++;
allowed_clients.push_back(argv[i]);
@@ -2310,7 +2313,29 @@ int main (int argc, char *argv[]) {
if (!getenv("AVAHI_COMPAT_NOWARN")) putenv(avahi_compat_nowarn);
#endif
- config_file = find_uxplay_config_file();
+ char *rcfile = NULL;
+ /* see if option -rc was given */
+ for (int i = 1; i < argc ; i++) {
+ std::string arg(argv[i]);
+ if (arg == "-rc") {
+ struct stat sb;
+ if (i+1 == argc) {
+ LOGE ("option -rc requires a filename (-rc