]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Add ability to change regtype; clean up some diagnostic messages.
authorMike Brady <mikebrady@eircom.net>
Fri, 1 Apr 2016 15:30:36 +0000 (16:30 +0100)
committerMike Brady <mikebrady@eircom.net>
Fri, 1 Apr 2016 15:30:36 +0000 (16:30 +0100)
configure.ac
mdns_dns_sd.c
mdns_external.c
mdns_tinysvcmdns.c
scripts/shairport-sync.conf
scripts/shairport-sync.conf~ [new file with mode: 0644]
shairport.c

index 05563e51478120dad4e3ab4b7efdaf7f72fa5506..4dd5ec10b6f212ad8703004722eefb62f7854891 100644 (file)
@@ -2,7 +2,7 @@
 # Process this file with autoconf to produce a configure script.
 
 AC_PREREQ([2.50])
-AC_INIT([shairport-sync], [2.9.5.4], [mikebrady@eircom.net])
+AC_INIT([shairport-sync], [2.9.5.5], [mikebrady@eircom.net])
 AM_INIT_AUTOMAKE
 AC_CONFIG_SRCDIR([shairport.c])
 AC_CONFIG_HEADERS([config.h])
index 114bb991ee7da7e4927dca302111855ca41fa575..216f05710e1c5fabda9a599cfa0f18f79137cb5d 100644 (file)
@@ -69,7 +69,7 @@ static int mdns_dns_sd_register(char *apname, int port) {
   }
 
   DNSServiceErrorType error;
-  error = DNSServiceRegister(&service, 0, kDNSServiceInterfaceIndexAny, apname, "_raop._tcp", "",
+  error = DNSServiceRegister(&service, 0, kDNSServiceInterfaceIndexAny, apname, config.regtype, "",
                              NULL, htons((uint16_t)port), length, buf, NULL, NULL);
 
   free(buf);
index f9ba20c6de2b514d2239b5bb334cee01f07975e9..c3b5dc1b89cda4c7e9c5b06f863a4e88db6aced5 100644 (file)
@@ -87,10 +87,10 @@ static int mdns_external_avahi_register(char *apname, int port) {
   char mdns_port[6];
   sprintf(mdns_port, "%d", config.port);
 
-  char *argvwithoutmetadata[] = {NULL, apname, "_raop._tcp", mdns_port,
+  char *argvwithoutmetadata[] = {NULL, apname, config.regtype, mdns_port,
                                  MDNS_RECORD_WITHOUT_METADATA, NULL};
 #ifdef CONFIG_METADATA
-  char *argvwithmetadata[] = {NULL, apname, "_raop._tcp", mdns_port, MDNS_RECORD_WITH_METADATA,
+  char *argvwithmetadata[] = {NULL, apname, config.regtype, mdns_port, MDNS_RECORD_WITH_METADATA,
                               NULL};
 #endif
   char **argv;
@@ -126,11 +126,11 @@ static int mdns_external_dns_sd_register(char *apname, int port) {
   char mdns_port[6];
   sprintf(mdns_port, "%d", config.port);
 
-  char *argvwithoutmetadata[] = {NULL, apname, "_raop._tcp", mdns_port,
+  char *argvwithoutmetadata[] = {NULL, apname, config.regtype, mdns_port,
                                  MDNS_RECORD_WITHOUT_METADATA, NULL};
 
 #ifdef CONFIG_METADATA
-  char *argvwithmetadata[] = {NULL, apname, "_raop._tcp", mdns_port, MDNS_RECORD_WITH_METADATA,
+  char *argvwithmetadata[] = {NULL, apname, config.regtype, mdns_port, MDNS_RECORD_WITH_METADATA,
                               NULL};
 #endif
 
index 9452c1f865fbf4ba3ec067926c738061b747ced9..60bdf36070ca3e071bb05f271485d9687aaea2e9 100644 (file)
@@ -124,12 +124,20 @@ static int mdns_tinysvcmdns_register(char *apname, int port) {
 #endif
 
     txt = txtwithoutmetadata;
+  
+  char* extendedregtype = malloc(strlen(config.regtype)+strlen(".local")+1);
 
-  struct mdns_service *svc =
-      mdnsd_register_svc(svr, apname, "_raop._tcp.local", port, NULL,
-                         (const char **)txt); // TTL should be 75 minutes, i.e. 4500 seconds
+  if (extendedregtype==NULL)
+    die("tinysvcmdns: could not allocated memory to request a Zeroconf service");
+    
+  strcpy(extendedregtype,config.regtype);
+  strcat(extendedregtype,".local");
 
+  struct mdns_service *svc = mdnsd_register_svc(svr, apname, extendedregtype, port, NULL,
+                         (const char **)txt); // TTL should be 75 minutes, i.e. 4500 seconds
   mdns_service_destroy(svc);
+  
+  free(extendedregtype);
 
   return 0;
 }
index 810903648a409ca5f2391a63427f98992b835e00..050ee3644e93e48bf30f77af09a30aa4051eea42 100644 (file)
@@ -18,6 +18,7 @@ general =
 //     log_verbosity = 0; // "0" means no debug verbosity, "3" is most verbose.
 //  ignore_volume_control = "no"; // set this to "yes" if you want the volume to be at 100% no matter what the source's volume control is set to.
 //  volume_range_db = 60 ; // use this to set the range, in dB, you want between the maximum volume and the minimum volume. Range is 30 to 150 dB. Leave it commented out to use mixer's native range.
+//     regtype = "_raop._tcp"; // Use this advanced setting to set the service type and transport to be advertised by Zeroconf/Bonjour. Default is "_raop._tcp".
 };
 
 // How to deal with metadata, including artwork
diff --git a/scripts/shairport-sync.conf~ b/scripts/shairport-sync.conf~
new file mode 100644 (file)
index 0000000..420bc6a
--- /dev/null
@@ -0,0 +1,81 @@
+// Sample Configuration File for Shairport Sync
+// Commented out settings are generally the defaults, except where noted.
+
+// General Settings
+general =
+{
+//     name = "Shairport Sync Player"; // This is the name the service will advertise to iTunes. The default is "Shairport Sync on <hostname>"
+//     password = "secret"; // leave this commented out if you don't want to require a password
+//     interpolation = "basic"; // aka "stuffing". Default is "basic", alternative is "soxr". Use "soxr" only if you have a reasonably fast processor.
+//     output_backend = "alsa"; // Run "shairport-sync -h" to get a list of all output_backends, e.g. "alsa", "pipe", "stdout". The default is the first one.
+//     mdns_backend = "avahi"; // Run "shairport-sync -h" to get a list of all mdns_backends. The default is the first one.
+//     port = 5000; // Listen for service requests on this port
+//     udp_port_base = 6001; // start allocating UDP ports from this port number when needed
+//     udp_port_range = 100; // look for free ports in this number of places, starting at the UDP port base (only three are needed).
+//     statistics = "no"; // set to "yes" to print statistics in the log
+//     drift = 88; // allow this number of frames of drift away from exact synchronisation before attempting to correct it
+//     resync_threshold = 2205; // a synchronisation error greater than this will cause resynchronisation; 0 disables it
+//     log_verbosity = 0; // "0" means no debug verbosity, "3" is most verbose.
+//  ignore_volume_control = "no"; // set this to "yes" if you want the volume to be at 100% no matter what the source's volume control is set to.
+//  volume_range_db = 60 ; // use this to set the range, in dB, you want between the maximum volume and the minimum volume. Range is 30 to 150 dB. Leave it commented out to use mixer's native range.
+//     regtype = "_raop._tcp"; // Use this advanced setting to set the service type and transport to be advertised by zeroconf/bonjour. Default is "_raop._tcp".
+};
+
+// How to deal with metadata, including artwork
+metadata =
+{
+//     enabled = "no"; // et to yes to get Shairport Sync to solicit metadata from the source and to pass it on via a pipe
+//     include_cover_art = "no"; // set to "yes" to get Shairport Sync to solicit cover art from the source and pass it via the pipe. You must also set "enabled" to "yes".
+//     pipe_name = "/tmp/shairport-sync-metadata";
+};
+
+// Advanced parameters for controlling how a Shairport Sync runs
+sessioncontrol = 
+{
+//     run_this_before_play_begins = "/full/path/to/application and args"; // make sure the application has executable permission. It it's a script, include the #!... stuff on the first line
+//     run_this_after_play_ends = "/full/path/to/application and args"; // make sure the application has executable permission. It it's a script, include the #!... stuff on the first line
+//     wait_for_completion = "no"; // set to "yes" to get Shairport Sync to wait until the "run_this..." applications have terminated before continuing
+//     allow_session_interruption = "no"; // set to "yes" to allow another device to interrupt Shairport Sync while it's playing from an existing audio source
+//     session_timeout = 120; // wait for this number of seconds after a source disappears before terminating the session and becoming available again.
+};
+
+// Back End Settings
+
+// These are parameters for the "alsa" audio back end, the only back end that supports synchronised audio.
+alsa =
+{
+//  output_device = "default"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc.
+//  mixer_control_name = "PCM"; // the name of the mixer to use to adjust output volume. If not specified, volume in adjusted in software.
+//  mixer_device = "default"; // the mixer_device default is whatever the output_device is. Normally you wouldn't have to use this.
+//  audio_backend_latency_offset = 0; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+//  audio_backend_buffer_desired_length = 6615; // If set too small, buffer underflow occurs on low-powered machines. Too long and the response times with software mixer become annoying.
+//  disable_synchronization = "no"; // Set to "yes" to disable synchronization. Default is "no".
+//  period_size = <number>; // Use this optional advanced setting to set the alsa period size near to this value
+//  buffer_size = <number>; // Use this optional advanced setting to set the alsa buffer size near to this value
+};
+
+// These are parameters for the "pipe" audio back end, a back end that directs raw CD-style audio output to a pipe. No interpolation is done.
+pipe =
+{
+//  name = "/path/to/pipe"; // there is no default pipe name for the output
+//  audio_backend_latency_offset = 0; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+//  audio_backend_buffer_desired_length = 44100; // Having started to send audio at the right time, send all subsequent audio this many frames ahead of time, creating a buffer this size.
+};
+
+// These are parameters for the "stdout" audio back end, a back end that directs raw CD-style audio output to stdout. No interpolation is done.
+stdout =
+{
+//  audio_backend_latency_offset = 0; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+//  audio_backend_buffer_desired_length = 44100; // Having started to send audio at the right time, send all subsequent audio this many frames ahead of time, creating a buffer this size.
+};
+
+// These are parameters for the "ao" audio back end. No interpolation is done.
+ao =
+{
+//  audio_backend_latency_offset = 0; // Set this offset to compensate for a fixed delay in the audio back end. E.g. if the output device delays by 100 ms, set this to -4410.
+//  audio_backend_buffer_desired_length = 44100; // Having started to send audio at the right time, send all subsequent audio this many frames ahead of time, creating a buffer this size.
+};
+
+// Static latency settings are deprecated and the settings have been removed. 
+
+
index d25d29fb0b4adeb713f3ec0f915e5c919f14051b..931c270b61f4eaacbe1ff3b42312a22090eccad6 100644 (file)
@@ -411,6 +411,13 @@ int parse_options(int argc, char **argv) {
           die("Invalid ignore_volume_control option choice \"%s\". It should be \"yes\" or \"no\"");
       }
 
+      /* Get the regtype -- the service type and protocol, separated by a dot. Default is "_raop._tcp" */
+      if (config_lookup_string(config.cfg, "general.regtype", &str))
+        config.regtype = strdup(str);
+      else
+        config.regtype = strdup("_raop._tcp");
+     
+
       /* Get the volume range, in dB, that should be used If not set, it means you just use the range set by the mixer. */
       if (config_lookup_int(config.cfg, "general.volume_range_db", &value)) {
         if ((value < 30) || (value > 150))
@@ -958,6 +965,7 @@ int main(int argc, char **argv) {
         config.audio_backend_buffer_desired_length);
   debug(1, "audio backend latency offset is %d.", config.audio_backend_latency_offset);
   debug(1, "volume range in dB (zero means use the range specified by the mixer): %u.", config.volume_range_db);
+  debug(1, "zeroconf regtype is \"%s\".", config.regtype);
   
   char *realConfigPath = realpath(config.configfile,NULL);
   if (realConfigPath) {