]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
format adjustments
authorMike Brady <4265913+mikebrady@users.noreply.github.com>
Mon, 11 Sep 2023 15:01:38 +0000 (16:01 +0100)
committerMike Brady <4265913+mikebrady@users.noreply.github.com>
Mon, 11 Sep 2023 15:01:38 +0000 (16:01 +0100)
audio_alsa.c
audio_jack.c
common.c
common.h
dacp.c
metadata_hub.c
rtp.c

index bf8d6adacdebd820eac2be8838e06042d8b67544..787808049d7ed625b090737ad243ab715db00374 100644 (file)
@@ -176,7 +176,8 @@ void handle_unfixable_error(int errorCode) {
       command_execute(config.cmd_unfixable, messageString, 1);
     } else {
       die("An unrecoverable error, \"output_device_error_%d\", has been "
-          "detected. Doing an emergency exit, as no run_this_if_an_unfixable_error_is_detected program.",
+          "detected. Doing an emergency exit, as no run_this_if_an_unfixable_error_is_detected "
+          "program.",
           errorCode);
     }
   }
index abdf09d90f1e62d33df82d9c7103049f9790ad9a..911fada7985213e51df965b944ad72d08eee8fa9 100644 (file)
@@ -299,7 +299,7 @@ static int jack_init(__attribute__((unused)) int argc, __attribute__((unused)) c
       while (port_list[i++] != NULL) {
         inform(
             "Additional matching port %s found. Check that the connections are what you intended.",
-            port_list[i-1]);
+            port_list[i - 1]);
       }
       jack_free(port_list);
     }
index bed243ba8d085367272e186a467dced81aa2d1ff..618293ae3989351f5aee81bd4d495cde196f4522 100644 (file)
--- a/common.c
+++ b/common.c
@@ -72,8 +72,8 @@
 #endif
 
 #ifdef CONFIG_OPENSSL
-#include <openssl/bio.h> // needed for BIO_new_mem_buf
 #include <openssl/aes.h> // needed for older AES stuff
+#include <openssl/bio.h> // needed for BIO_new_mem_buf
 #include <openssl/err.h> // needed for ERR_error_string, ERR_get_error
 #include <openssl/evp.h> // needed for EVP_PKEY_CTX_new, EVP_PKEY_sign_init, EVP_PKEY_sign
 #include <openssl/pem.h> // needed for PEM_read_bio_RSAPrivateKey, EVP_PKEY_CTX_set_rsa_padding
@@ -1203,14 +1203,14 @@ uint32_t uatoi(const char *nptr) {
 // clang-format on
 
 double flat_vol2attn(double vol, long max_db, long min_db) {
-// clang-format off
+  // clang-format off
 
 // This "flat" volume control profile has the property that a given change in the AirPlay volume
 // always results in the same change in output dB. For example, if a change of AirPlay volume
 // from 0 to -4 resulted in a 7 dB change, then a change in AirPlay volume from -20 to -24
 // would also result in a 7 dB change.
 
-// clang-format on
+  // clang-format on
   double vol_setting = min_db; // if all else fails, set this, for safety
 
   if ((vol <= 0.0) && (vol >= -30.0)) {
@@ -1219,15 +1219,15 @@ double flat_vol2attn(double vol, long max_db, long min_db) {
     // max_db);
   } else if (vol != -144.0) {
     debug(1,
-          "flat_vol2attn volume request value %f is out of range: should be from 0.0 to -30.0 or -144.0.",
+          "flat_vol2attn volume request value %f is out of range: should be from 0.0 to -30.0 or "
+          "-144.0.",
           vol);
   }
   return vol_setting;
 }
 
 double dasl_tapered_vol2attn(double vol, long max_db, long min_db) {
-// clang-format off
+  // clang-format off
 
 // The "dasl_tapered" volume control profile has the property that halving the AirPlay volume (the "vol" parameter)
 // reduces the output level by 10 dB, which corresponds to roughly halving the perceived volume.
@@ -1251,7 +1251,7 @@ double dasl_tapered_vol2attn(double vol, long max_db, long min_db) {
 // If the device's attenuation range is over about 50 dB,
 // the flat output level will hardly be needed at all.
 
-// clang-format on
+  // clang-format on
   double vol_setting = min_db; // if all else fails, set this, for safety
 
   if ((vol <= 0.0) && (vol >= -30.0)) {
@@ -1259,11 +1259,15 @@ double dasl_tapered_vol2attn(double vol, long max_db, long min_db) {
     if (vol_pct <= 0) {
       return min_db;
     }
-    
+
     double flat_setting = min_db + (max_db - min_db) * vol_pct;
-    vol_setting = max_db + 1000 * log10(vol_pct) / log10(2); // This will be in the range [-inf, max_db]
+    vol_setting =
+        max_db + 1000 * log10(vol_pct) / log10(2); // This will be in the range [-inf, max_db]
     if (vol_setting < flat_setting) {
-      debug(3, "dasl_tapered_vol2attn returning a flat setting of %f for AirPlay volume %f instead of a tapered setting of %f in a range from %f to %f.", flat_setting, vol, vol_setting, 1.0 * min_db, 1.0 *  max_db);
+      debug(3,
+            "dasl_tapered_vol2attn returning a flat setting of %f for AirPlay volume %f instead of "
+            "a tapered setting of %f in a range from %f to %f.",
+            flat_setting, vol, vol_setting, 1.0 * min_db, 1.0 * max_db);
       return flat_setting;
     }
     if (vol_setting > max_db) {
@@ -1272,7 +1276,8 @@ double dasl_tapered_vol2attn(double vol, long max_db, long min_db) {
     return vol_setting;
   } else if (vol != -144.0) {
     debug(1,
-          "dasl_tapered volume request value %f is out of range: should be from 0.0 to -30.0 or -144.0.",
+          "dasl_tapered volume request value %f is out of range: should be from 0.0 to -30.0 or "
+          "-144.0.",
           vol);
   }
   return vol_setting;
index c8e8915bc82f355646d930a09c410039b168c853..edd48fa8d8bda6f59844b59770f27213b69afd08 100644 (file)
--- a/common.h
+++ b/common.h
@@ -391,11 +391,13 @@ uint8_t *rsa_apply(uint8_t *input, int inlen, int *outlen, int mode);
 // dB), return an attenuation depending on a linear interpolation along the range
 double flat_vol2attn(double vol, long max_db, long min_db);
 
-// The intention behind dasl_tapered is that a given percentage change in volume should result in the same percentage change in
-// perceived loudness. For instance, doubling the volume level should result in doubling the perceived loudness.
-// With the range of AirPlay volume being from -30 to 0, doubling the volume from -22.5 to -15 results in an increase of 10 dB.
-// Similarly, doubling the volume from -15 to 0 results in an increase of 10 dB.
-// For compatibility with mixers having a restricted attenuation range (e.g. 30 dB), "dasl_tapered" will switch to a flat profile at low AirPlay volumes.
+// The intention behind dasl_tapered is that a given percentage change in volume should result in
+// the same percentage change in perceived loudness. For instance, doubling the volume level should
+// result in doubling the perceived loudness. With the range of AirPlay volume being from -30 to 0,
+// doubling the volume from -22.5 to -15 results in an increase of 10 dB. Similarly, doubling the
+// volume from -15 to 0 results in an increase of 10 dB. For compatibility with mixers having a
+// restricted attenuation range (e.g. 30 dB), "dasl_tapered" will switch to a flat profile at low
+// AirPlay volumes.
 double dasl_tapered_vol2attn(double vol, long max_db, long min_db);
 // given a volume (0 to -30) and high and low attenuations in dB*100 (e.g. 0 to -6000 for 0 to -60
 // dB), return an attenuation depending on the transfer function
diff --git a/dacp.c b/dacp.c
index 14154263b58bd9973aca913fdcab048ed539fb7a..52535cc55ba556bbf97f221f5fd22e04dd8bbf80 100644 (file)
--- a/dacp.c
+++ b/dacp.c
@@ -411,14 +411,14 @@ void set_dacp_server_information(rtsp_conn_info *conn) {
     debug(2, "set_dacp_server_information set IP to \"%s\" and DACP id to \"%s\".",
           dacp_server.ip_string, dacp_server.dacp_id);
 
-/*
+    /*
 
-"long polling" is not implemented by Shairport Sync, whereby by sending the client the
-last-received revision number, the link will hang until a change occurs.
+    "long polling" is not implemented by Shairport Sync, whereby by sending the client the
+    last-received revision number, the link will hang until a change occurs.
 
-Instead, at present, Shairport Sync always uses a revision number of 1.
+    Instead, at present, Shairport Sync always uses a revision number of 1.
 
-*/
+    */
 
     // always use revision number 1
     dacp_server.always_use_revision_number_1 = 1;
index 271760586deb2fb80b994e273614fb03a3a2600c..235b6fe5dc35a49a0f32b2bd0ceb518e0569da1b 100644 (file)
@@ -211,7 +211,7 @@ char *metadata_write_image_file(const char *buf, int len) {
 #ifdef CONFIG_OPENSSL
     EVP_MD_CTX *ctx;
     unsigned int img_md5_len = EVP_MD_size(EVP_md5());
-    
+
     ctx = EVP_MD_CTX_new();
     EVP_DigestInit_ex(ctx, EVP_md5(), NULL);
     EVP_DigestUpdate(ctx, buf, len);
diff --git a/rtp.c b/rtp.c
index ed64ea7489c115463635bc4eb25259cee585c8c2..c7c8efa3fee6477c7b83c57a9029509ef483ea52 100644 (file)
--- a/rtp.c
+++ b/rtp.c
@@ -2917,7 +2917,8 @@ void *rtp_buffered_audio_processor(void *arg) {
                             debug(1, "error %d during decoding", ret);
                           } else {
 #if LIBAVUTIL_VERSION_MAJOR >= 57
-                            av_samples_alloc(&pcm_audio, &dst_linesize, codec_context->ch_layout.nb_channels,
+                            av_samples_alloc(&pcm_audio, &dst_linesize,
+                                             codec_context->ch_layout.nb_channels,
                                              decoded_frame->nb_samples, av_format, 1);
 #else
                             av_samples_alloc(&pcm_audio, &dst_linesize, codec_context->channels,
@@ -2929,7 +2930,8 @@ void *rtp_buffered_audio_processor(void *arg) {
                                               decoded_frame->nb_samples);
 #if LIBAVUTIL_VERSION_MAJOR >= 57
                             dst_bufsize = av_samples_get_buffer_size(
-                                &dst_linesize, codec_context->ch_layout.nb_channels, ret, av_format, 1);
+                                &dst_linesize, codec_context->ch_layout.nb_channels, ret, av_format,
+                                1);
 #else
                             dst_bufsize = av_samples_get_buffer_size(
                                 &dst_linesize, codec_context->channels, ret, av_format, 1);