]> git.ipfire.org Git - thirdparty/shairport-sync.git/commitdiff
Format after adding a few new elements ot the native dbus interface
authorMike Brady <mikebrady@eircom.net>
Fri, 23 Mar 2018 21:29:38 +0000 (21:29 +0000)
committerMike Brady <mikebrady@eircom.net>
Fri, 23 Mar 2018 21:29:38 +0000 (21:29 +0000)
common.c
dacp.c
dbus-service.c
metadata_hub.h
player.c

index 3ac689c735d6f2a7dcdbb0bdc6698c04ab2318b1..2ae3b1ce2f778eaa8ad193c73d640170f4b2160f 100644 (file)
--- a/common.c
+++ b/common.c
@@ -1071,4 +1071,3 @@ char *get_version_string() {
   }
   return version_string;
 }
-
diff --git a/dacp.c b/dacp.c
index 0dc757c5107f2a34c0d1e550fd4b41de217a41ae..cafe16362bebf54a11466a025bdd4d2196ce0a36 100644 (file)
--- a/dacp.c
+++ b/dacp.c
@@ -349,7 +349,7 @@ void *dacp_monitor_thread_code(__attribute__((unused)) void *na) {
     if (diff)
       metadata_store.advanced_dacp_server_active = adv;
     metadata_hub_modify_epilog(diff);
-    
+
     if (result == 200) {
       ssize_t le;
       char *response = NULL;
index dc25bddf0a611368f5231a822367357a6d155a5f..aa450ec30f2b4a523c03c3ee3532f243e1ebd7d0 100644 (file)
@@ -1,5 +1,5 @@
-#include <stdlib.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 
 #include "config.h"
@@ -40,9 +40,11 @@ void dbus_metadata_watcher(struct metadata_bundle *argc, __attribute__((unused))
   }
 
   if (argc->advanced_dacp_server_active) {
-    shairport_sync_advanced_remote_control_set_available(shairportSyncAdvancedRemoteControlSkeleton, TRUE);
+    shairport_sync_advanced_remote_control_set_available(shairportSyncAdvancedRemoteControlSkeleton,
+                                                         TRUE);
   } else {
-    shairport_sync_advanced_remote_control_set_available(shairportSyncAdvancedRemoteControlSkeleton, FALSE);
+    shairport_sync_advanced_remote_control_set_available(shairportSyncAdvancedRemoteControlSkeleton,
+                                                         FALSE);
   }
 
   GVariantBuilder *dict_builder, *aa;
@@ -304,59 +306,65 @@ gboolean notify_loudness_threshold_callback(ShairportSync *skeleton,
 }
 
 gboolean notify_alacdecoder_callback(ShairportSync *skeleton,
-                                   __attribute__((unused)) gpointer user_data) {
-  charth = (char *)shairport_sync_get_alacdecoder(skeleton);
+                                     __attribute__((unused)) gpointer user_data) {
+  char *th = (char *)shairport_sync_get_alacdecoder(skeleton);
 #ifdef HAVE_APPLE_ALAC
-  if (strcasecmp(th,"hammerton")==0) 
+  if (strcasecmp(th, "hammerton") == 0)
     config.use_apple_decoder = 0;
-  else if (strcasecmp(th,"apple")==0)
+  else if (strcasecmp(th, "apple") == 0)
     config.use_apple_decoder = 1;
   else
-    warn("Unrecognised ALAC decoder: \"%s\".",th);
-  // debug(1,"Using the %s ALAC decoder.", ((config.use_apple_decoder==0) ? "Hammerton" : "Apple"));
+    warn("Unrecognised ALAC decoder: \"%s\".", th);
+// debug(1,"Using the %s ALAC decoder.", ((config.use_apple_decoder==0) ? "Hammerton" : "Apple"));
 #else
-  if (strcasecmp(th,"hammerton")==0) {
+  if (strcasecmp(th, "hammerton") == 0) {
     config.use_apple_decoder = 0;
     // debug(1,"Using the Hammerton ALAC decoder.");
-  } else 
-    warn("Unrecognised ALAC decoder: \"%s\" (or else support for this decoder was not compiled into this version of Shairport Sync).",th);
+  } else
+    warn("Unrecognised ALAC decoder: \"%s\" (or else support for this decoder was not compiled "
+         "into this version of Shairport Sync).",
+         th);
 #endif
   return TRUE;
 }
 
 gboolean notify_interpolation_callback(ShairportSync *skeleton,
-                                   __attribute__((unused)) gpointer user_data) {
-  charth = (char *)shairport_sync_get_interpolation(skeleton);
+                                       __attribute__((unused)) gpointer user_data) {
+  char *th = (char *)shairport_sync_get_interpolation(skeleton);
 #ifdef HAVE_LIBSOXR
-  if (strcasecmp(th,"basic")==0) 
+  if (strcasecmp(th, "basic") == 0)
     config.packet_stuffing = ST_basic;
-  else if (strcasecmp(th,"soxr")==0)
+  else if (strcasecmp(th, "soxr") == 0)
     config.packet_stuffing = ST_soxr;
   else
-    warn("Unrecognised interpolation: \"%s\".",th);
+    warn("Unrecognised interpolation: \"%s\".", th);
 #else
-  if (strcasecmp(th,"basic")==0) 
+  if (strcasecmp(th, "basic") == 0)
     config.packet_stuffing = ST_basic;
-  } else 
-    warn("Unrecognised interpolation method: \"%s\" (or else support for this interolation method was not compiled into this version of Shairport Sync).",th);
+}
+else warn("Unrecognised interpolation method: \"%s\" (or else support for this interolation method "
+          "was not compiled into this version of Shairport Sync).",
+          th);
 #endif
-   debug(1,"Using %s interpolation (aka \"stuffing\").", ((config.packet_stuffing==ST_basic) ? "basic" : "soxr"));
+  debug(1, "Using %s interpolation (aka \"stuffing\").",
+        ((config.packet_stuffing == ST_basic) ? "basic" : "soxr"));
   return TRUE;
 }
 
 gboolean notify_volume_control_profile_callback(ShairportSync *skeleton,
-                                   __attribute__((unused)) gpointer user_data) {
-  charth = (char *)shairport_sync_get_volume_control_profile(skeleton);
+                                                __attribute__((unused)) gpointer user_data) {
+  char *th = (char *)shairport_sync_get_volume_control_profile(skeleton);
   enum volume_control_profile_type previous_volume_control_profile = config.volume_control_profile;
-  if (strcasecmp(th,"standard")==0) 
+  if (strcasecmp(th, "standard") == 0)
     config.volume_control_profile = VCP_standard;
-  else if (strcasecmp(th,"flat")==0)
+  else if (strcasecmp(th, "flat") == 0)
     config.volume_control_profile = VCP_flat;
   else
-    warn("Unrecognised Volume Control Profile: \"%s\".",th);
-   debug(1,"Using the %s Volume Control Profile.", ((config.volume_control_profile==VCP_standard) ? "Standard" : "Flat"));
-  if (previous_volume_control_profile!=config.volume_control_profile)
-    debug(1,"Should really reset volume now, maybe?");
+    warn("Unrecognised Volume Control Profile: \"%s\".", th);
+  debug(1, "Using the %s Volume Control Profile.",
+        ((config.volume_control_profile == VCP_standard) ? "Standard" : "Flat"));
+  if (previous_volume_control_profile != config.volume_control_profile)
+    debug(1, "Should really reset volume now, maybe?");
   return TRUE;
 }
 
@@ -378,57 +386,41 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name
   g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(shairportSyncSkeleton), connection,
                                    "/org/gnome/ShairportSync", NULL);
 
-
-
-
-
-
-
   shairport_sync_set_loudness_threshold(SHAIRPORT_SYNC(shairportSyncSkeleton),
                                         config.loudness_reference_volume_db);
 
 #ifdef HAVE_APPLE_ALAC
-  if (config.use_apple_decoder==0) 
-    shairport_sync_set_alacdecoder(SHAIRPORT_SYNC(shairportSyncSkeleton),
-                                        "hammerton");
+  if (config.use_apple_decoder == 0)
+    shairport_sync_set_alacdecoder(SHAIRPORT_SYNC(shairportSyncSkeleton), "hammerton");
   else
-    shairport_sync_set_alacdecoder(SHAIRPORT_SYNC(shairportSyncSkeleton),
-                                        "apple");  
+    shairport_sync_set_alacdecoder(SHAIRPORT_SYNC(shairportSyncSkeleton), "apple");
 #else
-  shairport_sync_set_alacdecoder(SHAIRPORT_SYNC(shairportSyncSkeleton),
-                                        "hammerton");
+  shairport_sync_set_alacdecoder(SHAIRPORT_SYNC(shairportSyncSkeleton), "hammerton");
 #endif
 
 #ifdef HAVE_SOXR
-  if (config.packet_stuffing == ST_basic) 
-    shairport_sync_set_interpolation(SHAIRPORT_SYNC(shairportSyncSkeleton),
-                                        "basic");
+  if (config.packet_stuffing == ST_basic)
+    shairport_sync_set_interpolation(SHAIRPORT_SYNC(shairportSyncSkeleton), "basic");
   else
-    shairport_sync_set_interpolation(SHAIRPORT_SYNC(shairportSyncSkeleton),
-                                        "soxr");
+    shairport_sync_set_interpolation(SHAIRPORT_SYNC(shairportSyncSkeleton), "soxr");
 #else
-    shairport_sync_set_interpolation(SHAIRPORT_SYNC(shairportSyncSkeleton),
-                                        "basic");
+  shairport_sync_set_interpolation(SHAIRPORT_SYNC(shairportSyncSkeleton), "basic");
 #endif
 
-  if (config.volume_control_profile==VCP_standard) 
-    shairport_sync_set_volume_control_profile(SHAIRPORT_SYNC(shairportSyncSkeleton),
-                                        "standard");
+  if (config.volume_control_profile == VCP_standard)
+    shairport_sync_set_volume_control_profile(SHAIRPORT_SYNC(shairportSyncSkeleton), "standard");
   else
-    shairport_sync_set_volume_control_profile(SHAIRPORT_SYNC(shairportSyncSkeleton),
-                                        "flat");  
+    shairport_sync_set_volume_control_profile(SHAIRPORT_SYNC(shairportSyncSkeleton), "flat");
+
   if (config.loudness == 0) {
     shairport_sync_set_loudness_filter_active(SHAIRPORT_SYNC(shairportSyncSkeleton), FALSE);
   } else {
     shairport_sync_set_loudness_filter_active(SHAIRPORT_SYNC(shairportSyncSkeleton), TRUE);
   }
-  
-  shairport_sync_set_version(SHAIRPORT_SYNC(shairportSyncSkeleton),
-                                        PACKAGE_VERSION);
-  char * vs = get_version_string();
-  shairport_sync_set_version_string(SHAIRPORT_SYNC(shairportSyncSkeleton),
-                                        vs);
+
+  shairport_sync_set_version(SHAIRPORT_SYNC(shairportSyncSkeleton), PACKAGE_VERSION);
+  char *vs = get_version_string();
+  shairport_sync_set_version_string(SHAIRPORT_SYNC(shairportSyncSkeleton), vs);
   if (vs)
     free(vs);
 
@@ -442,7 +434,7 @@ static void on_dbus_name_acquired(GDBusConnection *connection, const gchar *name
                    G_CALLBACK(notify_loudness_filter_active_callback), NULL);
   g_signal_connect(shairportSyncSkeleton, "notify::loudness-threshold",
                    G_CALLBACK(notify_loudness_threshold_callback), NULL);
+
   g_signal_connect(shairportSyncSkeleton, "handle-remote-command",
                    G_CALLBACK(on_handle_remote_command), NULL);
 
index cf59ec0f741fdff8ed14e3ea15b87bb1b753d1e0..36dd8207ca5f2b42cb74e99ce8751e9dbe21e8c7 100644 (file)
@@ -30,8 +30,9 @@ typedef struct metadata_bundle {
 
   int dacp_server_active; // true if there's a reachable DACP server (assumed to be the Airplay
                           // client) ; false otherwise
-  int advanced_dacp_server_active; // true if there's a reachable DACP server with iTunes capabilitiues
-                          // ; false otherwise
+  int advanced_dacp_server_active; // true if there's a reachable DACP server with iTunes
+                                   // capabilitiues
+                                   // ; false otherwise
 
   int changed;                          // normally 0, nonzero if a field has been changed
   int playerstatusupdates_are_received; // false if it's "traditional" metadata
index 1d6f4babc4331c767bc4f0d2a6310efdbff7c622..4a3e82eeda28ef996a600ad161f8b8f6fb54041d 100644 (file)
--- a/player.c
+++ b/player.c
@@ -1575,10 +1575,10 @@ static void *player_thread_func(void *arg) {
   sbuf = 0;
   // initialise this, because soxr stuffing might be chosen later
   // if (config.packet_stuffing == ST_soxr) { // needed for stuffing
-    sbuf = malloc(sizeof(int32_t) * 2 * (conn->max_frames_per_packet * conn->output_sample_ratio +
-                                         conn->max_frame_size_change));
-    if (sbuf == NULL)
-      debug(1, "Failed to allocate memory for the sbuf buffer.");
+  sbuf = malloc(sizeof(int32_t) * 2 * (conn->max_frames_per_packet * conn->output_sample_ratio +
+                                       conn->max_frame_size_change));
+  if (sbuf == NULL)
+    debug(1, "Failed to allocate memory for the sbuf buffer.");
   // }
   // We might need an output buffer and a buffer of silence.
   // The size of these dependents on the number of frames, the size of each frame and the maximum