Use pkg-config to find libdaemon -- useful in FreeBSD -- and quieten a few warnings in FreeBSD

This commit is contained in:
Mike Brady
2014-10-11 19:55:29 +01:00
parent f7c07543fa
commit e052b5fb9e
5 changed files with 26 additions and 15 deletions
+5 -5
View File
@@ -226,7 +226,7 @@ static int init(int argc, char **argv) {
debug(1, "Hardware mixer has dB volume from %f to %f.", (1.0 * alsa_mix_mindb) / 100.0,
(1.0 * alsa_mix_maxdb) / 100.0);
} else {
debug(1, "Hardware mixer does not have dB volume -- not used.");
inform("note: the hardware mixer specified -- \"%s\" -- does not have dB volume, so it can not be used for volume control.",alsa_mix_ctrl);
}
}
if (snd_mixer_selem_has_playback_switch(alsa_mix_elem)) {
@@ -304,7 +304,7 @@ static uint32_t delay() {
current_delay = -1;
debug(1, "Error -- ALSA delay(): bad state: %d.", snd_pcm_state(alsa_handle));
}
if (derr = snd_pcm_prepare(alsa_handle)) {
if ((derr = snd_pcm_prepare(alsa_handle))) {
ignore = snd_pcm_recover(alsa_handle, derr, 0);
debug(1, "Error preparing after delay error: %s.", snd_strerror(derr));
current_delay = -1;
@@ -336,7 +336,7 @@ static void play(short buf[], int samples) {
} else {
debug(1, "Error -- ALSA device in incorrect state (%d) for play.",
snd_pcm_state(alsa_handle));
if (err = snd_pcm_prepare(alsa_handle)) {
if ((err = snd_pcm_prepare(alsa_handle))) {
ignore = snd_pcm_recover(alsa_handle, err, 0);
debug(1, "Error preparing after play error: %s.", snd_strerror(err));
}
@@ -349,10 +349,10 @@ static void flush(void) {
int derr;
if (alsa_handle) {
// debug(1,"Dropping frames for flush...");
if (derr = snd_pcm_drop(alsa_handle))
if ((derr = snd_pcm_drop(alsa_handle)))
debug(1, "Error dropping frames: %s.", snd_strerror(derr));
// debug(1,"Dropped frames ok. State is %d.",snd_pcm_state(alsa_handle));
if (derr = snd_pcm_prepare(alsa_handle))
if ((derr = snd_pcm_prepare(alsa_handle)))
debug(1, "Error preparing after flush: %s.", snd_strerror(derr));
// debug(1,"Frames successfully dropped.");
/*
+10 -2
View File
@@ -2,7 +2,7 @@
# Process this file with autoconf to produce a configure script.
AC_PREREQ([2.50])
AC_INIT([shairport-sync], [2.5.0.2], [mikebrady@eircom.net])
AC_INIT([shairport-sync], [2.5.0.3], [mikebrady@eircom.net])
AM_INIT_AUTOMAKE
AC_CONFIG_SRCDIR([shairport.c])
AC_CONFIG_HEADERS([config.h])
@@ -34,7 +34,15 @@ fi
AC_ARG_WITH([pkg_config],
[ --with-pkg-config = use pkg-config to find libraries], ,[with_pkg_config=yes])
AC_CHECK_LIB([daemon],[daemon_log], , AC_MSG_ERROR(libdaemon needed))
AC_MSG_RESULT(>>Including libdaemon)
if test "x${with_pkg_config}" = xyes ; then
PKG_CHECK_MODULES(
[DAEMON], [libdaemon],
[LIBS="${DAEMON_LIBS} ${LIBS}"])
else
AC_CHECK_LIB([daemon],[daemon_fork], , AC_MSG_ERROR(libdaemon needed))
fi
AC_CHECK_LIB([pthread],[pthread_create], , AC_MSG_ERROR(pthread library needed))
AC_CHECK_LIB([m],[exp], , AC_MSG_ERROR(maths library needed))
+5 -3
View File
@@ -1152,8 +1152,8 @@ static void *player_thread_func(void *arg) {
(1.0 * tsum_of_insertions_and_deletions) / number_of_statistics;
double moving_average_drift = (1.0 * tsum_of_drifts) / number_of_statistics;
// if ((play_number/print_interval)%20==0)
if (config.statistics_requested)
if (at_least_one_frame_seen)
if (config.statistics_requested) {
if (at_least_one_frame_seen) {
if (config.output->delay)
inform("Sync error: %.1f (frames); net correction: %.1f (ppm); corrections: %.1f "
"(ppm); missing packets %llu; late packets %llu; too late packets %llu; "
@@ -1170,8 +1170,10 @@ static void *player_thread_func(void *arg) {
missing_packets,
late_packets, too_late_packets, resend_requests,
minimum_buffer_occupancy, maximum_buffer_occupancy);
else
} else {
inform("No frames received in the last sampling interval.");
}
}
minimum_dac_queue_size = 1000000; // hack reset
maximum_buffer_occupancy = 0; // can't be less than this
minimum_buffer_occupancy = BUFFER_FRAMES; // can't be more than this
+3 -3
View File
@@ -547,7 +547,7 @@ shutdown:
msg_free(msg); // which will free the content and everything else
}
// in case the message wasn't formed or wasn't fully initialised
if ((msg) && (msg->content == NULL) || (!msg))
if ((msg && (msg->content == NULL)) || (!msg))
free(buf);
*the_packet = NULL;
return reply;
@@ -973,7 +973,7 @@ void metadata_process(uint32_t type, uint32_t code, char *data, uint32_t length)
if (towrite_count > 57)
towrite_count = 57;
size_t outbuf_size = 76; // size of output buffer on entry, length of result on exit
if (base64_encode_so(remaining_data, towrite_count, outbuf, &outbuf_size) == NULL)
if (base64_encode_so((unsigned char *)remaining_data, towrite_count, outbuf, &outbuf_size) == NULL)
debug(1, "Error encoding base64 data.");
// debug(1,"Remaining count: %d ret: %d, outbuf_size: %d.",remaining_count,ret,outbuf_size);
ret = non_blocking_write(fd, outbuf, outbuf_size);
@@ -1390,7 +1390,7 @@ static int rtsp_auth(char **nonce, rtsp_message *req, rtsp_message *resp) {
MD5_Update(&ctx, *nonce, strlen(*nonce));
MD5_Update(&ctx, ":", 1);
for (i = 0; i < 16; i++)
sprintf(buf + 2 * i, "%02X", digest_mu[i]);
sprintf((char *)buf + 2 * i, "%02X", digest_mu[i]);
MD5_Update(&ctx, buf, 32);
MD5_Final(digest_total, &ctx);
#endif
+3 -2
View File
@@ -380,13 +380,14 @@ int parse_options(int argc, char **argv) {
config.resyncthreshold = value;
/* Get the verbosity setting. */
if (config_lookup_int(config.cfg, "general.log_verbosity", &value))
if (config_lookup_int(config.cfg, "general.log_verbosity", &value)) {
if ((value >= 0) && (value <= 3))
debuglev = value;
else
die("Invalid log verbosity setting option choice \"%d\". It should be between 0 and 3, "
"inclusive.",
value);
}
/* Get the ignore_volume_control setting. */
if (config_lookup_string(config.cfg, "general.ignore_volume_control", &str)) {
@@ -629,7 +630,7 @@ int main(int argc, char **argv) {
strcat(configuration_file_path, ".conf");
config.configfile = configuration_file_path;
config.statistics_requested - 0; // don't print stats in the log
config.statistics_requested = 0; // don't print stats in the log
config.latency = 88200; // AirPlay. Is also reset in rtsp.c when play is about to start
config.userSuppliedLatency = 0; // zero means none supplied
config.iTunesLatency = 99400; // this seems to work pretty well for iTunes from Version 10 (?)