]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
clang format
authorMike Brady <mikebrady@eircom.net>
Fri, 4 Jan 2019 17:26:55 +0000 (17:26 +0000)
committerMike Brady <mikebrady@eircom.net>
Fri, 4 Jan 2019 17:26:55 +0000 (17:26 +0000)
audio.c
audio_alsa.c
audio_jack.c
audio_pa.c
audio_sndio.c
common.h
player.c

diff --git a/audio.c b/audio.c
index 4c3df7dff173ff76b92440ea38f9cd841691cd77..7d0f489f866468775c2b1b271ab5ed1cd96da731 100644 (file)
--- 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;
       }
index 0372dc536cd72d2d1d6fc21bb16183fce6902270..2a453b1e55d44ea26461df99332b5bf764371524 100644 (file)
@@ -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;
index 9f9d0a0ba47fe9d104c131e9eeed57e01f8f2030..11ae60724465789fb0c0d9c25fe1e95235675d1c 100644 (file)
@@ -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
index 48e4579d427b80dbd8c7a953a662c155c966e248..cd321bd9f4d681023374f60f5b3110ff12d012bc 100644 (file)
@@ -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;
 
index 511d90b32055b7904e5d7a67427911ef9f2e7ac3..f22ed5af1430867d0a87826f40157adf3e526922 100644 (file)
@@ -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
index 4e2fb65a66c40c1a91c247d5e87276cd352b1624..35996fef8c922005c29f7f35e5884bb42743eb45 100644 (file)
--- 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.
index f17cf6852fb1840a92316827e59f674ceb9b1d5a..a085a636ff118c3eb946a74c03238dbdc2723e5b 100644 (file)
--- 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;
   }
 }
-