]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Add a default name for the pipe backend: /tmp/shairport-sync-audio
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Fri, 11 Sep 2020 16:31:55 +0000 (17:31 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Fri, 11 Sep 2020 16:31:55 +0000 (17:31 +0100)
audio_pipe.c
scripts/shairport-sync.conf

index 05c9862354e5da462399ebd5dd7011f0960ed353..5e82496c80749d78173eccb356a7467ca15ff5f4 100644 (file)
@@ -42,6 +42,7 @@
 static int fd = -1;
 
 char *pipename = NULL;
+char *default_pipe_name = "/tmp/shairport-sync-audio";
 
 static void start(__attribute__((unused)) int sample_rate,
                   __attribute__((unused)) int sample_format) {
@@ -108,16 +109,19 @@ static int init(int argc, char **argv) {
     if (config_lookup_string(config.cfg, "pipe.name", &str)) {
       pipename = (char *)str;
     }
-
-    if ((pipename) && (strcasecmp(pipename, "STDOUT") == 0))
-      die("Can't use \"pipe\" backend for STDOUT. Use the \"stdout\" backend instead.");
   }
 
-  if ((pipename == NULL) && (argc != 1))
-    die("bad or missing argument(s) to pipe");
+  if (argc > 1)
+    die("too many command-line arguments to pipe");
 
   if (argc == 1)
-    pipename = strdup(argv[0]);
+    pipename = argv[0]; // command line argument has priority
+
+       if ((pipename) && (strcasecmp(pipename, "STDOUT") == 0))
+               die("Can't use \"pipe\" backend for STDOUT. Use the \"stdout\" backend instead.");
+
+       if (pipename == NULL)
+               pipename = default_pipe_name; // if none specified
 
   // here, create the pipe
   mode_t oldumask = umask(000);
index efa349965fb3a2112c5e1f451b5089a01138dcd9..6444b8a5e736d88fde8d1cb3184afc365245d8c6 100644 (file)
@@ -159,7 +159,7 @@ jack =
 // --with-pipe
 pipe =
 {
-//     name = "/path/to/pipe"; // there is no default pipe name for the output
+//     name = "/tmp/shairport-sync-audio"; // this is the default
 };
 
 // There are no configuration file parameters for the "stdout" audio back end. No interpolation is done.