From 705a0be1e4051861e1e2af657346c21944e18283 Mon Sep 17 00:00:00 2001 From: Mike Brady Date: Fri, 21 Nov 2014 17:39:27 +0000 Subject: [PATCH] Add new optioons --statistics to print out the, um, statistics, and remove them from debug level 1. --- common.c | 10 ++++++++++ common.h | 2 ++ man/shairport-sync.7 | 5 ++++- man/shairport-sync.7.xml | 8 ++++++++ man/shairport-sync.html | 8 ++++++++ player.c | 4 +++- shairport.c | 11 +++++++---- 7 files changed, 42 insertions(+), 6 deletions(-) diff --git a/common.c b/common.c index 761a6379..f268cc88 100644 --- a/common.c +++ b/common.c @@ -120,6 +120,16 @@ void debug(int level, char *format, ...) { daemon_log(LOG_DEBUG,"%s", s); } +void inform(char *format, ...) { + char s[1024]; + s[0]=0; + va_list args; + va_start(args, format); + vsprintf(s,format,args); + va_end(args); + daemon_log(LOG_INFO,"%s", s); +} + #ifdef HAVE_LIBPOLARSSL char *base64_enc(uint8_t *input, int length) { char *buf = NULL; diff --git a/common.h b/common.h index 11f15b73..cd6e61c8 100644 --- a/common.h +++ b/common.h @@ -55,6 +55,7 @@ typedef struct { uint32_t iTunesLatency; // supplied with --iTunesLatency option uint32_t AirPlayLatency; //supplied with --AirPlayLatency option int daemonise; + int statistics_requested; char *cmd_start, *cmd_stop; int cmd_blocking; enum stuffing_type packet_stuffing; @@ -72,6 +73,7 @@ void set_requested_connection_state_to_output(int v); int debuglev; void die(char *format, ...); void warn(char *format, ...); +void inform(char *format, ...); void debug(int level, char *format, ...); uint8_t *base64_dec(char *input, int *outlen); diff --git a/man/shairport-sync.7 b/man/shairport-sync.7 index e0dca195..f83281d3 100644 --- a/man/shairport-sync.7 +++ b/man/shairport-sync.7 @@ -2,7 +2,7 @@ .SH NAME shairport-sync \- Synchronised Audio Player for iTunes / AirPlay .SH SYNOPSIS -\fBshairport-sync [-dvw]\fB [-a \fB\fIname\fB]\fB [-A \fB\fIlatency\fB]\fB [-B \fB\fIcommand\fB]\fB [-E \fB\fIcommand\fB]\fB [-i \fB\fIlatency\fB]\fB [-m \fB\fIbackend\fB]\fB [-o \fB\fIbackend\fB]\fB [-r \fB\fIthreshold\fB]\fB [-S \fB\fImode\fB]\fB [-t \fB\fItimeout\fB]\fB [-- \fB\fIaudio_backend_options\fB]\fB +\fBshairport-sync [-dvw]\fB [-a \fB\fIname\fB]\fB [-A \fB\fIlatency\fB]\fB [-B \fB\fIcommand\fB]\fB [-E \fB\fIcommand\fB]\fB [-i \fB\fIlatency\fB]\fB [-m \fB\fIbackend\fB]\fB [-o \fB\fIbackend\fB]\fB [-r \fB\fIthreshold\fB]\fB [--statistics\fB [-S \fB\fImode\fB]\fB [-t \fB\fItimeout\fB]\fB [-- \fB\fIaudio_backend_options\fB]\fB shairport-sync -D\fB @@ -73,6 +73,9 @@ Reconnect the shairport-sync daemon to the output device and exit. It may take a \fB-r \f1\fIthreshold\f1\fB | --resync=\f1\fIthreshold\f1 Resynchronise if timings differ by more than \fIthreshold\f1 frames. If the output timing differs from the source timing by more than the threshold, output will be muted and a full resynchronisation will occur. The default threshold is 2,205 frames, i.e. 50 milliseconds. Specify \fB0\f1 to disable resynchronisation. .TP +\fB--statistics=\f1 +Print some statistics in the standard output, or in the logfile if in daemon mode. +.TP \fB-S \f1\fImode\f1\fB | --stuffing=\f1\fImode\f1 Stuff the audio stream using the \fImode\f1. "Stuffing" refers to the process of adding or removing frames of audio to or from the stream sent to the output device to keep it exactly in synchrony with the player. The default mode, \fBbasic\f1, is normally almost completely inaudible. The alternative mode, \fBsoxr\f1, is even less obtrusive but requires much more processing power. For this mode, support for libsoxr, the SoX Resampler Library, must be selected when shairport-sync is compiled. .TP diff --git a/man/shairport-sync.7.xml b/man/shairport-sync.7.xml index 19e5f965..82b50eb4 100644 --- a/man/shairport-sync.7.xml +++ b/man/shairport-sync.7.xml @@ -43,6 +43,7 @@ [-m backend] [-o backend] [-r threshold] + [--statistics [-S mode] [-t timeout] [-- audio_backend_options] @@ -217,6 +218,13 @@

+ +