From: Mike Brady Date: Fri, 8 Mar 2019 21:19:48 +0000 (+0000) Subject: Make soxr, metadata and apple_alac defaults if support for them is included in the... X-Git-Tag: 3.3RC1~4 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=178af21dab9564c4e462b62d41bad4697aa0d0b6;p=thirdparty%2Fshairport-sync.git Make soxr, metadata and apple_alac defaults if support for them is included in the build configuration. --- diff --git a/audio_alsa.c b/audio_alsa.c index 4010629d..99dcf405 100644 --- a/audio_alsa.c +++ b/audio_alsa.c @@ -700,7 +700,7 @@ int do_alsa_device_init_if_needed() { debug(1, "Can't get dB value corresponding to a minimum volume " "+ 1."); } - debug(1, "Hardware mixer has dB volume from %f to %f.", (1.0 * alsa_mix_mindb) / 100.0, + debug(3, "Hardware mixer has dB volume from %f to %f.", (1.0 * alsa_mix_mindb) / 100.0, (1.0 * alsa_mix_maxdb) / 100.0); } else { // use the linear scale and do the db conversion ourselves diff --git a/common.c b/common.c index 4db41149..2f52d69c 100644 --- a/common.c +++ b/common.c @@ -1282,6 +1282,9 @@ char *get_version_string() { char *version_string = malloc(1024); if (version_string) { strcpy(version_string, PACKAGE_VERSION); +#ifdef CONFIG_LIBDAEMON + strcat(version_string, "-libdaemon"); +#endif #ifdef CONFIG_MBEDTLS strcat(version_string, "-mbedTLS"); #endif @@ -1300,6 +1303,9 @@ char *get_version_string() { #ifdef CONFIG_DNS_SD strcat(version_string, "-dns_sd"); #endif +#ifdef CONFIG_EXTERNAL_MDNS + strcat(version_string, "-external_mdns"); +#endif #ifdef CONFIG_ALSA strcat(version_string, "-ALSA"); #endif diff --git a/scripts/shairport-sync.conf b/scripts/shairport-sync.conf index 806e2743..f33b6b92 100644 --- a/scripts/shairport-sync.conf +++ b/scripts/shairport-sync.conf @@ -1,5 +1,7 @@ // Sample Configuration File for Shairport Sync // Commented out settings are generally the defaults, except where noted. +// Some sections are operative only if Shairport Sync has been built with the right configuration flags. +// See the individual sections for details. // General Settings general = @@ -10,10 +12,11 @@ general = // %h for the hostname, // %H for the Hostname (i.e. with first letter capitalised (ASCII only)), // %v for the version number, e.g. 3.0 and -// %V for the full version string, e.g. 3.0-OpenSSL-Avahi-ALSA-soxr-metadata-sysconfdir:/etc +// %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 // interpolation = "basic"; // aka "stuffing". Default is "basic", alternative is "soxr". Use "soxr" only if you have a reasonably fast processor. +// If you build Shairport Sync with the flag --with-soxr, interpolation will be "soxr" by default. // 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 @@ -38,6 +41,7 @@ general = // playback_mode = "stereo"; // This can be "stereo", "mono", "reverse stereo", "both left" or "both right". Default is "stereo". // alac_decoder = "hammerton"; // This can be "hammerton" or "apple". This advanced setting allows you to choose // the original Shairport decoder by David Hammerton or the Apple Lossless Audio Codec (ALAC) decoder written by Apple. +// If you build Shairport Sync with the flag --with-apple-alac, the Apple ALAC decoder will be chosen by default. // 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. // audio_backend_latency_offset_in_seconds = 0.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 -0.1. @@ -73,6 +77,8 @@ sessioncontrol = // Back End Settings // These are parameters for the "alsa" audio back end. +// For this section to be operative, Shairport Sync must be built with the following configuration flag: +// --with-alsa alsa = { // output_device = "default"; // the name of the alsa output device. Use "alsamixer" or "aplay" to find out the names of devices, mixers, etc. @@ -90,6 +96,8 @@ alsa = }; // Parameters for the "sndio" audio back end. All are optional. +// For this section to be operative, Shairport Sync must be built with the following configuration flag: +// --with-sndio sndio = { // device = "snd/0"; // optional setting to set the name of the output device. Default is the sndio system default. @@ -100,12 +108,16 @@ sndio = }; // Parameters for the "pa" PulseAudio backend. +// For this section to be operative, Shairport Sync must be built with the following configuration flag: +// --with-pa pa = { // application_name = "Shairport Sync"; //Set this to the name that should appear in the Sounds "Applications" tab when Shairport Sync is active. }; // Parameters for the "jack" JACK Audio Connection Kit backend. +// For this section to be operative, Shairport Sync must be built with the following configuration flag: +// --with-jack jack = { // client_name = "shairport-sync"; // Set this to the name of the client that should appear in "Connections" when Shairport Sync is active. @@ -119,17 +131,23 @@ jack = }; // Parameters for the "pipe" audio back end, a back end that directs raw CD-style audio output to a pipe. No interpolation is done. +// For this section to be operative, Shairport Sync must have been built with the following configuration flag: +// --with-pipe pipe = { // name = "/path/to/pipe"; // there is no default pipe name for the output }; // There are no configuration file parameters for the "stdout" audio back end. No interpolation is done. +// To include support for the "stdout" backend, Shairport Sync must be built with the following configuration flag: +// --with-stdout // There are no configuration file parameters for the "ao" audio back end. No interpolation is done. +// To include support for the "ao" backend, Shairport Sync must be built with the following configuration flag: +// --with-ao -// Static latency settings are deprecated and the settings have been removed. - +// For this section to be operative, Shairport Sync must be built with the following configuration flag: +// --with-convolution dsp = { @@ -160,6 +178,9 @@ dsp = }; // How to deal with metadata, including artwork +// For this section to be operative, Shairport Sync must be built with at one (or more) of the following configuration flags: +// --with-metadata, --with-dbus-interface, --with-mpris-interface or --with-mqtt-client. +// In those cases, "enabled" and "include_cover_art" will both be "yes" by default metadata = { // enabled = "no"; // set this to yes to get Shairport Sync to solicit metadata from the source and to pass it on via a pipe @@ -172,6 +193,8 @@ metadata = }; // How to enable the MQTT-metadata/remote-service +// For this section to be operative, Shairport Sync must be built with the following configuration flag: +// --with-mqtt-client mqtt = { // enabled = "no"; // set this to yes to enable the mqtt-metadata-service diff --git a/shairport.c b/shairport.c index 3a0502ca..bfe4eabc 100644 --- a/shairport.c +++ b/shairport.c @@ -173,7 +173,7 @@ void usage(char *progname) { printf(" The default is to set it automatically.\n"); printf(" -S, --stuffing=MODE set how to adjust current latency to match desired latency, " "where \n"); - printf(" \"basic\" (default) inserts or deletes audio frames from " + printf(" \"basic\" inserts or deletes audio frames from " "packet frames with low processor overhead, and \n"); printf(" \"soxr\" uses libsoxr to minimally resample packet frames -- " "moderate processor overhead.\n"); @@ -207,12 +207,13 @@ void usage(char *progname) { printf(" --logOutputLevel log the output level setting -- useful for setting maximum " "volume.\n"); #ifdef CONFIG_METADATA + printf(" -M, --metadata-enable ask for metadata from the source and process it.\n"); printf(" --metadata-pipename=PIPE send metadata to PIPE, e.g. " "--metadata-pipename=/tmp/shairport-sync-metadata.\n"); printf(" The default is /tmp/shairport-sync-metadata.\n"); printf(" --get-coverart send cover art through the metadata pipe.\n"); #endif - printf(" -u, --use-stderr log messages through STDERR rather than syslog.\n"); + printf(" -u, --use-stderr log messages through STDERR rather than syslog.\n"); printf("\n"); mdns_ls_backends(); printf("\n"); @@ -259,7 +260,8 @@ int parse_options(int argc, char **argv) { {"tolerance", 'z', POPT_ARG_INT, &fTolerance, 0, NULL, NULL}, {"use-stderr", 'u', POPT_ARG_NONE, NULL, 'u', NULL, NULL}, #ifdef CONFIG_METADATA - {"metadata-pipename", 'M', POPT_ARG_STRING, &config.metadata_pipename, 'M', NULL, NULL}, + {"metadata-enable", 'M', POPT_ARG_NONE, &config.metadata_enabled, 'M', NULL, NULL}, + {"metadata-pipename", 0, POPT_ARG_STRING, &config.metadata_pipename, 0, NULL, NULL}, {"get-coverart", 'g', POPT_ARG_NONE, &config.get_coverart, 'g', NULL, NULL}, #endif POPT_AUTOHELP{NULL, 0, 0, NULL, 0, NULL, NULL}}; @@ -457,7 +459,7 @@ int parse_options(int argc, char **argv) { #ifdef CONFIG_SOXR config.packet_stuffing = ST_soxr; #else - die("The soxr option not available because this version of shairport-sync was built " + warn("The soxr option not available because this version of shairport-sync was built " "without libsoxr " "support. Change the \"general/interpolation\" setting in the configuration file."); #endif @@ -700,6 +702,7 @@ int parse_options(int argc, char **argv) { #ifdef CONFIG_METADATA /* Get the metadata setting. */ + config.metadata_enabled = 1; // if metadata support is included, then enable it by default if (config_lookup_string(config.cfg, "metadata.enabled", &str)) { if (strcasecmp(str, "no") == 0) config.metadata_enabled = 0; @@ -709,6 +712,7 @@ int parse_options(int argc, char **argv) { die("Invalid metadata enabled option choice \"%s\". It should be \"yes\" or \"no\""); } + config.get_coverart = 1; // if metadata support is included, then enable it by default if (config_lookup_string(config.cfg, "metadata.include_cover_art", &str)) { if (strcasecmp(str, "no") == 0) config.get_coverart = 0; @@ -1282,7 +1286,11 @@ int main(int argc, char **argv) { 0.002; // this number of seconds of timing error before attempting to correct it. config.buffer_start_fill = 220; config.port = 5000; +#ifdef CONFIG_SOXR + config.packet_stuffing = ST_soxr; // use soxr interpolation by default if support has been included +#else config.packet_stuffing = ST_basic; // simple interpolation or deletion +#endif // char hostname[100]; // gethostname(hostname, 100); // config.service_name = malloc(20 + 100); @@ -1298,6 +1306,7 @@ int main(int argc, char **argv) { 1 << decoder_hammerton; // David Hammerton's decoder supported by default #ifdef CONFIG_APPLE_ALAC config.decoders_supported += 1 << decoder_apple_alac; + config.use_apple_decoder = 1; // use the ALAC decoder by default if support has been included #endif // initialise random number generator