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);
}
}
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);
}
#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
// 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)) {
// 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.
// 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)) {
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) {
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;
// 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
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;
#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);
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,
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);