From: Mike Brady Date: Fri, 4 Jan 2019 17:26:55 +0000 (+0000) Subject: clang format X-Git-Tag: 3.3RC0~66^2~87 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=80f15e1f574f060d9f644eef176ecb37d775ddfd;p=thirdparty%2Fshairport-sync.git clang format --- diff --git a/audio.c b/audio.c index 4c3df7df..7d0f489f 100644 --- a/audio.c +++ b/audio.c @@ -152,15 +152,17 @@ void parse_general_audio_options(void) { config.audio_backend_buffer_desired_length = dvalue; } } - + /* Get the minumum buffer size for fancy interpolation setting in seconds. */ - if (config_lookup_float(config.cfg, "general.audio_backend_buffer_interpolation_threshold_in_seconds", + if (config_lookup_float(config.cfg, + "general.audio_backend_buffer_interpolation_threshold_in_seconds", &dvalue)) { if ((dvalue < 0) || (dvalue > config.audio_backend_buffer_desired_length)) { die("Invalid audio_backend_buffer_interpolation_threshold_in_seconds value: \"%f\". It " "should be between 0 and " "audio_backend_buffer_desired_length_in_seconds of %.3f, default is %.3f seconds", - dvalue, config.audio_backend_buffer_desired_length,config.audio_backend_buffer_interpolation_threshold_in_seconds); + dvalue, config.audio_backend_buffer_desired_length, + config.audio_backend_buffer_interpolation_threshold_in_seconds); } else { config.audio_backend_buffer_interpolation_threshold_in_seconds = dvalue; } diff --git a/audio_alsa.c b/audio_alsa.c index 0372dc53..2a453b1e 100644 --- a/audio_alsa.c +++ b/audio_alsa.c @@ -637,7 +637,8 @@ static int init(int argc, char **argv) { config.audio_backend_latency_offset = 0; config.audio_backend_buffer_desired_length = 0.15; - config.audio_backend_buffer_interpolation_threshold_in_seconds = 0.050; // below this, basic interpolation will be used to save time. + config.audio_backend_buffer_interpolation_threshold_in_seconds = + 0.050; // below this, basic interpolation will be used to save time. config.alsa_maximum_stall_time = 0.200; // 200 milliseconds -- if it takes longer, it's a problem // get settings from settings file first, allow them to be overridden by @@ -1145,11 +1146,12 @@ int untimed_play(void *buf, int samples) { if (ret == 0) { // will be non-zero if an error or a stall if ((samples != 0) && (buf != NULL)) { - + // jut check the state of the DAC - - if ((state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && (state != SND_PCM_STATE_XRUN)) { - debug(1,"alsa: DAC in odd SND_PCM_STATE_* %d prior to writing.",state); + + if ((state != SND_PCM_STATE_PREPARED) && (state != SND_PCM_STATE_RUNNING) && + (state != SND_PCM_STATE_XRUN)) { + debug(1, "alsa: DAC in odd SND_PCM_STATE_* %d prior to writing.", state); } // debug(3, "write %d frames.", samples); @@ -1188,7 +1190,8 @@ int untimed_play(void *buf, int samples) { if (ret == -EPIPE) { /* underrun */ ret = snd_pcm_recover(alsa_handle, ret, debuglev > 0 ? 1 : 0); if (ret < 0) { - debug(1, "alsa: failed to recover from SND_PCM_STATE_XRUN with snd_pcm_recover(); trying snd_pcm_prepare()."); + debug(1, "alsa: failed to recover from SND_PCM_STATE_XRUN with snd_pcm_recover(); " + "trying snd_pcm_prepare()."); ret = snd_pcm_prepare(alsa_handle); if (ret < 0) warn("alsa: can't recover from SND_PCM_STATE_XRUN, snd_pcm_recover() and " @@ -1196,8 +1199,8 @@ int untimed_play(void *buf, int samples) { snd_strerror(ret)); } } else if (ret == -ESTRPIPE) { /* suspended */ - while ((ret = snd_pcm_resume(alsa_handle)) == -EAGAIN) { - sleep(1); /* wait until the suspend flag is released */ + while ((ret = snd_pcm_resume(alsa_handle)) == -EAGAIN) { + sleep(1); /* wait until the suspend flag is released */ if (ret < 0) { ret = snd_pcm_prepare(alsa_handle); if (ret < 0) @@ -1209,7 +1212,7 @@ int untimed_play(void *buf, int samples) { } } } - } else { + } else { debug(1, "alsa: device status %d faulty for play.", state); frame_index = 0; measurement_data_is_valid = 0; diff --git a/audio_jack.c b/audio_jack.c index 9f9d0a0b..11ae6072 100644 --- a/audio_jack.c +++ b/audio_jack.c @@ -301,7 +301,9 @@ void *open_client_if_necessary_thread_function(void *arg) { int jack_init(__attribute__((unused)) int argc, __attribute__((unused)) char **argv) { config.audio_backend_latency_offset = 0; config.audio_backend_buffer_desired_length = 0.500; - config.audio_backend_buffer_interpolation_threshold_in_seconds = 0.25; // below this, soxr interpolation will not occur -- it'll be basic interpolation instead. + config.audio_backend_buffer_interpolation_threshold_in_seconds = + 0.25; // below this, soxr interpolation will not occur -- it'll be basic interpolation + // instead. config.jack_auto_client_open_interval = 1; // check every second // get settings from settings file first, allow them to be overridden by diff --git a/audio_pa.c b/audio_pa.c index 48e4579d..cd321bd9 100644 --- a/audio_pa.c +++ b/audio_pa.c @@ -70,7 +70,9 @@ static int init(__attribute__((unused)) int argc, __attribute__((unused)) char * // set up default values first config.audio_backend_buffer_desired_length = 0.35; - config.audio_backend_buffer_interpolation_threshold_in_seconds = 0.02; // below this, soxr interpolation will not occur -- it'll be basic interpolation instead. + config.audio_backend_buffer_interpolation_threshold_in_seconds = + 0.02; // below this, soxr interpolation will not occur -- it'll be basic interpolation + // instead. config.audio_backend_latency_offset = 0; diff --git a/audio_sndio.c b/audio_sndio.c index 511d90b3..f22ed5af 100644 --- a/audio_sndio.c +++ b/audio_sndio.c @@ -99,7 +99,9 @@ static int init(int argc, char **argv) { devname = SIO_DEVANY; config.audio_backend_buffer_desired_length = 1.0; - config.audio_backend_buffer_interpolation_threshold_in_seconds = 0.25; // below this, soxr interpolation will not occur -- it'll be basic interpolation instead. + config.audio_backend_buffer_interpolation_threshold_in_seconds = + 0.25; // below this, soxr interpolation will not occur -- it'll be basic interpolation + // instead. config.audio_backend_latency_offset = 0; // get settings from settings file diff --git a/common.h b/common.h index 4e2fb65a..35996fef 100644 --- a/common.h +++ b/common.h @@ -168,7 +168,9 @@ typedef struct { int interface_index; // only valid if the interface string is non-NULL double audio_backend_buffer_desired_length; // this will be the length in seconds of the // audio backend buffer -- the DAC buffer for ALSA - double audio_backend_buffer_interpolation_threshold_in_seconds; // below this, soxr interpolation will not occur -- it'll be basic interpolation instead. + double audio_backend_buffer_interpolation_threshold_in_seconds; // below this, soxr interpolation + // will not occur -- it'll be + // basic interpolation instead. double audio_backend_latency_offset; // this will be the offset in seconds to compensate for any // fixed latency there might be in the audio path double audio_backend_silent_lead_in_time; // the length of the silence that should precede a play. diff --git a/player.c b/player.c index f17cf685..a085a636 100644 --- a/player.c +++ b/player.c @@ -1491,7 +1491,7 @@ void *player_thread_func(void *arg) { conn->first_packet_timestamp = 0; conn->flush_requested = 0; conn->fix_volume = 0x10000; - + if (conn->latency == 0) { debug(3, "No latency has (yet) been specified. Setting 88,200 (2 seconds) frames " "as a default."); @@ -1551,9 +1551,10 @@ void *player_thread_func(void *arg) { debug(3, "Output frame bytes is %d.", conn->output_bytes_per_frame); - conn->dac_buffer_queue_minimum_length = (int64_t)(config.audio_backend_buffer_interpolation_threshold_in_seconds * - config.output_rate); - debug(1,"dac_buffer_queue_minimum_length is %" PRId64 " frames.", conn->dac_buffer_queue_minimum_length); + conn->dac_buffer_queue_minimum_length = (int64_t)( + config.audio_backend_buffer_interpolation_threshold_in_seconds * config.output_rate); + debug(1, "dac_buffer_queue_minimum_length is %" PRId64 " frames.", + conn->dac_buffer_queue_minimum_length); conn->session_corrections = 0; // conn->play_segment_reference_frame = 0; // zero signals that we are not in a play segment @@ -2835,4 +2836,3 @@ int player_stop(rtsp_conn_info *conn) { return -1; } } -