if (config.cfg != NULL) {
- if (config_lookup_int(config.cfg, "alsa.audio_backend_buffer_desired_length", &value))
- inform("The setting audio_backend_buffer_desired_length is no longer used and has been "
- "ignored. Use audio_backend_buffer_desired_length_in_seconds instead.");
-
- /* Get the latency offset. */
- if (config_lookup_int(config.cfg, "alsa.audio_backend_latency_offset", &value))
- inform("The setting audio_backend_latency_offset is no longer used and has been ignored. Use "
- "audio_backend_latency_offset_in_seconds instead.");
+ /* Get the desired buffer size setting. */
+ if (config_lookup_int(config.cfg,
+ "alsa.audio_backend_buffer_desired_length", &value)) {
+ if ((value < 0) || (value > 66150)) {
+ inform("The setting alsa.audio_backend_buffer_desired_length is deprecated. "
+ "Use alsa.audio_backend_buffer_desired_length_in_seconds instead.");
+ die("Invalid alsa audio backend buffer desired length \"%d\". It "
+ "should be between 0 and "
+ "66150, default is 6615",
+ value);
+ } else {
+ inform("The setting alsa.audio_backend_buffer_desired_length is deprecated. "
+ "Use alsa.audio_backend_buffer_desired_length_in_seconds instead.");
+ config.audio_backend_buffer_desired_length = 1.0*value/44100;
+ }
+ }
/* Get the desired buffer size setting. */
if (config_lookup_float(config.cfg, "alsa.audio_backend_buffer_desired_length_in_seconds",
&dvalue)) {
- if ((dvalue < 0) || (dvalue > 1.5))
+ if ((dvalue < 0) || (dvalue > 1.5)) {
die("Invalid alsa audio backend buffer desired time \"%f\". It "
"should be between 0 and "
"1.5, default is 0.15 seconds",
dvalue);
- else {
+ } else {
config.audio_backend_buffer_desired_length = dvalue;
}
}
+ /* Get the latency offset. */
+ if (config_lookup_int(config.cfg, "alsa.audio_backend_latency_offset",
+ &value)) {
+ if ((value < -66150) || (value > 66150)) {
+ inform("The setting alsa.audio_backend_latency_offset is deprecated. "
+ "Use alsa.audio_backend_latency_offset_in_seconds instead.");
+ die("Invalid alsa audio backend buffer latency offset \"%d\". It "
+ "should be between -66150 and +66150, default is 0",
+ value);
+ } else {
+ inform("The setting alsa.audio_backend_latency_offset is deprecated. "
+ "Use alsa.audio_backend_latency_offset_in_seconds instead.");
+ config.audio_backend_latency_offset = 1.0*value/44100;
+ }
+ }
+
/* Get the latency offset. */
if (config_lookup_float(config.cfg, "alsa.audio_backend_latency_offset_in_seconds", &dvalue)) {
- if ((dvalue < -1.0) || (dvalue > 1.5))
+ if ((dvalue < -1.0) || (dvalue > 1.5)) {
die("Invalid alsa audio backend buffer latency offset time \"%f\". It "
"should be between -1.0 and +1.5, default is 0 seconds",
dvalue);
- else
+ } else {
config.audio_backend_latency_offset = dvalue;
+ }
}
/* Get the Output Device Name. */
if (config.cfg != NULL) {
/* Get the desired buffer size setting. */
- if (config_lookup_float(config.cfg, "ao.audio_backend_buffer_desired_length", &dvalue)) {
- if ((dvalue < 0) || (value > 1.5))
- die("Invalid ao audio backend buffer desired length \"%f\". It "
+ if (config_lookup_int(config.cfg,
+ "ao.audio_backend_buffer_desired_length", &value)) {
+ if ((value < 0) || (value > 66150)) {
+ inform("The setting ao.audio_backend_buffer_desired_length is deprecated. "
+ "Use ao.audio_backend_buffer_desired_length_in_seconds instead.");
+ die("Invalid ao audio backend buffer desired length \"%d\". It "
"should be between 0 and "
- "1.5, default is 1.0 second",
+ "66150, default is 6615",
+ value);
+ } else {
+ inform("The setting ao.audio_backend_buffer_desired_length is deprecated. "
+ "Use ao.audio_backend_buffer_desired_length_in_seconds instead.");
+ config.audio_backend_buffer_desired_length = 1.0*value/44100;
+ }
+ }
+
+ /* Get the desired buffer size setting. */
+ if (config_lookup_float(config.cfg, "ao.audio_backend_buffer_desired_length_in_seconds",
+ &dvalue)) {
+ if ((dvalue < 0) || (dvalue > 1.5)) {
+ die("Invalid ao audio backend buffer desired time \"%f\". It "
+ "should be between 0 and "
+ "1.5, default is 0.15 seconds",
dvalue);
- else {
+ } else {
config.audio_backend_buffer_desired_length = dvalue;
}
}
/* Get the latency offset. */
- if (config_lookup_float(config.cfg, "ao.audio_backend_latency_offset", &dvalue)) {
- if ((dvalue < -1.0) || (value > 1.5))
- die("Invalid ao audio backend buffer latency offset \"%f\". It "
+ if (config_lookup_int(config.cfg, "ao.audio_backend_latency_offset",
+ &value)) {
+ if ((value < -66150) || (value > 66150)) {
+ inform("The setting ao.audio_backend_latency_offset is deprecated. "
+ "Use ao.audio_backend_latency_offset_in_seconds instead.");
+ die("Invalid ao audio backend buffer latency offset \"%d\". It "
+ "should be between -66150 and +66150, default is 0",
+ value);
+ } else {
+ inform("The setting ao.audio_backend_latency_offset is deprecated. "
+ "Use ao.audio_backend_latency_offset_in_seconds instead.");
+ config.audio_backend_latency_offset = 1.0*value/44100;
+ }
+ }
+
+ /* Get the latency offset. */
+ if (config_lookup_float(config.cfg, "ao.audio_backend_latency_offset_in_seconds", &dvalue)) {
+ if ((dvalue < -1.0) || (dvalue > 1.5)) {
+ die("Invalid ao audio backend buffer latency offset time \"%f\". It "
"should be between -1.0 and +1.5, default is 0 seconds",
dvalue);
- else
+ } else {
config.audio_backend_latency_offset = dvalue;
+ }
}
}
die("Can't use \"pipe\" backend for STDOUT. Use the \"stdout\" backend instead.");
/* Get the desired buffer size setting. */
- if (config_lookup_float(config.cfg, "pipe.audio_backend_buffer_desired_length", &dvalue)) {
- if ((dvalue < 0) || (value > 1.5))
- die("Invalid pipe audio backend buffer desired length \"%f\". It "
+ if (config_lookup_int(config.cfg,
+ "pipe.audio_backend_buffer_desired_length", &value)) {
+ if ((value < 0) || (value > 66150)) {
+ inform("The setting pipe.audio_backend_buffer_desired_length is deprecated. "
+ "Use pipe.audio_backend_buffer_desired_length_in_seconds instead.");
+ die("Invalid pipe audio backend buffer desired length \"%d\". It "
"should be between 0 and "
- "1.5, default is 1.0 second",
+ "66150, default is 6615",
+ value);
+ } else {
+ inform("The setting pipe.audio_backend_buffer_desired_length is deprecated. "
+ "Use pipe.audio_backend_buffer_desired_length_in_seconds instead.");
+ config.audio_backend_buffer_desired_length = 1.0*value/44100;
+ }
+ }
+
+ /* Get the desired buffer size setting. */
+ if (config_lookup_float(config.cfg, "pipe.audio_backend_buffer_desired_length_in_seconds",
+ &dvalue)) {
+ if ((dvalue < 0) || (dvalue > 1.5)) {
+ die("Invalid pipe audio backend buffer desired time \"%f\". It "
+ "should be between 0 and "
+ "1.5, default is 0.15 seconds",
dvalue);
- else {
+ } else {
config.audio_backend_buffer_desired_length = dvalue;
}
}
/* Get the latency offset. */
- if (config_lookup_float(config.cfg, "pipe.audio_backend_latency_offset", &dvalue)) {
- if ((dvalue < -1.0) || (value > 1.5))
- die("Invalid pipe audio backend buffer latency offset \"%f\". It "
+ if (config_lookup_int(config.cfg, "pipe.audio_backend_latency_offset",
+ &value)) {
+ if ((value < -66150) || (value > 66150)) {
+ inform("The setting pipe.audio_backend_latency_offset is deprecated. "
+ "Use pipe.audio_backend_latency_offset_in_seconds instead.");
+ die("Invalid pipe audio backend buffer latency offset \"%d\". It "
+ "should be between -66150 and +66150, default is 0",
+ value);
+ } else {
+ inform("The setting pipe.audio_backend_latency_offset is deprecated. "
+ "Use pipe.audio_backend_latency_offset_in_seconds instead.");
+ config.audio_backend_latency_offset = 1.0*value/44100;
+ }
+ }
+
+ /* Get the latency offset. */
+ if (config_lookup_float(config.cfg, "pipe.audio_backend_latency_offset_in_seconds", &dvalue)) {
+ if ((dvalue < -1.0) || (dvalue > 1.5)) {
+ die("Invalid pipe audio backend buffer latency offset time \"%f\". It "
"should be between -1.0 and +1.5, default is 0 seconds",
dvalue);
- else
+ } else {
config.audio_backend_latency_offset = dvalue;
+ }
}
}
if ((pipename == NULL) && (argc != 1))
if (config.cfg != NULL) {
/* Get the desired buffer size setting. */
- if (config_lookup_float(config.cfg, "stdout.audio_backend_buffer_desired_length", &dvalue)) {
- if ((dvalue < 0) || (dvalue > 1.5))
- die("Invalid stdout audio backend buffer desired length \"%f\". It "
+ if (config_lookup_int(config.cfg,
+ "stdout.audio_backend_buffer_desired_length", &value)) {
+ if ((value < 0) || (value > 66150)) {
+ inform("The setting audio_backend_buffer_desired_length is deprecated. "
+ "Use audio_backend_buffer_desired_length_in_seconds instead.");
+ die("Invalid stdout audio backend buffer desired length \"%d\". It "
"should be between 0 and "
- "1.5, default is 1.0 second",
+ "66150, default is 6615",
+ value);
+ } else {
+ inform("The stdout.setting audio_backend_buffer_desired_length is deprecated. "
+ "Use stdout.audio_backend_buffer_desired_length_in_seconds instead.");
+ config.audio_backend_buffer_desired_length = 1.0*value/44100;
+ }
+ }
+
+ /* Get the desired buffer size setting. */
+ if (config_lookup_float(config.cfg, "stdout.audio_backend_buffer_desired_length_in_seconds",
+ &dvalue)) {
+ if ((dvalue < 0) || (dvalue > 1.5)) {
+ die("Invalid stdout audio backend buffer desired time \"%f\". It "
+ "should be between 0 and "
+ "1.5, default is 0.15 seconds",
dvalue);
- else {
+ } else {
config.audio_backend_buffer_desired_length = dvalue;
}
}
/* Get the latency offset. */
- if (config_lookup_float(config.cfg, "stdout.audio_backend_latency_offset", &dvalue)) {
- if ((dvalue < -1.0) || (value > 1.5))
- die("Invalid stdout audio backend buffer latency offset \"%f\". It "
+ if (config_lookup_int(config.cfg, "stdout.audio_backend_latency_offset",
+ &value)) {
+ if ((value < -66150) || (value > 66150)) {
+ inform("The setting stdout.audio_backend_latency_offset is deprecated. "
+ "Use stdout.audio_backend_latency_offset_in_seconds instead.");
+ die("Invalid stdout audio backend buffer latency offset \"%d\". It "
+ "should be between -66150 and +66150, default is 0",
+ value);
+ } else {
+ inform("The setting stdout.audio_backend_latency_offset is deprecated. "
+ "Use stdout.audio_backend_latency_offset_in_seconds instead.");
+ config.audio_backend_latency_offset = 1.0*value/44100;
+ }
+ }
+
+ /* Get the latency offset. */
+ if (config_lookup_float(config.cfg, "stdout.audio_backend_latency_offset_in_seconds", &dvalue)) {
+ if ((dvalue < -1.0) || (dvalue > 1.5)) {
+ die("Invalid stdout audio backend buffer latency offset time \"%f\". It "
"should be between -1.0 and +1.5, default is 0 seconds",
dvalue);
- else
+ } else {
config.audio_backend_latency_offset = dvalue;
+ }
}
+
+
}
return 0;
}
* Shairport, an Apple Airplay receiver
* Copyright (c) James Laird 2013
* All rights reserved.
- * Modifications (c) Mike Brady 2014--2016
+ * Modifications (c) Mike Brady 2014--2017
*
* Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation
printf(" -v, --verbose -v print debug information; -vv more; -vvv lots.\n");
printf(" -p, --port=PORT set RTSP listening port.\n");
printf(" -a, --name=NAME set advertised name.\n");
- printf(" -A, --AirPlayLatency=FRAMES [Deprecated] Set the latency for audio sent from an "
- "AirPlay device.\n");
- printf(" The default is to set it automatically.\n");
- printf(" -i, --iTunesLatency=FRAMES [Deprecated] Set the latency for audio sent from iTunes "
- "10 or later.\n");
- printf(" The default is to set it automatically.\n");
+// printf(" -A, --AirPlayLatency=FRAMES [Deprecated] Set the latency for audio sent from an "
+// "AirPlay device.\n");
+// printf(" The default is to set it automatically.\n");
+// printf(" -i, --iTunesLatency=FRAMES [Deprecated] Set the latency for audio sent from iTunes "
+// "10 or later.\n");
+// printf(" The default is to set it automatically.\n");
printf(" -L, --latency=FRAMES [Deprecated] Set the latency for audio sent from an unknown "
"device.\n");
printf(" The default is to set it automatically.\n");
printf(" -m, --mdns=BACKEND force the use of BACKEND to advertize the service.\n");
printf(" if no mdns provider is specified,\n");
printf(" shairport tries them all until one works.\n");
- printf(" -r, --resync=THRESHOLD resync if timing error exceeds this number of seconds. Set "
- "to 0 to "
+ printf(" -r, --resync=THRESHOLD [Deprecated] resync if error exceeds this number of frames. Set to 0 to "
"stop resyncing.\n");
printf(" -t, --timeout=SECONDS go back to idle mode from play mode after a break in "
"communications of this many seconds (default 120). Set to 0 never to exit play mode.\n");
printf(" --statistics print some interesting statistics -- output to the logfile "
"if running as a daemon.\n");
- printf(" --tolerance=TOLERANCE allow a synchronization error of TOLERANCE seconds (default "
- "0.002) before trying to correct it.\n");
+ printf(" --tolerance=TOLERANCE [Deprecated] allow a synchronization error of TOLERANCE frames (default "
+ "88) before trying to correct it.\n");
printf(" --password=PASSWORD require PASSWORD to connect. Default is not to require a "
"password.\n");
#ifdef CONFIG_METADATA
char *stuffing = NULL; /* used for picking up the stuffing option */
signed char c; /* used for argument parsing */
int i = 0; /* used for tracking options */
+ int fResyncthreshold = (int)config.resyncthreshold*44100;
+ int fTolerance = (int)config.tolerance*44100;
poptContext optCon; /* context for parsing command-line options */
struct poptOption optionsTable[] = {
{"verbose", 'v', POPT_ARG_NONE, NULL, 'v', NULL},
{"latency", 'L', POPT_ARG_INT, &config.userSuppliedLatency, 0, NULL},
{"AirPlayLatency", 'A', POPT_ARG_INT, &config.AirPlayLatency, 0, NULL},
{"iTunesLatency", 'i', POPT_ARG_INT, &config.iTunesLatency, 0, NULL},
- {"forkedDaapdLatency", 0, POPT_ARG_INT, &config.ForkedDaapdLatency, 0, NULL},
+ {"forkedDaapdLatency", 'f', POPT_ARG_INT, &config.ForkedDaapdLatency, 0, NULL},
{"stuffing", 'S', POPT_ARG_STRING, &stuffing, 'S', NULL},
- {"resync", 'r', POPT_ARG_DOUBLE, &config.resyncthreshold, 0, NULL},
+ {"resync", 'r', POPT_ARG_INT, &fResyncthreshold, 0, NULL},
{"timeout", 't', POPT_ARG_INT, &config.timeout, 't', NULL},
{"password", 0, POPT_ARG_STRING, &config.password, 0, NULL},
- {"tolerance", 0, POPT_ARG_DOUBLE, &config.tolerance, 0, NULL},
+ {"tolerance", 'z', POPT_ARG_INT, &fTolerance, 0, NULL},
#ifdef CONFIG_METADATA
{"metadata-pipename", 'M', POPT_ARG_STRING, &config.metadata_pipename, 'M', NULL},
{"get-coverart", 'g', POPT_ARG_NONE, &config.get_coverart, 'g', NULL},
case 'v':
debuglev++;
break;
- }
+ case 'D':
+ inform("Warning: the option -D or --disconnectFromOutput is deprecated.");
+ break;
+ case 'R':
+ inform("Warning: the option -R or --reconnectToOutput is deprecated.");
+ break;
+ case 'A':
+ inform("Warning: the option -A or --AirPlayLatency is deprecated. This setting is now automatically received from the AirPlay device.");
+ break;
+ case 'i':
+ inform("Warning: the option -i or --iTunesLatency is deprecated. This setting is now automatically received from iTunes");
+ break;
+ case 'f':
+ inform("Warning: the option --forkedDaapdLatency is deprecated. This setting is now automatically received from forkedDaapd");
+ break;
+ case 'r':
+ inform("Warning: the option -r or --resync is deprecated. Please use the \"resync_threshold_in_seconds\" setting in the config file instead.");
+ break;
+ case 'z':
+ inform("Warning: the option --tolerance is deprecated. Please use the \"drift_tolerance_in_seconds\" setting in the config file instead.");
+ break;
+ }
}
if (c < -1) {
die("%s: %s", poptBadOption(optCon, POPT_BADOPTION_NOALIAS), poptStrerror(c));
}
+
+ config.resyncthreshold = 1.0*fResyncthreshold/44100;
+ config.tolerance = 1.0*fTolerance/44100;
config_setting_t *setting;
const char *str = 0;
}
/* The old drift tolerance setting. */
- if (config_lookup_int(config.cfg, "general.drift", &value))
- inform("The drift setting is deprecated and has been ignored. Use "
+ if (config_lookup_int(config.cfg, "general.drift", &value)) {
+ inform("The drift setting is deprecated. Use "
"drift_tolerance_in_seconds instead");
+ config.tolerance = 1.0*value/44100;
+ }
/* The old resync setting. */
- if (config_lookup_int(config.cfg, "general.resync_threshold", &value))
- inform("The resync_threshold setting is deprecated and has been ignored. Use "
+ if (config_lookup_int(config.cfg, "general.resync_threshold", &value)) {
+ inform("The resync_threshold setting is deprecated. Use "
"resync_threshold_in_seconds instead");
+ config.resyncthreshold = 1.0*value/44100;
+ }
/* Get the drift tolerance setting. */
if (config_lookup_float(config.cfg, "general.drift_tolerance_in_seconds", &dvalue))