// %v for the version number, e.g. 3.0 and
// %V for the full version string, e.g. 3.3-OpenSSL-Avahi-ALSA-soxr-metadata-sysconfdir:/etc
// Overall length can not exceed 50 characters. Example: "Shairport Sync %v on %H".
-// password = "secret"; // leave this commented out if you don't want to require a password
+// password = "secret"; // (AirPlay 1 only) leave this commented out if you don't want to require a password
// interpolation = "auto"; // aka "stuffing". Default is "auto". Alternatives are "basic" or "soxr". Choose "soxr" only if you have a reasonably fast processor and Shairport Sync has been built with "soxr" support.
// 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.
// interface = "name"; // Use this advanced setting to specify the interface on which Shairport Sync should provide its service. Leave it commented out to get the default, which is to select the interface(s) automatically.
-// 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 = 10; // look for free ports in this number of places, starting at the UDP port base. Allow at least 10, though only three are needed in a steady state.
-// regtype = "_raop._tcp"; // Use this advanced setting to set the service type and transport to be advertised by Zeroconf/Bonjour. Default is "_raop._tcp".
+// port = <number>; // Listen for service requests on this port. 5000 for AirPlay 1, 7000 for AirPlay 2
+// udp_port_base = 6001; // (AirPlay 1 only) start allocating UDP ports from this port number when needed
+// udp_port_range = 10; // (AirPlay 1 only) look for free ports in this number of places, starting at the UDP port base. Allow at least 10, though only three are needed in a steady state.
+// airplay_device_id_offset = 0; // (AirPlay 2 only) add this to the default airplay_device_id calculated from one of the device's MAC address
+// airplay_device_id = <6-byte_hexadecimal_number>; // (AirPlay 2 only) use this as the airplay_device_id
+// regtype = "<string>"; // Use this advanced setting to set the service type and transport to be advertised by Zeroconf/Bonjour. Default is "_raop._tcp" for AirPlay 1, "_airplay._tcp" for AirPlay 2.
// drift_tolerance_in_seconds = 0.002; // allow a timing error of this number of seconds of drift away from exact synchronisation before attempting to correct it
// resync_threshold_in_seconds = 0.050; // a synchronisation error greater than this number of seconds will cause resynchronisation; 0 disables it
// Set to NULL to work with transient pairing
config.airplay_pin = NULL;
- // use the start of the config.hw_addr and the PID to generate the airplay_device_id
+ // use the start of the config.hw_addr and the PID to generate the default airplay_device_id
uint64_t apid = nctoh64(config.hw_addr);
apid = apid >> 16; // we only use the first 6 bytes but have imported 8.
- // apid = apid + pid;
+
+ int64_t aid;
+
+ // add the airplay_device_id_offset if provided
+ if (config_lookup_int64(config.cfg, "general.airplay_device_id_offset", &aid)) {
+ apid += aid;
+ }
+
+ // replace the airplay_device_id with this, if provided
+ if (config_lookup_int64(config.cfg, "general.airplay_device_id", &aid)) {
+ apid = aid;
+ }
+
char apids[6*2+5+1]; // six pairs of digits, 5 colons and a NUL
apids[6*2+5] = 0; // NUL termination
int i;
if (i != 0)
apids[i*3-1] = ':';
}
+
config.airplay_device_id = strdup(apids);
// now generate a UUID