Merge other enhancements.
This commit is contained in:
+9
-4
@@ -19,6 +19,10 @@ noinst_LIBRARIES =
|
||||
|
||||
shairport_sync_SOURCES = shairport.c rtsp.c mdns.c common.c rtp.c player.c alac.c audio.c loudness.c activity_monitor.c
|
||||
|
||||
if BUILD_FOR_DARWIN
|
||||
AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -Wno-deprecated-declarations -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
AM_CFLAGS = -Wno-multichar -Wall -Wextra -Wno-deprecated-declarations -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
else
|
||||
if BUILD_FOR_FREEBSD
|
||||
AM_CXXFLAGS = -I/usr/local/include -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
AM_CFLAGS = -Wno-multichar -Wall -Wextra -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
@@ -31,16 +35,17 @@ else
|
||||
AM_CFLAGS = -fno-common -Wno-multichar -Wall -Wextra -Wno-clobbered -Wno-psabi -pthread -DSYSCONFDIR=\"$(sysconfdir)\"
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
# include information generated by 'git describe --dirty' if requested
|
||||
if USE_GIT_VERSION
|
||||
common.c: gitversion.h
|
||||
gitversion.h: .git/index
|
||||
echo "// Do not edit!" > gitversion.h
|
||||
echo "// This file is automatically generated by 'git describe --dirty', if available." >> gitversion.h
|
||||
echo -n " char git_version_string[] = \"" >> gitversion.h
|
||||
printf "// Do not edit!\n" > gitversion.h
|
||||
printf "// This file is automatically generated by 'git describe --dirty', if available.\n" >> gitversion.h
|
||||
printf " char git_version_string[] = \"" >> gitversion.h
|
||||
git describe --dirty | tr -d '[[:space:]]' >> gitversion.h
|
||||
echo "\";" >> gitversion.h
|
||||
printf "\";\n" >> gitversion.h
|
||||
CLEANFILES += gitversion.h
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
Version 4.1-dev-454-ga774a6fc
|
||||
====
|
||||
**Enhancement**
|
||||
* Strip the trailing dot and everything after it in the hostname when using it as the basis for a service name. E.g. `freebsd.local` becomes `freebsd`.
|
||||
|
||||
**Bug Fixes**
|
||||
* Fix a few compilation bugs and portability issues, and turn off deprecation warnings when compiling for Mac OS.
|
||||
|
||||
**Note:** After this update, you'll need to run `autoreconf -fi` and the `./configure...` steps again.
|
||||
|
||||
Version 4.1-dev-439-gb7a11cae
|
||||
====
|
||||
Documentation update. Comments, corrections and suggestions welcome.
|
||||
|
||||
@@ -62,6 +62,9 @@
|
||||
#endif
|
||||
|
||||
#ifdef COMPILE_FOR_OSX
|
||||
#include <net/if_dl.h>
|
||||
#include <net/if_types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <CoreServices/CoreServices.h>
|
||||
#include <mach/mach.h>
|
||||
#include <mach/mach_time.h>
|
||||
@@ -1220,7 +1223,6 @@ uint64_t get_monotonic_time_in_ns() {
|
||||
|
||||
#ifdef COMPILE_FOR_OSX
|
||||
uint64_t time_now_mach;
|
||||
uint64_t elapsedNano;
|
||||
static mach_timebase_info_data_t sTimebaseInfo = {0, 0};
|
||||
|
||||
// this actually give you a monotonic clock
|
||||
@@ -1238,7 +1240,7 @@ uint64_t get_monotonic_time_in_ns() {
|
||||
}
|
||||
|
||||
if (sTimebaseInfo.denom == 0)
|
||||
die("could not initialise Mac timebase info in get_monotonic_time_in_ns().")
|
||||
die("could not initialise Mac timebase info in get_monotonic_time_in_ns().");
|
||||
|
||||
// Do the maths. We hope that the multiplication doesn't
|
||||
// overflow; the price you pay for working in fixed point.
|
||||
@@ -1283,7 +1285,6 @@ uint64_t get_absolute_time_in_ns() {
|
||||
|
||||
#ifdef COMPILE_FOR_OSX
|
||||
uint64_t time_now_mach;
|
||||
uint64_t elapsedNano;
|
||||
static mach_timebase_info_data_t sTimebaseInfo = {0, 0};
|
||||
|
||||
// this actually give you a monotonic clock
|
||||
@@ -1303,7 +1304,7 @@ uint64_t get_absolute_time_in_ns() {
|
||||
// overflow; the price you pay for working in fixed point.
|
||||
|
||||
if (sTimebaseInfo.denom == 0)
|
||||
die("could not initialise Mac timebase info in get_absolute_time_in_ns().")
|
||||
die("could not initialise Mac timebase info in get_absolute_time_in_ns().");
|
||||
|
||||
// this gives us nanoseconds
|
||||
time_now_ns = time_now_mach * sTimebaseInfo.numer / sTimebaseInfo.denom;
|
||||
@@ -1949,20 +1950,20 @@ int get_device_id(uint8_t *id, int int_length) {
|
||||
}
|
||||
|
||||
if (getifaddrs(&ifaddr) == -1) {
|
||||
debug(1, "getifaddrs");
|
||||
response = -1;
|
||||
} else {
|
||||
t = id;
|
||||
int found = 0;
|
||||
for (ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
|
||||
|
||||
for (ifa = ifaddr; ((ifa != NULL) && (found == 0)); ifa = ifa->ifa_next) {
|
||||
#ifdef AF_PACKET
|
||||
if ((ifa->ifa_addr) && (ifa->ifa_addr->sa_family == AF_PACKET)) {
|
||||
struct sockaddr_ll *s = (struct sockaddr_ll *)ifa->ifa_addr;
|
||||
if ((strcmp(ifa->ifa_name, "lo") != 0) && (found == 0)) {
|
||||
if ((strcmp(ifa->ifa_name, "lo") != 0)) {
|
||||
found = 1;
|
||||
for (i = 0; ((i < s->sll_halen) && (i < int_length)); i++) {
|
||||
*t++ = s->sll_addr[i];
|
||||
}
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
#else
|
||||
@@ -1970,16 +1971,16 @@ int get_device_id(uint8_t *id, int int_length) {
|
||||
struct sockaddr_dl *sdl = (struct sockaddr_dl *)ifa->ifa_addr;
|
||||
if ((sdl) && (sdl->sdl_family == AF_LINK)) {
|
||||
if (sdl->sdl_type == IFT_ETHER) {
|
||||
char *s = LLADDR(sdl);
|
||||
for (i = 0; i < sdl->sdl_alen; i++) {
|
||||
debug(1, "char %d: \"%c\".", i, *s);
|
||||
*t++ = (uint8_t)*s++;
|
||||
}
|
||||
found = 1;
|
||||
uint8_t *s = (uint8_t *)LLADDR(sdl);
|
||||
for (i = 0; ((i < sdl->sdl_alen) && (i < int_length)); i++) {
|
||||
*t++ = *s++;
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
}
|
||||
freeifaddrs(ifaddr);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ fi
|
||||
AM_CONDITIONAL([BUILD_FOR_LINUX], [test "x${with_os}" = xlinux ])
|
||||
AM_CONDITIONAL([BUILD_FOR_FREEBSD], [test "x${with_os}" = xfreebsd ])
|
||||
AM_CONDITIONAL([BUILD_FOR_OPENBSD], [test "x${with_os}" = xopenbsd ])
|
||||
AM_CONDITIONAL([BUILD_FOR_DARWIN], [test "x${with_os}" = xdarwin ])
|
||||
|
||||
##### Some build systems are not fully using pkg-config, so we can use the flag ${with_pkg_config} on a case-by-case basis
|
||||
##### to control how to deal with them
|
||||
|
||||
+1
-1
@@ -575,7 +575,7 @@ gboolean notify_volume_callback(ShairportSync *skeleton,
|
||||
__attribute__((unused)) gpointer user_data) {
|
||||
gdouble iv = shairport_sync_get_volume(skeleton);
|
||||
if (((iv >= -30.0) && (iv <= 0.0)) || (iv == -144.0)) {
|
||||
debug(1, ">> setting volume to %6.3f.", iv);
|
||||
debug(2, ">> setting volume to %7.4f.", iv);
|
||||
|
||||
lock_player();
|
||||
config.airplay_volume = iv;
|
||||
|
||||
+4
-3
@@ -33,8 +33,9 @@
|
||||
|
||||
static DNSServiceRef service;
|
||||
|
||||
static int mdns_dns_sd_register(char *apname, int port,
|
||||
__attribute__((unused)) char **txt_records) {
|
||||
static int mdns_dns_sd_register(char *ap1name, __attribute__((unused)) char *ap2name, int port,
|
||||
__attribute__((unused)) char **txt_records,
|
||||
__attribute__((unused)) char **secondary_txt_records) {
|
||||
char *recordwithoutmetadata[] = {MDNS_RECORD_WITHOUT_METADATA, NULL};
|
||||
#ifdef CONFIG_METADATA
|
||||
char *recordwithmetadata[] = {MDNS_RECORD_WITH_METADATA, NULL};
|
||||
@@ -71,7 +72,7 @@ static int mdns_dns_sd_register(char *apname, int port,
|
||||
}
|
||||
|
||||
DNSServiceErrorType error;
|
||||
error = DNSServiceRegister(&service, 0, kDNSServiceInterfaceIndexAny, apname, config.regtype, "",
|
||||
error = DNSServiceRegister(&service, 0, kDNSServiceInterfaceIndexAny, ap1name, config.regtype, "",
|
||||
NULL, htons((uint16_t)port), length, buf, NULL, NULL);
|
||||
|
||||
free(buf);
|
||||
|
||||
@@ -2412,7 +2412,7 @@ void *player_thread_func(void *arg) {
|
||||
double moving_average_correction = 0.0;
|
||||
double moving_average_insertions_plus_deletions = 0.0;
|
||||
if (number_of_statistics == 0) {
|
||||
debug(2, "number_of_statistics is zero.");
|
||||
debug(2, "number_of_statistics is zero!");
|
||||
} else {
|
||||
moving_average_sync_error = (1.0 * tsum_of_sync_errors) / number_of_statistics;
|
||||
moving_average_correction = (1.0 * tsum_of_corrections) / number_of_statistics;
|
||||
|
||||
@@ -723,7 +723,7 @@ void *rtp_timing_receiver(void *arg) {
|
||||
// for getting mean and sd of return times
|
||||
int32_t stat_n = 0;
|
||||
double stat_mean = 0.0;
|
||||
double stat_M2 = 0.0;
|
||||
// double stat_M2 = 0.0;
|
||||
|
||||
while (1) {
|
||||
nread = recv(conn->timing_socket, packet, sizeof(packet), 0);
|
||||
@@ -813,7 +813,7 @@ void *rtp_timing_receiver(void *arg) {
|
||||
stat_n += 1;
|
||||
double stat_delta = return_time - stat_mean;
|
||||
stat_mean += stat_delta / stat_n;
|
||||
stat_M2 += stat_delta * (return_time - stat_mean);
|
||||
// stat_M2 += stat_delta * (return_time - stat_mean);
|
||||
// debug(1, "Timing packet return time stats: current, mean and standard deviation over
|
||||
// %d packets: %.1f, %.1f, %.1f (nanoseconds).",
|
||||
// stat_n,return_time,stat_mean, sqrtf(stat_M2 / (stat_n - 1)));
|
||||
|
||||
@@ -2620,7 +2620,7 @@ void handle_teardown_2(rtsp_conn_info *conn, __attribute__((unused)) rtsp_messag
|
||||
} else {
|
||||
teardown_phase_one(conn); // try to do phase one anyway
|
||||
teardown_phase_two(conn);
|
||||
debug(1, "Connection %d: TEARDOWN phase two complete", conn->connection_number);
|
||||
debug(2, "Connection %d: TEARDOWN phase two complete", conn->connection_number);
|
||||
}
|
||||
//} else {
|
||||
// warn("Connection %d TEARDOWN received without having the player (no ANNOUNCE?)",
|
||||
|
||||
+6
-1
@@ -1454,6 +1454,11 @@ int parse_options(int argc, char **argv) {
|
||||
// now, do the substitutions in the service name
|
||||
char hostname[100];
|
||||
gethostname(hostname, 100);
|
||||
|
||||
// strip off a terminating .<anything>, e.g. .local from the hostname
|
||||
char *last_dot = strrchr(hostname,'.');
|
||||
if (last_dot != NULL)
|
||||
*last_dot = '\0';
|
||||
|
||||
char *i0;
|
||||
if (raw_service_name == NULL)
|
||||
@@ -1698,6 +1703,7 @@ void termHandler(__attribute__((unused)) int k) {
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
memset(&config, 0, sizeof(config)); // also clears all strings, BTW
|
||||
/* Check if we are called with -V or --version parameter */
|
||||
if (argc >= 2 && ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0))) {
|
||||
print_version();
|
||||
@@ -1731,7 +1737,6 @@ int main(int argc, char **argv) {
|
||||
config.log_fd = -1;
|
||||
conns = NULL; // no connections active
|
||||
memset((void *)&main_thread_id, 0, sizeof(main_thread_id));
|
||||
memset(&config, 0, sizeof(config)); // also clears all strings, BTW
|
||||
ns_time_at_startup = get_absolute_time_in_ns();
|
||||
ns_time_at_last_debug_message = ns_time_at_startup;
|
||||
// this is a bit weird, but necessary -- basename() may modify the argument passed in
|
||||
|
||||
Reference in New Issue
Block a user